зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1445854 - Part 3: Use GenericCreatePrototype in more places. r=arai
Depends on D7667 Differential Revision: https://phabricator.services.mozilla.com/D7783 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
d910c71322
Коммит
35350226ea
|
@ -26,12 +26,6 @@ IsBigInt(HandleValue v)
|
|||
return v.isBigInt() || (v.isObject() && v.toObject().is<BigIntObject>());
|
||||
}
|
||||
|
||||
static JSObject*
|
||||
CreateBigIntPrototype(JSContext* cx, JSProtoKey key)
|
||||
{
|
||||
return GlobalObject::createBlankPrototype<PlainObject>(cx, cx->global());
|
||||
}
|
||||
|
||||
// BigInt proposal section 5.1.3
|
||||
static bool
|
||||
BigIntConstructor(JSContext* cx, unsigned argc, Value* vp)
|
||||
|
@ -189,7 +183,7 @@ BigIntObject::toLocaleString(JSContext* cx, unsigned argc, Value* vp)
|
|||
|
||||
const ClassSpec BigIntObject::classSpec_ = {
|
||||
GenericCreateConstructor<BigIntConstructor, 1, gc::AllocKind::FUNCTION>,
|
||||
CreateBigIntPrototype,
|
||||
GenericCreatePrototype<BigIntObject>,
|
||||
nullptr,
|
||||
nullptr,
|
||||
BigIntObject::methods,
|
||||
|
@ -205,6 +199,13 @@ const Class BigIntObject::class_ = {
|
|||
&BigIntObject::classSpec_
|
||||
};
|
||||
|
||||
const Class BigIntObject::protoClass_ = {
|
||||
js_Object_str,
|
||||
JSCLASS_HAS_CACHED_PROTO(JSProto_BigInt),
|
||||
JS_NULL_CLASS_OPS,
|
||||
&BigIntObject::classSpec_
|
||||
};
|
||||
|
||||
const JSPropertySpec BigIntObject::properties[] = {
|
||||
// BigInt proposal section 5.3.5
|
||||
JS_STRING_SYM_PS(toStringTag, "BigInt", JSPROP_READONLY),
|
||||
|
|
|
@ -24,6 +24,7 @@ class BigIntObject : public NativeObject
|
|||
public:
|
||||
static const ClassSpec classSpec_;
|
||||
static const Class class_;
|
||||
static const Class protoClass_;
|
||||
|
||||
static JSObject* create(JSContext* cx, JS::Handle<JS::BigInt*> bi);
|
||||
|
||||
|
|
|
@ -935,13 +935,6 @@ DataViewObject::byteOffsetGetter(JSContext* cx, unsigned argc, Value* vp)
|
|||
return CallNonGenericMethod<is, byteOffsetGetterImpl>(cx, args);
|
||||
}
|
||||
|
||||
const Class DataViewObject::protoClass_ = {
|
||||
js_Object_str,
|
||||
JSCLASS_HAS_CACHED_PROTO(JSProto_DataView),
|
||||
JS_NULL_CLASS_OPS,
|
||||
&DataViewObject::classSpec_
|
||||
};
|
||||
|
||||
JSObject*
|
||||
DataViewObject::CreatePrototype(JSContext* cx, JSProtoKey key)
|
||||
{
|
||||
|
@ -964,7 +957,7 @@ static const ClassOps DataViewObjectClassOps = {
|
|||
|
||||
const ClassSpec DataViewObject::classSpec_ = {
|
||||
GenericCreateConstructor<DataViewObject::construct, 3, gc::AllocKind::FUNCTION>,
|
||||
DataViewObject::CreatePrototype,
|
||||
GenericCreatePrototype<DataViewObject>,
|
||||
nullptr,
|
||||
nullptr,
|
||||
DataViewObject::methods,
|
||||
|
@ -980,6 +973,13 @@ const Class DataViewObject::class_ = {
|
|||
&DataViewObject::classSpec_
|
||||
};
|
||||
|
||||
const Class DataViewObject::protoClass_ = {
|
||||
js_Object_str,
|
||||
JSCLASS_HAS_CACHED_PROTO(JSProto_DataView),
|
||||
JS_NULL_CLASS_OPS,
|
||||
&DataViewObject::classSpec_
|
||||
};
|
||||
|
||||
const JSFunctionSpec DataViewObject::methods[] = {
|
||||
JS_FN("getInt8", DataViewObject::fun_getInt8, 1,0),
|
||||
JS_FN("getUint8", DataViewObject::fun_getUint8, 1,0),
|
||||
|
|
|
@ -26,7 +26,6 @@ namespace js {
|
|||
class DataViewObject : public NativeObject
|
||||
{
|
||||
private:
|
||||
static const Class protoClass_;
|
||||
static const ClassSpec classSpec_;
|
||||
|
||||
static JSObject* CreatePrototype(JSContext* cx, JSProtoKey key);
|
||||
|
@ -60,6 +59,7 @@ class DataViewObject : public NativeObject
|
|||
|
||||
public:
|
||||
static const Class class_;
|
||||
static const Class protoClass_;
|
||||
|
||||
static Value byteOffsetValue(const DataViewObject* view) {
|
||||
Value v = view->getFixedSlot(TypedArrayObject::BYTEOFFSET_SLOT);
|
||||
|
|
|
@ -412,12 +412,6 @@ MapIteratorObject::createResultPair(JSContext* cx)
|
|||
|
||||
/*** Map *****************************************************************************************/
|
||||
|
||||
static JSObject*
|
||||
CreateMapPrototype(JSContext* cx, JSProtoKey key)
|
||||
{
|
||||
return GlobalObject::createBlankPrototype(cx, cx->global(), &MapObject::protoClass_);
|
||||
}
|
||||
|
||||
const ClassOps MapObject::classOps_ = {
|
||||
nullptr, // addProperty
|
||||
nullptr, // delProperty
|
||||
|
@ -434,7 +428,7 @@ const ClassOps MapObject::classOps_ = {
|
|||
|
||||
const ClassSpec MapObject::classSpec_ = {
|
||||
GenericCreateConstructor<MapObject::construct, 0, gc::AllocKind::FUNCTION>,
|
||||
CreateMapPrototype,
|
||||
GenericCreatePrototype<MapObject>,
|
||||
nullptr,
|
||||
MapObject::staticProperties,
|
||||
MapObject::methods,
|
||||
|
@ -1274,12 +1268,6 @@ SetIteratorObject::createResult(JSContext* cx)
|
|||
|
||||
/*** Set *****************************************************************************************/
|
||||
|
||||
static JSObject*
|
||||
CreateSetPrototype(JSContext* cx, JSProtoKey key)
|
||||
{
|
||||
return GlobalObject::createBlankPrototype(cx, cx->global(), &SetObject::protoClass_);
|
||||
}
|
||||
|
||||
const ClassOps SetObject::classOps_ = {
|
||||
nullptr, // addProperty
|
||||
nullptr, // delProperty
|
||||
|
@ -1296,7 +1284,7 @@ const ClassOps SetObject::classOps_ = {
|
|||
|
||||
const ClassSpec SetObject::classSpec_ = {
|
||||
GenericCreateConstructor<SetObject::construct, 0, gc::AllocKind::FUNCTION>,
|
||||
CreateSetPrototype,
|
||||
GenericCreatePrototype<SetObject>,
|
||||
nullptr,
|
||||
SetObject::staticProperties,
|
||||
SetObject::methods,
|
||||
|
|
|
@ -5045,12 +5045,6 @@ OffThreadPromiseRuntimeState::shutdown(JSContext* cx)
|
|||
MOZ_ASSERT(!initialized());
|
||||
}
|
||||
|
||||
static JSObject*
|
||||
CreatePromisePrototype(JSContext* cx, JSProtoKey key)
|
||||
{
|
||||
return GlobalObject::createBlankPrototype(cx, cx->global(), &PromiseObject::protoClass_);
|
||||
}
|
||||
|
||||
const JSJitInfo promise_then_info = {
|
||||
{ (JSJitGetterOp)Promise_then_noRetVal },
|
||||
{ 0 }, /* unused */
|
||||
|
@ -5096,7 +5090,7 @@ static const JSPropertySpec promise_static_properties[] = {
|
|||
|
||||
static const ClassSpec PromiseObjectClassSpec = {
|
||||
GenericCreateConstructor<PromiseConstructor, 1, gc::AllocKind::FUNCTION>,
|
||||
CreatePromisePrototype,
|
||||
GenericCreatePrototype<PromiseObject>,
|
||||
promise_static_methods,
|
||||
promise_static_properties,
|
||||
promise_methods,
|
||||
|
|
|
@ -3604,13 +3604,6 @@ DateConstructor(JSContext* cx, unsigned argc, Value* vp)
|
|||
return DateMultipleArguments(cx, args);
|
||||
}
|
||||
|
||||
// ES6 final draft 20.3.4.
|
||||
static JSObject*
|
||||
CreateDatePrototype(JSContext* cx, JSProtoKey key)
|
||||
{
|
||||
return GlobalObject::createBlankPrototype(cx, cx->global(), &DateObject::protoClass_);
|
||||
}
|
||||
|
||||
static bool
|
||||
FinishDateClassInit(JSContext* cx, HandleObject ctor, HandleObject proto)
|
||||
{
|
||||
|
@ -3628,7 +3621,7 @@ FinishDateClassInit(JSContext* cx, HandleObject ctor, HandleObject proto)
|
|||
|
||||
static const ClassSpec DateObjectClassSpec = {
|
||||
GenericCreateConstructor<DateConstructor, 7, gc::AllocKind::FUNCTION>,
|
||||
CreateDatePrototype,
|
||||
GenericCreatePrototype<DateObject>,
|
||||
date_static_methods,
|
||||
nullptr,
|
||||
date_methods,
|
||||
|
|
|
@ -261,12 +261,6 @@ js::UnmapBufferMemory(void* base, size_t mappedSize)
|
|||
* ArrayBufferObject (base)
|
||||
*/
|
||||
|
||||
static JSObject*
|
||||
CreateArrayBufferPrototype(JSContext* cx, JSProtoKey key)
|
||||
{
|
||||
return GlobalObject::createBlankPrototype(cx, cx->global(), &ArrayBufferObject::protoClass_);
|
||||
}
|
||||
|
||||
static const ClassOps ArrayBufferObjectClassOps = {
|
||||
nullptr, /* addProperty */
|
||||
nullptr, /* delProperty */
|
||||
|
@ -305,7 +299,7 @@ static const JSPropertySpec arraybuffer_proto_properties[] = {
|
|||
|
||||
static const ClassSpec ArrayBufferObjectClassSpec = {
|
||||
GenericCreateConstructor<ArrayBufferObject::class_constructor, 1, gc::AllocKind::FUNCTION>,
|
||||
CreateArrayBufferPrototype,
|
||||
GenericCreatePrototype<ArrayBufferObject>,
|
||||
arraybuffer_functions,
|
||||
arraybuffer_properties,
|
||||
arraybuffer_proto_functions,
|
||||
|
|
|
@ -167,12 +167,6 @@ RegExpObject::trace(JSTracer* trc)
|
|||
TraceNullableEdge(trc, &sharedRef(), "RegExpObject shared");
|
||||
}
|
||||
|
||||
static JSObject*
|
||||
CreateRegExpPrototype(JSContext* cx, JSProtoKey key)
|
||||
{
|
||||
return GlobalObject::createBlankPrototype(cx, cx->global(), &RegExpObject::protoClass_);
|
||||
}
|
||||
|
||||
static const ClassOps RegExpObjectClassOps = {
|
||||
nullptr, /* addProperty */
|
||||
nullptr, /* delProperty */
|
||||
|
@ -189,7 +183,7 @@ static const ClassOps RegExpObjectClassOps = {
|
|||
|
||||
static const ClassSpec RegExpObjectClassSpec = {
|
||||
GenericCreateConstructor<js::regexp_construct, 2, gc::AllocKind::FUNCTION>,
|
||||
CreateRegExpPrototype,
|
||||
GenericCreatePrototype<RegExpObject>,
|
||||
nullptr,
|
||||
js::regexp_static_props,
|
||||
js::regexp_methods,
|
||||
|
|
|
@ -367,13 +367,6 @@ SharedArrayBufferObject::createFromNewRawBuffer(JSContext* cx, SharedArrayRawBuf
|
|||
return obj;
|
||||
}
|
||||
|
||||
static JSObject*
|
||||
CreateSharedArrayBufferPrototype(JSContext* cx, JSProtoKey key)
|
||||
{
|
||||
return GlobalObject::createBlankPrototype(cx, cx->global(),
|
||||
&SharedArrayBufferObject::protoClass_);
|
||||
}
|
||||
|
||||
static const ClassOps SharedArrayBufferObjectClassOps = {
|
||||
nullptr, /* addProperty */
|
||||
nullptr, /* delProperty */
|
||||
|
@ -410,7 +403,7 @@ static const JSPropertySpec sharedarray_proto_properties[] = {
|
|||
|
||||
static const ClassSpec SharedArrayBufferObjectClassSpec = {
|
||||
GenericCreateConstructor<SharedArrayBufferObject::class_constructor, 1, gc::AllocKind::FUNCTION>,
|
||||
CreateSharedArrayBufferPrototype,
|
||||
GenericCreatePrototype<SharedArrayBufferObject>,
|
||||
sharedarrray_functions,
|
||||
sharedarrray_properties,
|
||||
sharedarray_proto_functions,
|
||||
|
|
Загрузка…
Ссылка в новой задаче