OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 10 matching lines...) Loading... |
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #ifndef V8_ELEMENTS_H_ | 28 #ifndef V8_ELEMENTS_H_ |
29 #define V8_ELEMENTS_H_ | 29 #define V8_ELEMENTS_H_ |
30 | 30 |
| 31 #include "elements-kind.h" |
31 #include "objects.h" | 32 #include "objects.h" |
32 #include "heap.h" | 33 #include "heap.h" |
33 #include "isolate.h" | 34 #include "isolate.h" |
34 | 35 |
35 namespace v8 { | 36 namespace v8 { |
36 namespace internal { | 37 namespace internal { |
37 | 38 |
38 // Abstract base class for handles that can operate on objects with differing | 39 // Abstract base class for handles that can operate on objects with differing |
39 // ElementsKinds. | 40 // ElementsKinds. |
40 class ElementsAccessor { | 41 class ElementsAccessor { |
41 public: | 42 public: |
42 explicit ElementsAccessor(const char* name) : name_(name) { } | 43 explicit ElementsAccessor(const char* name) : name_(name) { } |
43 virtual ~ElementsAccessor() { } | 44 virtual ~ElementsAccessor() { } |
44 | 45 |
45 virtual ElementsKind kind() const = 0; | 46 virtual ElementsKind kind() const = 0; |
46 const char* name() const { return name_; } | 47 const char* name() const { return name_; } |
47 | 48 |
| 49 // Checks the elements of an object for consistency, asserting when a problem |
| 50 // is found. |
| 51 virtual void Validate(JSObject* obj) = 0; |
| 52 |
48 // Returns true if a holder contains an element with the specified key | 53 // Returns true if a holder contains an element with the specified key |
49 // without iterating up the prototype chain. The caller can optionally pass | 54 // without iterating up the prototype chain. The caller can optionally pass |
50 // in the backing store to use for the check, which must be compatible with | 55 // in the backing store to use for the check, which must be compatible with |
51 // the ElementsKind of the ElementsAccessor. If backing_store is NULL, the | 56 // the ElementsKind of the ElementsAccessor. If backing_store is NULL, the |
52 // holder->elements() is used as the backing store. | 57 // holder->elements() is used as the backing store. |
53 virtual bool HasElement(Object* receiver, | 58 virtual bool HasElement(Object* receiver, |
54 JSObject* holder, | 59 JSObject* holder, |
55 uint32_t key, | 60 uint32_t key, |
56 FixedArrayBase* backing_store = NULL) = 0; | 61 FixedArrayBase* backing_store = NULL) = 0; |
57 | 62 |
(...skipping 107 matching lines...) Loading... |
165 uint32_t from_start, | 170 uint32_t from_start, |
166 FixedArray* to_obj, | 171 FixedArray* to_obj, |
167 ElementsKind to_kind, | 172 ElementsKind to_kind, |
168 uint32_t to_start, | 173 uint32_t to_start, |
169 int copy_size); | 174 int copy_size); |
170 | 175 |
171 | 176 |
172 } } // namespace v8::internal | 177 } } // namespace v8::internal |
173 | 178 |
174 #endif // V8_ELEMENTS_H_ | 179 #endif // V8_ELEMENTS_H_ |
OLD | NEW |