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

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

Issue 676393002: Reland "Limit the number of transitions allowed per hidden class." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Make sure TransitionArray::Insert() is called only when it is allowed Created 6 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/objects.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 2503 matching lines...) Expand 10 before | Expand all | Expand 10 after
2514 TrimDescriptorArray(map, descriptors, number_of_own_descriptors); 2514 TrimDescriptorArray(map, descriptors, number_of_own_descriptors);
2515 DCHECK(descriptors->number_of_descriptors() == number_of_own_descriptors); 2515 DCHECK(descriptors->number_of_descriptors() == number_of_own_descriptors);
2516 map->set_owns_descriptors(true); 2516 map->set_owns_descriptors(true);
2517 } else { 2517 } else {
2518 DCHECK(descriptors == heap_->empty_descriptor_array()); 2518 DCHECK(descriptors == heap_->empty_descriptor_array());
2519 } 2519 }
2520 } 2520 }
2521 2521
2522 // Note that we never eliminate a transition array, though we might right-trim 2522 // Note that we never eliminate a transition array, though we might right-trim
2523 // such that number_of_transitions() == 0. If this assumption changes, 2523 // such that number_of_transitions() == 0. If this assumption changes,
2524 // TransitionArray::CopyInsert() will need to deal with the case that a 2524 // TransitionArray::Insert() will need to deal with the case that a transition
2525 // transition array disappeared during GC. 2525 // array disappeared during GC.
2526 int trim = t->number_of_transitions() - transition_index; 2526 int trim = t->number_of_transitions_storage() - transition_index;
2527 if (trim > 0) { 2527 if (trim > 0) {
2528 heap_->RightTrimFixedArray<Heap::FROM_GC>( 2528 heap_->RightTrimFixedArray<Heap::FROM_GC>(
2529 t, t->IsSimpleTransition() ? trim 2529 t, t->IsSimpleTransition() ? trim
2530 : trim * TransitionArray::kTransitionSize); 2530 : trim * TransitionArray::kTransitionSize);
2531 t->SetNumberOfTransitions(transition_index);
2531 } 2532 }
2532 DCHECK(map->HasTransitionArray()); 2533 DCHECK(map->HasTransitionArray());
2533 } 2534 }
2534 2535
2535 2536
2536 void MarkCompactCollector::TrimDescriptorArray(Map* map, 2537 void MarkCompactCollector::TrimDescriptorArray(Map* map,
2537 DescriptorArray* descriptors, 2538 DescriptorArray* descriptors,
2538 int number_of_own_descriptors) { 2539 int number_of_own_descriptors) {
2539 int number_of_descriptors = descriptors->number_of_descriptors_storage(); 2540 int number_of_descriptors = descriptors->number_of_descriptors_storage();
2540 int to_trim = number_of_descriptors - number_of_own_descriptors; 2541 int to_trim = number_of_descriptors - number_of_own_descriptors;
(...skipping 1910 matching lines...) Expand 10 before | Expand all | Expand 10 after
4451 SlotsBuffer* buffer = *buffer_address; 4452 SlotsBuffer* buffer = *buffer_address;
4452 while (buffer != NULL) { 4453 while (buffer != NULL) {
4453 SlotsBuffer* next_buffer = buffer->next(); 4454 SlotsBuffer* next_buffer = buffer->next();
4454 DeallocateBuffer(buffer); 4455 DeallocateBuffer(buffer);
4455 buffer = next_buffer; 4456 buffer = next_buffer;
4456 } 4457 }
4457 *buffer_address = NULL; 4458 *buffer_address = NULL;
4458 } 4459 }
4459 } 4460 }
4460 } // namespace v8::internal 4461 } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698