OLD | NEW |
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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/base/platform/platform.h" | 8 #include "src/base/platform/platform.h" |
9 #include "src/full-codegen.h" | 9 #include "src/full-codegen.h" |
10 #include "src/heap/mark-compact.h" | 10 #include "src/heap/mark-compact.h" |
(...skipping 2884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2895 | 2895 |
2896 if (size_ > maximum_committed_) { | 2896 if (size_ > maximum_committed_) { |
2897 maximum_committed_ = size_; | 2897 maximum_committed_ = size_; |
2898 } | 2898 } |
2899 | 2899 |
2900 // Register all MemoryChunk::kAlignment-aligned chunks covered by | 2900 // Register all MemoryChunk::kAlignment-aligned chunks covered by |
2901 // this large page in the chunk map. | 2901 // this large page in the chunk map. |
2902 uintptr_t base = reinterpret_cast<uintptr_t>(page) / MemoryChunk::kAlignment; | 2902 uintptr_t base = reinterpret_cast<uintptr_t>(page) / MemoryChunk::kAlignment; |
2903 uintptr_t limit = base + (page->size() - 1) / MemoryChunk::kAlignment; | 2903 uintptr_t limit = base + (page->size() - 1) / MemoryChunk::kAlignment; |
2904 for (uintptr_t key = base; key <= limit; key++) { | 2904 for (uintptr_t key = base; key <= limit; key++) { |
2905 HashMap::Entry* entry = chunk_map_.Lookup(reinterpret_cast<void*>(key), | 2905 HashMap::Entry* entry = chunk_map_.LookupOrInsert( |
2906 static_cast<uint32_t>(key), true); | 2906 reinterpret_cast<void*>(key), static_cast<uint32_t>(key)); |
2907 DCHECK(entry != NULL); | 2907 DCHECK(entry != NULL); |
2908 entry->value = page; | 2908 entry->value = page; |
2909 } | 2909 } |
2910 | 2910 |
2911 HeapObject* object = page->GetObject(); | 2911 HeapObject* object = page->GetObject(); |
2912 | 2912 |
2913 MSAN_ALLOCATED_UNINITIALIZED_MEMORY(object->address(), object_size); | 2913 MSAN_ALLOCATED_UNINITIALIZED_MEMORY(object->address(), object_size); |
2914 | 2914 |
2915 if (Heap::ShouldZapGarbage()) { | 2915 if (Heap::ShouldZapGarbage()) { |
2916 // Make the object consistent so the heap can be verified in OldSpaceStep. | 2916 // Make the object consistent so the heap can be verified in OldSpaceStep. |
(...skipping 26 matching lines...) Expand all Loading... |
2943 if (page != NULL) { | 2943 if (page != NULL) { |
2944 return page->GetObject(); | 2944 return page->GetObject(); |
2945 } | 2945 } |
2946 return Smi::FromInt(0); // Signaling not found. | 2946 return Smi::FromInt(0); // Signaling not found. |
2947 } | 2947 } |
2948 | 2948 |
2949 | 2949 |
2950 LargePage* LargeObjectSpace::FindPage(Address a) { | 2950 LargePage* LargeObjectSpace::FindPage(Address a) { |
2951 uintptr_t key = reinterpret_cast<uintptr_t>(a) / MemoryChunk::kAlignment; | 2951 uintptr_t key = reinterpret_cast<uintptr_t>(a) / MemoryChunk::kAlignment; |
2952 HashMap::Entry* e = chunk_map_.Lookup(reinterpret_cast<void*>(key), | 2952 HashMap::Entry* e = chunk_map_.Lookup(reinterpret_cast<void*>(key), |
2953 static_cast<uint32_t>(key), false); | 2953 static_cast<uint32_t>(key)); |
2954 if (e != NULL) { | 2954 if (e != NULL) { |
2955 DCHECK(e->value != NULL); | 2955 DCHECK(e->value != NULL); |
2956 LargePage* page = reinterpret_cast<LargePage*>(e->value); | 2956 LargePage* page = reinterpret_cast<LargePage*>(e->value); |
2957 DCHECK(page->is_valid()); | 2957 DCHECK(page->is_valid()); |
2958 if (page->Contains(a)) { | 2958 if (page->Contains(a)) { |
2959 return page; | 2959 return page; |
2960 } | 2960 } |
2961 } | 2961 } |
2962 return NULL; | 2962 return NULL; |
2963 } | 2963 } |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3136 object->ShortPrint(); | 3136 object->ShortPrint(); |
3137 PrintF("\n"); | 3137 PrintF("\n"); |
3138 } | 3138 } |
3139 printf(" --------------------------------------\n"); | 3139 printf(" --------------------------------------\n"); |
3140 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3140 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
3141 } | 3141 } |
3142 | 3142 |
3143 #endif // DEBUG | 3143 #endif // DEBUG |
3144 } | 3144 } |
3145 } // namespace v8::internal | 3145 } // namespace v8::internal |
OLD | NEW |