OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 26 matching lines...) Expand all Loading... |
37 // ElementsKinds. | 37 // ElementsKinds. |
38 class ElementsAccessor { | 38 class ElementsAccessor { |
39 public: | 39 public: |
40 ElementsAccessor() { } | 40 ElementsAccessor() { } |
41 virtual ~ElementsAccessor() { } | 41 virtual ~ElementsAccessor() { } |
42 virtual MaybeObject* Get(FixedArrayBase* backing_store, | 42 virtual MaybeObject* Get(FixedArrayBase* backing_store, |
43 uint32_t key, | 43 uint32_t key, |
44 JSObject* holder, | 44 JSObject* holder, |
45 Object* receiver) = 0; | 45 Object* receiver) = 0; |
46 | 46 |
47 // Modifies the length data property as specified for JSArrays and resizes | 47 // Modifies the length data property as specified for JSArrays and resizes the |
48 // the underlying backing store accordingly. | 48 // 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 |
| 50 // have non-deletable elements can only be shrunk to the size of highest |
| 51 // element that is non-deletable. |
49 virtual MaybeObject* SetLength(JSObject* holder, | 52 virtual MaybeObject* SetLength(JSObject* holder, |
50 Object* new_length) = 0; | 53 Object* new_length) = 0; |
51 | 54 |
| 55 // Modifies both the length and capacity of a JSArray, resizing the underlying |
| 56 // backing store as necessary. This method does NOT honor the semantics of |
| 57 // EcmaScript 5.1 15.4.5.2, arrays can be shrunk beyond non-deletable |
| 58 // elements. This method should only be called for array expansion OR by |
| 59 // runtime JavaScript code that use InternalArrays and don't care about |
| 60 // EcmaScript 5.1 semantics. |
| 61 virtual MaybeObject* SetCapacityAndLength(JSArray* array, |
| 62 int capacity, |
| 63 int length) = 0; |
| 64 |
52 virtual MaybeObject* Delete(JSObject* holder, | 65 virtual MaybeObject* Delete(JSObject* holder, |
53 uint32_t key, | 66 uint32_t key, |
54 JSReceiver::DeleteMode mode) = 0; | 67 JSReceiver::DeleteMode mode) = 0; |
55 | 68 |
56 virtual MaybeObject* AddElementsToFixedArray(FixedArrayBase* from, | 69 virtual MaybeObject* AddElementsToFixedArray(FixedArrayBase* from, |
57 FixedArray* to, | 70 FixedArray* to, |
58 JSObject* holder, | 71 JSObject* holder, |
59 Object* receiver) = 0; | 72 Object* receiver) = 0; |
60 | 73 |
61 // Returns a shared ElementsAccessor for the specified ElementsKind. | 74 // Returns a shared ElementsAccessor for the specified ElementsKind. |
(...skipping 29 matching lines...) Expand all Loading... |
91 | 104 |
92 private: | 105 private: |
93 static ElementsAccessor** elements_accessors_; | 106 static ElementsAccessor** elements_accessors_; |
94 | 107 |
95 DISALLOW_COPY_AND_ASSIGN(ElementsAccessor); | 108 DISALLOW_COPY_AND_ASSIGN(ElementsAccessor); |
96 }; | 109 }; |
97 | 110 |
98 } } // namespace v8::internal | 111 } } // namespace v8::internal |
99 | 112 |
100 #endif // V8_ELEMENTS_H_ | 113 #endif // V8_ELEMENTS_H_ |
OLD | NEW |