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

Side by Side Diff: src/heap/spaces.cc

Issue 2728723004: [heap] Install a filler in newly allocated large objects to re-use ObjectMarking infrastructure. (Closed)
Patch Set: fix comment Created 3 years, 9 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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/heap/spaces.h" 5 #include "src/heap/spaces.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/base/platform/platform.h" 10 #include "src/base/platform/platform.h"
(...skipping 2996 matching lines...) Expand 10 before | Expand all | Expand 10 after
3007 // We only need to do this in debug builds or if verify_heap is on. 3007 // We only need to do this in debug builds or if verify_heap is on.
3008 reinterpret_cast<Object**>(object->address())[0] = 3008 reinterpret_cast<Object**>(object->address())[0] =
3009 heap()->fixed_array_map(); 3009 heap()->fixed_array_map();
3010 reinterpret_cast<Object**>(object->address())[1] = Smi::kZero; 3010 reinterpret_cast<Object**>(object->address())[1] = Smi::kZero;
3011 } 3011 }
3012 3012
3013 heap()->StartIncrementalMarkingIfAllocationLimitIsReached(Heap::kNoGCFlags, 3013 heap()->StartIncrementalMarkingIfAllocationLimitIsReached(Heap::kNoGCFlags,
3014 kNoGCCallbackFlags); 3014 kNoGCCallbackFlags);
3015 AllocationStep(object->address(), object_size); 3015 AllocationStep(object->address(), object_size);
3016 3016
3017 heap()->CreateFillerObjectAt(object->address(), object_size,
3018 ClearRecordedSlots::kNo);
3019
3017 if (heap()->incremental_marking()->black_allocation()) { 3020 if (heap()->incremental_marking()->black_allocation()) {
3018 // We cannot use ObjectMarking here as the object still lacks a size. 3021 ObjectMarking::WhiteToBlack(object);
3019 Marking::WhiteToBlack(ObjectMarking::MarkBitFrom(object));
3020 MemoryChunk::IncrementLiveBytes(object, object_size);
3021 } 3022 }
3022 return object; 3023 return object;
3023 } 3024 }
3024 3025
3025 3026
3026 size_t LargeObjectSpace::CommittedPhysicalMemory() { 3027 size_t LargeObjectSpace::CommittedPhysicalMemory() {
3027 // On a platform that provides lazy committing of memory, we over-account 3028 // On a platform that provides lazy committing of memory, we over-account
3028 // the actually committed memory. There is no easy way right now to support 3029 // the actually committed memory. There is no easy way right now to support
3029 // precise accounting of committed memory in large object space. 3030 // precise accounting of committed memory in large object space.
3030 return CommittedMemory(); 3031 return CommittedMemory();
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
3175 3176
3176 // The first word should be a map, and we expect all map pointers to be 3177 // The first word should be a map, and we expect all map pointers to be
3177 // in map space. 3178 // in map space.
3178 Map* map = object->map(); 3179 Map* map = object->map();
3179 CHECK(map->IsMap()); 3180 CHECK(map->IsMap());
3180 CHECK(heap()->map_space()->Contains(map)); 3181 CHECK(heap()->map_space()->Contains(map));
3181 3182
3182 // We have only code, sequential strings, external strings 3183 // We have only code, sequential strings, external strings
3183 // (sequential strings that have been morphed into external 3184 // (sequential strings that have been morphed into external
3184 // strings), thin strings (sequential strings that have been 3185 // strings), thin strings (sequential strings that have been
3185 // morphed into thin strings), fixed arrays, byte arrays, and 3186 // morphed into thin strings), fixed arrays, fixed double arrays,
3186 // constant pool arrays in the large object space. 3187 // byte arrays, and free space (right after allocation) in the
3188 // large object space.
3187 CHECK(object->IsAbstractCode() || object->IsSeqString() || 3189 CHECK(object->IsAbstractCode() || object->IsSeqString() ||
3188 object->IsExternalString() || object->IsThinString() || 3190 object->IsExternalString() || object->IsThinString() ||
3189 object->IsFixedArray() || object->IsFixedDoubleArray() || 3191 object->IsFixedArray() || object->IsFixedDoubleArray() ||
3190 object->IsByteArray()); 3192 object->IsByteArray() || object->IsFreeSpace());
3191 3193
3192 // The object itself should look OK. 3194 // The object itself should look OK.
3193 object->ObjectVerify(); 3195 object->ObjectVerify();
3194 3196
3195 // Byte arrays and strings don't have interior pointers. 3197 // Byte arrays and strings don't have interior pointers.
3196 if (object->IsAbstractCode()) { 3198 if (object->IsAbstractCode()) {
3197 VerifyPointersVisitor code_visitor; 3199 VerifyPointersVisitor code_visitor;
3198 object->IterateBody(map->instance_type(), object->Size(), &code_visitor); 3200 object->IterateBody(map->instance_type(), object->Size(), &code_visitor);
3199 } else if (object->IsFixedArray()) { 3201 } else if (object->IsFixedArray()) {
3200 FixedArray* array = FixedArray::cast(object); 3202 FixedArray* array = FixedArray::cast(object);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
3256 object->ShortPrint(); 3258 object->ShortPrint();
3257 PrintF("\n"); 3259 PrintF("\n");
3258 } 3260 }
3259 printf(" --------------------------------------\n"); 3261 printf(" --------------------------------------\n");
3260 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); 3262 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes());
3261 } 3263 }
3262 3264
3263 #endif // DEBUG 3265 #endif // DEBUG
3264 } // namespace internal 3266 } // namespace internal
3265 } // namespace v8 3267 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698