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

Side by Side Diff: src/elements.h

Issue 230603002: Revert "Further ElementsAccessor handlification (GetKeyForIndex(), GetCapacity(), GetType() and Get… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/elements.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 // 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 return AddElementsToFixedArray( 219 return AddElementsToFixedArray(
220 receiver, holder, to, handle(holder->elements())); 220 receiver, holder, to, handle(holder->elements()));
221 } 221 }
222 222
223 // Returns a shared ElementsAccessor for the specified ElementsKind. 223 // Returns a shared ElementsAccessor for the specified ElementsKind.
224 static ElementsAccessor* ForKind(ElementsKind elements_kind) { 224 static ElementsAccessor* ForKind(ElementsKind elements_kind) {
225 ASSERT(elements_kind < kElementsKindCount); 225 ASSERT(elements_kind < kElementsKindCount);
226 return elements_accessors_[elements_kind]; 226 return elements_accessors_[elements_kind];
227 } 227 }
228 228
229 static ElementsAccessor* ForArray(Handle<FixedArrayBase> array); 229 // TODO(ishell): Temporary wrapper until handlified.
230 inline static ElementsAccessor* ForArray(Handle<FixedArrayBase> array) {
231 return ForArray(*array);
232 }
233 static ElementsAccessor* ForArray(FixedArrayBase* array);
230 234
231 static void InitializeOncePerProcess(); 235 static void InitializeOncePerProcess();
232 static void TearDown(); 236 static void TearDown();
233 237
234 protected: 238 protected:
235 friend class SloppyArgumentsElementsAccessor; 239 friend class SloppyArgumentsElementsAccessor;
236 240
237 virtual uint32_t GetCapacity(Handle<FixedArrayBase> backing_store) = 0; 241 virtual uint32_t GetCapacity(FixedArrayBase* backing_store) = 0;
238 242
239 // Element handlers distinguish between indexes and keys when they manipulate 243 // Element handlers distinguish between indexes and keys when they manipulate
240 // elements. Indexes refer to elements in terms of their location in the 244 // elements. Indexes refer to elements in terms of their location in the
241 // underlying storage's backing store representation, and are between 0 and 245 // underlying storage's backing store representation, and are between 0 and
242 // GetCapacity. Keys refer to elements in terms of the value that would be 246 // GetCapacity. Keys refer to elements in terms of the value that would be
243 // specified in JavaScript to access the element. In most implementations, 247 // specified in JavaScript to access the element. In most implementations,
244 // keys are equivalent to indexes, and GetKeyForIndex returns the same value 248 // keys are equivalent to indexes, and GetKeyForIndex returns the same value
245 // it is passed. In the NumberDictionary ElementsAccessor, GetKeyForIndex maps 249 // it is passed. In the NumberDictionary ElementsAccessor, GetKeyForIndex maps
246 // the index to a key using the KeyAt method on the NumberDictionary. 250 // the index to a key using the KeyAt method on the NumberDictionary.
247 virtual uint32_t GetKeyForIndex(Handle<FixedArrayBase> backing_store, 251 virtual uint32_t GetKeyForIndex(Handle<FixedArrayBase> backing_store,
248 uint32_t index) = 0; 252 uint32_t index) = 0;
249 253
254 // TODO(ishell): Non-handlified versions, used only by accessors'
255 // implementations. To be removed once elements.cc is handlified.
256 MUST_USE_RESULT virtual PropertyAttributes GetAttributes(
257 Object* receiver,
258 JSObject* holder,
259 uint32_t key,
260 FixedArrayBase* backing_store) = 0;
261
262 MUST_USE_RESULT virtual PropertyType GetType(
263 Object* receiver,
264 JSObject* holder,
265 uint32_t key,
266 FixedArrayBase* backing_store) = 0;
267
250 private: 268 private:
251 static ElementsAccessor** elements_accessors_; 269 static ElementsAccessor** elements_accessors_;
252 const char* name_; 270 const char* name_;
253 271
254 DISALLOW_COPY_AND_ASSIGN(ElementsAccessor); 272 DISALLOW_COPY_AND_ASSIGN(ElementsAccessor);
255 }; 273 };
256 274
257 void CheckArrayAbuse(Handle<JSObject> obj, const char* op, uint32_t key, 275 void CheckArrayAbuse(Handle<JSObject> obj, const char* op, uint32_t key,
258 bool allow_appending = false); 276 bool allow_appending = false);
259 277
260 Handle<Object> ArrayConstructInitializeElements(Handle<JSArray> array, 278 Handle<Object> ArrayConstructInitializeElements(Handle<JSArray> array,
261 Arguments* args); 279 Arguments* args);
262 280
263 } } // namespace v8::internal 281 } } // namespace v8::internal
264 282
265 #endif // V8_ELEMENTS_H_ 283 #endif // V8_ELEMENTS_H_
OLDNEW
« no previous file with comments | « no previous file | src/elements.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698