Bug 992958 - Stop going through the __proto__ getter in getPrototypeOf. r=luke

The need for this is long-gone, I believe.
This commit is contained in:
Bobby Holley 2014-05-23 16:53:02 -07:00
parent 1c2ad9bb25
commit 15a4860557
3 changed files with 5 additions and 26 deletions

View File

@ -523,19 +523,11 @@ obj_getPrototypeOf(JSContext *cx, unsigned argc, Value *vp)
}
/* Step 2. */
/*
* Implement [[Prototype]]-getting -- particularly across compartment
* boundaries -- by calling a cached __proto__ getter function.
*/
InvokeArgs args2(cx);
if (!args2.init(0))
RootedObject thisObj(cx, &args[0].toObject());
RootedObject proto(cx);
if (!JSObject::getProto(cx, thisObj, &proto))
return false;
args2.setCallee(cx->global()->protoGetter());
args2.setThis(args[0]);
if (!Invoke(cx, args2))
return false;
args.rval().set(args2.rval());
args.rval().setObjectOrNull(proto);
return true;
}

View File

@ -366,8 +366,6 @@ GlobalObject::initFunctionAndObjectClasses(JSContext *cx)
return nullptr;
}
#endif /* JS_HAS_OBJ_PROTO_PROP */
self->setProtoGetter(getter);
if (!DefinePropertiesAndBrand(cx, objectCtor, nullptr, object_static_methods) ||
!LinkConstructorAndPrototype(cx, functionCtor, functionProto) ||

View File

@ -81,13 +81,12 @@ class GlobalObject : public JSObject
static const unsigned EVAL = APPLICATION_SLOTS + STANDARD_CLASS_SLOTS;
static const unsigned CREATE_DATAVIEW_FOR_THIS = EVAL + 1;
static const unsigned THROWTYPEERROR = CREATE_DATAVIEW_FOR_THIS + 1;
static const unsigned PROTO_GETTER = THROWTYPEERROR + 1;
/*
* Instances of the internal createArrayFromBuffer function used by the
* typed array code, one per typed array element type.
*/
static const unsigned FROM_BUFFER_UINT8 = PROTO_GETTER + 1;
static const unsigned FROM_BUFFER_UINT8 = THROWTYPEERROR + 1;
static const unsigned FROM_BUFFER_INT8 = FROM_BUFFER_UINT8 + 1;
static const unsigned FROM_BUFFER_UINT16 = FROM_BUFFER_INT8 + 1;
static const unsigned FROM_BUFFER_INT16 = FROM_BUFFER_UINT16 + 1;
@ -142,11 +141,6 @@ class GlobalObject : public JSObject
setSlot(EVAL, ObjectValue(*evalobj));
}
void setProtoGetter(JSFunction *protoGetter) {
JS_ASSERT(getSlotRef(PROTO_GETTER).isUndefined());
setSlot(PROTO_GETTER, ObjectValue(*protoGetter));
}
void setIntrinsicsHolder(JSObject *obj) {
JS_ASSERT(getSlotRef(INTRINSICS).isUndefined());
setSlot(INTRINSICS, ObjectValue(*obj));
@ -609,11 +603,6 @@ class GlobalObject : public JSObject
template<typename T>
inline Value createArrayFromBuffer() const;
Value protoGetter() const {
JS_ASSERT(functionObjectClassesInitialized());
return getSlot(PROTO_GETTER);
}
static bool isRuntimeCodeGenEnabled(JSContext *cx, Handle<GlobalObject*> global);
// Warn about use of the deprecated watch/unwatch functions in the global