mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 765956 - Set Bindings' parent eagerly (r=bhackett)
--HG-- extra : rebase_source : 4f907c3e3692199033813539b173189d760b4a7c
This commit is contained in:
parent
f86b798bff
commit
043fc7c6eb
@ -128,7 +128,7 @@ struct JSCompartment
|
||||
//
|
||||
// In contrast, JSObject::global() is infallible because marking a JSObject
|
||||
// always marks its global as well.
|
||||
// TODO: add infallible JSScript::global() and JSContext::global()
|
||||
// TODO: add infallible JSScript::global()
|
||||
//
|
||||
js::GlobalObject *maybeGlobal() const {
|
||||
JS_ASSERT_IF(global_, global_->compartment() == this);
|
||||
|
@ -5032,14 +5032,6 @@ TypeScript::SetScope(JSContext *cx, JSScript *script_, JSObject *scope_)
|
||||
JS_ASSERT_IF(fun && scope, fun->global() == scope->global());
|
||||
script->types->global = fun ? &fun->global() : &scope->global();
|
||||
|
||||
/*
|
||||
* Update the parent in the script's bindings. The bindings are created
|
||||
* with a NULL parent, and fixing the parent now avoids the need to reshape
|
||||
* every time a call object is created from the bindings.
|
||||
*/
|
||||
if (!script->bindings.setParent(cx, script->types->global))
|
||||
return false;
|
||||
|
||||
if (!cx->typeInferenceEnabled())
|
||||
return true;
|
||||
|
||||
|
@ -1207,31 +1207,6 @@ Bindings::setExtensibleParents(JSContext *cx)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
Bindings::setParent(JSContext *cx, JSObject *obj_)
|
||||
{
|
||||
RootedObject obj(cx, obj_);
|
||||
|
||||
/*
|
||||
* This may be invoked on GC heap allocated bindings, in which case this
|
||||
* is pointing to an internal value of a JSScript that can't itself be
|
||||
* relocated. The script itself will be rooted, and will not be moved, so
|
||||
* mark the stack value as non-relocatable for the stack root analysis.
|
||||
*/
|
||||
Bindings *self = this;
|
||||
SkipRoot root(cx, &self);
|
||||
|
||||
if (!ensureShape(cx))
|
||||
return false;
|
||||
|
||||
/* This is only used for Block objects, which have a NULL proto. */
|
||||
Shape *newShape = Shape::setObjectParent(cx, obj, NULL, self->lastBinding);
|
||||
if (!newShape)
|
||||
return false;
|
||||
self->lastBinding = newShape;
|
||||
return true;
|
||||
}
|
||||
|
||||
inline
|
||||
InitialShapeEntry::InitialShapeEntry() : shape(NULL), proto(NULL)
|
||||
{
|
||||
|
@ -124,7 +124,7 @@ Bindings::add(JSContext *cx, HandleAtom name, BindingKind kind)
|
||||
id = AtomToId(name);
|
||||
}
|
||||
|
||||
StackBaseShape base(&CallClass, NULL, BaseShape::VAROBJ);
|
||||
StackBaseShape base(&CallClass, cx->global(), BaseShape::VAROBJ);
|
||||
base.updateGetterSetter(attrs, getter, setter);
|
||||
|
||||
UnownedBaseShape *nbase = BaseShape::getUnowned(cx, base);
|
||||
|
@ -128,8 +128,6 @@ class Bindings
|
||||
inline bool extensibleParents();
|
||||
bool setExtensibleParents(JSContext *cx);
|
||||
|
||||
bool setParent(JSContext *cx, JSObject *obj);
|
||||
|
||||
enum {
|
||||
/* A script may have no more than this many arguments or variables. */
|
||||
BINDING_COUNT_LIMIT = 0xFFFF
|
||||
|
@ -55,8 +55,8 @@ Bindings::initialShape(JSContext *cx) const
|
||||
gc::AllocKind kind = gc::FINALIZE_OBJECT2_BACKGROUND;
|
||||
JS_ASSERT(gc::GetGCKindSlots(kind) == CallObject::RESERVED_SLOTS);
|
||||
|
||||
return EmptyShape::getInitialShape(cx, &CallClass, NULL, NULL, kind,
|
||||
BaseShape::VAROBJ);
|
||||
return EmptyShape::getInitialShape(cx, &CallClass, NULL, cx->global(),
|
||||
kind, BaseShape::VAROBJ);
|
||||
}
|
||||
|
||||
bool
|
||||
|
Loading…
Reference in New Issue
Block a user