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

Side by Side Diff: src/objects.cc

Issue 1101993002: Fix adding to WeakFixedArray after compaction. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | test/cctest/test-heap.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 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 8292 matching lines...) Expand 10 before | Expand all | Expand 10 after
8303 8303
8304 void WeakFixedArray::Compact() { 8304 void WeakFixedArray::Compact() {
8305 FixedArray* array = FixedArray::cast(this); 8305 FixedArray* array = FixedArray::cast(this);
8306 int new_length = kFirstIndex; 8306 int new_length = kFirstIndex;
8307 for (int i = kFirstIndex; i < array->length(); i++) { 8307 for (int i = kFirstIndex; i < array->length(); i++) {
8308 Object* element = array->get(i); 8308 Object* element = array->get(i);
8309 if (element->IsSmi()) continue; 8309 if (element->IsSmi()) continue;
8310 if (WeakCell::cast(element)->cleared()) continue; 8310 if (WeakCell::cast(element)->cleared()) continue;
8311 array->set(new_length++, element); 8311 array->set(new_length++, element);
8312 } 8312 }
8313 if (new_length == kFirstIndex) new_length++;
8313 array->Shrink(new_length); 8314 array->Shrink(new_length);
8314 set_last_used_index(0); 8315 set_last_used_index(0);
8315 } 8316 }
8316 8317
8317 8318
8318 void WeakFixedArray::Remove(Handle<HeapObject> value) { 8319 void WeakFixedArray::Remove(Handle<HeapObject> value) {
8319 // Optimize for the most recently added element to be removed again. 8320 // Optimize for the most recently added element to be removed again.
8320 int first_index = last_used_index(); 8321 int first_index = last_used_index();
8321 for (int i = first_index;;) { 8322 for (int i = first_index;;) {
8322 if (Get(i) == *value) { 8323 if (Get(i) == *value) {
(...skipping 8798 matching lines...) Expand 10 before | Expand all | Expand 10 after
17121 void PropertyCell::SetValueWithInvalidation(Handle<PropertyCell> cell, 17122 void PropertyCell::SetValueWithInvalidation(Handle<PropertyCell> cell,
17122 Handle<Object> new_value) { 17123 Handle<Object> new_value) {
17123 if (cell->value() != *new_value) { 17124 if (cell->value() != *new_value) {
17124 cell->set_value(*new_value); 17125 cell->set_value(*new_value);
17125 Isolate* isolate = cell->GetIsolate(); 17126 Isolate* isolate = cell->GetIsolate();
17126 cell->dependent_code()->DeoptimizeDependentCodeGroup( 17127 cell->dependent_code()->DeoptimizeDependentCodeGroup(
17127 isolate, DependentCode::kPropertyCellChangedGroup); 17128 isolate, DependentCode::kPropertyCellChangedGroup);
17128 } 17129 }
17129 } 17130 }
17130 } } // namespace v8::internal 17131 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698