Bug 1522837 part 4 - Implement JSOP_CALLSITEOBJ in BaselineInterpreterCodeGen. r=tcampbell

This is just a VM call in the interpreter. We could optimize this with an IC or
inline path if it ever becomes a problem.

Depends on D17934

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jan de Mooij 2019-01-29 17:41:30 +00:00
Родитель fabe18cff5
Коммит 120ec68d75
3 изменённых файлов: 39 добавлений и 26 удалений

Просмотреть файл

@ -2092,15 +2092,9 @@ bool BaselineCodeGen<Handler>::emit_JSOP_OBJECT() {
template <>
bool BaselineCompilerCodeGen::emit_JSOP_CALLSITEOBJ() {
JSScript* script = handler.script();
jsbytecode* pc = handler.pc();
RootedObject cso(cx, script->getObject(pc));
RootedObject raw(cx, script->getObject(GET_UINT32_INDEX(pc) + 1));
if (!cso || !raw) {
return false;
}
if (!ProcessCallSiteObjOperation(cx, cso, raw)) {
RootedScript script(cx, handler.script());
JSObject* cso = ProcessCallSiteObjOperation(cx, script, handler.pc());
if (!cso) {
return false;
}
@ -2108,9 +2102,27 @@ bool BaselineCompilerCodeGen::emit_JSOP_CALLSITEOBJ() {
return true;
}
typedef ArrayObject* (*ProcessCallSiteObjFn)(JSContext*, HandleScript,
jsbytecode*);
static const VMFunction ProcessCallSiteObjInfo =
FunctionInfo<ProcessCallSiteObjFn>(ProcessCallSiteObjOperation,
"ProcessCallSiteObjOperation");
template <>
bool BaselineInterpreterCodeGen::emit_JSOP_CALLSITEOBJ() {
MOZ_CRASH("NYI: interpreter JSOP_CALLSITEOBJ");
prepareVMCall();
pushBytecodePCArg();
pushScriptArg(R2.scratchReg());
if (!callVM(ProcessCallSiteObjInfo)) {
return false;
}
// Box and push return value.
masm.tagValue(JSVAL_TYPE_OBJECT, ReturnReg, R0);
frame.push(R0);
return true;
}
typedef JSObject* (*CloneRegExpObjectFn)(JSContext*, Handle<RegExpObject*>);

Просмотреть файл

@ -672,25 +672,30 @@ static MOZ_ALWAYS_INLINE bool InitArrayElemOperation(JSContext* cx,
return true;
}
static MOZ_ALWAYS_INLINE bool ProcessCallSiteObjOperation(JSContext* cx,
HandleObject cso,
HandleObject raw) {
MOZ_ASSERT(cso->is<ArrayObject>());
MOZ_ASSERT(raw->is<ArrayObject>());
static inline ArrayObject* ProcessCallSiteObjOperation(JSContext* cx,
HandleScript script,
jsbytecode* pc) {
MOZ_ASSERT(*pc == JSOP_CALLSITEOBJ);
RootedArrayObject cso(cx, &script->getObject(pc)->as<ArrayObject>());
if (cso->isExtensible()) {
RootedObject raw(cx, script->getObject(GET_UINT32_INDEX(pc) + 1));
MOZ_ASSERT(raw->is<ArrayObject>());
if (cso->nonProxyIsExtensible()) {
RootedValue rawValue(cx, ObjectValue(*raw));
if (!DefineDataProperty(cx, cso, cx->names().raw, rawValue, 0)) {
return false;
return nullptr;
}
if (!FreezeObject(cx, raw)) {
return false;
return nullptr;
}
if (!FreezeObject(cx, cso)) {
return false;
return nullptr;
}
}
return true;
return cso;
}
// BigInt proposal 3.2.4 Abstract Relational Comparison

Просмотреть файл

@ -3299,14 +3299,10 @@ static MOZ_NEVER_INLINE JS_HAZ_JSNATIVE_CALLER bool Interpret(JSContext* cx,
END_CASE(JSOP_OBJECT)
CASE(JSOP_CALLSITEOBJ) {
ReservedRooted<JSObject*> cso(&rootObject0, script->getObject(REGS.pc));
ReservedRooted<JSObject*> raw(
&rootObject1, script->getObject(GET_UINT32_INDEX(REGS.pc) + 1));
if (!ProcessCallSiteObjOperation(cx, cso, raw)) {
JSObject* cso = ProcessCallSiteObjOperation(cx, script, REGS.pc);
if (!cso) {
goto error;
}
PUSH_OBJECT(*cso);
}
END_CASE(JSOP_CALLSITEOBJ)