Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: src/elements.h

Issue 1198343004: Merge AddFastElement and AddFastDoubleElement (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/builtins.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 static ElementsAccessor* ForKind(ElementsKind elements_kind) { 131 static ElementsAccessor* ForKind(ElementsKind elements_kind) {
132 DCHECK(static_cast<int>(elements_kind) < kElementsKindCount); 132 DCHECK(static_cast<int>(elements_kind) < kElementsKindCount);
133 return elements_accessors_[elements_kind]; 133 return elements_accessors_[elements_kind];
134 } 134 }
135 135
136 static ElementsAccessor* ForArray(Handle<FixedArrayBase> array); 136 static ElementsAccessor* ForArray(Handle<FixedArrayBase> array);
137 137
138 static void InitializeOncePerProcess(); 138 static void InitializeOncePerProcess();
139 static void TearDown(); 139 static void TearDown();
140 140
141 virtual void Set(FixedArrayBase* backing_store, uint32_t key,
142 Object* value) = 0;
143
141 protected: 144 protected:
142 friend class SloppyArgumentsElementsAccessor; 145 friend class SloppyArgumentsElementsAccessor;
143 friend class LookupIterator; 146 friend class LookupIterator;
144 147
145 static ElementsAccessor* ForArray(FixedArrayBase* array); 148 static ElementsAccessor* ForArray(FixedArrayBase* array);
146 149
147 virtual uint32_t GetCapacity(JSObject* holder, 150 virtual uint32_t GetCapacity(JSObject* holder,
148 FixedArrayBase* backing_store) = 0; 151 FixedArrayBase* backing_store) = 0;
149 152
150 // Element handlers distinguish between indexes and keys when they manipulate 153 // Element handlers distinguish between indexes and keys when they manipulate
151 // elements. Indexes refer to elements in terms of their location in the 154 // elements. Indexes refer to elements in terms of their location in the
152 // underlying storage's backing store representation, and are between 0 and 155 // underlying storage's backing store representation, and are between 0 and
153 // GetCapacity. Keys refer to elements in terms of the value that would be 156 // GetCapacity. Keys refer to elements in terms of the value that would be
154 // specified in JavaScript to access the element. In most implementations, 157 // specified in JavaScript to access the element. In most implementations,
155 // keys are equivalent to indexes, and GetKeyForIndex returns the same value 158 // keys are equivalent to indexes, and GetKeyForIndex returns the same value
156 // it is passed. In the NumberDictionary ElementsAccessor, GetKeyForIndex maps 159 // it is passed. In the NumberDictionary ElementsAccessor, GetKeyForIndex maps
157 // the index to a key using the KeyAt method on the NumberDictionary. 160 // the index to a key using the KeyAt method on the NumberDictionary.
158 virtual uint32_t GetKeyForIndex(FixedArrayBase* backing_store, 161 virtual uint32_t GetKeyForIndex(FixedArrayBase* backing_store,
159 uint32_t index) = 0; 162 uint32_t index) = 0;
160 virtual uint32_t GetIndexForKey(JSObject* holder, 163 virtual uint32_t GetIndexForKey(JSObject* holder,
161 FixedArrayBase* backing_store, 164 FixedArrayBase* backing_store,
162 uint32_t key) = 0; 165 uint32_t key) = 0;
163 virtual PropertyDetails GetDetails(FixedArrayBase* backing_store, 166 virtual PropertyDetails GetDetails(FixedArrayBase* backing_store,
164 uint32_t index) = 0; 167 uint32_t index) = 0;
165 virtual bool HasIndex(FixedArrayBase* backing_store, uint32_t key) = 0; 168 virtual bool HasIndex(FixedArrayBase* backing_store, uint32_t key) = 0;
166 169
167 virtual void Set(FixedArrayBase* backing_store, uint32_t key,
168 Object* value) = 0;
169
170 private: 170 private:
171 static ElementsAccessor** elements_accessors_; 171 static ElementsAccessor** elements_accessors_;
172 const char* name_; 172 const char* name_;
173 173
174 DISALLOW_COPY_AND_ASSIGN(ElementsAccessor); 174 DISALLOW_COPY_AND_ASSIGN(ElementsAccessor);
175 }; 175 };
176 176
177 void CheckArrayAbuse(Handle<JSObject> obj, const char* op, uint32_t key, 177 void CheckArrayAbuse(Handle<JSObject> obj, const char* op, uint32_t key,
178 bool allow_appending = false); 178 bool allow_appending = false);
179 179
180 MUST_USE_RESULT MaybeHandle<Object> ArrayConstructInitializeElements( 180 MUST_USE_RESULT MaybeHandle<Object> ArrayConstructInitializeElements(
181 Handle<JSArray> array, 181 Handle<JSArray> array,
182 Arguments* args); 182 Arguments* args);
183 183
184 } } // namespace v8::internal 184 } } // namespace v8::internal
185 185
186 #endif // V8_ELEMENTS_H_ 186 #endif // V8_ELEMENTS_H_
OLDNEW
« no previous file with comments | « src/builtins.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698