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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #include "src/counters.h" | 9 #include "src/counters.h" |
10 #include "src/heap/store-buffer-inl.h" | 10 #include "src/heap/store-buffer-inl.h" |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 // TODO(hpayer): This may introduce a huge pause here. We | 476 // TODO(hpayer): This may introduce a huge pause here. We |
477 // just care about finish sweeping of the scan on scavenge page. | 477 // just care about finish sweeping of the scan on scavenge page. |
478 heap_->mark_compact_collector()->EnsureSweepingCompleted(); | 478 heap_->mark_compact_collector()->EnsureSweepingCompleted(); |
479 } | 479 } |
480 } | 480 } |
481 CHECK(page->owner() == heap_->old_space()); | 481 CHECK(page->owner() == heap_->old_space()); |
482 HeapObjectIterator iterator(page, NULL); | 482 HeapObjectIterator iterator(page, NULL); |
483 for (HeapObject* heap_object = iterator.Next(); heap_object != NULL; | 483 for (HeapObject* heap_object = iterator.Next(); heap_object != NULL; |
484 heap_object = iterator.Next()) { | 484 heap_object = iterator.Next()) { |
485 // We iterate over objects that contain new space pointers only. | 485 // We iterate over objects that contain new space pointers only. |
486 bool may_contain_raw_values = heap_object->MayContainRawValues(); | 486 Address obj_address = heap_object->address(); |
487 if (!may_contain_raw_values) { | 487 const int start_offset = HeapObject::kHeaderSize; |
488 Address obj_address = heap_object->address(); | 488 const int end_offset = heap_object->Size(); |
489 const int start_offset = HeapObject::kHeaderSize; | |
490 const int end_offset = heap_object->Size(); | |
491 #if V8_DOUBLE_FIELDS_UNBOXING | |
492 LayoutDescriptorHelper helper(heap_object->map()); | |
493 bool has_only_tagged_fields = helper.all_fields_tagged(); | |
494 | 489 |
495 if (!has_only_tagged_fields) { | 490 switch (heap_object->ContentType()) { |
496 for (int offset = start_offset; offset < end_offset;) { | 491 case HeapObjectContents::kTaggedValues: { |
497 int end_of_region_offset; | |
498 if (helper.IsTagged(offset, end_offset, | |
499 &end_of_region_offset)) { | |
500 FindPointersToNewSpaceInRegion( | |
501 obj_address + offset, | |
502 obj_address + end_of_region_offset, slot_callback); | |
503 } | |
504 offset = end_of_region_offset; | |
505 } | |
506 } else { | |
507 #endif | |
508 Address start_address = obj_address + start_offset; | 492 Address start_address = obj_address + start_offset; |
509 Address end_address = obj_address + end_offset; | 493 Address end_address = obj_address + end_offset; |
510 // Object has only tagged fields. | 494 // Object has only tagged fields. |
511 FindPointersToNewSpaceInRegion(start_address, end_address, | 495 FindPointersToNewSpaceInRegion(start_address, end_address, |
512 slot_callback); | 496 slot_callback); |
513 #if V8_DOUBLE_FIELDS_UNBOXING | 497 break; |
514 } | 498 } |
515 #endif | 499 |
| 500 case HeapObjectContents::kMixedValues: { |
| 501 if (FLAG_unbox_double_fields) { |
| 502 LayoutDescriptorHelper helper(heap_object->map()); |
| 503 DCHECK(!helper.all_fields_tagged()); |
| 504 for (int offset = start_offset; offset < end_offset;) { |
| 505 int end_of_region_offset; |
| 506 if (helper.IsTagged(offset, end_offset, |
| 507 &end_of_region_offset)) { |
| 508 FindPointersToNewSpaceInRegion( |
| 509 obj_address + offset, |
| 510 obj_address + end_of_region_offset, slot_callback); |
| 511 } |
| 512 offset = end_of_region_offset; |
| 513 } |
| 514 } else { |
| 515 UNREACHABLE(); |
| 516 } |
| 517 break; |
| 518 } |
| 519 |
| 520 case HeapObjectContents::kRawValues: |
| 521 break; |
516 } | 522 } |
517 } | 523 } |
518 } | 524 } |
519 } | 525 } |
520 } | 526 } |
521 } | 527 } |
522 if (callback_ != NULL) { | 528 if (callback_ != NULL) { |
523 (*callback_)(heap_, NULL, kStoreBufferScanningPageEvent); | 529 (*callback_)(heap_, NULL, kStoreBufferScanningPageEvent); |
524 } | 530 } |
525 } | 531 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 } | 580 } |
575 old_buffer_is_sorted_ = false; | 581 old_buffer_is_sorted_ = false; |
576 old_buffer_is_filtered_ = false; | 582 old_buffer_is_filtered_ = false; |
577 *old_top_++ = reinterpret_cast<Address>(int_addr << kPointerSizeLog2); | 583 *old_top_++ = reinterpret_cast<Address>(int_addr << kPointerSizeLog2); |
578 DCHECK(old_top_ <= old_limit_); | 584 DCHECK(old_top_ <= old_limit_); |
579 } | 585 } |
580 heap_->isolate()->counters()->store_buffer_compactions()->Increment(); | 586 heap_->isolate()->counters()->store_buffer_compactions()->Increment(); |
581 } | 587 } |
582 } // namespace internal | 588 } // namespace internal |
583 } // namespace v8 | 589 } // namespace v8 |
OLD | NEW |