OLD | NEW |
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 Loading... |
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::Insert() will need to deal with the case that a transition | 2524 // TransitionArray::CopyInsert() will need to deal with the case that a |
2525 // array disappeared during GC. | 2525 // transition array disappeared during GC. |
2526 int trim = t->number_of_transitions_storage() - transition_index; | 2526 int trim = t->number_of_transitions() - 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); | |
2532 } | 2531 } |
2533 DCHECK(map->HasTransitionArray()); | 2532 DCHECK(map->HasTransitionArray()); |
2534 } | 2533 } |
2535 | 2534 |
2536 | 2535 |
2537 void MarkCompactCollector::TrimDescriptorArray(Map* map, | 2536 void MarkCompactCollector::TrimDescriptorArray(Map* map, |
2538 DescriptorArray* descriptors, | 2537 DescriptorArray* descriptors, |
2539 int number_of_own_descriptors) { | 2538 int number_of_own_descriptors) { |
2540 int number_of_descriptors = descriptors->number_of_descriptors_storage(); | 2539 int number_of_descriptors = descriptors->number_of_descriptors_storage(); |
2541 int to_trim = number_of_descriptors - number_of_own_descriptors; | 2540 int to_trim = number_of_descriptors - number_of_own_descriptors; |
(...skipping 1910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4452 SlotsBuffer* buffer = *buffer_address; | 4451 SlotsBuffer* buffer = *buffer_address; |
4453 while (buffer != NULL) { | 4452 while (buffer != NULL) { |
4454 SlotsBuffer* next_buffer = buffer->next(); | 4453 SlotsBuffer* next_buffer = buffer->next(); |
4455 DeallocateBuffer(buffer); | 4454 DeallocateBuffer(buffer); |
4456 buffer = next_buffer; | 4455 buffer = next_buffer; |
4457 } | 4456 } |
4458 *buffer_address = NULL; | 4457 *buffer_address = NULL; |
4459 } | 4458 } |
4460 } | 4459 } |
4461 } // namespace v8::internal | 4460 } // namespace v8::internal |
OLD | NEW |