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

Side by Side Diff: src/elements.h

Issue 223413002: Partial recover from performance degradation after handlification of ElementsAccessor::CopyElements… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressing review comments 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 | « 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 // 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 62
63 // Returns the element with the specified key or undefined if there is no such 63 // Returns the element with the specified key or undefined if there is no such
64 // element. This method doesn't iterate up the prototype chain. The caller 64 // element. This method doesn't iterate up the prototype chain. The caller
65 // can optionally pass in the backing store to use for the check, which must 65 // can optionally pass in the backing store to use for the check, which must
66 // be compatible with the ElementsKind of the ElementsAccessor. If 66 // be compatible with the ElementsKind of the ElementsAccessor. If
67 // backing_store is NULL, the holder->elements() is used as the backing store. 67 // backing_store is NULL, the holder->elements() is used as the backing store.
68 MUST_USE_RESULT virtual Handle<Object> Get( 68 MUST_USE_RESULT virtual Handle<Object> Get(
69 Handle<Object> receiver, 69 Handle<Object> receiver,
70 Handle<JSObject> holder, 70 Handle<JSObject> holder,
71 uint32_t key, 71 uint32_t key,
72 Handle<FixedArrayBase> backing_store = 72 Handle<FixedArrayBase> backing_store) = 0;
73 Handle<FixedArrayBase>::null()) = 0; 73
74 MUST_USE_RESULT virtual Handle<Object> Get(
75 Handle<Object> receiver,
76 Handle<JSObject> holder,
77 uint32_t key) = 0;
74 78
75 MUST_USE_RESULT virtual MaybeObject* Get( 79 MUST_USE_RESULT virtual MaybeObject* Get(
76 Object* receiver, 80 Object* receiver,
77 JSObject* holder, 81 JSObject* holder,
78 uint32_t key, 82 uint32_t key,
79 FixedArrayBase* backing_store = NULL) = 0; 83 FixedArrayBase* backing_store = NULL) = 0;
80 84
81 // Returns an element's attributes, or ABSENT if there is no such 85 // Returns an element's attributes, or ABSENT if there is no such
82 // element. This method doesn't iterate up the prototype chain. The caller 86 // element. This method doesn't iterate up the prototype chain. The caller
83 // can optionally pass in the backing store to use for the check, which must 87 // can optionally pass in the backing store to use for the check, which must
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 // CopyElements, it copies all of elements from source after source_start to 148 // CopyElements, it copies all of elements from source after source_start to
145 // destination array, padding any remaining uninitialized elements in the 149 // destination array, padding any remaining uninitialized elements in the
146 // destination array with the hole. 150 // destination array with the hole.
147 static const int kCopyToEndAndInitializeToHole = -2; 151 static const int kCopyToEndAndInitializeToHole = -2;
148 152
149 // Copy elements from one backing store to another. Typically, callers specify 153 // Copy elements from one backing store to another. Typically, callers specify
150 // the source JSObject or JSArray in source_holder. If the holder's backing 154 // the source JSObject or JSArray in source_holder. If the holder's backing
151 // store is available, it can be passed in source and source_holder is 155 // store is available, it can be passed in source and source_holder is
152 // ignored. 156 // ignored.
153 virtual void CopyElements( 157 virtual void CopyElements(
154 Handle<JSObject> source_holder, 158 Handle<FixedArrayBase> source,
155 uint32_t source_start, 159 uint32_t source_start,
156 ElementsKind source_kind, 160 ElementsKind source_kind,
157 Handle<FixedArrayBase> destination, 161 Handle<FixedArrayBase> destination,
158 uint32_t destination_start, 162 uint32_t destination_start,
159 int copy_size, 163 int copy_size) = 0;
160 Handle<FixedArrayBase> source = Handle<FixedArrayBase>::null()) = 0;
161 164
162 void CopyElements( 165 // TODO(ishell): Keeping |source_holder| parameter in a non-handlified form
166 // helps avoiding ArrayConcat() builtin performance degradation.
167 // Revisit this later.
168 virtual void CopyElements(
169 JSObject* source_holder,
170 uint32_t source_start,
171 ElementsKind source_kind,
172 Handle<FixedArrayBase> destination,
173 uint32_t destination_start,
174 int copy_size) = 0;
175
176 inline void CopyElements(
163 Handle<JSObject> from_holder, 177 Handle<JSObject> from_holder,
164 Handle<FixedArrayBase> to, 178 Handle<FixedArrayBase> to,
165 ElementsKind from_kind, 179 ElementsKind from_kind) {
166 Handle<FixedArrayBase> from = Handle<FixedArrayBase>::null()) { 180 CopyElements(
167 CopyElements(from_holder, 0, from_kind, to, 0, 181 *from_holder, 0, from_kind, to, 0, kCopyToEndAndInitializeToHole);
168 kCopyToEndAndInitializeToHole, from);
169 } 182 }
170 183
171 MUST_USE_RESULT virtual MaybeObject* AddElementsToFixedArray( 184 MUST_USE_RESULT virtual MaybeObject* AddElementsToFixedArray(
172 Object* receiver, 185 Object* receiver,
173 JSObject* holder, 186 JSObject* holder,
174 FixedArray* to, 187 FixedArray* to,
175 FixedArrayBase* from = NULL) = 0; 188 FixedArrayBase* from = NULL) = 0;
176 189
177 // Returns a shared ElementsAccessor for the specified ElementsKind. 190 // Returns a shared ElementsAccessor for the specified ElementsKind.
178 static ElementsAccessor* ForKind(ElementsKind elements_kind) { 191 static ElementsAccessor* ForKind(ElementsKind elements_kind) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 223
211 void CheckArrayAbuse(JSObject* obj, const char* op, uint32_t key, 224 void CheckArrayAbuse(JSObject* obj, const char* op, uint32_t key,
212 bool allow_appending = false); 225 bool allow_appending = false);
213 226
214 Handle<Object> ArrayConstructInitializeElements(Handle<JSArray> array, 227 Handle<Object> ArrayConstructInitializeElements(Handle<JSArray> array,
215 Arguments* args); 228 Arguments* args);
216 229
217 } } // namespace v8::internal 230 } } // namespace v8::internal
218 231
219 #endif // V8_ELEMENTS_H_ 232 #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