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

Side by Side Diff: src/runtime/runtime-array.cc

Issue 2036493006: Keep prototype maps in dictionary mode until ICs see them (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: make ignition tests happy Created 4 years, 6 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/prototype.h ('k') | src/runtime/runtime-debug.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 #include "src/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/conversions-inl.h" 9 #include "src/conversions-inl.h"
10 #include "src/elements.h" 10 #include "src/elements.h"
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 if (!array->elements()->IsDictionary()) { 196 if (!array->elements()->IsDictionary()) {
197 CHECK(array->HasFastSmiOrObjectElements() || 197 CHECK(array->HasFastSmiOrObjectElements() ||
198 array->HasFastDoubleElements()); 198 array->HasFastDoubleElements());
199 uint32_t actual_length = static_cast<uint32_t>(array->elements()->length()); 199 uint32_t actual_length = static_cast<uint32_t>(array->elements()->length());
200 return *isolate->factory()->NewNumberFromUint(Min(actual_length, length)); 200 return *isolate->factory()->NewNumberFromUint(Min(actual_length, length));
201 } 201 }
202 202
203 KeyAccumulator accumulator(isolate, KeyCollectionMode::kOwnOnly, 203 KeyAccumulator accumulator(isolate, KeyCollectionMode::kOwnOnly,
204 ALL_PROPERTIES); 204 ALL_PROPERTIES);
205 // No need to separate prototype levels since we only get element keys. 205 // No need to separate prototype levels since we only get element keys.
206 for (PrototypeIterator iter(isolate, array, 206 for (PrototypeIterator iter(isolate, array, kStartAtReceiver);
207 PrototypeIterator::START_AT_RECEIVER);
208 !iter.IsAtEnd(); iter.Advance()) { 207 !iter.IsAtEnd(); iter.Advance()) {
209 if (PrototypeIterator::GetCurrent(iter)->IsJSProxy() || 208 if (PrototypeIterator::GetCurrent(iter)->IsJSProxy() ||
210 PrototypeIterator::GetCurrent<JSObject>(iter) 209 PrototypeIterator::GetCurrent<JSObject>(iter)
211 ->HasIndexedInterceptor()) { 210 ->HasIndexedInterceptor()) {
212 // Bail out if we find a proxy or interceptor, likely not worth 211 // Bail out if we find a proxy or interceptor, likely not worth
213 // collecting keys in that case. 212 // collecting keys in that case.
214 return *isolate->factory()->NewNumberFromUint(length); 213 return *isolate->factory()->NewNumberFromUint(length);
215 } 214 }
216 Handle<JSObject> current = PrototypeIterator::GetCurrent<JSObject>(iter); 215 Handle<JSObject> current = PrototypeIterator::GetCurrent<JSObject>(iter);
217 accumulator.CollectOwnElementIndices(array, current); 216 accumulator.CollectOwnElementIndices(array, current);
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 443
445 // On success, return the fixed array elements. 444 // On success, return the fixed array elements.
446 return object->elements(); 445 return object->elements();
447 } 446 }
448 447
449 448
450 RUNTIME_FUNCTION(Runtime_HasComplexElements) { 449 RUNTIME_FUNCTION(Runtime_HasComplexElements) {
451 HandleScope scope(isolate); 450 HandleScope scope(isolate);
452 DCHECK(args.length() == 1); 451 DCHECK(args.length() == 1);
453 CONVERT_ARG_HANDLE_CHECKED(JSObject, array, 0); 452 CONVERT_ARG_HANDLE_CHECKED(JSObject, array, 0);
454 for (PrototypeIterator iter(isolate, array, 453 for (PrototypeIterator iter(isolate, array, kStartAtReceiver);
455 PrototypeIterator::START_AT_RECEIVER);
456 !iter.IsAtEnd(); iter.Advance()) { 454 !iter.IsAtEnd(); iter.Advance()) {
457 if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) { 455 if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) {
458 return isolate->heap()->true_value(); 456 return isolate->heap()->true_value();
459 } 457 }
460 Handle<JSObject> current = PrototypeIterator::GetCurrent<JSObject>(iter); 458 Handle<JSObject> current = PrototypeIterator::GetCurrent<JSObject>(iter);
461 if (current->HasIndexedInterceptor()) { 459 if (current->HasIndexedInterceptor()) {
462 return isolate->heap()->true_value(); 460 return isolate->heap()->true_value();
463 } 461 }
464 if (!current->HasDictionaryElements()) continue; 462 if (!current->HasDictionaryElements()) continue;
465 if (current->element_dictionary()->HasComplexElements()) { 463 if (current->element_dictionary()->HasComplexElements()) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 RUNTIME_FUNCTION(Runtime_ArraySpeciesConstructor) { 502 RUNTIME_FUNCTION(Runtime_ArraySpeciesConstructor) {
505 HandleScope scope(isolate); 503 HandleScope scope(isolate);
506 DCHECK(args.length() == 1); 504 DCHECK(args.length() == 1);
507 CONVERT_ARG_HANDLE_CHECKED(Object, original_array, 0); 505 CONVERT_ARG_HANDLE_CHECKED(Object, original_array, 0);
508 RETURN_RESULT_OR_FAILURE( 506 RETURN_RESULT_OR_FAILURE(
509 isolate, Object::ArraySpeciesConstructor(isolate, original_array)); 507 isolate, Object::ArraySpeciesConstructor(isolate, original_array));
510 } 508 }
511 509
512 } // namespace internal 510 } // namespace internal
513 } // namespace v8 511 } // namespace v8
OLDNEW
« no previous file with comments | « src/prototype.h ('k') | src/runtime/runtime-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698