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

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

Issue 2224253003: [runtime] %GrowArrayElements doesn't have a native context in TurboFan. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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 | test/mjsunit/regress/regress-crbug-635798.js » ('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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 CONVERT_NUMBER_CHECKED(int, key, Int32, args[1]); 367 CONVERT_NUMBER_CHECKED(int, key, Int32, args[1]);
368 368
369 if (key < 0) { 369 if (key < 0) {
370 return object->elements(); 370 return object->elements();
371 } 371 }
372 372
373 uint32_t capacity = static_cast<uint32_t>(object->elements()->length()); 373 uint32_t capacity = static_cast<uint32_t>(object->elements()->length());
374 uint32_t index = static_cast<uint32_t>(key); 374 uint32_t index = static_cast<uint32_t>(key);
375 375
376 if (index >= capacity) { 376 if (index >= capacity) {
377 if (object->WouldConvertToSlowElements(index)) { 377 if (object->map()->is_prototype_map() ||
378 object->WouldConvertToSlowElements(index)) {
378 // We don't want to allow operations that cause lazy deopt. Return a Smi 379 // We don't want to allow operations that cause lazy deopt. Return a Smi
379 // as a signal that optimized code should eagerly deoptimize. 380 // as a signal that optimized code should eagerly deoptimize.
380 return Smi::FromInt(0); 381 return Smi::FromInt(0);
381 } 382 }
382 383
383 uint32_t new_capacity = JSObject::NewElementsCapacity(index + 1); 384 uint32_t new_capacity = JSObject::NewElementsCapacity(index + 1);
384 object->GetElementsAccessor()->GrowCapacityAndConvert(object, new_capacity); 385 object->GetElementsAccessor()->GrowCapacityAndConvert(object, new_capacity);
385 } 386 }
386 387
387 // On success, return the fixed array elements. 388 // On success, return the fixed array elements.
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 // If SameValueZero(searchElement, elementK) is true, return true. 539 // If SameValueZero(searchElement, elementK) is true, return true.
539 if (search_element->SameValueZero(*element_k)) { 540 if (search_element->SameValueZero(*element_k)) {
540 return isolate->heap()->true_value(); 541 return isolate->heap()->true_value();
541 } 542 }
542 } 543 }
543 return isolate->heap()->false_value(); 544 return isolate->heap()->false_value();
544 } 545 }
545 546
546 } // namespace internal 547 } // namespace internal
547 } // namespace v8 548 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-635798.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698