diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2019-06-08 23:46:41 -0400 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2019-07-18 22:38:27 -0400 |
commit | 761b3afca59ba1c24337ff3afe0c91d005f7718b (patch) | |
tree | e4112b321901610e104693d386eeccdae92bc372 /js/src/vm/StringObject-inl.h | |
parent | 08aee2f9d9948c9a4540706d40ea4abf01f452a5 (diff) | |
download | UXP-761b3afca59ba1c24337ff3afe0c91d005f7718b.tar UXP-761b3afca59ba1c24337ff3afe0c91d005f7718b.tar.gz UXP-761b3afca59ba1c24337ff3afe0c91d005f7718b.tar.lz UXP-761b3afca59ba1c24337ff3afe0c91d005f7718b.tar.xz UXP-761b3afca59ba1c24337ff3afe0c91d005f7718b.zip |
1320408 - Part 18: Change StringObject::init to static method.
Diffstat (limited to 'js/src/vm/StringObject-inl.h')
-rw-r--r-- | js/src/vm/StringObject-inl.h | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/js/src/vm/StringObject-inl.h b/js/src/vm/StringObject-inl.h index 5fc1656f6..38191fc7a 100644 --- a/js/src/vm/StringObject-inl.h +++ b/js/src/vm/StringObject-inl.h @@ -15,31 +15,29 @@ namespace js { -inline bool -StringObject::init(JSContext* cx, HandleString str) +/* static */ inline bool +StringObject::init(JSContext* cx, Handle<StringObject*> obj, HandleString str) { - MOZ_ASSERT(numFixedSlots() == 2); + MOZ_ASSERT(obj->numFixedSlots() == 2); - Rooted<StringObject*> self(cx, this); - - if (!EmptyShape::ensureInitialCustomShape<StringObject>(cx, self)) + if (!EmptyShape::ensureInitialCustomShape<StringObject>(cx, obj)) return false; - MOZ_ASSERT(self->lookup(cx, NameToId(cx->names().length))->slot() == LENGTH_SLOT); + MOZ_ASSERT(obj->lookup(cx, NameToId(cx->names().length))->slot() == LENGTH_SLOT); - self->setStringThis(str); + obj->setStringThis(str); return true; } -inline StringObject* +/* static */ inline StringObject* StringObject::create(JSContext* cx, HandleString str, HandleObject proto, NewObjectKind newKind) { JSObject* obj = NewObjectWithClassProto(cx, &class_, proto, newKind); if (!obj) return nullptr; Rooted<StringObject*> strobj(cx, &obj->as<StringObject>()); - if (!strobj->init(cx, str)) + if (!StringObject::init(cx, strobj, str)) return nullptr; return strobj; } |