Bug 1522837 part 6 - Implement JSOP_BUILTINPROTO in BaselineInterpreterCodeGen. r=tcampbell

Differential Revision: https://phabricator.services.mozilla.com/D17937

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jan de Mooij 2019-02-06 07:53:44 +00:00
parent 83e77e93f3
commit eafe4a10dd
3 changed files with 28 additions and 7 deletions

View File

@ -5554,9 +5554,7 @@ bool BaselineCodeGen<Handler>::emit_JSOP_INITHOMEOBJECT() {
template <>
bool BaselineCompilerCodeGen::emit_JSOP_BUILTINPROTO() {
// The builtin prototype is a constant for a given global.
JSProtoKey key = static_cast<JSProtoKey>(GET_UINT8(handler.pc()));
MOZ_ASSERT(key < JSProto_LIMIT);
JSObject* builtin = GlobalObject::getOrCreatePrototype(cx, key);
JSObject* builtin = BuiltinProtoOperation(cx, handler.pc());
if (!builtin) {
return false;
}
@ -5564,9 +5562,24 @@ bool BaselineCompilerCodeGen::emit_JSOP_BUILTINPROTO() {
return true;
}
typedef JSObject* (*BuiltinProtoOperationFn)(JSContext*, jsbytecode*);
static const VMFunction BuiltinProtoOperationInfo =
FunctionInfo<BuiltinProtoOperationFn>(BuiltinProtoOperation,
"BuiltinProtoOperation");
template <>
bool BaselineInterpreterCodeGen::emit_JSOP_BUILTINPROTO() {
MOZ_CRASH("NYI: interpreter JSOP_BUILTINPROTO");
prepareVMCall();
pushBytecodePCArg();
if (!callVM(BuiltinProtoOperationInfo)) {
return false;
}
masm.tagValue(JSVAL_TYPE_OBJECT, ReturnReg, R0);
frame.push(R0);
return true;
}
typedef JSObject* (*ObjectWithProtoOperationFn)(JSContext*, HandleValue);

View File

@ -4147,9 +4147,7 @@ static MOZ_NEVER_INLINE JS_HAZ_JSNATIVE_CALLER bool Interpret(JSContext* cx,
END_CASE(JSOP_CHECKCLASSHERITAGE)
CASE(JSOP_BUILTINPROTO) {
MOZ_ASSERT(GET_UINT8(REGS.pc) < JSProto_LIMIT);
JSProtoKey key = static_cast<JSProtoKey>(GET_UINT8(REGS.pc));
JSObject* builtin = GlobalObject::getOrCreatePrototype(cx, key);
JSObject* builtin = BuiltinProtoOperation(cx, REGS.pc);
if (!builtin) {
goto error;
}
@ -4691,6 +4689,14 @@ JSObject* js::ImportMetaOperation(JSContext* cx, HandleScript script) {
return GetOrCreateModuleMetaObject(cx, module);
}
JSObject* js::BuiltinProtoOperation(JSContext* cx, jsbytecode* pc) {
MOZ_ASSERT(*pc == JSOP_BUILTINPROTO);
MOZ_ASSERT(GET_UINT8(pc) < JSProto_LIMIT);
JSProtoKey key = static_cast<JSProtoKey>(GET_UINT8(pc));
return GlobalObject::getOrCreatePrototype(cx, key);
}
bool js::ThrowMsgOperation(JSContext* cx, const unsigned errorNum) {
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, errorNum);
return false;

View File

@ -503,6 +503,8 @@ JSObject* SingletonObjectLiteralOperation(JSContext* cx, HandleScript script,
JSObject* ImportMetaOperation(JSContext* cx, HandleScript script);
JSObject* BuiltinProtoOperation(JSContext* cx, jsbytecode* pc);
bool ThrowMsgOperation(JSContext* cx, const unsigned errorNum);
bool GetAndClearException(JSContext* cx, MutableHandleValue res);