mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-23 02:05:42 +00:00
Address bug 700501 review comments, r=luke.
This commit is contained in:
parent
0174f509ce
commit
3854e8c2db
@ -3819,7 +3819,12 @@ js_InitArrayClass(JSContext *cx, JSObject *obj)
|
||||
if (!ctor)
|
||||
return NULL;
|
||||
|
||||
/* The default 'new' object for Array.prototype has unknown properties. */
|
||||
/*
|
||||
* The default 'new' type of Array.prototype is required by type inference
|
||||
* to have unknown properties, to simplify handling of e.g. heterogenous
|
||||
* arrays in JSON and script literals and allows setDenseArrayElement to
|
||||
* be used without updating the indexed type set for such default arrays.
|
||||
*/
|
||||
if (!arrayProto->setNewTypeUnknown(cx))
|
||||
return NULL;
|
||||
|
||||
|
@ -5781,8 +5781,7 @@ JSObject::setNewTypeUnknown(JSContext *cx)
|
||||
*/
|
||||
TypeObjectSet &table = cx->compartment->newTypeObjects;
|
||||
if (table.initialized()) {
|
||||
TypeObjectSet::Ptr p = table.lookup(this);
|
||||
if (p)
|
||||
if (TypeObjectSet::Ptr p = table.lookup(this))
|
||||
MarkTypeObjectUnknownProperties(cx, *p);
|
||||
}
|
||||
|
||||
|
@ -845,9 +845,7 @@ struct JSObject : js::gc::Cell
|
||||
|
||||
/*
|
||||
* Mark an object as requiring its default 'new' type to have unknown
|
||||
* properties. This is set for a few builtins like Object.prototype and
|
||||
* Array.prototype; several places in the VM require that the default
|
||||
* type for these objects have unknown contents.
|
||||
* properties.
|
||||
*/
|
||||
bool setNewTypeUnknown(JSContext *cx);
|
||||
|
||||
|
@ -106,6 +106,11 @@ GlobalObject::initFunctionAndObjectClasses(JSContext *cx)
|
||||
if (!objectProto || !objectProto->setSingletonType(cx))
|
||||
return NULL;
|
||||
|
||||
/*
|
||||
* The default 'new' type of Object.prototype is required by type inference
|
||||
* to have unknown properties, to simplify handling of e.g. heterogenous
|
||||
* objects in JSON and script literals.
|
||||
*/
|
||||
if (!objectProto->setNewTypeUnknown(cx))
|
||||
return NULL;
|
||||
|
||||
@ -140,6 +145,11 @@ GlobalObject::initFunctionAndObjectClasses(JSContext *cx)
|
||||
if (!proto->setSingletonType(cx))
|
||||
return NULL;
|
||||
|
||||
/*
|
||||
* The default 'new' type of Function.prototype is required by type
|
||||
* inference to have unknown properties, to simplify handling of e.g.
|
||||
* CloneFunctionObject.
|
||||
*/
|
||||
if (!proto->setNewTypeUnknown(cx))
|
||||
return NULL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user