1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 : * vim: set ts=8 sw=4 et tw=78:
3 : *
4 : * This Source Code Form is subject to the terms of the Mozilla Public
5 : * License, v. 2.0. If a copy of the MPL was not distributed with this file,
6 : * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 :
8 : #include "mozilla/Assertions.h"
9 : #include "mozilla/Attributes.h"
10 :
11 : #include "jsscope.h"
12 : #include "jsobjinlines.h"
13 :
14 : #include "ObjectImpl.h"
15 :
16 : #include "ObjectImpl-inl.h"
17 :
18 : using namespace js;
19 :
20 19870 : static ObjectElements emptyElementsHeader(0, 0);
21 :
22 : /* Objects with no elements share one empty set of elements. */
23 : HeapSlot *js::emptyObjectElements =
24 : reinterpret_cast<HeapSlot *>(uintptr_t(&emptyElementsHeader) + sizeof(ObjectElements));
25 :
26 : #if defined(_MSC_VER) && _MSC_VER >= 1500
27 : /*
28 : * Work around a compiler bug in MSVC9 and above, where inlining this function
29 : * causes stack pointer offsets to go awry and spp to refer to something higher
30 : * up the stack.
31 : */
32 : MOZ_NEVER_INLINE
33 : #endif
34 : const Shape *
35 217061661 : js::ObjectImpl::nativeLookup(JSContext *cx, jsid id)
36 : {
37 217061661 : MOZ_ASSERT(isNative());
38 : Shape **spp;
39 217061661 : return Shape::search(cx, lastProperty(), id, &spp);
40 : }
41 :
42 : void
43 3334743 : js::ObjectImpl::markChildren(JSTracer *trc)
44 : {
45 3334743 : MarkTypeObject(trc, &type_, "type");
46 :
47 3334743 : MarkShape(trc, &shape_, "shape");
48 :
49 3334743 : Class *clasp = shape_->getObjectClass();
50 3334743 : JSObject *obj = asObjectPtr();
51 3334743 : if (clasp->trace)
52 2840913 : clasp->trace(trc, obj);
53 :
54 3334743 : if (shape_->isNative())
55 3283626 : MarkObjectSlots(trc, obj, 0, obj->slotSpan());
56 3394353 : }
|