Debian Codegraph @

js/src/vm/DisposableRecord.cpp

raw
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/. */
6
7 #include "vm/DisposableRecord.h"
8
9 #include "vm/NativeObject-inl.h"
10 #include "vm/Shape-inl.h"
11
12 using namespace js;
13
14 /* static */ SharedShape* DisposableRecordObject::assignInitialShape(
15 JSContext* cx, Handle<DisposableRecordObject*> self) {
16 MOZ_ASSERT(self->empty());
17
18 constexpr PropertyFlags flags = {PropertyFlag::Writable};
19
20 if (!NativeObject::addPropertyInReservedSlot(
21 cx, self, cx->names().value, DisposableRecordObject::VALUE_SLOT,
22 flags)) {
23 return nullptr;
24 }
25
26 if (!NativeObject::addPropertyInReservedSlot(
27 cx, self, cx->names().method, DisposableRecordObject::METHOD_SLOT,
28 flags)) {
29 return nullptr;
30 }
31
32 if (!NativeObject::addPropertyInReservedSlot(
33 cx, self, cx->names().hint, DisposableRecordObject::HINT_SLOT,
34 flags)) {
35 return nullptr;
36 }
37
38 return self->sharedShape();
39 }
40
41 const JSClass DisposableRecordObject::class_ = {
42 "DisposableRecord",
43 JSCLASS_HAS_RESERVED_SLOTS(DisposableRecordObject::RESERVED_SLOTS),
44 };