Bug 934526 - Remove unnecessary attempt to instantiate intrinsic values in IonBuilder, r=jandem.

This commit is contained in:
Brian Hackett 2013-11-05 10:15:51 -08:00
parent 6efba18832
commit 33d73d4879
3 changed files with 15 additions and 12 deletions

View File

@ -6371,11 +6371,8 @@ IonBuilder::jsop_intrinsic(PropertyName *name)
}
// Bake in the intrinsic. Make sure that TI agrees with us on the type.
RootedPropertyName nameRoot(cx, name);
RootedValue vp(cx, UndefinedValue());
if (!cx->global()->getIntrinsicValue(cx, nameRoot, &vp))
return false;
Value vp;
JS_ALWAYS_TRUE(script()->global().maybeGetIntrinsicValue(name, &vp));
JS_ASSERT(types->hasType(types::GetValueType(vp)));
MConstant *ins = MConstant::New(vp);

View File

@ -511,13 +511,22 @@ class GlobalObject : public JSObject
return &getSlotRef(INTRINSICS).toObject();
}
bool maybeGetIntrinsicValue(PropertyName *name, Value *vp) {
JSObject *holder = intrinsicsHolder();
if (Shape *shape = holder->nativeLookupPure(name)) {
*vp = holder->getSlot(shape->slot());
return true;
}
return false;
}
bool getIntrinsicValue(JSContext *cx, HandlePropertyName name, MutableHandleValue value) {
RootedObject holder(cx, intrinsicsHolder());
RootedId id(cx, NameToId(name));
if (HasDataProperty(cx, holder, id, value.address()))
if (maybeGetIntrinsicValue(name, value.address()))
return true;
if (!cx->runtime()->cloneSelfHostedValue(cx, name, value))
return false;
RootedObject holder(cx, intrinsicsHolder());
RootedId id(cx, NameToId(name));
return JS_DefinePropertyById(cx, holder, id, value, nullptr, nullptr, 0);
}

View File

@ -1242,10 +1242,7 @@ class ObjectImpl : public gc::BarrieredCell<ObjectImpl>
return nativeLookup(cx, shape->propid()) == shape;
}
/*
* Contextless; can be called from parallel code. Returns false if the
* operation would have been effectful.
*/
/* Contextless; can be called from parallel code. */
Shape *nativeLookupPure(jsid id);
Shape *nativeLookupPure(PropertyId pid) {
return nativeLookupPure(pid.asId());