Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 : * vim: set ts=8 sts=4 et sw=4 tw=99:
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 : #ifndef vm_jsarrayinlines_h
8 : #define vm_jsarrayinlines_h
9 :
10 : #include "jsarray.h"
11 :
12 : #include "jsobj.h"
13 :
14 : #include "vm/ArgumentsObject.h"
15 :
16 : #include "vm/ArgumentsObject-inl.h"
17 : #include "vm/UnboxedObject-inl.h"
18 :
19 : namespace js {
20 :
21 : inline bool
22 86 : GetElement(JSContext* cx, HandleObject obj, uint32_t index, MutableHandleValue vp)
23 : {
24 86 : if (index < GetAnyBoxedOrUnboxedInitializedLength(obj)) {
25 74 : vp.set(GetAnyBoxedOrUnboxedDenseElement(obj, index));
26 74 : if (!vp.isMagic(JS_ELEMENTS_HOLE))
27 74 : return true;
28 : }
29 :
30 12 : if (obj->is<ArgumentsObject>()) {
31 0 : if (obj->as<ArgumentsObject>().maybeGetElement(index, vp))
32 0 : return true;
33 : }
34 :
35 12 : return GetElement(cx, obj, obj, index, vp);
36 : }
37 :
38 : } // namespace js
39 :
40 : #endif // vm_jsarrayinlines_h
|