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

Side by Side Diff: src/elements.h

Issue 1221713003: Distinguish slow from fast sloppy arguments (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 | « src/contexts.h ('k') | src/elements.cc » ('j') | src/elements.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"
11 #include "src/objects.h" 11 #include "src/objects.h"
12 12
13 namespace v8 { 13 namespace v8 {
14 namespace internal { 14 namespace internal {
15 15
16 class FastHoleyObjectElementsAccessor;
17 class DictionaryElementsAccessor;
18 class FastSloppyArgumentsElementsAccessor;
19 class SlowSloppyArgumentsElementsAccessor;
20 template <ElementsKind Kind>
21 class ElementsKindTraits;
22 template <typename SloppyArgumentsElementsAccessorSubclass,
23 typename ArgumentsAccessor, typename KindTraits>
24 class SloppyArgumentsElementsAccessor;
Igor Sheludko 2015/07/02 13:28:42 These declarations should not be here.
Toon Verwaest 2015/07/02 13:49:02 Done.
25
16 // Abstract base class for handles that can operate on objects with differing 26 // Abstract base class for handles that can operate on objects with differing
17 // ElementsKinds. 27 // ElementsKinds.
18 class ElementsAccessor { 28 class ElementsAccessor {
19 public: 29 public:
20 explicit ElementsAccessor(const char* name) : name_(name) { } 30 explicit ElementsAccessor(const char* name) : name_(name) { }
21 virtual ~ElementsAccessor() { } 31 virtual ~ElementsAccessor() { }
22 32
23 const char* name() const { return name_; } 33 const char* name() const { return name_; }
24 34
25 // Checks the elements of an object for consistency, asserting when a problem 35 // Checks the elements of an object for consistency, asserting when a problem
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 Object* value) = 0; 152 Object* value) = 0;
143 virtual void Reconfigure(Handle<JSObject> object, 153 virtual void Reconfigure(Handle<JSObject> object,
144 Handle<FixedArrayBase> backing_store, uint32_t index, 154 Handle<FixedArrayBase> backing_store, uint32_t index,
145 Handle<Object> value, 155 Handle<Object> value,
146 PropertyAttributes attributes) = 0; 156 PropertyAttributes attributes) = 0;
147 virtual void Add(Handle<JSObject> object, uint32_t index, 157 virtual void Add(Handle<JSObject> object, uint32_t index,
148 Handle<Object> value, PropertyAttributes attributes, 158 Handle<Object> value, PropertyAttributes attributes,
149 uint32_t new_capacity) = 0; 159 uint32_t new_capacity) = 0;
150 160
151 protected: 161 protected:
152 friend class SloppyArgumentsElementsAccessor;
153 friend class LookupIterator; 162 friend class LookupIterator;
163 friend class SloppyArgumentsElementsAccessor<
164 FastSloppyArgumentsElementsAccessor, FastHoleyObjectElementsAccessor,
165 ElementsKindTraits<FAST_SLOPPY_ARGUMENTS_ELEMENTS> >;
166 friend class SloppyArgumentsElementsAccessor<
167 SlowSloppyArgumentsElementsAccessor, DictionaryElementsAccessor,
168 ElementsKindTraits<SLOW_SLOPPY_ARGUMENTS_ELEMENTS> >;
Igor Sheludko 2015/07/02 13:28:42 These friend declarations should not be here. You
Toon Verwaest 2015/07/02 13:49:02 Done.
154 169
155 static ElementsAccessor* ForArray(FixedArrayBase* array); 170 static ElementsAccessor* ForArray(FixedArrayBase* array);
156 171
157 virtual uint32_t GetCapacity(JSObject* holder, 172 virtual uint32_t GetCapacity(JSObject* holder,
158 FixedArrayBase* backing_store) = 0; 173 FixedArrayBase* backing_store) = 0;
159 174
160 // Element handlers distinguish between indexes and keys when they manipulate 175 // Element handlers distinguish between indexes and keys when they manipulate
161 // elements. Indexes refer to elements in terms of their location in the 176 // elements. Indexes refer to elements in terms of their location in the
162 // underlying storage's backing store representation, and are between 0 and 177 // underlying storage's backing store representation, and are between 0 and
163 // GetCapacity. Keys refer to elements in terms of the value that would be 178 // GetCapacity. Keys refer to elements in terms of the value that would be
(...skipping 20 matching lines...) Expand all
184 void CheckArrayAbuse(Handle<JSObject> obj, const char* op, uint32_t key, 199 void CheckArrayAbuse(Handle<JSObject> obj, const char* op, uint32_t key,
185 bool allow_appending = false); 200 bool allow_appending = false);
186 201
187 MUST_USE_RESULT MaybeHandle<Object> ArrayConstructInitializeElements( 202 MUST_USE_RESULT MaybeHandle<Object> ArrayConstructInitializeElements(
188 Handle<JSArray> array, 203 Handle<JSArray> array,
189 Arguments* args); 204 Arguments* args);
190 205
191 } } // namespace v8::internal 206 } } // namespace v8::internal
192 207
193 #endif // V8_ELEMENTS_H_ 208 #endif // V8_ELEMENTS_H_
OLDNEW
« no previous file with comments | « src/contexts.h ('k') | src/elements.cc » ('j') | src/elements.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698