diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2019-06-08 19:49:29 -0400 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2019-07-18 22:38:24 -0400 |
commit | 1d0ab1c752c583c153b850af339edb86d23f6cc8 (patch) | |
tree | a59897de81ee25b02faad4dd67c08e3acf1272a5 /js/src/vm/Shape.cpp | |
parent | fe20cd26491f8db4e7304d509a2639cfccf26c7e (diff) | |
download | UXP-1d0ab1c752c583c153b850af339edb86d23f6cc8.tar UXP-1d0ab1c752c583c153b850af339edb86d23f6cc8.tar.gz UXP-1d0ab1c752c583c153b850af339edb86d23f6cc8.tar.lz UXP-1d0ab1c752c583c153b850af339edb86d23f6cc8.tar.xz UXP-1d0ab1c752c583c153b850af339edb86d23f6cc8.zip |
1320408 - Part 9: Change JSObject::setFlags and depending methods to static method.
Diffstat (limited to 'js/src/vm/Shape.cpp')
-rw-r--r-- | js/src/vm/Shape.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/js/src/vm/Shape.cpp b/js/src/vm/Shape.cpp index 15fb71343..065a96337 100644 --- a/js/src/vm/Shape.cpp +++ b/js/src/vm/Shape.cpp @@ -1206,38 +1206,37 @@ NativeObject::shadowingShapeChange(ExclusiveContext* cx, const Shape& shape) return generateOwnShape(cx); } -bool -JSObject::setFlags(ExclusiveContext* cx, BaseShape::Flag flags, GenerateShape generateShape) +/* static */ bool +JSObject::setFlags(ExclusiveContext* cx, HandleObject obj, BaseShape::Flag flags, + GenerateShape generateShape) { - if (hasAllFlags(flags)) + if (obj->hasAllFlags(flags)) return true; - RootedObject self(cx, this); - - Shape* existingShape = self->ensureShape(cx); + Shape* existingShape = obj->ensureShape(cx); if (!existingShape) return false; - if (isNative() && as<NativeObject>().inDictionaryMode()) { - if (generateShape == GENERATE_SHAPE && !as<NativeObject>().generateOwnShape(cx)) + if (obj->isNative() && obj->as<NativeObject>().inDictionaryMode()) { + if (generateShape == GENERATE_SHAPE && !obj->as<NativeObject>().generateOwnShape(cx)) return false; - StackBaseShape base(self->as<NativeObject>().lastProperty()); + StackBaseShape base(obj->as<NativeObject>().lastProperty()); base.flags |= flags; UnownedBaseShape* nbase = BaseShape::getUnowned(cx, base); if (!nbase) return false; - self->as<NativeObject>().lastProperty()->base()->adoptUnowned(nbase); + obj->as<NativeObject>().lastProperty()->base()->adoptUnowned(nbase); return true; } - Shape* newShape = Shape::setObjectFlags(cx, flags, self->taggedProto(), existingShape); + Shape* newShape = Shape::setObjectFlags(cx, flags, obj->taggedProto(), existingShape); if (!newShape) return false; - // The success of the |JSObject::ensureShape| call above means that |self| + // The success of the |JSObject::ensureShape| call above means that |obj| // can be assumed to have a shape. - self->as<ShapedObject>().setShape(newShape); + obj->as<ShapedObject>().setShape(newShape); return true; } |