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/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // generation can be aligned to its size. | 77 // generation can be aligned to its size. |
78 maximum_committed_(0), | 78 maximum_committed_(0), |
79 survived_since_last_expansion_(0), | 79 survived_since_last_expansion_(0), |
80 survived_last_scavenge_(0), | 80 survived_last_scavenge_(0), |
81 sweep_generation_(0), | 81 sweep_generation_(0), |
82 always_allocate_scope_depth_(0), | 82 always_allocate_scope_depth_(0), |
83 contexts_disposed_(0), | 83 contexts_disposed_(0), |
84 global_ic_age_(0), | 84 global_ic_age_(0), |
85 scan_on_scavenge_pages_(0), | 85 scan_on_scavenge_pages_(0), |
86 new_space_(this), | 86 new_space_(this), |
87 old_pointer_space_(NULL), | 87 old_space_(NULL), |
88 old_data_space_(NULL), | |
89 code_space_(NULL), | 88 code_space_(NULL), |
90 map_space_(NULL), | 89 map_space_(NULL), |
91 cell_space_(NULL), | 90 cell_space_(NULL), |
92 lo_space_(NULL), | 91 lo_space_(NULL), |
93 gc_state_(NOT_IN_GC), | 92 gc_state_(NOT_IN_GC), |
94 gc_post_processing_depth_(0), | 93 gc_post_processing_depth_(0), |
95 allocations_count_(0), | 94 allocations_count_(0), |
96 raw_allocations_hash_(0), | 95 raw_allocations_hash_(0), |
97 dump_allocations_hash_countdown_(FLAG_dump_allocations_digest_at_alloc), | 96 dump_allocations_hash_countdown_(FLAG_dump_allocations_digest_at_alloc), |
98 ms_count_(0), | 97 ms_count_(0), |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 // minidump even if there are no real unmapped pages. | 164 // minidump even if there are no real unmapped pages. |
166 RememberUnmappedPage(NULL, false); | 165 RememberUnmappedPage(NULL, false); |
167 | 166 |
168 ClearObjectStats(true); | 167 ClearObjectStats(true); |
169 } | 168 } |
170 | 169 |
171 | 170 |
172 intptr_t Heap::Capacity() { | 171 intptr_t Heap::Capacity() { |
173 if (!HasBeenSetUp()) return 0; | 172 if (!HasBeenSetUp()) return 0; |
174 | 173 |
175 return new_space_.Capacity() + old_pointer_space_->Capacity() + | 174 return new_space_.Capacity() + old_space_->Capacity() + |
176 old_data_space_->Capacity() + code_space_->Capacity() + | 175 code_space_->Capacity() + map_space_->Capacity() + |
177 map_space_->Capacity() + cell_space_->Capacity(); | 176 cell_space_->Capacity(); |
178 } | 177 } |
179 | 178 |
180 | 179 |
181 intptr_t Heap::CommittedOldGenerationMemory() { | 180 intptr_t Heap::CommittedOldGenerationMemory() { |
182 if (!HasBeenSetUp()) return 0; | 181 if (!HasBeenSetUp()) return 0; |
183 | 182 |
184 return old_pointer_space_->CommittedMemory() + | 183 return old_space_->CommittedMemory() + code_space_->CommittedMemory() + |
185 old_data_space_->CommittedMemory() + code_space_->CommittedMemory() + | |
186 map_space_->CommittedMemory() + cell_space_->CommittedMemory() + | 184 map_space_->CommittedMemory() + cell_space_->CommittedMemory() + |
187 lo_space_->Size(); | 185 lo_space_->Size(); |
188 } | 186 } |
189 | 187 |
190 | 188 |
191 intptr_t Heap::CommittedMemory() { | 189 intptr_t Heap::CommittedMemory() { |
192 if (!HasBeenSetUp()) return 0; | 190 if (!HasBeenSetUp()) return 0; |
193 | 191 |
194 return new_space_.CommittedMemory() + CommittedOldGenerationMemory(); | 192 return new_space_.CommittedMemory() + CommittedOldGenerationMemory(); |
195 } | 193 } |
196 | 194 |
197 | 195 |
198 size_t Heap::CommittedPhysicalMemory() { | 196 size_t Heap::CommittedPhysicalMemory() { |
199 if (!HasBeenSetUp()) return 0; | 197 if (!HasBeenSetUp()) return 0; |
200 | 198 |
201 return new_space_.CommittedPhysicalMemory() + | 199 return new_space_.CommittedPhysicalMemory() + |
202 old_pointer_space_->CommittedPhysicalMemory() + | 200 old_space_->CommittedPhysicalMemory() + |
203 old_data_space_->CommittedPhysicalMemory() + | |
204 code_space_->CommittedPhysicalMemory() + | 201 code_space_->CommittedPhysicalMemory() + |
205 map_space_->CommittedPhysicalMemory() + | 202 map_space_->CommittedPhysicalMemory() + |
206 cell_space_->CommittedPhysicalMemory() + | 203 cell_space_->CommittedPhysicalMemory() + |
207 lo_space_->CommittedPhysicalMemory(); | 204 lo_space_->CommittedPhysicalMemory(); |
208 } | 205 } |
209 | 206 |
210 | 207 |
211 intptr_t Heap::CommittedMemoryExecutable() { | 208 intptr_t Heap::CommittedMemoryExecutable() { |
212 if (!HasBeenSetUp()) return 0; | 209 if (!HasBeenSetUp()) return 0; |
213 | 210 |
214 return isolate()->memory_allocator()->SizeExecutable(); | 211 return isolate()->memory_allocator()->SizeExecutable(); |
215 } | 212 } |
216 | 213 |
217 | 214 |
218 void Heap::UpdateMaximumCommitted() { | 215 void Heap::UpdateMaximumCommitted() { |
219 if (!HasBeenSetUp()) return; | 216 if (!HasBeenSetUp()) return; |
220 | 217 |
221 intptr_t current_committed_memory = CommittedMemory(); | 218 intptr_t current_committed_memory = CommittedMemory(); |
222 if (current_committed_memory > maximum_committed_) { | 219 if (current_committed_memory > maximum_committed_) { |
223 maximum_committed_ = current_committed_memory; | 220 maximum_committed_ = current_committed_memory; |
224 } | 221 } |
225 } | 222 } |
226 | 223 |
227 | 224 |
228 intptr_t Heap::Available() { | 225 intptr_t Heap::Available() { |
229 if (!HasBeenSetUp()) return 0; | 226 if (!HasBeenSetUp()) return 0; |
230 | 227 |
231 return new_space_.Available() + old_pointer_space_->Available() + | 228 return new_space_.Available() + old_space_->Available() + |
232 old_data_space_->Available() + code_space_->Available() + | 229 code_space_->Available() + map_space_->Available() + |
233 map_space_->Available() + cell_space_->Available(); | 230 cell_space_->Available(); |
234 } | 231 } |
235 | 232 |
236 | 233 |
237 bool Heap::HasBeenSetUp() { | 234 bool Heap::HasBeenSetUp() { |
238 return old_pointer_space_ != NULL && old_data_space_ != NULL && | 235 return old_space_ != NULL && code_space_ != NULL && map_space_ != NULL && |
239 code_space_ != NULL && map_space_ != NULL && cell_space_ != NULL && | 236 cell_space_ != NULL && lo_space_ != NULL; |
240 lo_space_ != NULL; | |
241 } | 237 } |
242 | 238 |
243 | 239 |
244 int Heap::GcSafeSizeOfOldObject(HeapObject* object) { | 240 int Heap::GcSafeSizeOfOldObject(HeapObject* object) { |
245 if (IntrusiveMarking::IsMarked(object)) { | 241 if (IntrusiveMarking::IsMarked(object)) { |
246 return IntrusiveMarking::SizeOfMarkedObject(object); | 242 return IntrusiveMarking::SizeOfMarkedObject(object); |
247 } | 243 } |
248 return object->SizeFromMap(object->map()); | 244 return object->SizeFromMap(object->map()); |
249 } | 245 } |
250 | 246 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 ", available: %6" V8_PTR_PREFIX "d KB\n", | 329 ", available: %6" V8_PTR_PREFIX "d KB\n", |
334 isolate_->memory_allocator()->Size() / KB, | 330 isolate_->memory_allocator()->Size() / KB, |
335 isolate_->memory_allocator()->Available() / KB); | 331 isolate_->memory_allocator()->Available() / KB); |
336 PrintPID("New space, used: %6" V8_PTR_PREFIX | 332 PrintPID("New space, used: %6" V8_PTR_PREFIX |
337 "d KB" | 333 "d KB" |
338 ", available: %6" V8_PTR_PREFIX | 334 ", available: %6" V8_PTR_PREFIX |
339 "d KB" | 335 "d KB" |
340 ", committed: %6" V8_PTR_PREFIX "d KB\n", | 336 ", committed: %6" V8_PTR_PREFIX "d KB\n", |
341 new_space_.Size() / KB, new_space_.Available() / KB, | 337 new_space_.Size() / KB, new_space_.Available() / KB, |
342 new_space_.CommittedMemory() / KB); | 338 new_space_.CommittedMemory() / KB); |
343 PrintPID("Old pointers, used: %6" V8_PTR_PREFIX | 339 PrintPID("Old space, used: %6" V8_PTR_PREFIX |
344 "d KB" | 340 "d KB" |
345 ", available: %6" V8_PTR_PREFIX | 341 ", available: %6" V8_PTR_PREFIX |
346 "d KB" | 342 "d KB" |
347 ", committed: %6" V8_PTR_PREFIX "d KB\n", | 343 ", committed: %6" V8_PTR_PREFIX "d KB\n", |
348 old_pointer_space_->SizeOfObjects() / KB, | 344 old_space_->SizeOfObjects() / KB, old_space_->Available() / KB, |
349 old_pointer_space_->Available() / KB, | 345 old_space_->CommittedMemory() / KB); |
350 old_pointer_space_->CommittedMemory() / KB); | |
351 PrintPID("Old data space, used: %6" V8_PTR_PREFIX | |
352 "d KB" | |
353 ", available: %6" V8_PTR_PREFIX | |
354 "d KB" | |
355 ", committed: %6" V8_PTR_PREFIX "d KB\n", | |
356 old_data_space_->SizeOfObjects() / KB, | |
357 old_data_space_->Available() / KB, | |
358 old_data_space_->CommittedMemory() / KB); | |
359 PrintPID("Code space, used: %6" V8_PTR_PREFIX | 346 PrintPID("Code space, used: %6" V8_PTR_PREFIX |
360 "d KB" | 347 "d KB" |
361 ", available: %6" V8_PTR_PREFIX | 348 ", available: %6" V8_PTR_PREFIX |
362 "d KB" | 349 "d KB" |
363 ", committed: %6" V8_PTR_PREFIX "d KB\n", | 350 ", committed: %6" V8_PTR_PREFIX "d KB\n", |
364 code_space_->SizeOfObjects() / KB, code_space_->Available() / KB, | 351 code_space_->SizeOfObjects() / KB, code_space_->Available() / KB, |
365 code_space_->CommittedMemory() / KB); | 352 code_space_->CommittedMemory() / KB); |
366 PrintPID("Map space, used: %6" V8_PTR_PREFIX | 353 PrintPID("Map space, used: %6" V8_PTR_PREFIX |
367 "d KB" | 354 "d KB" |
368 ", available: %6" V8_PTR_PREFIX | 355 ", available: %6" V8_PTR_PREFIX |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 (crankshaft_codegen_bytes_generated_ + | 632 (crankshaft_codegen_bytes_generated_ + |
646 full_codegen_bytes_generated_))); | 633 full_codegen_bytes_generated_))); |
647 } | 634 } |
648 | 635 |
649 if (CommittedMemory() > 0) { | 636 if (CommittedMemory() > 0) { |
650 isolate_->counters()->external_fragmentation_total()->AddSample( | 637 isolate_->counters()->external_fragmentation_total()->AddSample( |
651 static_cast<int>(100 - (SizeOfObjects() * 100.0) / CommittedMemory())); | 638 static_cast<int>(100 - (SizeOfObjects() * 100.0) / CommittedMemory())); |
652 | 639 |
653 isolate_->counters()->heap_fraction_new_space()->AddSample(static_cast<int>( | 640 isolate_->counters()->heap_fraction_new_space()->AddSample(static_cast<int>( |
654 (new_space()->CommittedMemory() * 100.0) / CommittedMemory())); | 641 (new_space()->CommittedMemory() * 100.0) / CommittedMemory())); |
655 isolate_->counters()->heap_fraction_old_pointer_space()->AddSample( | 642 isolate_->counters()->heap_fraction_old_space()->AddSample(static_cast<int>( |
656 static_cast<int>((old_pointer_space()->CommittedMemory() * 100.0) / | 643 (old_space()->CommittedMemory() * 100.0) / CommittedMemory())); |
657 CommittedMemory())); | |
658 isolate_->counters()->heap_fraction_old_data_space()->AddSample( | |
659 static_cast<int>((old_data_space()->CommittedMemory() * 100.0) / | |
660 CommittedMemory())); | |
661 isolate_->counters()->heap_fraction_code_space()->AddSample( | 644 isolate_->counters()->heap_fraction_code_space()->AddSample( |
662 static_cast<int>((code_space()->CommittedMemory() * 100.0) / | 645 static_cast<int>((code_space()->CommittedMemory() * 100.0) / |
663 CommittedMemory())); | 646 CommittedMemory())); |
664 isolate_->counters()->heap_fraction_map_space()->AddSample(static_cast<int>( | 647 isolate_->counters()->heap_fraction_map_space()->AddSample(static_cast<int>( |
665 (map_space()->CommittedMemory() * 100.0) / CommittedMemory())); | 648 (map_space()->CommittedMemory() * 100.0) / CommittedMemory())); |
666 isolate_->counters()->heap_fraction_cell_space()->AddSample( | 649 isolate_->counters()->heap_fraction_cell_space()->AddSample( |
667 static_cast<int>((cell_space()->CommittedMemory() * 100.0) / | 650 static_cast<int>((cell_space()->CommittedMemory() * 100.0) / |
668 CommittedMemory())); | 651 CommittedMemory())); |
669 isolate_->counters()->heap_fraction_lo_space()->AddSample(static_cast<int>( | 652 isolate_->counters()->heap_fraction_lo_space()->AddSample(static_cast<int>( |
670 (lo_space()->CommittedMemory() * 100.0) / CommittedMemory())); | 653 (lo_space()->CommittedMemory() * 100.0) / CommittedMemory())); |
(...skipping 25 matching lines...) Expand all Loading... |
696 isolate_->counters()->external_fragmentation_##space()->AddSample( \ | 679 isolate_->counters()->external_fragmentation_##space()->AddSample( \ |
697 static_cast<int>(100 - \ | 680 static_cast<int>(100 - \ |
698 (space()->SizeOfObjects() * 100.0) / \ | 681 (space()->SizeOfObjects() * 100.0) / \ |
699 space()->CommittedMemory())); \ | 682 space()->CommittedMemory())); \ |
700 } | 683 } |
701 #define UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE(space) \ | 684 #define UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE(space) \ |
702 UPDATE_COUNTERS_FOR_SPACE(space) \ | 685 UPDATE_COUNTERS_FOR_SPACE(space) \ |
703 UPDATE_FRAGMENTATION_FOR_SPACE(space) | 686 UPDATE_FRAGMENTATION_FOR_SPACE(space) |
704 | 687 |
705 UPDATE_COUNTERS_FOR_SPACE(new_space) | 688 UPDATE_COUNTERS_FOR_SPACE(new_space) |
706 UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE(old_pointer_space) | 689 UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE(old_space) |
707 UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE(old_data_space) | |
708 UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE(code_space) | 690 UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE(code_space) |
709 UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE(map_space) | 691 UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE(map_space) |
710 UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE(cell_space) | 692 UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE(cell_space) |
711 UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE(lo_space) | 693 UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE(lo_space) |
712 #undef UPDATE_COUNTERS_FOR_SPACE | 694 #undef UPDATE_COUNTERS_FOR_SPACE |
713 #undef UPDATE_FRAGMENTATION_FOR_SPACE | 695 #undef UPDATE_FRAGMENTATION_FOR_SPACE |
714 #undef UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE | 696 #undef UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE |
715 | 697 |
716 #ifdef DEBUG | 698 #ifdef DEBUG |
717 ReportStatisticsAfterGC(); | 699 ReportStatisticsAfterGC(); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 } | 757 } |
776 } | 758 } |
777 | 759 |
778 | 760 |
779 void Heap::CollectAllGarbage(int flags, const char* gc_reason, | 761 void Heap::CollectAllGarbage(int flags, const char* gc_reason, |
780 const v8::GCCallbackFlags gc_callback_flags) { | 762 const v8::GCCallbackFlags gc_callback_flags) { |
781 // Since we are ignoring the return value, the exact choice of space does | 763 // Since we are ignoring the return value, the exact choice of space does |
782 // not matter, so long as we do not specify NEW_SPACE, which would not | 764 // not matter, so long as we do not specify NEW_SPACE, which would not |
783 // cause a full GC. | 765 // cause a full GC. |
784 mark_compact_collector_.SetFlags(flags); | 766 mark_compact_collector_.SetFlags(flags); |
785 CollectGarbage(OLD_POINTER_SPACE, gc_reason, gc_callback_flags); | 767 CollectGarbage(OLD_SPACE, gc_reason, gc_callback_flags); |
786 mark_compact_collector_.SetFlags(kNoGCFlags); | 768 mark_compact_collector_.SetFlags(kNoGCFlags); |
787 } | 769 } |
788 | 770 |
789 | 771 |
790 void Heap::CollectAllAvailableGarbage(const char* gc_reason) { | 772 void Heap::CollectAllAvailableGarbage(const char* gc_reason) { |
791 // Since we are ignoring the return value, the exact choice of space does | 773 // Since we are ignoring the return value, the exact choice of space does |
792 // not matter, so long as we do not specify NEW_SPACE, which would not | 774 // not matter, so long as we do not specify NEW_SPACE, which would not |
793 // cause a full GC. | 775 // cause a full GC. |
794 // Major GC would invoke weak handle callbacks on weakly reachable | 776 // Major GC would invoke weak handle callbacks on weakly reachable |
795 // handles, but won't collect weakly reachable objects until next | 777 // handles, but won't collect weakly reachable objects until next |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1359 | 1341 |
1360 | 1342 |
1361 static void VerifyNonPointerSpacePointers(Heap* heap) { | 1343 static void VerifyNonPointerSpacePointers(Heap* heap) { |
1362 // Verify that there are no pointers to new space in spaces where we | 1344 // Verify that there are no pointers to new space in spaces where we |
1363 // do not expect them. | 1345 // do not expect them. |
1364 VerifyNonPointerSpacePointersVisitor v(heap); | 1346 VerifyNonPointerSpacePointersVisitor v(heap); |
1365 HeapObjectIterator code_it(heap->code_space()); | 1347 HeapObjectIterator code_it(heap->code_space()); |
1366 for (HeapObject* object = code_it.Next(); object != NULL; | 1348 for (HeapObject* object = code_it.Next(); object != NULL; |
1367 object = code_it.Next()) | 1349 object = code_it.Next()) |
1368 object->Iterate(&v); | 1350 object->Iterate(&v); |
1369 | |
1370 HeapObjectIterator data_it(heap->old_data_space()); | |
1371 for (HeapObject* object = data_it.Next(); object != NULL; | |
1372 object = data_it.Next()) | |
1373 object->Iterate(&v); | |
1374 } | 1351 } |
1375 #endif // VERIFY_HEAP | 1352 #endif // VERIFY_HEAP |
1376 | 1353 |
1377 | 1354 |
1378 void Heap::CheckNewSpaceExpansionCriteria() { | 1355 void Heap::CheckNewSpaceExpansionCriteria() { |
1379 if (FLAG_experimental_new_space_growth_heuristic) { | 1356 if (FLAG_experimental_new_space_growth_heuristic) { |
1380 if (new_space_.TotalCapacity() < new_space_.MaximumCapacity() && | 1357 if (new_space_.TotalCapacity() < new_space_.MaximumCapacity() && |
1381 survived_last_scavenge_ * 100 / new_space_.TotalCapacity() >= 10) { | 1358 survived_last_scavenge_ * 100 / new_space_.TotalCapacity() >= 10) { |
1382 // Grow the size of new space if there is room to grow, and more than 10% | 1359 // Grow the size of new space if there is room to grow, and more than 10% |
1383 // have survived the last scavenge. | 1360 // have survived the last scavenge. |
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2161 HeapObject* object, int object_size) { | 2138 HeapObject* object, int object_size) { |
2162 Heap* heap = map->GetHeap(); | 2139 Heap* heap = map->GetHeap(); |
2163 | 2140 |
2164 int allocation_size = object_size; | 2141 int allocation_size = object_size; |
2165 if (alignment != kObjectAlignment) { | 2142 if (alignment != kObjectAlignment) { |
2166 DCHECK(alignment == kDoubleAlignment); | 2143 DCHECK(alignment == kDoubleAlignment); |
2167 allocation_size += kPointerSize; | 2144 allocation_size += kPointerSize; |
2168 } | 2145 } |
2169 | 2146 |
2170 AllocationResult allocation; | 2147 AllocationResult allocation; |
2171 if (object_contents == DATA_OBJECT) { | 2148 allocation = heap->old_space()->AllocateRaw(allocation_size); |
2172 DCHECK(heap->AllowedToBeMigrated(object, OLD_DATA_SPACE)); | |
2173 allocation = heap->old_data_space()->AllocateRaw(allocation_size); | |
2174 } else { | |
2175 DCHECK(heap->AllowedToBeMigrated(object, OLD_POINTER_SPACE)); | |
2176 allocation = heap->old_pointer_space()->AllocateRaw(allocation_size); | |
2177 } | |
2178 | 2149 |
2179 HeapObject* target = NULL; // Initialization to please compiler. | 2150 HeapObject* target = NULL; // Initialization to please compiler. |
2180 if (allocation.To(&target)) { | 2151 if (allocation.To(&target)) { |
2181 if (alignment != kObjectAlignment) { | 2152 if (alignment != kObjectAlignment) { |
2182 target = EnsureDoubleAligned(heap, target, allocation_size); | 2153 target = EnsureDoubleAligned(heap, target, allocation_size); |
2183 } | 2154 } |
2184 MigrateObject(heap, object, target, object_size); | 2155 MigrateObject(heap, object, target, object_size); |
2185 | 2156 |
2186 // Update slot to new target. | 2157 // Update slot to new target. |
2187 *slot = target; | 2158 *slot = target; |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2587 } | 2558 } |
2588 | 2559 |
2589 // Allocate the empty array. | 2560 // Allocate the empty array. |
2590 { | 2561 { |
2591 AllocationResult allocation = AllocateEmptyFixedArray(); | 2562 AllocationResult allocation = AllocateEmptyFixedArray(); |
2592 if (!allocation.To(&obj)) return false; | 2563 if (!allocation.To(&obj)) return false; |
2593 } | 2564 } |
2594 set_empty_fixed_array(FixedArray::cast(obj)); | 2565 set_empty_fixed_array(FixedArray::cast(obj)); |
2595 | 2566 |
2596 { | 2567 { |
2597 AllocationResult allocation = Allocate(null_map(), OLD_POINTER_SPACE); | 2568 AllocationResult allocation = Allocate(null_map(), OLD_SPACE); |
2598 if (!allocation.To(&obj)) return false; | 2569 if (!allocation.To(&obj)) return false; |
2599 } | 2570 } |
2600 set_null_value(Oddball::cast(obj)); | 2571 set_null_value(Oddball::cast(obj)); |
2601 Oddball::cast(obj)->set_kind(Oddball::kNull); | 2572 Oddball::cast(obj)->set_kind(Oddball::kNull); |
2602 | 2573 |
2603 { | 2574 { |
2604 AllocationResult allocation = Allocate(undefined_map(), OLD_POINTER_SPACE); | 2575 AllocationResult allocation = Allocate(undefined_map(), OLD_SPACE); |
2605 if (!allocation.To(&obj)) return false; | 2576 if (!allocation.To(&obj)) return false; |
2606 } | 2577 } |
2607 set_undefined_value(Oddball::cast(obj)); | 2578 set_undefined_value(Oddball::cast(obj)); |
2608 Oddball::cast(obj)->set_kind(Oddball::kUndefined); | 2579 Oddball::cast(obj)->set_kind(Oddball::kUndefined); |
2609 DCHECK(!InNewSpace(undefined_value())); | 2580 DCHECK(!InNewSpace(undefined_value())); |
2610 | 2581 |
2611 // Set preliminary exception sentinel value before actually initializing it. | 2582 // Set preliminary exception sentinel value before actually initializing it. |
2612 set_exception(null_value()); | 2583 set_exception(null_value()); |
2613 | 2584 |
2614 // Allocate the empty descriptor array. | 2585 // Allocate the empty descriptor array. |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2831 } | 2802 } |
2832 | 2803 |
2833 | 2804 |
2834 AllocationResult Heap::AllocateHeapNumber(double value, MutableMode mode, | 2805 AllocationResult Heap::AllocateHeapNumber(double value, MutableMode mode, |
2835 PretenureFlag pretenure) { | 2806 PretenureFlag pretenure) { |
2836 // Statically ensure that it is safe to allocate heap numbers in paged | 2807 // Statically ensure that it is safe to allocate heap numbers in paged |
2837 // spaces. | 2808 // spaces. |
2838 int size = HeapNumber::kSize; | 2809 int size = HeapNumber::kSize; |
2839 STATIC_ASSERT(HeapNumber::kSize <= Page::kMaxRegularHeapObjectSize); | 2810 STATIC_ASSERT(HeapNumber::kSize <= Page::kMaxRegularHeapObjectSize); |
2840 | 2811 |
2841 AllocationSpace space = SelectSpace(size, OLD_DATA_SPACE, pretenure); | 2812 AllocationSpace space = SelectSpace(size, pretenure); |
2842 | 2813 |
2843 HeapObject* result; | 2814 HeapObject* result; |
2844 { | 2815 { |
2845 AllocationResult allocation = AllocateRaw(size, space, OLD_DATA_SPACE); | 2816 AllocationResult allocation = AllocateRaw(size, space, OLD_SPACE); |
2846 if (!allocation.To(&result)) return allocation; | 2817 if (!allocation.To(&result)) return allocation; |
2847 } | 2818 } |
2848 | 2819 |
2849 Map* map = mode == MUTABLE ? mutable_heap_number_map() : heap_number_map(); | 2820 Map* map = mode == MUTABLE ? mutable_heap_number_map() : heap_number_map(); |
2850 HeapObject::cast(result)->set_map_no_write_barrier(map); | 2821 HeapObject::cast(result)->set_map_no_write_barrier(map); |
2851 HeapNumber::cast(result)->set_value(value); | 2822 HeapNumber::cast(result)->set_value(value); |
2852 return result; | 2823 return result; |
2853 } | 2824 } |
2854 | 2825 |
2855 | 2826 |
(...skipping 10 matching lines...) Expand all Loading... |
2866 Cell::cast(result)->set_value(value); | 2837 Cell::cast(result)->set_value(value); |
2867 return result; | 2838 return result; |
2868 } | 2839 } |
2869 | 2840 |
2870 | 2841 |
2871 AllocationResult Heap::AllocatePropertyCell() { | 2842 AllocationResult Heap::AllocatePropertyCell() { |
2872 int size = PropertyCell::kSize; | 2843 int size = PropertyCell::kSize; |
2873 STATIC_ASSERT(PropertyCell::kSize <= Page::kMaxRegularHeapObjectSize); | 2844 STATIC_ASSERT(PropertyCell::kSize <= Page::kMaxRegularHeapObjectSize); |
2874 | 2845 |
2875 HeapObject* result; | 2846 HeapObject* result; |
2876 AllocationResult allocation = | 2847 AllocationResult allocation = AllocateRaw(size, OLD_SPACE, OLD_SPACE); |
2877 AllocateRaw(size, OLD_POINTER_SPACE, OLD_POINTER_SPACE); | |
2878 if (!allocation.To(&result)) return allocation; | 2848 if (!allocation.To(&result)) return allocation; |
2879 | 2849 |
2880 result->set_map_no_write_barrier(global_property_cell_map()); | 2850 result->set_map_no_write_barrier(global_property_cell_map()); |
2881 PropertyCell* cell = PropertyCell::cast(result); | 2851 PropertyCell* cell = PropertyCell::cast(result); |
2882 cell->set_dependent_code(DependentCode::cast(empty_fixed_array()), | 2852 cell->set_dependent_code(DependentCode::cast(empty_fixed_array()), |
2883 SKIP_WRITE_BARRIER); | 2853 SKIP_WRITE_BARRIER); |
2884 cell->set_value(the_hole_value()); | 2854 cell->set_value(the_hole_value()); |
2885 return result; | 2855 return result; |
2886 } | 2856 } |
2887 | 2857 |
2888 | 2858 |
2889 AllocationResult Heap::AllocateWeakCell(HeapObject* value) { | 2859 AllocationResult Heap::AllocateWeakCell(HeapObject* value) { |
2890 int size = WeakCell::kSize; | 2860 int size = WeakCell::kSize; |
2891 STATIC_ASSERT(WeakCell::kSize <= Page::kMaxRegularHeapObjectSize); | 2861 STATIC_ASSERT(WeakCell::kSize <= Page::kMaxRegularHeapObjectSize); |
2892 HeapObject* result = NULL; | 2862 HeapObject* result = NULL; |
2893 { | 2863 { |
2894 AllocationResult allocation = | 2864 AllocationResult allocation = AllocateRaw(size, OLD_SPACE, OLD_SPACE); |
2895 AllocateRaw(size, OLD_POINTER_SPACE, OLD_POINTER_SPACE); | |
2896 if (!allocation.To(&result)) return allocation; | 2865 if (!allocation.To(&result)) return allocation; |
2897 } | 2866 } |
2898 result->set_map_no_write_barrier(weak_cell_map()); | 2867 result->set_map_no_write_barrier(weak_cell_map()); |
2899 WeakCell::cast(result)->initialize(value); | 2868 WeakCell::cast(result)->initialize(value); |
2900 WeakCell::cast(result)->set_next(undefined_value(), SKIP_WRITE_BARRIER); | 2869 WeakCell::cast(result)->set_next(undefined_value(), SKIP_WRITE_BARRIER); |
2901 return result; | 2870 return result; |
2902 } | 2871 } |
2903 | 2872 |
2904 | 2873 |
2905 void Heap::CreateApiObjects() { | 2874 void Heap::CreateApiObjects() { |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3439 FixedTypedArrayBase* Heap::EmptyFixedTypedArrayForMap(Map* map) { | 3408 FixedTypedArrayBase* Heap::EmptyFixedTypedArrayForMap(Map* map) { |
3440 return FixedTypedArrayBase::cast( | 3409 return FixedTypedArrayBase::cast( |
3441 roots_[RootIndexForEmptyFixedTypedArray(map->elements_kind())]); | 3410 roots_[RootIndexForEmptyFixedTypedArray(map->elements_kind())]); |
3442 } | 3411 } |
3443 | 3412 |
3444 | 3413 |
3445 AllocationResult Heap::AllocateForeign(Address address, | 3414 AllocationResult Heap::AllocateForeign(Address address, |
3446 PretenureFlag pretenure) { | 3415 PretenureFlag pretenure) { |
3447 // Statically ensure that it is safe to allocate foreigns in paged spaces. | 3416 // Statically ensure that it is safe to allocate foreigns in paged spaces. |
3448 STATIC_ASSERT(Foreign::kSize <= Page::kMaxRegularHeapObjectSize); | 3417 STATIC_ASSERT(Foreign::kSize <= Page::kMaxRegularHeapObjectSize); |
3449 AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE; | 3418 AllocationSpace space = (pretenure == TENURED) ? OLD_SPACE : NEW_SPACE; |
3450 Foreign* result; | 3419 Foreign* result; |
3451 AllocationResult allocation = Allocate(foreign_map(), space); | 3420 AllocationResult allocation = Allocate(foreign_map(), space); |
3452 if (!allocation.To(&result)) return allocation; | 3421 if (!allocation.To(&result)) return allocation; |
3453 result->set_foreign_address(address); | 3422 result->set_foreign_address(address); |
3454 return result; | 3423 return result; |
3455 } | 3424 } |
3456 | 3425 |
3457 | 3426 |
3458 AllocationResult Heap::AllocateByteArray(int length, PretenureFlag pretenure) { | 3427 AllocationResult Heap::AllocateByteArray(int length, PretenureFlag pretenure) { |
3459 if (length < 0 || length > ByteArray::kMaxLength) { | 3428 if (length < 0 || length > ByteArray::kMaxLength) { |
3460 v8::internal::Heap::FatalProcessOutOfMemory("invalid array length", true); | 3429 v8::internal::Heap::FatalProcessOutOfMemory("invalid array length", true); |
3461 } | 3430 } |
3462 int size = ByteArray::SizeFor(length); | 3431 int size = ByteArray::SizeFor(length); |
3463 AllocationSpace space = SelectSpace(size, OLD_DATA_SPACE, pretenure); | 3432 AllocationSpace space = SelectSpace(size, pretenure); |
3464 HeapObject* result; | 3433 HeapObject* result; |
3465 { | 3434 { |
3466 AllocationResult allocation = AllocateRaw(size, space, OLD_DATA_SPACE); | 3435 AllocationResult allocation = AllocateRaw(size, space, OLD_SPACE); |
3467 if (!allocation.To(&result)) return allocation; | 3436 if (!allocation.To(&result)) return allocation; |
3468 } | 3437 } |
3469 | 3438 |
3470 result->set_map_no_write_barrier(byte_array_map()); | 3439 result->set_map_no_write_barrier(byte_array_map()); |
3471 ByteArray::cast(result)->set_length(length); | 3440 ByteArray::cast(result)->set_length(length); |
3472 return result; | 3441 return result; |
3473 } | 3442 } |
3474 | 3443 |
3475 | 3444 |
3476 void Heap::CreateFillerObjectAt(Address addr, int size) { | 3445 void Heap::CreateFillerObjectAt(Address addr, int size) { |
(...skipping 10 matching lines...) Expand all Loading... |
3487 } else { | 3456 } else { |
3488 filler->set_map_no_write_barrier(raw_unchecked_free_space_map()); | 3457 filler->set_map_no_write_barrier(raw_unchecked_free_space_map()); |
3489 DCHECK(filler->map() == NULL || filler->map() == free_space_map()); | 3458 DCHECK(filler->map() == NULL || filler->map() == free_space_map()); |
3490 FreeSpace::cast(filler)->nobarrier_set_size(size); | 3459 FreeSpace::cast(filler)->nobarrier_set_size(size); |
3491 } | 3460 } |
3492 } | 3461 } |
3493 | 3462 |
3494 | 3463 |
3495 bool Heap::CanMoveObjectStart(HeapObject* object) { | 3464 bool Heap::CanMoveObjectStart(HeapObject* object) { |
3496 Address address = object->address(); | 3465 Address address = object->address(); |
3497 bool is_in_old_pointer_space = InOldPointerSpace(address); | |
3498 bool is_in_old_data_space = InOldDataSpace(address); | |
3499 | 3466 |
3500 if (lo_space()->Contains(object)) return false; | 3467 if (lo_space()->Contains(object)) return false; |
3501 | 3468 |
3502 Page* page = Page::FromAddress(address); | 3469 Page* page = Page::FromAddress(address); |
3503 // We can move the object start if: | 3470 // We can move the object start if: |
3504 // (1) the object is not in old pointer or old data space, | 3471 // (1) the object is not in old space, |
3505 // (2) the page of the object was already swept, | 3472 // (2) the page of the object was already swept, |
3506 // (3) the page was already concurrently swept. This case is an optimization | 3473 // (3) the page was already concurrently swept. This case is an optimization |
3507 // for concurrent sweeping. The WasSwept predicate for concurrently swept | 3474 // for concurrent sweeping. The WasSwept predicate for concurrently swept |
3508 // pages is set after sweeping all pages. | 3475 // pages is set after sweeping all pages. |
3509 return (!is_in_old_pointer_space && !is_in_old_data_space) || | 3476 return !InOldSpace(address) || page->WasSwept() || page->SweepingCompleted(); |
3510 page->WasSwept() || page->SweepingCompleted(); | |
3511 } | 3477 } |
3512 | 3478 |
3513 | 3479 |
3514 void Heap::AdjustLiveBytes(Address address, int by, InvocationMode mode) { | 3480 void Heap::AdjustLiveBytes(Address address, int by, InvocationMode mode) { |
3515 if (incremental_marking()->IsMarking() && | 3481 if (incremental_marking()->IsMarking() && |
3516 Marking::IsBlack(Marking::MarkBitFrom(address))) { | 3482 Marking::IsBlack(Marking::MarkBitFrom(address))) { |
3517 if (mode == FROM_GC) { | 3483 if (mode == FROM_GC) { |
3518 MemoryChunk::IncrementLiveBytesFromGC(address, by); | 3484 MemoryChunk::IncrementLiveBytesFromGC(address, by); |
3519 } else { | 3485 } else { |
3520 MemoryChunk::IncrementLiveBytesFromMutator(address, by); | 3486 MemoryChunk::IncrementLiveBytesFromMutator(address, by); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3634 profiler->UpdateObjectSizeEvent(object->address(), object->Size()); | 3600 profiler->UpdateObjectSizeEvent(object->address(), object->Size()); |
3635 } | 3601 } |
3636 } | 3602 } |
3637 | 3603 |
3638 | 3604 |
3639 AllocationResult Heap::AllocateExternalArray(int length, | 3605 AllocationResult Heap::AllocateExternalArray(int length, |
3640 ExternalArrayType array_type, | 3606 ExternalArrayType array_type, |
3641 void* external_pointer, | 3607 void* external_pointer, |
3642 PretenureFlag pretenure) { | 3608 PretenureFlag pretenure) { |
3643 int size = ExternalArray::kAlignedSize; | 3609 int size = ExternalArray::kAlignedSize; |
3644 AllocationSpace space = SelectSpace(size, OLD_DATA_SPACE, pretenure); | 3610 AllocationSpace space = SelectSpace(size, pretenure); |
3645 HeapObject* result; | 3611 HeapObject* result; |
3646 { | 3612 { |
3647 AllocationResult allocation = AllocateRaw(size, space, OLD_DATA_SPACE); | 3613 AllocationResult allocation = AllocateRaw(size, space, OLD_SPACE); |
3648 if (!allocation.To(&result)) return allocation; | 3614 if (!allocation.To(&result)) return allocation; |
3649 } | 3615 } |
3650 | 3616 |
3651 result->set_map_no_write_barrier(MapForExternalArrayType(array_type)); | 3617 result->set_map_no_write_barrier(MapForExternalArrayType(array_type)); |
3652 ExternalArray::cast(result)->set_length(length); | 3618 ExternalArray::cast(result)->set_length(length); |
3653 ExternalArray::cast(result)->set_external_pointer(external_pointer); | 3619 ExternalArray::cast(result)->set_external_pointer(external_pointer); |
3654 return result; | 3620 return result; |
3655 } | 3621 } |
3656 | 3622 |
3657 static void ForFixedTypedArray(ExternalArrayType array_type, int* element_size, | 3623 static void ForFixedTypedArray(ExternalArrayType array_type, int* element_size, |
(...skipping 22 matching lines...) Expand all Loading... |
3680 int element_size; | 3646 int element_size; |
3681 ElementsKind elements_kind; | 3647 ElementsKind elements_kind; |
3682 ForFixedTypedArray(array_type, &element_size, &elements_kind); | 3648 ForFixedTypedArray(array_type, &element_size, &elements_kind); |
3683 int size = OBJECT_POINTER_ALIGN(length * element_size + | 3649 int size = OBJECT_POINTER_ALIGN(length * element_size + |
3684 FixedTypedArrayBase::kDataOffset); | 3650 FixedTypedArrayBase::kDataOffset); |
3685 #ifndef V8_HOST_ARCH_64_BIT | 3651 #ifndef V8_HOST_ARCH_64_BIT |
3686 if (array_type == kExternalFloat64Array) { | 3652 if (array_type == kExternalFloat64Array) { |
3687 size += kPointerSize; | 3653 size += kPointerSize; |
3688 } | 3654 } |
3689 #endif | 3655 #endif |
3690 AllocationSpace space = SelectSpace(size, OLD_DATA_SPACE, pretenure); | 3656 AllocationSpace space = SelectSpace(size, pretenure); |
3691 | 3657 |
3692 HeapObject* object; | 3658 HeapObject* object; |
3693 AllocationResult allocation = AllocateRaw(size, space, OLD_DATA_SPACE); | 3659 AllocationResult allocation = AllocateRaw(size, space, OLD_SPACE); |
3694 if (!allocation.To(&object)) return allocation; | 3660 if (!allocation.To(&object)) return allocation; |
3695 | 3661 |
3696 if (array_type == kExternalFloat64Array) { | 3662 if (array_type == kExternalFloat64Array) { |
3697 object = EnsureDoubleAligned(this, object, size); | 3663 object = EnsureDoubleAligned(this, object, size); |
3698 } | 3664 } |
3699 | 3665 |
3700 object->set_map(MapForFixedTypedArray(array_type)); | 3666 object->set_map(MapForFixedTypedArray(array_type)); |
3701 FixedTypedArrayBase* elements = FixedTypedArrayBase::cast(object); | 3667 FixedTypedArrayBase* elements = FixedTypedArrayBase::cast(object); |
3702 elements->set_length(length); | 3668 elements->set_length(length); |
3703 memset(elements->DataPtr(), 0, elements->DataSize()); | 3669 memset(elements->DataPtr(), 0, elements->DataSize()); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3847 } | 3813 } |
3848 } | 3814 } |
3849 | 3815 |
3850 | 3816 |
3851 AllocationResult Heap::Allocate(Map* map, AllocationSpace space, | 3817 AllocationResult Heap::Allocate(Map* map, AllocationSpace space, |
3852 AllocationSite* allocation_site) { | 3818 AllocationSite* allocation_site) { |
3853 DCHECK(gc_state_ == NOT_IN_GC); | 3819 DCHECK(gc_state_ == NOT_IN_GC); |
3854 DCHECK(map->instance_type() != MAP_TYPE); | 3820 DCHECK(map->instance_type() != MAP_TYPE); |
3855 // If allocation failures are disallowed, we may allocate in a different | 3821 // If allocation failures are disallowed, we may allocate in a different |
3856 // space when new space is full and the object is not a large object. | 3822 // space when new space is full and the object is not a large object. |
3857 AllocationSpace retry_space = | 3823 AllocationSpace retry_space = (space != NEW_SPACE) ? space : OLD_SPACE; |
3858 (space != NEW_SPACE) ? space : TargetSpaceId(map->instance_type()); | |
3859 int size = map->instance_size(); | 3824 int size = map->instance_size(); |
3860 if (allocation_site != NULL) { | 3825 if (allocation_site != NULL) { |
3861 size += AllocationMemento::kSize; | 3826 size += AllocationMemento::kSize; |
3862 } | 3827 } |
3863 HeapObject* result; | 3828 HeapObject* result; |
3864 AllocationResult allocation = AllocateRaw(size, space, retry_space); | 3829 AllocationResult allocation = AllocateRaw(size, space, retry_space); |
3865 if (!allocation.To(&result)) return allocation; | 3830 if (!allocation.To(&result)) return allocation; |
3866 // No need for write barrier since object is white and map is in old space. | 3831 // No need for write barrier since object is white and map is in old space. |
3867 result->set_map_no_write_barrier(map); | 3832 result->set_map_no_write_barrier(map); |
3868 if (allocation_site != NULL) { | 3833 if (allocation_site != NULL) { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3925 { | 3890 { |
3926 AllocationResult allocation = AllocateFixedArray(prop_size, pretenure); | 3891 AllocationResult allocation = AllocateFixedArray(prop_size, pretenure); |
3927 if (!allocation.To(&properties)) return allocation; | 3892 if (!allocation.To(&properties)) return allocation; |
3928 } | 3893 } |
3929 } else { | 3894 } else { |
3930 properties = empty_fixed_array(); | 3895 properties = empty_fixed_array(); |
3931 } | 3896 } |
3932 | 3897 |
3933 // Allocate the JSObject. | 3898 // Allocate the JSObject. |
3934 int size = map->instance_size(); | 3899 int size = map->instance_size(); |
3935 AllocationSpace space = SelectSpace(size, OLD_POINTER_SPACE, pretenure); | 3900 AllocationSpace space = SelectSpace(size, pretenure); |
3936 JSObject* js_obj; | 3901 JSObject* js_obj; |
3937 AllocationResult allocation = Allocate(map, space, allocation_site); | 3902 AllocationResult allocation = Allocate(map, space, allocation_site); |
3938 if (!allocation.To(&js_obj)) return allocation; | 3903 if (!allocation.To(&js_obj)) return allocation; |
3939 | 3904 |
3940 // Initialize the JSObject. | 3905 // Initialize the JSObject. |
3941 InitializeJSObjectFromMap(js_obj, properties, map); | 3906 InitializeJSObjectFromMap(js_obj, properties, map); |
3942 DCHECK(js_obj->HasFastElements() || js_obj->HasExternalArrayElements() || | 3907 DCHECK(js_obj->HasFastElements() || js_obj->HasExternalArrayElements() || |
3943 js_obj->HasFixedTypedArrayElements()); | 3908 js_obj->HasFixedTypedArrayElements()); |
3944 return js_obj; | 3909 return js_obj; |
3945 } | 3910 } |
(...skipping 30 matching lines...) Expand all Loading... |
3976 | 3941 |
3977 DCHECK(site == NULL || AllocationSite::CanTrack(map->instance_type())); | 3942 DCHECK(site == NULL || AllocationSite::CanTrack(map->instance_type())); |
3978 | 3943 |
3979 WriteBarrierMode wb_mode = UPDATE_WRITE_BARRIER; | 3944 WriteBarrierMode wb_mode = UPDATE_WRITE_BARRIER; |
3980 | 3945 |
3981 // If we're forced to always allocate, we use the general allocation | 3946 // If we're forced to always allocate, we use the general allocation |
3982 // functions which may leave us with an object in old space. | 3947 // functions which may leave us with an object in old space. |
3983 if (always_allocate()) { | 3948 if (always_allocate()) { |
3984 { | 3949 { |
3985 AllocationResult allocation = | 3950 AllocationResult allocation = |
3986 AllocateRaw(object_size, NEW_SPACE, OLD_POINTER_SPACE); | 3951 AllocateRaw(object_size, NEW_SPACE, OLD_SPACE); |
3987 if (!allocation.To(&clone)) return allocation; | 3952 if (!allocation.To(&clone)) return allocation; |
3988 } | 3953 } |
3989 Address clone_address = clone->address(); | 3954 Address clone_address = clone->address(); |
3990 CopyBlock(clone_address, source->address(), object_size); | 3955 CopyBlock(clone_address, source->address(), object_size); |
3991 | 3956 |
3992 // Update write barrier for all tagged fields that lie beyond the header. | 3957 // Update write barrier for all tagged fields that lie beyond the header. |
3993 const int start_offset = JSObject::kHeaderSize; | 3958 const int start_offset = JSObject::kHeaderSize; |
3994 const int end_offset = object_size; | 3959 const int end_offset = object_size; |
3995 | 3960 |
3996 #if V8_DOUBLE_FIELDS_UNBOXING | 3961 #if V8_DOUBLE_FIELDS_UNBOXING |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4127 | 4092 |
4128 DCHECK_LE(0, chars); | 4093 DCHECK_LE(0, chars); |
4129 DCHECK_GE(String::kMaxLength, chars); | 4094 DCHECK_GE(String::kMaxLength, chars); |
4130 if (is_one_byte) { | 4095 if (is_one_byte) { |
4131 map = one_byte_internalized_string_map(); | 4096 map = one_byte_internalized_string_map(); |
4132 size = SeqOneByteString::SizeFor(chars); | 4097 size = SeqOneByteString::SizeFor(chars); |
4133 } else { | 4098 } else { |
4134 map = internalized_string_map(); | 4099 map = internalized_string_map(); |
4135 size = SeqTwoByteString::SizeFor(chars); | 4100 size = SeqTwoByteString::SizeFor(chars); |
4136 } | 4101 } |
4137 AllocationSpace space = SelectSpace(size, OLD_DATA_SPACE, TENURED); | 4102 AllocationSpace space = SelectSpace(size, TENURED); |
4138 | 4103 |
4139 // Allocate string. | 4104 // Allocate string. |
4140 HeapObject* result; | 4105 HeapObject* result; |
4141 { | 4106 { |
4142 AllocationResult allocation = AllocateRaw(size, space, OLD_DATA_SPACE); | 4107 AllocationResult allocation = AllocateRaw(size, space, OLD_SPACE); |
4143 if (!allocation.To(&result)) return allocation; | 4108 if (!allocation.To(&result)) return allocation; |
4144 } | 4109 } |
4145 | 4110 |
4146 result->set_map_no_write_barrier(map); | 4111 result->set_map_no_write_barrier(map); |
4147 // Set length and hash fields of the allocated string. | 4112 // Set length and hash fields of the allocated string. |
4148 String* answer = String::cast(result); | 4113 String* answer = String::cast(result); |
4149 answer->set_length(chars); | 4114 answer->set_length(chars); |
4150 answer->set_hash_field(hash_field); | 4115 answer->set_hash_field(hash_field); |
4151 | 4116 |
4152 DCHECK_EQ(size, answer->Size()); | 4117 DCHECK_EQ(size, answer->Size()); |
(...skipping 17 matching lines...) Expand all Loading... |
4170 template AllocationResult Heap::AllocateInternalizedStringImpl<false>( | 4135 template AllocationResult Heap::AllocateInternalizedStringImpl<false>( |
4171 Vector<const char>, int, uint32_t); | 4136 Vector<const char>, int, uint32_t); |
4172 | 4137 |
4173 | 4138 |
4174 AllocationResult Heap::AllocateRawOneByteString(int length, | 4139 AllocationResult Heap::AllocateRawOneByteString(int length, |
4175 PretenureFlag pretenure) { | 4140 PretenureFlag pretenure) { |
4176 DCHECK_LE(0, length); | 4141 DCHECK_LE(0, length); |
4177 DCHECK_GE(String::kMaxLength, length); | 4142 DCHECK_GE(String::kMaxLength, length); |
4178 int size = SeqOneByteString::SizeFor(length); | 4143 int size = SeqOneByteString::SizeFor(length); |
4179 DCHECK(size <= SeqOneByteString::kMaxSize); | 4144 DCHECK(size <= SeqOneByteString::kMaxSize); |
4180 AllocationSpace space = SelectSpace(size, OLD_DATA_SPACE, pretenure); | 4145 AllocationSpace space = SelectSpace(size, pretenure); |
4181 | 4146 |
4182 HeapObject* result; | 4147 HeapObject* result; |
4183 { | 4148 { |
4184 AllocationResult allocation = AllocateRaw(size, space, OLD_DATA_SPACE); | 4149 AllocationResult allocation = AllocateRaw(size, space, OLD_SPACE); |
4185 if (!allocation.To(&result)) return allocation; | 4150 if (!allocation.To(&result)) return allocation; |
4186 } | 4151 } |
4187 | 4152 |
4188 // Partially initialize the object. | 4153 // Partially initialize the object. |
4189 result->set_map_no_write_barrier(one_byte_string_map()); | 4154 result->set_map_no_write_barrier(one_byte_string_map()); |
4190 String::cast(result)->set_length(length); | 4155 String::cast(result)->set_length(length); |
4191 String::cast(result)->set_hash_field(String::kEmptyHashField); | 4156 String::cast(result)->set_hash_field(String::kEmptyHashField); |
4192 DCHECK_EQ(size, HeapObject::cast(result)->Size()); | 4157 DCHECK_EQ(size, HeapObject::cast(result)->Size()); |
4193 | 4158 |
4194 return result; | 4159 return result; |
4195 } | 4160 } |
4196 | 4161 |
4197 | 4162 |
4198 AllocationResult Heap::AllocateRawTwoByteString(int length, | 4163 AllocationResult Heap::AllocateRawTwoByteString(int length, |
4199 PretenureFlag pretenure) { | 4164 PretenureFlag pretenure) { |
4200 DCHECK_LE(0, length); | 4165 DCHECK_LE(0, length); |
4201 DCHECK_GE(String::kMaxLength, length); | 4166 DCHECK_GE(String::kMaxLength, length); |
4202 int size = SeqTwoByteString::SizeFor(length); | 4167 int size = SeqTwoByteString::SizeFor(length); |
4203 DCHECK(size <= SeqTwoByteString::kMaxSize); | 4168 DCHECK(size <= SeqTwoByteString::kMaxSize); |
4204 AllocationSpace space = SelectSpace(size, OLD_DATA_SPACE, pretenure); | 4169 AllocationSpace space = SelectSpace(size, pretenure); |
4205 | 4170 |
4206 HeapObject* result; | 4171 HeapObject* result; |
4207 { | 4172 { |
4208 AllocationResult allocation = AllocateRaw(size, space, OLD_DATA_SPACE); | 4173 AllocationResult allocation = AllocateRaw(size, space, OLD_SPACE); |
4209 if (!allocation.To(&result)) return allocation; | 4174 if (!allocation.To(&result)) return allocation; |
4210 } | 4175 } |
4211 | 4176 |
4212 // Partially initialize the object. | 4177 // Partially initialize the object. |
4213 result->set_map_no_write_barrier(string_map()); | 4178 result->set_map_no_write_barrier(string_map()); |
4214 String::cast(result)->set_length(length); | 4179 String::cast(result)->set_length(length); |
4215 String::cast(result)->set_hash_field(String::kEmptyHashField); | 4180 String::cast(result)->set_hash_field(String::kEmptyHashField); |
4216 DCHECK_EQ(size, HeapObject::cast(result)->Size()); | 4181 DCHECK_EQ(size, HeapObject::cast(result)->Size()); |
4217 return result; | 4182 return result; |
4218 } | 4183 } |
4219 | 4184 |
4220 | 4185 |
4221 AllocationResult Heap::AllocateEmptyFixedArray() { | 4186 AllocationResult Heap::AllocateEmptyFixedArray() { |
4222 int size = FixedArray::SizeFor(0); | 4187 int size = FixedArray::SizeFor(0); |
4223 HeapObject* result; | 4188 HeapObject* result; |
4224 { | 4189 { |
4225 AllocationResult allocation = | 4190 AllocationResult allocation = AllocateRaw(size, OLD_SPACE, OLD_SPACE); |
4226 AllocateRaw(size, OLD_DATA_SPACE, OLD_DATA_SPACE); | |
4227 if (!allocation.To(&result)) return allocation; | 4191 if (!allocation.To(&result)) return allocation; |
4228 } | 4192 } |
4229 // Initialize the object. | 4193 // Initialize the object. |
4230 result->set_map_no_write_barrier(fixed_array_map()); | 4194 result->set_map_no_write_barrier(fixed_array_map()); |
4231 FixedArray::cast(result)->set_length(0); | 4195 FixedArray::cast(result)->set_length(0); |
4232 return result; | 4196 return result; |
4233 } | 4197 } |
4234 | 4198 |
4235 | 4199 |
4236 AllocationResult Heap::AllocateEmptyExternalArray( | 4200 AllocationResult Heap::AllocateEmptyExternalArray( |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4338 return obj; | 4302 return obj; |
4339 } | 4303 } |
4340 | 4304 |
4341 | 4305 |
4342 AllocationResult Heap::AllocateRawFixedArray(int length, | 4306 AllocationResult Heap::AllocateRawFixedArray(int length, |
4343 PretenureFlag pretenure) { | 4307 PretenureFlag pretenure) { |
4344 if (length < 0 || length > FixedArray::kMaxLength) { | 4308 if (length < 0 || length > FixedArray::kMaxLength) { |
4345 v8::internal::Heap::FatalProcessOutOfMemory("invalid array length", true); | 4309 v8::internal::Heap::FatalProcessOutOfMemory("invalid array length", true); |
4346 } | 4310 } |
4347 int size = FixedArray::SizeFor(length); | 4311 int size = FixedArray::SizeFor(length); |
4348 AllocationSpace space = SelectSpace(size, OLD_POINTER_SPACE, pretenure); | 4312 AllocationSpace space = SelectSpace(size, pretenure); |
4349 | 4313 |
4350 return AllocateRaw(size, space, OLD_POINTER_SPACE); | 4314 return AllocateRaw(size, space, OLD_SPACE); |
4351 } | 4315 } |
4352 | 4316 |
4353 | 4317 |
4354 AllocationResult Heap::AllocateFixedArrayWithFiller(int length, | 4318 AllocationResult Heap::AllocateFixedArrayWithFiller(int length, |
4355 PretenureFlag pretenure, | 4319 PretenureFlag pretenure, |
4356 Object* filler) { | 4320 Object* filler) { |
4357 DCHECK(length >= 0); | 4321 DCHECK(length >= 0); |
4358 DCHECK(empty_fixed_array()->IsFixedArray()); | 4322 DCHECK(empty_fixed_array()->IsFixedArray()); |
4359 if (length == 0) return empty_fixed_array(); | 4323 if (length == 0) return empty_fixed_array(); |
4360 | 4324 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4409 | 4373 |
4410 AllocationResult Heap::AllocateRawFixedDoubleArray(int length, | 4374 AllocationResult Heap::AllocateRawFixedDoubleArray(int length, |
4411 PretenureFlag pretenure) { | 4375 PretenureFlag pretenure) { |
4412 if (length < 0 || length > FixedDoubleArray::kMaxLength) { | 4376 if (length < 0 || length > FixedDoubleArray::kMaxLength) { |
4413 v8::internal::Heap::FatalProcessOutOfMemory("invalid array length", true); | 4377 v8::internal::Heap::FatalProcessOutOfMemory("invalid array length", true); |
4414 } | 4378 } |
4415 int size = FixedDoubleArray::SizeFor(length); | 4379 int size = FixedDoubleArray::SizeFor(length); |
4416 #ifndef V8_HOST_ARCH_64_BIT | 4380 #ifndef V8_HOST_ARCH_64_BIT |
4417 size += kPointerSize; | 4381 size += kPointerSize; |
4418 #endif | 4382 #endif |
4419 AllocationSpace space = SelectSpace(size, OLD_DATA_SPACE, pretenure); | 4383 AllocationSpace space = SelectSpace(size, pretenure); |
4420 | 4384 |
4421 HeapObject* object; | 4385 HeapObject* object; |
4422 { | 4386 { |
4423 AllocationResult allocation = AllocateRaw(size, space, OLD_DATA_SPACE); | 4387 AllocationResult allocation = AllocateRaw(size, space, OLD_SPACE); |
4424 if (!allocation.To(&object)) return allocation; | 4388 if (!allocation.To(&object)) return allocation; |
4425 } | 4389 } |
4426 | 4390 |
4427 return EnsureDoubleAligned(this, object, size); | 4391 return EnsureDoubleAligned(this, object, size); |
4428 } | 4392 } |
4429 | 4393 |
4430 | 4394 |
4431 AllocationResult Heap::AllocateConstantPoolArray( | 4395 AllocationResult Heap::AllocateConstantPoolArray( |
4432 const ConstantPoolArray::NumberOfEntries& small) { | 4396 const ConstantPoolArray::NumberOfEntries& small) { |
4433 CHECK(small.are_in_range(0, ConstantPoolArray::kMaxSmallEntriesPerType)); | 4397 CHECK(small.are_in_range(0, ConstantPoolArray::kMaxSmallEntriesPerType)); |
4434 int size = ConstantPoolArray::SizeFor(small); | 4398 int size = ConstantPoolArray::SizeFor(small); |
4435 #ifndef V8_HOST_ARCH_64_BIT | 4399 #ifndef V8_HOST_ARCH_64_BIT |
4436 size += kPointerSize; | 4400 size += kPointerSize; |
4437 #endif | 4401 #endif |
4438 AllocationSpace space = SelectSpace(size, OLD_POINTER_SPACE, TENURED); | 4402 AllocationSpace space = SelectSpace(size, TENURED); |
4439 | 4403 |
4440 HeapObject* object; | 4404 HeapObject* object; |
4441 { | 4405 { |
4442 AllocationResult allocation = AllocateRaw(size, space, OLD_POINTER_SPACE); | 4406 AllocationResult allocation = AllocateRaw(size, space, OLD_SPACE); |
4443 if (!allocation.To(&object)) return allocation; | 4407 if (!allocation.To(&object)) return allocation; |
4444 } | 4408 } |
4445 object = EnsureDoubleAligned(this, object, size); | 4409 object = EnsureDoubleAligned(this, object, size); |
4446 object->set_map_no_write_barrier(constant_pool_array_map()); | 4410 object->set_map_no_write_barrier(constant_pool_array_map()); |
4447 | 4411 |
4448 ConstantPoolArray* constant_pool = ConstantPoolArray::cast(object); | 4412 ConstantPoolArray* constant_pool = ConstantPoolArray::cast(object); |
4449 constant_pool->Init(small); | 4413 constant_pool->Init(small); |
4450 constant_pool->ClearPtrEntries(isolate()); | 4414 constant_pool->ClearPtrEntries(isolate()); |
4451 return constant_pool; | 4415 return constant_pool; |
4452 } | 4416 } |
4453 | 4417 |
4454 | 4418 |
4455 AllocationResult Heap::AllocateExtendedConstantPoolArray( | 4419 AllocationResult Heap::AllocateExtendedConstantPoolArray( |
4456 const ConstantPoolArray::NumberOfEntries& small, | 4420 const ConstantPoolArray::NumberOfEntries& small, |
4457 const ConstantPoolArray::NumberOfEntries& extended) { | 4421 const ConstantPoolArray::NumberOfEntries& extended) { |
4458 CHECK(small.are_in_range(0, ConstantPoolArray::kMaxSmallEntriesPerType)); | 4422 CHECK(small.are_in_range(0, ConstantPoolArray::kMaxSmallEntriesPerType)); |
4459 CHECK(extended.are_in_range(0, kMaxInt)); | 4423 CHECK(extended.are_in_range(0, kMaxInt)); |
4460 int size = ConstantPoolArray::SizeForExtended(small, extended); | 4424 int size = ConstantPoolArray::SizeForExtended(small, extended); |
4461 #ifndef V8_HOST_ARCH_64_BIT | 4425 #ifndef V8_HOST_ARCH_64_BIT |
4462 size += kPointerSize; | 4426 size += kPointerSize; |
4463 #endif | 4427 #endif |
4464 AllocationSpace space = SelectSpace(size, OLD_POINTER_SPACE, TENURED); | 4428 AllocationSpace space = SelectSpace(size, TENURED); |
4465 | 4429 |
4466 HeapObject* object; | 4430 HeapObject* object; |
4467 { | 4431 { |
4468 AllocationResult allocation = AllocateRaw(size, space, OLD_POINTER_SPACE); | 4432 AllocationResult allocation = AllocateRaw(size, space, OLD_SPACE); |
4469 if (!allocation.To(&object)) return allocation; | 4433 if (!allocation.To(&object)) return allocation; |
4470 } | 4434 } |
4471 object = EnsureDoubleAligned(this, object, size); | 4435 object = EnsureDoubleAligned(this, object, size); |
4472 object->set_map_no_write_barrier(constant_pool_array_map()); | 4436 object->set_map_no_write_barrier(constant_pool_array_map()); |
4473 | 4437 |
4474 ConstantPoolArray* constant_pool = ConstantPoolArray::cast(object); | 4438 ConstantPoolArray* constant_pool = ConstantPoolArray::cast(object); |
4475 constant_pool->InitExtended(small, extended); | 4439 constant_pool->InitExtended(small, extended); |
4476 constant_pool->ClearPtrEntries(isolate()); | 4440 constant_pool->ClearPtrEntries(isolate()); |
4477 return constant_pool; | 4441 return constant_pool; |
4478 } | 4442 } |
4479 | 4443 |
4480 | 4444 |
4481 AllocationResult Heap::AllocateEmptyConstantPoolArray() { | 4445 AllocationResult Heap::AllocateEmptyConstantPoolArray() { |
4482 ConstantPoolArray::NumberOfEntries small(0, 0, 0, 0); | 4446 ConstantPoolArray::NumberOfEntries small(0, 0, 0, 0); |
4483 int size = ConstantPoolArray::SizeFor(small); | 4447 int size = ConstantPoolArray::SizeFor(small); |
4484 HeapObject* result = NULL; | 4448 HeapObject* result = NULL; |
4485 { | 4449 { |
4486 AllocationResult allocation = | 4450 AllocationResult allocation = AllocateRaw(size, OLD_SPACE, OLD_SPACE); |
4487 AllocateRaw(size, OLD_DATA_SPACE, OLD_DATA_SPACE); | |
4488 if (!allocation.To(&result)) return allocation; | 4451 if (!allocation.To(&result)) return allocation; |
4489 } | 4452 } |
4490 result->set_map_no_write_barrier(constant_pool_array_map()); | 4453 result->set_map_no_write_barrier(constant_pool_array_map()); |
4491 ConstantPoolArray::cast(result)->Init(small); | 4454 ConstantPoolArray::cast(result)->Init(small); |
4492 return result; | 4455 return result; |
4493 } | 4456 } |
4494 | 4457 |
4495 | 4458 |
4496 AllocationResult Heap::AllocateSymbol() { | 4459 AllocationResult Heap::AllocateSymbol() { |
4497 // Statically ensure that it is safe to allocate symbols in paged spaces. | 4460 // Statically ensure that it is safe to allocate symbols in paged spaces. |
4498 STATIC_ASSERT(Symbol::kSize <= Page::kMaxRegularHeapObjectSize); | 4461 STATIC_ASSERT(Symbol::kSize <= Page::kMaxRegularHeapObjectSize); |
4499 | 4462 |
4500 HeapObject* result = NULL; | 4463 HeapObject* result = NULL; |
4501 AllocationResult allocation = | 4464 AllocationResult allocation = |
4502 AllocateRaw(Symbol::kSize, OLD_POINTER_SPACE, OLD_POINTER_SPACE); | 4465 AllocateRaw(Symbol::kSize, OLD_SPACE, OLD_SPACE); |
4503 if (!allocation.To(&result)) return allocation; | 4466 if (!allocation.To(&result)) return allocation; |
4504 | 4467 |
4505 result->set_map_no_write_barrier(symbol_map()); | 4468 result->set_map_no_write_barrier(symbol_map()); |
4506 | 4469 |
4507 // Generate a random hash value. | 4470 // Generate a random hash value. |
4508 int hash; | 4471 int hash; |
4509 int attempts = 0; | 4472 int attempts = 0; |
4510 do { | 4473 do { |
4511 hash = isolate()->random_number_generator()->NextInt() & Name::kHashBitMask; | 4474 hash = isolate()->random_number_generator()->NextInt() & Name::kHashBitMask; |
4512 attempts++; | 4475 attempts++; |
(...skipping 17 matching lines...) Expand all Loading... |
4530 case NAME##_TYPE: \ | 4493 case NAME##_TYPE: \ |
4531 map = name##_map(); \ | 4494 map = name##_map(); \ |
4532 break; | 4495 break; |
4533 STRUCT_LIST(MAKE_CASE) | 4496 STRUCT_LIST(MAKE_CASE) |
4534 #undef MAKE_CASE | 4497 #undef MAKE_CASE |
4535 default: | 4498 default: |
4536 UNREACHABLE(); | 4499 UNREACHABLE(); |
4537 return exception(); | 4500 return exception(); |
4538 } | 4501 } |
4539 int size = map->instance_size(); | 4502 int size = map->instance_size(); |
4540 AllocationSpace space = SelectSpace(size, OLD_POINTER_SPACE, TENURED); | 4503 AllocationSpace space = SelectSpace(size, TENURED); |
4541 Struct* result; | 4504 Struct* result; |
4542 { | 4505 { |
4543 AllocationResult allocation = Allocate(map, space); | 4506 AllocationResult allocation = Allocate(map, space); |
4544 if (!allocation.To(&result)) return allocation; | 4507 if (!allocation.To(&result)) return allocation; |
4545 } | 4508 } |
4546 result->InitializeBody(size); | 4509 result->InitializeBody(size); |
4547 return result; | 4510 return result; |
4548 } | 4511 } |
4549 | 4512 |
4550 | 4513 |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4799 | 4762 |
4800 PrintF("\n"); | 4763 PrintF("\n"); |
4801 PrintF("Number of handles : %d\n", HandleScope::NumberOfHandles(isolate_)); | 4764 PrintF("Number of handles : %d\n", HandleScope::NumberOfHandles(isolate_)); |
4802 isolate_->global_handles()->PrintStats(); | 4765 isolate_->global_handles()->PrintStats(); |
4803 PrintF("\n"); | 4766 PrintF("\n"); |
4804 | 4767 |
4805 PrintF("Heap statistics : "); | 4768 PrintF("Heap statistics : "); |
4806 isolate_->memory_allocator()->ReportStatistics(); | 4769 isolate_->memory_allocator()->ReportStatistics(); |
4807 PrintF("To space : "); | 4770 PrintF("To space : "); |
4808 new_space_.ReportStatistics(); | 4771 new_space_.ReportStatistics(); |
4809 PrintF("Old pointer space : "); | 4772 PrintF("Old space : "); |
4810 old_pointer_space_->ReportStatistics(); | 4773 old_space_->ReportStatistics(); |
4811 PrintF("Old data space : "); | |
4812 old_data_space_->ReportStatistics(); | |
4813 PrintF("Code space : "); | 4774 PrintF("Code space : "); |
4814 code_space_->ReportStatistics(); | 4775 code_space_->ReportStatistics(); |
4815 PrintF("Map space : "); | 4776 PrintF("Map space : "); |
4816 map_space_->ReportStatistics(); | 4777 map_space_->ReportStatistics(); |
4817 PrintF("Cell space : "); | 4778 PrintF("Cell space : "); |
4818 cell_space_->ReportStatistics(); | 4779 cell_space_->ReportStatistics(); |
4819 PrintF("Large object space : "); | 4780 PrintF("Large object space : "); |
4820 lo_space_->ReportStatistics(); | 4781 lo_space_->ReportStatistics(); |
4821 PrintF(">>>>>> ========================================= >>>>>>\n"); | 4782 PrintF(">>>>>> ========================================= >>>>>>\n"); |
4822 } | 4783 } |
4823 | 4784 |
4824 #endif // DEBUG | 4785 #endif // DEBUG |
4825 | 4786 |
4826 bool Heap::Contains(HeapObject* value) { return Contains(value->address()); } | 4787 bool Heap::Contains(HeapObject* value) { return Contains(value->address()); } |
4827 | 4788 |
4828 | 4789 |
4829 bool Heap::Contains(Address addr) { | 4790 bool Heap::Contains(Address addr) { |
4830 if (isolate_->memory_allocator()->IsOutsideAllocatedSpace(addr)) return false; | 4791 if (isolate_->memory_allocator()->IsOutsideAllocatedSpace(addr)) return false; |
4831 return HasBeenSetUp() && | 4792 return HasBeenSetUp() && |
4832 (new_space_.ToSpaceContains(addr) || | 4793 (new_space_.ToSpaceContains(addr) || old_space_->Contains(addr) || |
4833 old_pointer_space_->Contains(addr) || | 4794 code_space_->Contains(addr) || map_space_->Contains(addr) || |
4834 old_data_space_->Contains(addr) || code_space_->Contains(addr) || | 4795 cell_space_->Contains(addr) || lo_space_->SlowContains(addr)); |
4835 map_space_->Contains(addr) || cell_space_->Contains(addr) || | |
4836 lo_space_->SlowContains(addr)); | |
4837 } | 4796 } |
4838 | 4797 |
4839 | 4798 |
4840 bool Heap::InSpace(HeapObject* value, AllocationSpace space) { | 4799 bool Heap::InSpace(HeapObject* value, AllocationSpace space) { |
4841 return InSpace(value->address(), space); | 4800 return InSpace(value->address(), space); |
4842 } | 4801 } |
4843 | 4802 |
4844 | 4803 |
4845 bool Heap::InSpace(Address addr, AllocationSpace space) { | 4804 bool Heap::InSpace(Address addr, AllocationSpace space) { |
4846 if (isolate_->memory_allocator()->IsOutsideAllocatedSpace(addr)) return false; | 4805 if (isolate_->memory_allocator()->IsOutsideAllocatedSpace(addr)) return false; |
4847 if (!HasBeenSetUp()) return false; | 4806 if (!HasBeenSetUp()) return false; |
4848 | 4807 |
4849 switch (space) { | 4808 switch (space) { |
4850 case NEW_SPACE: | 4809 case NEW_SPACE: |
4851 return new_space_.ToSpaceContains(addr); | 4810 return new_space_.ToSpaceContains(addr); |
4852 case OLD_POINTER_SPACE: | 4811 case OLD_SPACE: |
4853 return old_pointer_space_->Contains(addr); | 4812 return old_space_->Contains(addr); |
4854 case OLD_DATA_SPACE: | |
4855 return old_data_space_->Contains(addr); | |
4856 case CODE_SPACE: | 4813 case CODE_SPACE: |
4857 return code_space_->Contains(addr); | 4814 return code_space_->Contains(addr); |
4858 case MAP_SPACE: | 4815 case MAP_SPACE: |
4859 return map_space_->Contains(addr); | 4816 return map_space_->Contains(addr); |
4860 case CELL_SPACE: | 4817 case CELL_SPACE: |
4861 return cell_space_->Contains(addr); | 4818 return cell_space_->Contains(addr); |
4862 case LO_SPACE: | 4819 case LO_SPACE: |
4863 return lo_space_->SlowContains(addr); | 4820 return lo_space_->SlowContains(addr); |
4864 } | 4821 } |
4865 UNREACHABLE(); | 4822 UNREACHABLE(); |
(...skipping 27 matching lines...) Expand all Loading... |
4893 } | 4850 } |
4894 | 4851 |
4895 VerifyPointersVisitor visitor; | 4852 VerifyPointersVisitor visitor; |
4896 IterateRoots(&visitor, VISIT_ONLY_STRONG); | 4853 IterateRoots(&visitor, VISIT_ONLY_STRONG); |
4897 | 4854 |
4898 VerifySmisVisitor smis_visitor; | 4855 VerifySmisVisitor smis_visitor; |
4899 IterateSmiRoots(&smis_visitor); | 4856 IterateSmiRoots(&smis_visitor); |
4900 | 4857 |
4901 new_space_.Verify(); | 4858 new_space_.Verify(); |
4902 | 4859 |
4903 old_pointer_space_->Verify(&visitor); | 4860 old_space_->Verify(&visitor); |
4904 map_space_->Verify(&visitor); | 4861 map_space_->Verify(&visitor); |
4905 | 4862 |
4906 VerifyPointersVisitor no_dirty_regions_visitor; | 4863 VerifyPointersVisitor no_dirty_regions_visitor; |
4907 old_data_space_->Verify(&no_dirty_regions_visitor); | |
4908 code_space_->Verify(&no_dirty_regions_visitor); | 4864 code_space_->Verify(&no_dirty_regions_visitor); |
4909 cell_space_->Verify(&no_dirty_regions_visitor); | 4865 cell_space_->Verify(&no_dirty_regions_visitor); |
4910 | 4866 |
4911 lo_space_->Verify(); | 4867 lo_space_->Verify(); |
4912 } | 4868 } |
4913 #endif | 4869 #endif |
4914 | 4870 |
4915 | 4871 |
4916 void Heap::ZapFromSpace() { | 4872 void Heap::ZapFromSpace() { |
4917 NewSpacePageIterator it(new_space_.FromSpaceStart(), | 4873 NewSpacePageIterator it(new_space_.FromSpaceStart(), |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5203 | 5159 |
5204 | 5160 |
5205 bool Heap::ConfigureHeapDefault() { return ConfigureHeap(0, 0, 0, 0); } | 5161 bool Heap::ConfigureHeapDefault() { return ConfigureHeap(0, 0, 0, 0); } |
5206 | 5162 |
5207 | 5163 |
5208 void Heap::RecordStats(HeapStats* stats, bool take_snapshot) { | 5164 void Heap::RecordStats(HeapStats* stats, bool take_snapshot) { |
5209 *stats->start_marker = HeapStats::kStartMarker; | 5165 *stats->start_marker = HeapStats::kStartMarker; |
5210 *stats->end_marker = HeapStats::kEndMarker; | 5166 *stats->end_marker = HeapStats::kEndMarker; |
5211 *stats->new_space_size = new_space_.SizeAsInt(); | 5167 *stats->new_space_size = new_space_.SizeAsInt(); |
5212 *stats->new_space_capacity = static_cast<int>(new_space_.Capacity()); | 5168 *stats->new_space_capacity = static_cast<int>(new_space_.Capacity()); |
5213 *stats->old_pointer_space_size = old_pointer_space_->SizeOfObjects(); | 5169 *stats->old_space_size = old_space_->SizeOfObjects(); |
5214 *stats->old_pointer_space_capacity = old_pointer_space_->Capacity(); | 5170 *stats->old_space_capacity = old_space_->Capacity(); |
5215 *stats->old_data_space_size = old_data_space_->SizeOfObjects(); | |
5216 *stats->old_data_space_capacity = old_data_space_->Capacity(); | |
5217 *stats->code_space_size = code_space_->SizeOfObjects(); | 5171 *stats->code_space_size = code_space_->SizeOfObjects(); |
5218 *stats->code_space_capacity = code_space_->Capacity(); | 5172 *stats->code_space_capacity = code_space_->Capacity(); |
5219 *stats->map_space_size = map_space_->SizeOfObjects(); | 5173 *stats->map_space_size = map_space_->SizeOfObjects(); |
5220 *stats->map_space_capacity = map_space_->Capacity(); | 5174 *stats->map_space_capacity = map_space_->Capacity(); |
5221 *stats->cell_space_size = cell_space_->SizeOfObjects(); | 5175 *stats->cell_space_size = cell_space_->SizeOfObjects(); |
5222 *stats->cell_space_capacity = cell_space_->Capacity(); | 5176 *stats->cell_space_capacity = cell_space_->Capacity(); |
5223 *stats->lo_space_size = lo_space_->Size(); | 5177 *stats->lo_space_size = lo_space_->Size(); |
5224 isolate_->global_handles()->RecordStats(stats); | 5178 isolate_->global_handles()->RecordStats(stats); |
5225 *stats->memory_allocator_size = isolate()->memory_allocator()->Size(); | 5179 *stats->memory_allocator_size = isolate()->memory_allocator()->Size(); |
5226 *stats->memory_allocator_capacity = | 5180 *stats->memory_allocator_capacity = |
5227 isolate()->memory_allocator()->Size() + | 5181 isolate()->memory_allocator()->Size() + |
5228 isolate()->memory_allocator()->Available(); | 5182 isolate()->memory_allocator()->Available(); |
5229 *stats->os_error = base::OS::GetLastError(); | 5183 *stats->os_error = base::OS::GetLastError(); |
5230 isolate()->memory_allocator()->Available(); | 5184 isolate()->memory_allocator()->Available(); |
5231 if (take_snapshot) { | 5185 if (take_snapshot) { |
5232 HeapIterator iterator(this); | 5186 HeapIterator iterator(this); |
5233 for (HeapObject* obj = iterator.next(); obj != NULL; | 5187 for (HeapObject* obj = iterator.next(); obj != NULL; |
5234 obj = iterator.next()) { | 5188 obj = iterator.next()) { |
5235 InstanceType type = obj->map()->instance_type(); | 5189 InstanceType type = obj->map()->instance_type(); |
5236 DCHECK(0 <= type && type <= LAST_TYPE); | 5190 DCHECK(0 <= type && type <= LAST_TYPE); |
5237 stats->objects_per_type[type]++; | 5191 stats->objects_per_type[type]++; |
5238 stats->size_per_type[type] += obj->Size(); | 5192 stats->size_per_type[type] += obj->Size(); |
5239 } | 5193 } |
5240 } | 5194 } |
5241 } | 5195 } |
5242 | 5196 |
5243 | 5197 |
5244 intptr_t Heap::PromotedSpaceSizeOfObjects() { | 5198 intptr_t Heap::PromotedSpaceSizeOfObjects() { |
5245 return old_pointer_space_->SizeOfObjects() + | 5199 return old_space_->SizeOfObjects() + code_space_->SizeOfObjects() + |
5246 old_data_space_->SizeOfObjects() + code_space_->SizeOfObjects() + | |
5247 map_space_->SizeOfObjects() + cell_space_->SizeOfObjects() + | 5200 map_space_->SizeOfObjects() + cell_space_->SizeOfObjects() + |
5248 lo_space_->SizeOfObjects(); | 5201 lo_space_->SizeOfObjects(); |
5249 } | 5202 } |
5250 | 5203 |
5251 | 5204 |
5252 int64_t Heap::PromotedExternalMemorySize() { | 5205 int64_t Heap::PromotedExternalMemorySize() { |
5253 if (amount_of_external_allocated_memory_ <= | 5206 if (amount_of_external_allocated_memory_ <= |
5254 amount_of_external_allocated_memory_at_last_global_gc_) | 5207 amount_of_external_allocated_memory_at_last_global_gc_) |
5255 return 0; | 5208 return 0; |
5256 return amount_of_external_allocated_memory_ - | 5209 return amount_of_external_allocated_memory_ - |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5360 // Set up memory allocator. | 5313 // Set up memory allocator. |
5361 if (!isolate_->memory_allocator()->SetUp(MaxReserved(), MaxExecutableSize())) | 5314 if (!isolate_->memory_allocator()->SetUp(MaxReserved(), MaxExecutableSize())) |
5362 return false; | 5315 return false; |
5363 | 5316 |
5364 // Set up new space. | 5317 // Set up new space. |
5365 if (!new_space_.SetUp(reserved_semispace_size_, max_semi_space_size_)) { | 5318 if (!new_space_.SetUp(reserved_semispace_size_, max_semi_space_size_)) { |
5366 return false; | 5319 return false; |
5367 } | 5320 } |
5368 new_space_top_after_last_gc_ = new_space()->top(); | 5321 new_space_top_after_last_gc_ = new_space()->top(); |
5369 | 5322 |
5370 // Initialize old pointer space. | 5323 // Initialize old space. |
5371 old_pointer_space_ = new OldSpace(this, max_old_generation_size_, | 5324 old_space_ = |
5372 OLD_POINTER_SPACE, NOT_EXECUTABLE); | 5325 new OldSpace(this, max_old_generation_size_, OLD_SPACE, NOT_EXECUTABLE); |
5373 if (old_pointer_space_ == NULL) return false; | 5326 if (old_space_ == NULL) return false; |
5374 if (!old_pointer_space_->SetUp()) return false; | 5327 if (!old_space_->SetUp()) return false; |
5375 | |
5376 // Initialize old data space. | |
5377 old_data_space_ = new OldSpace(this, max_old_generation_size_, OLD_DATA_SPACE, | |
5378 NOT_EXECUTABLE); | |
5379 if (old_data_space_ == NULL) return false; | |
5380 if (!old_data_space_->SetUp()) return false; | |
5381 | 5328 |
5382 if (!isolate_->code_range()->SetUp(code_range_size_)) return false; | 5329 if (!isolate_->code_range()->SetUp(code_range_size_)) return false; |
5383 | 5330 |
5384 // Initialize the code space, set its maximum capacity to the old | 5331 // Initialize the code space, set its maximum capacity to the old |
5385 // generation size. It needs executable memory. | 5332 // generation size. It needs executable memory. |
5386 code_space_ = | 5333 code_space_ = |
5387 new OldSpace(this, max_old_generation_size_, CODE_SPACE, EXECUTABLE); | 5334 new OldSpace(this, max_old_generation_size_, CODE_SPACE, EXECUTABLE); |
5388 if (code_space_ == NULL) return false; | 5335 if (code_space_ == NULL) return false; |
5389 if (!code_space_->SetUp()) return false; | 5336 if (!code_space_->SetUp()) return false; |
5390 | 5337 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5493 PrintF("total_sweeping_time=%.1f ", tracer_.cumulative_sweeping_duration()); | 5440 PrintF("total_sweeping_time=%.1f ", tracer_.cumulative_sweeping_duration()); |
5494 PrintF("\n\n"); | 5441 PrintF("\n\n"); |
5495 } | 5442 } |
5496 | 5443 |
5497 if (FLAG_print_max_heap_committed) { | 5444 if (FLAG_print_max_heap_committed) { |
5498 PrintF("\n"); | 5445 PrintF("\n"); |
5499 PrintF("maximum_committed_by_heap=%" V8_PTR_PREFIX "d ", | 5446 PrintF("maximum_committed_by_heap=%" V8_PTR_PREFIX "d ", |
5500 MaximumCommittedMemory()); | 5447 MaximumCommittedMemory()); |
5501 PrintF("maximum_committed_by_new_space=%" V8_PTR_PREFIX "d ", | 5448 PrintF("maximum_committed_by_new_space=%" V8_PTR_PREFIX "d ", |
5502 new_space_.MaximumCommittedMemory()); | 5449 new_space_.MaximumCommittedMemory()); |
5503 PrintF("maximum_committed_by_old_pointer_space=%" V8_PTR_PREFIX "d ", | 5450 PrintF("maximum_committed_by_old_space=%" V8_PTR_PREFIX "d ", |
5504 old_data_space_->MaximumCommittedMemory()); | 5451 old_space_->MaximumCommittedMemory()); |
5505 PrintF("maximum_committed_by_old_data_space=%" V8_PTR_PREFIX "d ", | |
5506 old_pointer_space_->MaximumCommittedMemory()); | |
5507 PrintF("maximum_committed_by_old_data_space=%" V8_PTR_PREFIX "d ", | |
5508 old_pointer_space_->MaximumCommittedMemory()); | |
5509 PrintF("maximum_committed_by_code_space=%" V8_PTR_PREFIX "d ", | 5452 PrintF("maximum_committed_by_code_space=%" V8_PTR_PREFIX "d ", |
5510 code_space_->MaximumCommittedMemory()); | 5453 code_space_->MaximumCommittedMemory()); |
5511 PrintF("maximum_committed_by_map_space=%" V8_PTR_PREFIX "d ", | 5454 PrintF("maximum_committed_by_map_space=%" V8_PTR_PREFIX "d ", |
5512 map_space_->MaximumCommittedMemory()); | 5455 map_space_->MaximumCommittedMemory()); |
5513 PrintF("maximum_committed_by_cell_space=%" V8_PTR_PREFIX "d ", | 5456 PrintF("maximum_committed_by_cell_space=%" V8_PTR_PREFIX "d ", |
5514 cell_space_->MaximumCommittedMemory()); | 5457 cell_space_->MaximumCommittedMemory()); |
5515 PrintF("maximum_committed_by_lo_space=%" V8_PTR_PREFIX "d ", | 5458 PrintF("maximum_committed_by_lo_space=%" V8_PTR_PREFIX "d ", |
5516 lo_space_->MaximumCommittedMemory()); | 5459 lo_space_->MaximumCommittedMemory()); |
5517 PrintF("\n\n"); | 5460 PrintF("\n\n"); |
5518 } | 5461 } |
5519 | 5462 |
5520 if (FLAG_verify_predictable) { | 5463 if (FLAG_verify_predictable) { |
5521 PrintAlloctionsHash(); | 5464 PrintAlloctionsHash(); |
5522 } | 5465 } |
5523 | 5466 |
5524 TearDownArrayBuffers(); | 5467 TearDownArrayBuffers(); |
5525 | 5468 |
5526 isolate_->global_handles()->TearDown(); | 5469 isolate_->global_handles()->TearDown(); |
5527 | 5470 |
5528 external_string_table_.TearDown(); | 5471 external_string_table_.TearDown(); |
5529 | 5472 |
5530 mark_compact_collector()->TearDown(); | 5473 mark_compact_collector()->TearDown(); |
5531 | 5474 |
5532 new_space_.TearDown(); | 5475 new_space_.TearDown(); |
5533 | 5476 |
5534 if (old_pointer_space_ != NULL) { | 5477 if (old_space_ != NULL) { |
5535 old_pointer_space_->TearDown(); | 5478 old_space_->TearDown(); |
5536 delete old_pointer_space_; | 5479 delete old_space_; |
5537 old_pointer_space_ = NULL; | 5480 old_space_ = NULL; |
5538 } | |
5539 | |
5540 if (old_data_space_ != NULL) { | |
5541 old_data_space_->TearDown(); | |
5542 delete old_data_space_; | |
5543 old_data_space_ = NULL; | |
5544 } | 5481 } |
5545 | 5482 |
5546 if (code_space_ != NULL) { | 5483 if (code_space_ != NULL) { |
5547 code_space_->TearDown(); | 5484 code_space_->TearDown(); |
5548 delete code_space_; | 5485 delete code_space_; |
5549 code_space_ = NULL; | 5486 code_space_ = NULL; |
5550 } | 5487 } |
5551 | 5488 |
5552 if (map_space_ != NULL) { | 5489 if (map_space_ != NULL) { |
5553 map_space_->TearDown(); | 5490 map_space_->TearDown(); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5688 void Heap::CheckHandleCount() { | 5625 void Heap::CheckHandleCount() { |
5689 CheckHandleCountVisitor v; | 5626 CheckHandleCountVisitor v; |
5690 isolate_->handle_scope_implementer()->Iterate(&v); | 5627 isolate_->handle_scope_implementer()->Iterate(&v); |
5691 } | 5628 } |
5692 | 5629 |
5693 | 5630 |
5694 Space* AllSpaces::next() { | 5631 Space* AllSpaces::next() { |
5695 switch (counter_++) { | 5632 switch (counter_++) { |
5696 case NEW_SPACE: | 5633 case NEW_SPACE: |
5697 return heap_->new_space(); | 5634 return heap_->new_space(); |
5698 case OLD_POINTER_SPACE: | 5635 case OLD_SPACE: |
5699 return heap_->old_pointer_space(); | 5636 return heap_->old_space(); |
5700 case OLD_DATA_SPACE: | |
5701 return heap_->old_data_space(); | |
5702 case CODE_SPACE: | 5637 case CODE_SPACE: |
5703 return heap_->code_space(); | 5638 return heap_->code_space(); |
5704 case MAP_SPACE: | 5639 case MAP_SPACE: |
5705 return heap_->map_space(); | 5640 return heap_->map_space(); |
5706 case CELL_SPACE: | 5641 case CELL_SPACE: |
5707 return heap_->cell_space(); | 5642 return heap_->cell_space(); |
5708 case LO_SPACE: | 5643 case LO_SPACE: |
5709 return heap_->lo_space(); | 5644 return heap_->lo_space(); |
5710 default: | 5645 default: |
5711 return NULL; | 5646 return NULL; |
5712 } | 5647 } |
5713 } | 5648 } |
5714 | 5649 |
5715 | 5650 |
5716 PagedSpace* PagedSpaces::next() { | 5651 PagedSpace* PagedSpaces::next() { |
5717 switch (counter_++) { | 5652 switch (counter_++) { |
5718 case OLD_POINTER_SPACE: | 5653 case OLD_SPACE: |
5719 return heap_->old_pointer_space(); | 5654 return heap_->old_space(); |
5720 case OLD_DATA_SPACE: | |
5721 return heap_->old_data_space(); | |
5722 case CODE_SPACE: | 5655 case CODE_SPACE: |
5723 return heap_->code_space(); | 5656 return heap_->code_space(); |
5724 case MAP_SPACE: | 5657 case MAP_SPACE: |
5725 return heap_->map_space(); | 5658 return heap_->map_space(); |
5726 case CELL_SPACE: | 5659 case CELL_SPACE: |
5727 return heap_->cell_space(); | 5660 return heap_->cell_space(); |
5728 default: | 5661 default: |
5729 return NULL; | 5662 return NULL; |
5730 } | 5663 } |
5731 } | 5664 } |
5732 | 5665 |
5733 | 5666 |
5734 OldSpace* OldSpaces::next() { | 5667 OldSpace* OldSpaces::next() { |
5735 switch (counter_++) { | 5668 switch (counter_++) { |
5736 case OLD_POINTER_SPACE: | 5669 case OLD_SPACE: |
5737 return heap_->old_pointer_space(); | 5670 return heap_->old_space(); |
5738 case OLD_DATA_SPACE: | |
5739 return heap_->old_data_space(); | |
5740 case CODE_SPACE: | 5671 case CODE_SPACE: |
5741 return heap_->code_space(); | 5672 return heap_->code_space(); |
5742 default: | 5673 default: |
5743 return NULL; | 5674 return NULL; |
5744 } | 5675 } |
5745 } | 5676 } |
5746 | 5677 |
5747 | 5678 |
5748 SpaceIterator::SpaceIterator(Heap* heap) | 5679 SpaceIterator::SpaceIterator(Heap* heap) |
5749 : heap_(heap), | 5680 : heap_(heap), |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5788 | 5719 |
5789 | 5720 |
5790 // Create an iterator for the space to iterate. | 5721 // Create an iterator for the space to iterate. |
5791 ObjectIterator* SpaceIterator::CreateIterator() { | 5722 ObjectIterator* SpaceIterator::CreateIterator() { |
5792 DCHECK(iterator_ == NULL); | 5723 DCHECK(iterator_ == NULL); |
5793 | 5724 |
5794 switch (current_space_) { | 5725 switch (current_space_) { |
5795 case NEW_SPACE: | 5726 case NEW_SPACE: |
5796 iterator_ = new SemiSpaceIterator(heap_->new_space(), size_func_); | 5727 iterator_ = new SemiSpaceIterator(heap_->new_space(), size_func_); |
5797 break; | 5728 break; |
5798 case OLD_POINTER_SPACE: | 5729 case OLD_SPACE: |
5799 iterator_ = | 5730 iterator_ = new HeapObjectIterator(heap_->old_space(), size_func_); |
5800 new HeapObjectIterator(heap_->old_pointer_space(), size_func_); | |
5801 break; | |
5802 case OLD_DATA_SPACE: | |
5803 iterator_ = new HeapObjectIterator(heap_->old_data_space(), size_func_); | |
5804 break; | 5731 break; |
5805 case CODE_SPACE: | 5732 case CODE_SPACE: |
5806 iterator_ = new HeapObjectIterator(heap_->code_space(), size_func_); | 5733 iterator_ = new HeapObjectIterator(heap_->code_space(), size_func_); |
5807 break; | 5734 break; |
5808 case MAP_SPACE: | 5735 case MAP_SPACE: |
5809 iterator_ = new HeapObjectIterator(heap_->map_space(), size_func_); | 5736 iterator_ = new HeapObjectIterator(heap_->map_space(), size_func_); |
5810 break; | 5737 break; |
5811 case CELL_SPACE: | 5738 case CELL_SPACE: |
5812 iterator_ = new HeapObjectIterator(heap_->cell_space(), size_func_); | 5739 iterator_ = new HeapObjectIterator(heap_->cell_space(), size_func_); |
5813 break; | 5740 break; |
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6435 static_cast<int>(object_sizes_last_time_[index])); | 6362 static_cast<int>(object_sizes_last_time_[index])); |
6436 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6363 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6437 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6364 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6438 | 6365 |
6439 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6366 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6440 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6367 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6441 ClearObjectStats(); | 6368 ClearObjectStats(); |
6442 } | 6369 } |
6443 } | 6370 } |
6444 } // namespace v8::internal | 6371 } // namespace v8::internal |
OLD | NEW |