Bug 963641 - Miscellaneous cleanups not implicated in actual bugs. r=jorendorff

--HG--
extra : rebase_source : a7969e756bc5456b6524fab8f602f61a7ed83a13
This commit is contained in:
Jeff Walden 2014-01-27 16:33:03 -08:00
parent 6a537286af
commit 757c601d5a
3 changed files with 14 additions and 18 deletions

View File

@ -5894,11 +5894,8 @@ EmitObject(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn)
/*
* Emit code for {p:a, '%q':b, 2:c} that is equivalent to constructing
* a new object and in source order evaluating each property value and
* adding the property to the object, without invoking latent setters.
* We use the JSOP_NEWINIT and JSOP_INITELEM/JSOP_INITPROP bytecodes to
* ignore setters and to avoid dup'ing and popping the object as each
* property is added, as JSOP_SETELEM/JSOP_SETPROP would do.
* a new object and defining (in source order) each property on the object
* (or mutating the object's [[Prototype]], in the case of __proto__).
*/
ptrdiff_t offset = bce->offset();
if (!EmitNewInit(cx, bce, JSProto_Object))

View File

@ -254,12 +254,7 @@ class FullParseHandler
bool addShorthandPropertyDefinition(ParseNode *literal, ParseNode *name) {
JS_ASSERT(literal->isArity(PN_LIST));
literal->pn_xflags |= PNX_DESTRUCT | PNX_NONCONST; // XXX why PNX_DESTRUCT?
ParseNode *propdef = newBinary(PNK_COLON, name, name, JSOP_INITPROP);
if (!propdef)
return false;
literal->append(propdef);
return true;
return addPropertyDefinition(literal, name, name);
}
bool addAccessorPropertyDefinition(ParseNode *literal, ParseNode *name, ParseNode *fn, JSOp op)

View File

@ -7250,8 +7250,9 @@ DoSetPropFallback(JSContext *cx, BaselineFrame *frame, ICSetProp_Fallback *stub,
RootedShape oldShape(cx, obj->lastProperty());
uint32_t oldSlots = obj->numDynamicSlots();
if (op == JSOP_INITPROP && name != cx->names().proto) {
JS_ASSERT(obj->is<JSObject>());
if (op == JSOP_INITPROP) {
MOZ_ASSERT(name != cx->names().proto, "should have used JSOP_MUTATEPROTO");
MOZ_ASSERT(obj->is<JSObject>());
if (!DefineNativeProperty(cx, obj, id, rhs, nullptr, nullptr, JSPROP_ENUMERATE, 0, 0, 0))
return false;
} else if (op == JSOP_SETNAME || op == JSOP_SETGNAME) {
@ -7259,12 +7260,15 @@ DoSetPropFallback(JSContext *cx, BaselineFrame *frame, ICSetProp_Fallback *stub,
return false;
} else if (op == JSOP_SETALIASEDVAR) {
obj->as<ScopeObject>().setAliasedVar(cx, pc, name, rhs);
} else if (script->strict()) {
if (!js::SetProperty<true>(cx, obj, id, rhs))
return false;
} else {
if (!js::SetProperty<false>(cx, obj, id, rhs))
return false;
MOZ_ASSERT(op == JSOP_SETPROP);
if (script->strict()) {
if (!js::SetProperty<true>(cx, obj, id, rhs))
return false;
} else {
if (!js::SetProperty<false>(cx, obj, id, rhs))
return false;
}
}
// Leave the RHS on the stack.