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

Side by Side Diff: src/elements.h

Issue 1397063002: [runtime] Fancify KeyAccumulator (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: documentation + cleanup Created 5 years, 2 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') | src/objects.cc » ('J')
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 ElementsKind from_kind) { 95 ElementsKind from_kind) {
96 CopyElements( 96 CopyElements(
97 *from_holder, 0, from_kind, to, 0, kCopyToEndAndInitializeToHole); 97 *from_holder, 0, from_kind, to, 0, kCopyToEndAndInitializeToHole);
98 } 98 }
99 99
100 virtual void GrowCapacityAndConvert(Handle<JSObject> object, 100 virtual void GrowCapacityAndConvert(Handle<JSObject> object,
101 uint32_t capacity) = 0; 101 uint32_t capacity) = 0;
102 102
103 virtual void AddElementsToKeyAccumulator(Handle<JSObject> receiver, 103 virtual void AddElementsToKeyAccumulator(Handle<JSObject> receiver,
104 KeyAccumulator* accumulator, 104 KeyAccumulator* accumulator,
105 KeyFilter filter) = 0; 105 AddKeyConversion convert) = 0;
106 106
107 // Returns a shared ElementsAccessor for the specified ElementsKind. 107 // Returns a shared ElementsAccessor for the specified ElementsKind.
108 static ElementsAccessor* ForKind(ElementsKind elements_kind) { 108 static ElementsAccessor* ForKind(ElementsKind elements_kind) {
109 DCHECK(static_cast<int>(elements_kind) < kElementsKindCount); 109 DCHECK(static_cast<int>(elements_kind) < kElementsKindCount);
110 return elements_accessors_[elements_kind]; 110 return elements_accessors_[elements_kind];
111 } 111 }
112 112
113 static ElementsAccessor* ForArray(Handle<FixedArrayBase> array); 113 static ElementsAccessor* ForArray(Handle<FixedArrayBase> array);
114 114
115 static void InitializeOncePerProcess(); 115 static void InitializeOncePerProcess();
(...skipping 30 matching lines...) Expand all
146 Handle<FixedArrayBase> backing_store, 146 Handle<FixedArrayBase> backing_store,
147 uint32_t start, uint32_t delete_count, 147 uint32_t start, uint32_t delete_count,
148 Arguments* args, uint32_t add_count) = 0; 148 Arguments* args, uint32_t add_count) = 0;
149 149
150 virtual Handle<Object> Pop(Handle<JSArray> receiver, 150 virtual Handle<Object> Pop(Handle<JSArray> receiver,
151 Handle<FixedArrayBase> backing_store) = 0; 151 Handle<FixedArrayBase> backing_store) = 0;
152 152
153 virtual Handle<Object> Shift(Handle<JSArray> receiver, 153 virtual Handle<Object> Shift(Handle<JSArray> receiver,
154 Handle<FixedArrayBase> backing_store) = 0; 154 Handle<FixedArrayBase> backing_store) = 0;
155 155
156 virtual uint32_t GetCapacity(JSObject* holder,
157 FixedArrayBase* backing_store) = 0;
158
156 protected: 159 protected:
157 friend class LookupIterator; 160 friend class LookupIterator;
158 161
159 static ElementsAccessor* ForArray(FixedArrayBase* array); 162 static ElementsAccessor* ForArray(FixedArrayBase* array);
160 163
161 virtual uint32_t GetCapacity(JSObject* holder,
162 FixedArrayBase* backing_store) = 0;
163 164
164 // Element handlers distinguish between entries and indices when they 165 // Element handlers distinguish between entries and indices when they
165 // manipulate elements. Entries refer to elements in terms of their location 166 // manipulate elements. Entries refer to elements in terms of their location
166 // in the underlying storage's backing store representation, and are between 0 167 // in the underlying storage's backing store representation, and are between 0
167 // and GetCapacity. Indices refer to elements in terms of the value that would 168 // and GetCapacity. Indices refer to elements in terms of the value that would
168 // be specified in JavaScript to access the element. In most implementations, 169 // be specified in JavaScript to access the element. In most implementations,
169 // indices are equivalent to entries. In the NumberDictionary 170 // indices are equivalent to entries. In the NumberDictionary
170 // ElementsAccessor, entries are mapped to an index using the KeyAt method on 171 // ElementsAccessor, entries are mapped to an index using the KeyAt method on
171 // the NumberDictionary. 172 // the NumberDictionary.
172 virtual uint32_t GetEntryForIndex(JSObject* holder, 173 virtual uint32_t GetEntryForIndex(JSObject* holder,
(...skipping 13 matching lines...) Expand all
186 bool allow_appending = false); 187 bool allow_appending = false);
187 188
188 MUST_USE_RESULT MaybeHandle<Object> ArrayConstructInitializeElements( 189 MUST_USE_RESULT MaybeHandle<Object> ArrayConstructInitializeElements(
189 Handle<JSArray> array, 190 Handle<JSArray> array,
190 Arguments* args); 191 Arguments* args);
191 192
192 } // namespace internal 193 } // namespace internal
193 } // namespace v8 194 } // namespace v8
194 195
195 #endif // V8_ELEMENTS_H_ 196 #endif // V8_ELEMENTS_H_
OLDNEW
« no previous file with comments | « no previous file | src/elements.cc » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698