mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 952944 - Refactor JSOP_ARRAYPUSH. r=jorendorff
This commit is contained in:
parent
532c7a7ee8
commit
30a6653283
@ -6516,7 +6516,9 @@ frontend::EmitTree(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn)
|
||||
uint32_t slot = bce->arrayCompDepth;
|
||||
if (!AdjustBlockSlot(cx, bce, &slot))
|
||||
return false;
|
||||
if (!EmitUnaliasedVarOp(cx, pn->getOp(), slot, bce))
|
||||
if (!EmitUnaliasedVarOp(cx, JSOP_GETLOCAL, slot, bce))
|
||||
return false;
|
||||
if (Emit1(cx, bce, JSOP_ARRAYPUSH) < 0)
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
@ -2004,8 +2004,8 @@ js::array_sort(JSContext *cx, unsigned argc, Value *vp)
|
||||
return true;
|
||||
}
|
||||
|
||||
static JS_ALWAYS_INLINE bool
|
||||
NewbornArrayPushImpl(JSContext *cx, HandleObject obj, const Value &v)
|
||||
bool
|
||||
js::NewbornArrayPush(JSContext *cx, HandleObject obj, const Value &v)
|
||||
{
|
||||
Rooted<ArrayObject*> arr(cx, &obj->as<ArrayObject>());
|
||||
|
||||
@ -2024,12 +2024,6 @@ NewbornArrayPushImpl(JSContext *cx, HandleObject obj, const Value &v)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
js_NewbornArrayPush(JSContext *cx, HandleObject obj, const Value &vp)
|
||||
{
|
||||
return NewbornArrayPushImpl(cx, obj, vp);
|
||||
}
|
||||
|
||||
/* ES5 15.4.4.7 */
|
||||
bool
|
||||
js::array_push(JSContext *cx, unsigned argc, Value *vp)
|
||||
|
@ -140,13 +140,6 @@ ArrayShiftMoveElements(JSObject *obj);
|
||||
extern bool
|
||||
array_shift(JSContext *cx, unsigned argc, js::Value *vp);
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
#ifdef DEBUG
|
||||
extern bool
|
||||
js_ArrayInfo(JSContext *cx, unsigned argc, js::Value *vp);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Append the given (non-hole) value to the end of an array. The array must be
|
||||
* a newborn array -- that is, one which has not been exposed to script for
|
||||
@ -155,7 +148,14 @@ js_ArrayInfo(JSContext *cx, unsigned argc, js::Value *vp);
|
||||
* sparse, which requires that the array be completely filled.)
|
||||
*/
|
||||
extern bool
|
||||
js_NewbornArrayPush(JSContext *cx, js::HandleObject obj, const js::Value &v);
|
||||
NewbornArrayPush(JSContext *cx, HandleObject obj, const Value &v);
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
#ifdef DEBUG
|
||||
extern bool
|
||||
js_ArrayInfo(JSContext *cx, unsigned argc, js::Value *vp);
|
||||
#endif
|
||||
|
||||
/* Array constructor native. Exposed only so the JIT can know its address. */
|
||||
bool
|
||||
|
@ -439,7 +439,7 @@ OPDEF(JSOP_UNUSED201, 201,"unused201", NULL, 1, 0, 0, JOF_BYTE)
|
||||
*/
|
||||
OPDEF(JSOP_GENERATOR, 202,"generator", NULL, 1, 0, 0, JOF_BYTE)
|
||||
OPDEF(JSOP_YIELD, 203,"yield", NULL, 1, 1, 1, JOF_BYTE)
|
||||
OPDEF(JSOP_ARRAYPUSH, 204,"arraypush", NULL, 4, 1, 0, JOF_LOCAL)
|
||||
OPDEF(JSOP_ARRAYPUSH, 204,"arraypush", NULL, 1, 2, 0, JOF_BYTE)
|
||||
|
||||
OPDEF(JSOP_UNUSED205, 205, "unused205", NULL, 1, 0, 0, JOF_BYTE)
|
||||
OPDEF(JSOP_UNUSED206, 206, "unused206", NULL, 1, 0, 0, JOF_BYTE)
|
||||
|
@ -369,7 +369,7 @@ JS_NondeterministicGetWeakMapKeys(JSContext *cx, JSObject *objArg, JSObject **re
|
||||
RootedObject key(cx, r.front().key());
|
||||
if (!cx->compartment()->wrap(cx, &key))
|
||||
return false;
|
||||
if (!js_NewbornArrayPush(cx, arr, ObjectValue(*key)))
|
||||
if (!NewbornArrayPush(cx, arr, ObjectValue(*key)))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -2737,7 +2737,7 @@ Debugger::findAllGlobals(JSContext *cx, unsigned argc, Value *vp)
|
||||
RootedValue globalValue(cx, ObjectValue(*global));
|
||||
if (!dbg->wrapDebuggeeValue(cx, &globalValue))
|
||||
return false;
|
||||
if (!js_NewbornArrayPush(cx, result, globalValue))
|
||||
if (!NewbornArrayPush(cx, result, globalValue))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -3028,7 +3028,7 @@ DebuggerScript_getChildScripts(JSContext *cx, unsigned argc, Value *vp)
|
||||
if (!funScript)
|
||||
return false;
|
||||
s = dbg->wrapScript(cx, funScript);
|
||||
if (!s || !js_NewbornArrayPush(cx, result, ObjectValue(*s)))
|
||||
if (!s || !NewbornArrayPush(cx, result, ObjectValue(*s)))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -3360,7 +3360,7 @@ DebuggerScript_getAllOffsets(JSContext *cx, unsigned argc, Value *vp)
|
||||
}
|
||||
|
||||
/* Append the current offset to the offsets array. */
|
||||
if (!js_NewbornArrayPush(cx, offsets, NumberValue(offset)))
|
||||
if (!NewbornArrayPush(cx, offsets, NumberValue(offset)))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -3413,7 +3413,7 @@ DebuggerScript_getAllColumnOffsets(JSContext *cx, unsigned argc, Value *vp)
|
||||
if (!JSObject::defineGeneric(cx, entry, id, value))
|
||||
return false;
|
||||
|
||||
if (!js_NewbornArrayPush(cx, result, ObjectValue(*entry)))
|
||||
if (!NewbornArrayPush(cx, result, ObjectValue(*entry)))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -3462,7 +3462,7 @@ DebuggerScript_getLineOffsets(JSContext *cx, unsigned argc, Value *vp)
|
||||
!flowData[offset].hasNoEdges() &&
|
||||
flowData[offset].lineno() != lineno)
|
||||
{
|
||||
if (!js_NewbornArrayPush(cx, result, NumberValue(offset)))
|
||||
if (!NewbornArrayPush(cx, result, NumberValue(offset)))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -3575,7 +3575,7 @@ DebuggerScript_getBreakpoints(JSContext *cx, unsigned argc, Value *vp)
|
||||
if (site && (!pc || site->pc == pc)) {
|
||||
for (Breakpoint *bp = site->firstBreakpoint(); bp; bp = bp->nextInSite()) {
|
||||
if (bp->debugger == dbg &&
|
||||
!js_NewbornArrayPush(cx, arr, ObjectValue(*bp->getHandler())))
|
||||
!NewbornArrayPush(cx, arr, ObjectValue(*bp->getHandler())))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -5649,7 +5649,7 @@ DebuggerEnv_names(JSContext *cx, unsigned argc, Value *vp)
|
||||
if (JSID_IS_ATOM(id) && IsIdentifier(JSID_TO_ATOM(id))) {
|
||||
if (!cx->compartment()->wrapId(cx, id.address()))
|
||||
return false;
|
||||
if (!js_NewbornArrayPush(cx, arr, StringValue(JSID_TO_STRING(id))))
|
||||
if (!NewbornArrayPush(cx, arr, StringValue(JSID_TO_STRING(id))))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -3395,14 +3395,11 @@ CASE(JSOP_YIELD)
|
||||
|
||||
CASE(JSOP_ARRAYPUSH)
|
||||
{
|
||||
uint32_t slot = GET_LOCALNO(REGS.pc);
|
||||
JS_ASSERT(script->nfixed() <= slot);
|
||||
JS_ASSERT(slot < script->nslots());
|
||||
RootedObject &obj = rootObject0;
|
||||
obj = ®S.fp()->unaliasedLocal(slot).toObject();
|
||||
if (!js_NewbornArrayPush(cx, obj, REGS.sp[-1]))
|
||||
obj = ®S.sp[-1].toObject();
|
||||
if (!NewbornArrayPush(cx, obj, REGS.sp[-2]))
|
||||
goto error;
|
||||
REGS.sp--;
|
||||
REGS.sp -= 2;
|
||||
}
|
||||
END_CASE(JSOP_ARRAYPUSH)
|
||||
|
||||
|
@ -22,7 +22,7 @@ namespace js {
|
||||
* and saved versions. If deserialization fails, the data should be
|
||||
* invalidated if possible.
|
||||
*/
|
||||
static const uint32_t XDR_BYTECODE_VERSION = uint32_t(0xb973c0de - 162);
|
||||
static const uint32_t XDR_BYTECODE_VERSION = uint32_t(0xb973c0de - 163);
|
||||
|
||||
class XDRBuffer {
|
||||
public:
|
||||
|
Loading…
Reference in New Issue
Block a user