зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1431726 part 4 - Replace GetBuiltinPrototypePure with GlobalObject::maybeGetPrototype. r=anba
This commit is contained in:
Родитель
7becc21a04
Коммит
f207865841
|
@ -1546,16 +1546,16 @@ GetPropIRGenerator::tryAttachPrimitive(ValOperandId valId, HandleId id)
|
|||
return false;
|
||||
}
|
||||
primitiveType = JSVAL_TYPE_STRING;
|
||||
proto = MaybeNativeObject(GetBuiltinPrototypePure(cx_->global(), JSProto_String));
|
||||
proto = MaybeNativeObject(cx_->global()->maybeGetPrototype(JSProto_String));
|
||||
} else if (val_.isNumber()) {
|
||||
primitiveType = JSVAL_TYPE_DOUBLE;
|
||||
proto = MaybeNativeObject(GetBuiltinPrototypePure(cx_->global(), JSProto_Number));
|
||||
proto = MaybeNativeObject(cx_->global()->maybeGetPrototype(JSProto_Number));
|
||||
} else if (val_.isBoolean()) {
|
||||
primitiveType = JSVAL_TYPE_BOOLEAN;
|
||||
proto = MaybeNativeObject(GetBuiltinPrototypePure(cx_->global(), JSProto_Boolean));
|
||||
proto = MaybeNativeObject(cx_->global()->maybeGetPrototype(JSProto_Boolean));
|
||||
} else if (val_.isSymbol()) {
|
||||
primitiveType = JSVAL_TYPE_SYMBOL;
|
||||
proto = MaybeNativeObject(GetBuiltinPrototypePure(cx_->global(), JSProto_Symbol));
|
||||
proto = MaybeNativeObject(cx_->global()->maybeGetPrototype(JSProto_Symbol));
|
||||
} else {
|
||||
MOZ_ASSERT(val_.isNullOrUndefined() || val_.isMagic());
|
||||
return false;
|
||||
|
|
|
@ -7093,8 +7093,7 @@ IonBuilder::testSingletonPropertyTypes(MDefinition* obj, jsid id)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
JSObject* proto = GetBuiltinPrototypePure(&script()->global(), key);
|
||||
if (proto)
|
||||
if (JSObject* proto = script()->global().maybeGetPrototype(key))
|
||||
return testSingletonProperty(proto, id);
|
||||
|
||||
return nullptr;
|
||||
|
|
|
@ -3190,21 +3190,6 @@ js::IsDelegateOfObject(JSContext* cx, HandleObject protoObj, JSObject* obj, bool
|
|||
}
|
||||
}
|
||||
|
||||
JSObject*
|
||||
js::GetBuiltinPrototypePure(GlobalObject* global, JSProtoKey protoKey)
|
||||
{
|
||||
MOZ_ASSERT(JSProto_Null <= protoKey);
|
||||
MOZ_ASSERT(protoKey < JSProto_LIMIT);
|
||||
|
||||
if (protoKey != JSProto_Null) {
|
||||
const Value& v = global->getPrototype(protoKey);
|
||||
if (v.isObject())
|
||||
return &v.toObject();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
JSObject*
|
||||
js::PrimitiveToObject(JSContext* cx, const Value& v)
|
||||
{
|
||||
|
|
|
@ -1032,9 +1032,6 @@ GetThisValueOfWith(JSObject* env);
|
|||
typedef JSObject* (*ClassInitializerOp)(JSContext* cx, JS::HandleObject obj);
|
||||
|
||||
/* Fast access to builtin constructors and prototypes. */
|
||||
JSObject*
|
||||
GetBuiltinPrototypePure(GlobalObject* global, JSProtoKey protoKey);
|
||||
|
||||
extern bool
|
||||
IsStandardPrototype(JSObject* obj, JSProtoKey key);
|
||||
|
||||
|
|
|
@ -163,6 +163,13 @@ class GlobalObject : public NativeObject
|
|||
return &global->getPrototype(key).toObject();
|
||||
}
|
||||
|
||||
JSObject* maybeGetPrototype(JSProtoKey protoKey) const {
|
||||
MOZ_ASSERT(JSProto_Null < protoKey);
|
||||
MOZ_ASSERT(protoKey < JSProto_LIMIT);
|
||||
const Value& v = getPrototype(protoKey);
|
||||
return v.isObject() ? &v.toObject() : nullptr;
|
||||
}
|
||||
|
||||
void setConstructor(JSProtoKey key, const Value& v) {
|
||||
MOZ_ASSERT(key <= JSProto_LIMIT);
|
||||
setSlot(APPLICATION_SLOTS + key, v);
|
||||
|
|
|
@ -1769,7 +1769,8 @@ GlobalHelperThreadState::mergeParseTaskCompartment(JSContext* cx, ParseTask* par
|
|||
if (key != JSProto_Null) {
|
||||
MOZ_ASSERT(key == JSProto_Object || key == JSProto_Array ||
|
||||
key == JSProto_Function || key == JSProto_RegExp);
|
||||
newProto = GetBuiltinPrototypePure(global, key);
|
||||
newProto = global->maybeGetPrototype(key);
|
||||
MOZ_ASSERT(newProto);
|
||||
} else if (protoObj == parseTaskGenFunctionProto) {
|
||||
newProto = global->getGeneratorFunctionPrototype();
|
||||
} else if (protoObj == moduleProto) {
|
||||
|
|
|
@ -3500,7 +3500,7 @@ PreliminaryObjectArray::sweep()
|
|||
JSObject* obj = *ptr;
|
||||
GlobalObject* global = obj->compartment()->unsafeUnbarrieredMaybeGlobal();
|
||||
if (global && !obj->isSingleton()) {
|
||||
JSObject* objectProto = GetBuiltinPrototypePure(global, JSProto_Object);
|
||||
JSObject* objectProto = global->maybeGetPrototype(JSProto_Object);
|
||||
obj->setGroup(objectProto->groupRaw());
|
||||
MOZ_ASSERT(obj->is<NativeObject>());
|
||||
MOZ_ASSERT(obj->getClass() == objectProto->getClass());
|
||||
|
|
Загрузка…
Ссылка в новой задаче