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

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

Issue 1033273005: Layout descriptor must be trimmed when corresponding descriptors array is trimmed to stay in sync. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Forgot to actually trim the array 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 | src/layout-descriptor.h » ('j') | src/layout-descriptor.cc » ('J')
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 2591 matching lines...) Expand 10 before | Expand all | Expand 10 after
2602 int number_of_descriptors = descriptors->number_of_descriptors_storage(); 2602 int number_of_descriptors = descriptors->number_of_descriptors_storage();
2603 int to_trim = number_of_descriptors - number_of_own_descriptors; 2603 int to_trim = number_of_descriptors - number_of_own_descriptors;
2604 if (to_trim == 0) return; 2604 if (to_trim == 0) return;
2605 2605
2606 heap_->RightTrimFixedArray<Heap::FROM_GC>( 2606 heap_->RightTrimFixedArray<Heap::FROM_GC>(
2607 descriptors, to_trim * DescriptorArray::kDescriptorSize); 2607 descriptors, to_trim * DescriptorArray::kDescriptorSize);
2608 descriptors->SetNumberOfDescriptors(number_of_own_descriptors); 2608 descriptors->SetNumberOfDescriptors(number_of_own_descriptors);
2609 2609
2610 if (descriptors->HasEnumCache()) TrimEnumCache(map, descriptors); 2610 if (descriptors->HasEnumCache()) TrimEnumCache(map, descriptors);
2611 descriptors->Sort(); 2611 descriptors->Sort();
2612
2613 if (FLAG_unbox_double_fields) {
2614 LayoutDescriptor* layout_descriptor = map->layout_descriptor();
2615 layout_descriptor = layout_descriptor->Trim(heap_, map, descriptors,
2616 number_of_own_descriptors);
2617 SLOW_DCHECK(layout_descriptor->IsConsistentWithMap(map, true));
2618 }
2612 } 2619 }
2613 2620
2614 2621
2615 void MarkCompactCollector::TrimEnumCache(Map* map, 2622 void MarkCompactCollector::TrimEnumCache(Map* map,
2616 DescriptorArray* descriptors) { 2623 DescriptorArray* descriptors) {
2617 int live_enum = map->EnumLength(); 2624 int live_enum = map->EnumLength();
2618 if (live_enum == kInvalidEnumCacheSentinel) { 2625 if (live_enum == kInvalidEnumCacheSentinel) {
2619 live_enum = map->NumberOfDescribedProperties(OWN_DESCRIPTORS, DONT_ENUM); 2626 live_enum = map->NumberOfDescribedProperties(OWN_DESCRIPTORS, DONT_ENUM);
2620 } 2627 }
2621 if (live_enum == 0) return descriptors->ClearEnumCache(); 2628 if (live_enum == 0) return descriptors->ClearEnumCache();
(...skipping 2139 matching lines...) Expand 10 before | Expand all | Expand 10 after
4761 SlotsBuffer* buffer = *buffer_address; 4768 SlotsBuffer* buffer = *buffer_address;
4762 while (buffer != NULL) { 4769 while (buffer != NULL) {
4763 SlotsBuffer* next_buffer = buffer->next(); 4770 SlotsBuffer* next_buffer = buffer->next();
4764 DeallocateBuffer(buffer); 4771 DeallocateBuffer(buffer);
4765 buffer = next_buffer; 4772 buffer = next_buffer;
4766 } 4773 }
4767 *buffer_address = NULL; 4774 *buffer_address = NULL;
4768 } 4775 }
4769 } 4776 }
4770 } // namespace v8::internal 4777 } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/layout-descriptor.h » ('j') | src/layout-descriptor.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698