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

Side by Side Diff: src/elements.h

Issue 1230213002: Use entry rather than index in ElementsAccessor::Get (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 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 | « 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 // 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 20 matching lines...) Expand all
31 // in the backing store to use for the check, which must be compatible with 31 // in the backing store to use for the check, which must be compatible with
32 // the ElementsKind of the ElementsAccessor. If backing_store is NULL, the 32 // the ElementsKind of the ElementsAccessor. If backing_store is NULL, the
33 // holder->elements() is used as the backing store. 33 // holder->elements() is used as the backing store.
34 virtual bool HasElement(Handle<JSObject> holder, uint32_t index, 34 virtual bool HasElement(Handle<JSObject> holder, uint32_t index,
35 Handle<FixedArrayBase> backing_store) = 0; 35 Handle<FixedArrayBase> backing_store) = 0;
36 36
37 inline bool HasElement(Handle<JSObject> holder, uint32_t index) { 37 inline bool HasElement(Handle<JSObject> holder, uint32_t index) {
38 return HasElement(holder, index, handle(holder->elements())); 38 return HasElement(holder, index, handle(holder->elements()));
39 } 39 }
40 40
41 // Returns the element with the specified index or undefined if there is no 41 virtual Handle<Object> Get(Handle<FixedArrayBase> backing_store,
42 // such element. This method doesn't iterate up the prototype chain. The 42 uint32_t entry) = 0;
43 // caller can optionally pass in the backing store to use for the check, which
44 // must be compatible with the ElementsKind of the ElementsAccessor. If
45 // backing_store is NULL, the holder->elements() is used as the backing store.
46 virtual Handle<Object> Get(Handle<JSObject> holder, uint32_t index,
47 Handle<FixedArrayBase> backing_store) = 0;
48
49 inline Handle<Object> Get(Handle<JSObject> holder, uint32_t index) {
50 return Get(holder, index, handle(holder->elements()));
51 }
52 43
53 // Modifies the length data property as specified for JSArrays and resizes the 44 // Modifies the length data property as specified for JSArrays and resizes the
54 // underlying backing store accordingly. The method honors the semantics of 45 // underlying backing store accordingly. The method honors the semantics of
55 // changing array sizes as defined in EcmaScript 5.1 15.4.5.2, i.e. array that 46 // changing array sizes as defined in EcmaScript 5.1 15.4.5.2, i.e. array that
56 // have non-deletable elements can only be shrunk to the size of highest 47 // have non-deletable elements can only be shrunk to the size of highest
57 // element that is non-deletable. 48 // element that is non-deletable.
58 virtual void SetLength(Handle<JSArray> holder, uint32_t new_length) = 0; 49 virtual void SetLength(Handle<JSArray> holder, uint32_t new_length) = 0;
59 50
60 // Deletes an element in an object. 51 // Deletes an element in an object.
61 virtual void Delete(Handle<JSObject> holder, uint32_t entry) = 0; 52 virtual void Delete(Handle<JSObject> holder, uint32_t entry) = 0;
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 void CheckArrayAbuse(Handle<JSObject> obj, const char* op, uint32_t index, 152 void CheckArrayAbuse(Handle<JSObject> obj, const char* op, uint32_t index,
162 bool allow_appending = false); 153 bool allow_appending = false);
163 154
164 MUST_USE_RESULT MaybeHandle<Object> ArrayConstructInitializeElements( 155 MUST_USE_RESULT MaybeHandle<Object> ArrayConstructInitializeElements(
165 Handle<JSArray> array, 156 Handle<JSArray> array,
166 Arguments* args); 157 Arguments* args);
167 158
168 } } // namespace v8::internal 159 } } // namespace v8::internal
169 160
170 #endif // V8_ELEMENTS_H_ 161 #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