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

Side by Side Diff: src/objects.cc

Issue 1211833002: Back off normalizing on set length in sync with adding a property (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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/objects.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 <iomanip> 5 #include <iomanip>
6 #include <sstream> 6 #include <sstream>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/accessors.h" 10 #include "src/accessors.h"
(...skipping 11768 matching lines...) Expand 10 before | Expand all | Expand 10 after
11779 : JSReceiver::GetDataProperty(&it); 11779 : JSReceiver::GetDataProperty(&it);
11780 old_values->Add(value); 11780 old_values->Add(value);
11781 indices->Add(index); 11781 indices->Add(index);
11782 return true; 11782 return true;
11783 } 11783 }
11784 11784
11785 11785
11786 void JSArray::SetLength(Handle<JSArray> array, uint32_t new_length) { 11786 void JSArray::SetLength(Handle<JSArray> array, uint32_t new_length) {
11787 // We should never end in here with a pixel or external array. 11787 // We should never end in here with a pixel or external array.
11788 DCHECK(array->AllowsSetLength()); 11788 DCHECK(array->AllowsSetLength());
11789 if (JSArray::SetLengthWouldNormalize(array->GetHeap(), new_length)) { 11789 if (array->SetLengthWouldNormalize(new_length)) {
11790 JSObject::NormalizeElements(array); 11790 JSObject::NormalizeElements(array);
11791 } 11791 }
11792 array->GetElementsAccessor()->SetLength(array, new_length); 11792 array->GetElementsAccessor()->SetLength(array, new_length);
11793 } 11793 }
11794 11794
11795 11795
11796 MaybeHandle<Object> JSArray::ObservableSetLength(Handle<JSArray> array, 11796 MaybeHandle<Object> JSArray::ObservableSetLength(Handle<JSArray> array,
11797 uint32_t new_length) { 11797 uint32_t new_length) {
11798 if (!array->map()->is_observed()) { 11798 if (!array->map()->is_observed()) {
11799 SetLength(array, new_length); 11799 SetLength(array, new_length);
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
12512 RETURN_ON_EXCEPTION( 12512 RETURN_ON_EXCEPTION(
12513 isolate, EnqueueChangeRecord(object, "add", name, 12513 isolate, EnqueueChangeRecord(object, "add", name,
12514 isolate->factory()->the_hole_value()), 12514 isolate->factory()->the_hole_value()),
12515 Object); 12515 Object);
12516 } 12516 }
12517 12517
12518 return value; 12518 return value;
12519 } 12519 }
12520 12520
12521 12521
12522 bool JSArray::SetLengthWouldNormalize(uint32_t new_length) {
12523 if (!HasFastElements()) return false;
12524 uint32_t capacity = static_cast<uint32_t>(elements()->length());
12525 uint32_t new_capacity;
12526 return JSArray::SetLengthWouldNormalize(GetHeap(), new_length) &&
12527 ShouldConvertToSlowElements(this, capacity, new_length - 1,
12528 &new_capacity);
12529 }
12530
12531
12522 const double AllocationSite::kPretenureRatio = 0.85; 12532 const double AllocationSite::kPretenureRatio = 0.85;
12523 12533
12524 12534
12525 void AllocationSite::ResetPretenureDecision() { 12535 void AllocationSite::ResetPretenureDecision() {
12526 set_pretenure_decision(kUndecided); 12536 set_pretenure_decision(kUndecided);
12527 set_memento_found_count(0); 12537 set_memento_found_count(0);
12528 set_memento_create_count(0); 12538 set_memento_create_count(0);
12529 } 12539 }
12530 12540
12531 12541
(...skipping 3577 matching lines...) Expand 10 before | Expand all | Expand 10 after
16109 Handle<Object> new_value) { 16119 Handle<Object> new_value) {
16110 if (cell->value() != *new_value) { 16120 if (cell->value() != *new_value) {
16111 cell->set_value(*new_value); 16121 cell->set_value(*new_value);
16112 Isolate* isolate = cell->GetIsolate(); 16122 Isolate* isolate = cell->GetIsolate();
16113 cell->dependent_code()->DeoptimizeDependentCodeGroup( 16123 cell->dependent_code()->DeoptimizeDependentCodeGroup(
16114 isolate, DependentCode::kPropertyCellChangedGroup); 16124 isolate, DependentCode::kPropertyCellChangedGroup);
16115 } 16125 }
16116 } 16126 }
16117 } // namespace internal 16127 } // namespace internal
16118 } // namespace v8 16128 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698