OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_ELEMENTS_H_ | 5 #ifndef V8_ELEMENTS_H_ |
6 #define V8_ELEMENTS_H_ | 6 #define V8_ELEMENTS_H_ |
7 | 7 |
8 #include "src/elements-kind.h" | 8 #include "src/elements-kind.h" |
9 #include "src/heap/heap.h" | 9 #include "src/heap/heap.h" |
10 #include "src/isolate.h" | 10 #include "src/isolate.h" |
11 #include "src/objects.h" | 11 #include "src/objects.h" |
12 | 12 |
13 namespace v8 { | 13 namespace v8 { |
14 namespace internal { | 14 namespace internal { |
15 | 15 |
16 // Abstract base class for handles that can operate on objects with differing | 16 // Abstract base class for handles that can operate on objects with differing |
17 // ElementsKinds. | 17 // ElementsKinds. |
18 class ElementsAccessor { | 18 class ElementsAccessor { |
19 public: | 19 public: |
20 explicit ElementsAccessor(const char* name) : name_(name) { } | 20 explicit ElementsAccessor(const char* name) : name_(name) { } |
21 virtual ~ElementsAccessor() { } | 21 virtual ~ElementsAccessor() { } |
22 | 22 |
23 virtual ElementsKind kind() const = 0; | |
24 const char* name() const { return name_; } | 23 const char* name() const { return name_; } |
25 | 24 |
26 // Checks the elements of an object for consistency, asserting when a problem | 25 // Checks the elements of an object for consistency, asserting when a problem |
27 // is found. | 26 // is found. |
28 virtual void Validate(Handle<JSObject> obj) = 0; | 27 virtual void Validate(Handle<JSObject> obj) = 0; |
29 | 28 |
30 // Returns true if a holder contains an element with the specified key | 29 // Returns true if a holder contains an element with the specified key |
31 // without iterating up the prototype chain. The caller can optionally pass | 30 // without iterating up the prototype chain. The caller can optionally pass |
32 // in the backing store to use for the check, which must be compatible with | 31 // in the backing store to use for the check, which must be compatible with |
33 // the ElementsKind of the ElementsAccessor. If backing_store is NULL, the | 32 // the ElementsKind of the ElementsAccessor. If backing_store is NULL, the |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 void CheckArrayAbuse(Handle<JSObject> obj, const char* op, uint32_t key, | 177 void CheckArrayAbuse(Handle<JSObject> obj, const char* op, uint32_t key, |
179 bool allow_appending = false); | 178 bool allow_appending = false); |
180 | 179 |
181 MUST_USE_RESULT MaybeHandle<Object> ArrayConstructInitializeElements( | 180 MUST_USE_RESULT MaybeHandle<Object> ArrayConstructInitializeElements( |
182 Handle<JSArray> array, | 181 Handle<JSArray> array, |
183 Arguments* args); | 182 Arguments* args); |
184 | 183 |
185 } } // namespace v8::internal | 184 } } // namespace v8::internal |
186 | 185 |
187 #endif // V8_ELEMENTS_H_ | 186 #endif // V8_ELEMENTS_H_ |
OLD | NEW |