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 19 matching lines...) Expand all Loading... | |
30 | 30 |
31 #include "objects.h" | 31 #include "objects.h" |
32 | 32 |
33 namespace v8 { | 33 namespace v8 { |
34 namespace internal { | 34 namespace internal { |
35 | 35 |
36 // Abstract base class for handles that can operate on objects with differing | 36 // Abstract base class for handles that can operate on objects with differing |
37 // ElementsKinds. | 37 // ElementsKinds. |
38 class ElementsAccessor { | 38 class ElementsAccessor { |
39 public: | 39 public: |
40 ElementsAccessor() { } | 40 ElementsAccessor(const char* name) : name_(name) { } |
Jakob Kummerow
2012/03/06 10:07:42
explicit
| |
41 virtual ~ElementsAccessor() { } | 41 virtual ~ElementsAccessor() { } |
42 | |
43 virtual const char* name() const { return name_; } | |
44 | |
42 virtual MaybeObject* Get(FixedArrayBase* backing_store, | 45 virtual MaybeObject* Get(FixedArrayBase* backing_store, |
43 uint32_t key, | 46 uint32_t key, |
44 JSObject* holder, | 47 JSObject* holder, |
45 Object* receiver) = 0; | 48 Object* receiver) = 0; |
46 | 49 |
47 // Modifies the length data property as specified for JSArrays and resizes the | 50 // Modifies the length data property as specified for JSArrays and resizes the |
48 // underlying backing store accordingly. The method honors the semantics of | 51 // underlying backing store accordingly. The method honors the semantics of |
49 // changing array sizes as defined in EcmaScript 5.1 15.4.5.2, i.e. array that | 52 // changing array sizes as defined in EcmaScript 5.1 15.4.5.2, i.e. array that |
50 // have non-deletable elements can only be shrunk to the size of highest | 53 // have non-deletable elements can only be shrunk to the size of highest |
51 // element that is non-deletable. | 54 // element that is non-deletable. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
97 // GetCapacity. Keys refer to elements in terms of the value that would be | 100 // GetCapacity. Keys refer to elements in terms of the value that would be |
98 // specified in JavaScript to access the element. In most implementations, | 101 // specified in JavaScript to access the element. In most implementations, |
99 // keys are equivalent to indexes, and GetKeyForIndex returns the same value | 102 // keys are equivalent to indexes, and GetKeyForIndex returns the same value |
100 // it is passed. In the NumberDictionary ElementsAccessor, GetKeyForIndex maps | 103 // it is passed. In the NumberDictionary ElementsAccessor, GetKeyForIndex maps |
101 // the index to a key using the KeyAt method on the NumberDictionary. | 104 // the index to a key using the KeyAt method on the NumberDictionary. |
102 virtual uint32_t GetKeyForIndex(FixedArrayBase* backing_store, | 105 virtual uint32_t GetKeyForIndex(FixedArrayBase* backing_store, |
103 uint32_t index) = 0; | 106 uint32_t index) = 0; |
104 | 107 |
105 private: | 108 private: |
106 static ElementsAccessor** elements_accessors_; | 109 static ElementsAccessor** elements_accessors_; |
110 const char* name_; | |
107 | 111 |
108 DISALLOW_COPY_AND_ASSIGN(ElementsAccessor); | 112 DISALLOW_COPY_AND_ASSIGN(ElementsAccessor); |
109 }; | 113 }; |
110 | 114 |
111 } } // namespace v8::internal | 115 } } // namespace v8::internal |
112 | 116 |
113 #endif // V8_ELEMENTS_H_ | 117 #endif // V8_ELEMENTS_H_ |
OLD | NEW |