1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * vim: set ts=8 sts=2 et sw=2 tw=80:
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef vm_StringObject_inl_h
8 #define vm_StringObject_inl_h
10 #include "vm/StringObject.h"
12 #include "vm/JSObject-inl.h"
13 #include "vm/Shape-inl.h"
17 /* static */ inline bool StringObject::init(JSContext
* cx
,
18 Handle
<StringObject
*> obj
,
20 MOZ_ASSERT(obj
->numFixedSlots() == 2);
22 if (!SharedShape::ensureInitialCustomShape
<StringObject
>(cx
, obj
)) {
26 MOZ_ASSERT(obj
->lookup(cx
, NameToId(cx
->names().length
))->slot() ==
29 obj
->setStringThis(str
);
34 /* static */ inline StringObject
* StringObject::create(JSContext
* cx
,
37 NewObjectKind newKind
) {
38 Rooted
<StringObject
*> obj(
39 cx
, NewObjectWithClassProtoAndKind
<StringObject
>(
41 ObjectFlags({ObjectFlag::NeedsProxyGetSetResultValidation
})));
45 if (!StringObject::init(cx
, obj
, str
)) {
53 #endif /* vm_StringObject_inl_h */