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...) Expand all 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" | |
32 #include "objects.h" | 31 #include "objects.h" |
33 #include "heap.h" | 32 #include "heap.h" |
34 #include "isolate.h" | 33 #include "isolate.h" |
35 | 34 |
36 namespace v8 { | 35 namespace v8 { |
37 namespace internal { | 36 namespace internal { |
38 | 37 |
39 // Abstract base class for handles that can operate on objects with differing | 38 // Abstract base class for handles that can operate on objects with differing |
40 // ElementsKinds. | 39 // ElementsKinds. |
41 class ElementsAccessor { | 40 class ElementsAccessor { |
42 public: | 41 public: |
43 explicit ElementsAccessor(const char* name) : name_(name) { } | 42 explicit ElementsAccessor(const char* name) : name_(name) { } |
44 virtual ~ElementsAccessor() { } | 43 virtual ~ElementsAccessor() { } |
45 | 44 |
46 virtual ElementsKind kind() const = 0; | 45 virtual ElementsKind kind() const = 0; |
47 const char* name() const { return name_; } | 46 const char* name() const { return name_; } |
48 | 47 |
49 // Checks the elements of an object for consistency, asserting when a problem | |
50 // is found. | |
51 virtual void Validate(JSObject* obj) = 0; | |
52 | |
53 // Returns true if a holder contains an element with the specified key | 48 // Returns true if a holder contains an element with the specified key |
54 // without iterating up the prototype chain. The caller can optionally pass | 49 // without iterating up the prototype chain. The caller can optionally pass |
55 // in the backing store to use for the check, which must be compatible with | 50 // in the backing store to use for the check, which must be compatible with |
56 // the ElementsKind of the ElementsAccessor. If backing_store is NULL, the | 51 // the ElementsKind of the ElementsAccessor. If backing_store is NULL, the |
57 // holder->elements() is used as the backing store. | 52 // holder->elements() is used as the backing store. |
58 virtual bool HasElement(Object* receiver, | 53 virtual bool HasElement(Object* receiver, |
59 JSObject* holder, | 54 JSObject* holder, |
60 uint32_t key, | 55 uint32_t key, |
61 FixedArrayBase* backing_store = NULL) = 0; | 56 FixedArrayBase* backing_store = NULL) = 0; |
62 | 57 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 uint32_t from_start, | 165 uint32_t from_start, |
171 FixedArray* to_obj, | 166 FixedArray* to_obj, |
172 ElementsKind to_kind, | 167 ElementsKind to_kind, |
173 uint32_t to_start, | 168 uint32_t to_start, |
174 int copy_size); | 169 int copy_size); |
175 | 170 |
176 | 171 |
177 } } // namespace v8::internal | 172 } } // namespace v8::internal |
178 | 173 |
179 #endif // V8_ELEMENTS_H_ | 174 #endif // V8_ELEMENTS_H_ |
OLD | NEW |