mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 841499 - Allow calling SetObjectElementOperation with explicit script and pc arguments. r=jimb
This commit is contained in:
parent
5214f9d134
commit
59ac0260e5
@ -3581,6 +3581,18 @@ js::SetObjectElement(JSContext *cx, HandleObject obj, HandleValue index, HandleV
|
||||
return SetObjectElementOperation(cx, obj, id, value, strict);
|
||||
}
|
||||
|
||||
bool
|
||||
js::SetObjectElement(JSContext *cx, HandleObject obj, HandleValue index, HandleValue value,
|
||||
JSBool strict, HandleScript script, jsbytecode *pc)
|
||||
{
|
||||
JS_ASSERT(pc);
|
||||
RootedId id(cx);
|
||||
RootedValue indexval(cx, index);
|
||||
if (!FetchElementId(cx, obj, indexval, &id, &indexval))
|
||||
return false;
|
||||
return SetObjectElementOperation(cx, obj, id, value, strict, script, pc);
|
||||
}
|
||||
|
||||
bool
|
||||
js::AddValues(JSContext *cx, HandleScript script, jsbytecode *pc,
|
||||
MutableHandleValue lhs, MutableHandleValue rhs,
|
||||
|
@ -368,6 +368,9 @@ CallElement(JSContext *cx, MutableHandleValue lref, HandleValue rref, MutableHan
|
||||
bool
|
||||
SetObjectElement(JSContext *cx, HandleObject obj, HandleValue index, HandleValue value,
|
||||
JSBool strict);
|
||||
bool
|
||||
SetObjectElement(JSContext *cx, HandleObject obj, HandleValue index, HandleValue value,
|
||||
JSBool strict, HandleScript script, jsbytecode *pc);
|
||||
|
||||
bool
|
||||
AddValues(JSContext *cx, HandleScript script, jsbytecode *pc,
|
||||
|
@ -892,20 +892,28 @@ GetElementOperation(JSContext *cx, JSOp op, MutableHandleValue lref, HandleValue
|
||||
}
|
||||
|
||||
static JS_ALWAYS_INLINE bool
|
||||
SetObjectElementOperation(JSContext *cx, Handle<JSObject*> obj, HandleId id, const Value &value, bool strict)
|
||||
SetObjectElementOperation(JSContext *cx, Handle<JSObject*> obj, HandleId id, const Value &value,
|
||||
bool strict, RawScript maybeScript = NULL, jsbytecode *pc = NULL)
|
||||
{
|
||||
RootedScript script(cx, maybeScript);
|
||||
types::TypeScript::MonitorAssign(cx, obj, id);
|
||||
|
||||
if (obj->isArray() && JSID_IS_INT(id)) {
|
||||
uint32_t length = obj->getDenseInitializedLength();
|
||||
int32_t i = JSID_TO_INT(id);
|
||||
if ((uint32_t)i >= length && !cx->fp()->beginsIonActivation()) {
|
||||
JSScript *script = NULL;
|
||||
jsbytecode *pc;
|
||||
types::TypeScript::GetPcScript(cx, &script, &pc);
|
||||
if ((uint32_t)i >= length) {
|
||||
// In an Ion activation, GetPcScript won't work. For non-baseline activations,
|
||||
// that's ok, because optimized ion doesn't generate analysis info. However,
|
||||
// baseline must generate this information, so it passes the script and pc in
|
||||
// as arguments.
|
||||
if (script || !cx->fp()->beginsIonActivation()) {
|
||||
JS_ASSERT(!!script == !!pc);
|
||||
if (!script)
|
||||
types::TypeScript::GetPcScript(cx, script.address(), &pc);
|
||||
|
||||
if (script->hasAnalysis())
|
||||
script->analysis()->getCode(pc).arrayWriteHole = true;
|
||||
if (script->hasAnalysis())
|
||||
script->analysis()->getCode(pc).arrayWriteHole = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user