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

Side by Side Diff: src/heap/mark-compact.cc

Issue 1163073002: Replace ad-hoc weakness in prototype transitions with WeakCell. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix crash 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 | « no previous file | src/heap/objects-visiting-inl.h » ('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 // 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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/base/atomicops.h" 7 #include "src/base/atomicops.h"
8 #include "src/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/compilation-cache.h" 10 #include "src/compilation-cache.h"
(...skipping 2355 matching lines...) Expand 10 before | Expand all | Expand 10 after
2366 2366
2367 void MarkCompactCollector::ClearNonLivePrototypeTransitions(Map* map) { 2367 void MarkCompactCollector::ClearNonLivePrototypeTransitions(Map* map) {
2368 FixedArray* prototype_transitions = 2368 FixedArray* prototype_transitions =
2369 TransitionArray::GetPrototypeTransitions(map); 2369 TransitionArray::GetPrototypeTransitions(map);
2370 int number_of_transitions = 2370 int number_of_transitions =
2371 TransitionArray::NumberOfPrototypeTransitions(prototype_transitions); 2371 TransitionArray::NumberOfPrototypeTransitions(prototype_transitions);
2372 2372
2373 const int header = TransitionArray::kProtoTransitionHeaderSize; 2373 const int header = TransitionArray::kProtoTransitionHeaderSize;
2374 int new_number_of_transitions = 0; 2374 int new_number_of_transitions = 0;
2375 for (int i = 0; i < number_of_transitions; i++) { 2375 for (int i = 0; i < number_of_transitions; i++) {
2376 Object* cached_map = prototype_transitions->get(header + i); 2376 Object* cell = prototype_transitions->get(header + i);
2377 if (IsMarked(cached_map)) { 2377 if (!WeakCell::cast(cell)->cleared()) {
2378 if (new_number_of_transitions != i) { 2378 if (new_number_of_transitions != i) {
2379 prototype_transitions->set(header + new_number_of_transitions, 2379 prototype_transitions->set(header + new_number_of_transitions, cell);
2380 cached_map, SKIP_WRITE_BARRIER);
2381 } 2380 }
2382 new_number_of_transitions++; 2381 new_number_of_transitions++;
2383 } 2382 }
2384 } 2383 }
2385 2384
2386 if (new_number_of_transitions != number_of_transitions) { 2385 if (new_number_of_transitions != number_of_transitions) {
2387 TransitionArray::SetNumberOfPrototypeTransitions(prototype_transitions, 2386 TransitionArray::SetNumberOfPrototypeTransitions(prototype_transitions,
2388 new_number_of_transitions); 2387 new_number_of_transitions);
2389 } 2388 }
2390 2389
(...skipping 2283 matching lines...) Expand 10 before | Expand all | Expand 10 after
4674 SlotsBuffer* buffer = *buffer_address; 4673 SlotsBuffer* buffer = *buffer_address;
4675 while (buffer != NULL) { 4674 while (buffer != NULL) {
4676 SlotsBuffer* next_buffer = buffer->next(); 4675 SlotsBuffer* next_buffer = buffer->next();
4677 DeallocateBuffer(buffer); 4676 DeallocateBuffer(buffer);
4678 buffer = next_buffer; 4677 buffer = next_buffer;
4679 } 4678 }
4680 *buffer_address = NULL; 4679 *buffer_address = NULL;
4681 } 4680 }
4682 } // namespace internal 4681 } // namespace internal
4683 } // namespace v8 4682 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/heap/objects-visiting-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698