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

Side by Side Diff: src/elements.h

Issue 1302413006: Unify ElementsAccessor Array Builtins (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@2015-08-28_elements_accessor_unshift
Patch Set: Created 5 years, 3 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/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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 // If kCopyToEnd is specified as the copy_size to CopyElements, it copies all 59 // If kCopyToEnd is specified as the copy_size to CopyElements, it copies all
60 // of elements from source after source_start to the destination array. 60 // of elements from source after source_start to the destination array.
61 static const int kCopyToEnd = -1; 61 static const int kCopyToEnd = -1;
62 // If kCopyToEndAndInitializeToHole is specified as the copy_size to 62 // If kCopyToEndAndInitializeToHole is specified as the copy_size to
63 // CopyElements, it copies all of elements from source after source_start to 63 // CopyElements, it copies all of elements from source after source_start to
64 // destination array, padding any remaining uninitialized elements in the 64 // destination array, padding any remaining uninitialized elements in the
65 // destination array with the hole. 65 // destination array with the hole.
66 static const int kCopyToEndAndInitializeToHole = -2; 66 static const int kCopyToEndAndInitializeToHole = -2;
67 67
68 static const int kDirectionForward = 1;
69 static const int kDirectionReverse = -1;
70
71 // Copy elements from one backing store to another. Typically, callers specify 68 // Copy elements from one backing store to another. Typically, callers specify
72 // the source JSObject or JSArray in source_holder. If the holder's backing 69 // the source JSObject or JSArray in source_holder. If the holder's backing
73 // store is available, it can be passed in source and source_holder is 70 // store is available, it can be passed in source and source_holder is
74 // ignored. 71 // ignored.
75 virtual void CopyElements( 72 virtual void CopyElements(
76 Handle<FixedArrayBase> source, 73 Handle<FixedArrayBase> source,
77 uint32_t source_start, 74 uint32_t source_start,
78 ElementsKind source_kind, 75 ElementsKind source_kind,
79 Handle<FixedArrayBase> destination, 76 Handle<FixedArrayBase> destination,
80 uint32_t destination_start, 77 uint32_t destination_start,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 Handle<Object> value, 123 Handle<Object> value,
127 PropertyAttributes attributes) = 0; 124 PropertyAttributes attributes) = 0;
128 125
129 virtual void Add(Handle<JSObject> object, uint32_t index, 126 virtual void Add(Handle<JSObject> object, uint32_t index,
130 Handle<Object> value, PropertyAttributes attributes, 127 Handle<Object> value, PropertyAttributes attributes,
131 uint32_t new_capacity) = 0; 128 uint32_t new_capacity) = 0;
132 129
133 // TODO(cbruni): Consider passing Arguments* instead of Object** depending on 130 // TODO(cbruni): Consider passing Arguments* instead of Object** depending on
134 // the requirements of future callers. 131 // the requirements of future callers.
135 virtual uint32_t Push(Handle<JSArray> receiver, 132 virtual uint32_t Push(Handle<JSArray> receiver,
136 Handle<FixedArrayBase> backing_store, Object** objects, 133 Handle<FixedArrayBase> backing_store, Arguments* args,
137 uint32_t start, int direction) = 0; 134 uint32_t push_size) = 0;
138 135
139 virtual uint32_t Unshift(Handle<JSArray> receiver, 136 virtual uint32_t Unshift(Handle<JSArray> receiver,
140 Handle<FixedArrayBase> backing_store, 137 Handle<FixedArrayBase> backing_store,
141 Arguments* args, uint32_t unshift_size) = 0; 138 Arguments* args, uint32_t unshift_size) = 0;
142 139
143 virtual Handle<JSArray> Slice(Handle<JSObject> receiver, 140 virtual Handle<JSArray> Slice(Handle<JSObject> receiver,
144 Handle<FixedArrayBase> backing_store, 141 Handle<FixedArrayBase> backing_store,
145 uint32_t start, uint32_t end) = 0; 142 uint32_t start, uint32_t end) = 0;
146 143
147 virtual Handle<JSArray> Splice(Handle<JSArray> receiver, 144 virtual Handle<JSArray> Splice(Handle<JSArray> receiver,
148 Handle<FixedArrayBase> backing_store, 145 Handle<FixedArrayBase> backing_store,
149 uint32_t start, uint32_t delete_count, 146 uint32_t start, uint32_t delete_count,
150 Arguments args, uint32_t add_count) = 0; 147 Arguments* args, uint32_t add_count) = 0;
151 148
152 virtual Handle<Object> Pop(Handle<JSArray> receiver, 149 virtual Handle<Object> Pop(Handle<JSArray> receiver,
153 Handle<FixedArrayBase> backing_store) = 0; 150 Handle<FixedArrayBase> backing_store) = 0;
154 151
155 protected: 152 protected:
156 friend class LookupIterator; 153 friend class LookupIterator;
157 154
158 static ElementsAccessor* ForArray(FixedArrayBase* array); 155 static ElementsAccessor* ForArray(FixedArrayBase* array);
159 156
160 virtual uint32_t GetCapacity(JSObject* holder, 157 virtual uint32_t GetCapacity(JSObject* holder,
(...skipping 23 matching lines...) Expand all
184 void CheckArrayAbuse(Handle<JSObject> obj, const char* op, uint32_t index, 181 void CheckArrayAbuse(Handle<JSObject> obj, const char* op, uint32_t index,
185 bool allow_appending = false); 182 bool allow_appending = false);
186 183
187 MUST_USE_RESULT MaybeHandle<Object> ArrayConstructInitializeElements( 184 MUST_USE_RESULT MaybeHandle<Object> ArrayConstructInitializeElements(
188 Handle<JSArray> array, 185 Handle<JSArray> array,
189 Arguments* args); 186 Arguments* args);
190 187
191 } } // namespace v8::internal 188 } } // namespace v8::internal
192 189
193 #endif // V8_ELEMENTS_H_ 190 #endif // V8_ELEMENTS_H_
OLDNEW
« no previous file with comments | « src/builtins.cc ('k') | src/elements.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698