| 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 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 if (!page->SweepingCompleted()) { | 461 if (!page->SweepingCompleted()) { |
| 462 heap_->mark_compact_collector()->SweepInParallel(page, owner); | 462 heap_->mark_compact_collector()->SweepInParallel(page, owner); |
| 463 if (!page->SweepingCompleted()) { | 463 if (!page->SweepingCompleted()) { |
| 464 // We were not able to sweep that page, i.e., a concurrent | 464 // We were not able to sweep that page, i.e., a concurrent |
| 465 // sweeper thread currently owns this page. | 465 // sweeper thread currently owns this page. |
| 466 // TODO(hpayer): This may introduce a huge pause here. We | 466 // TODO(hpayer): This may introduce a huge pause here. We |
| 467 // just care about finish sweeping of the scan on scavenge page. | 467 // just care about finish sweeping of the scan on scavenge page. |
| 468 heap_->mark_compact_collector()->EnsureSweepingCompleted(); | 468 heap_->mark_compact_collector()->EnsureSweepingCompleted(); |
| 469 } | 469 } |
| 470 } | 470 } |
| 471 CHECK(page->owner() == heap_->old_pointer_space()); | 471 CHECK(page->owner() == heap_->old_space()); |
| 472 HeapObjectIterator iterator(page, NULL); | 472 HeapObjectIterator iterator(page, NULL); |
| 473 for (HeapObject* heap_object = iterator.Next(); heap_object != NULL; | 473 for (HeapObject* heap_object = iterator.Next(); heap_object != NULL; |
| 474 heap_object = iterator.Next()) { | 474 heap_object = iterator.Next()) { |
| 475 // We iterate over objects that contain new space pointers only. | 475 // We iterate over objects that contain new space pointers only. |
| 476 bool may_contain_raw_values = heap_object->MayContainRawValues(); | 476 bool may_contain_raw_values = heap_object->MayContainRawValues(); |
| 477 if (!may_contain_raw_values) { | 477 if (!may_contain_raw_values) { |
| 478 Address obj_address = heap_object->address(); | 478 Address obj_address = heap_object->address(); |
| 479 const int start_offset = HeapObject::kHeaderSize; | 479 const int start_offset = HeapObject::kHeaderSize; |
| 480 const int end_offset = heap_object->Size(); | 480 const int end_offset = heap_object->Size(); |
| 481 #if V8_DOUBLE_FIELDS_UNBOXING | 481 #if V8_DOUBLE_FIELDS_UNBOXING |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 EnsureSpace(top - start_); | 531 EnsureSpace(top - start_); |
| 532 DCHECK(may_move_store_buffer_entries_); | 532 DCHECK(may_move_store_buffer_entries_); |
| 533 // Goes through the addresses in the store buffer attempting to remove | 533 // Goes through the addresses in the store buffer attempting to remove |
| 534 // duplicates. In the interest of speed this is a lossy operation. Some | 534 // duplicates. In the interest of speed this is a lossy operation. Some |
| 535 // duplicates will remain. We have two hash sets with different hash | 535 // duplicates will remain. We have two hash sets with different hash |
| 536 // functions to reduce the number of unnecessary clashes. | 536 // functions to reduce the number of unnecessary clashes. |
| 537 hash_sets_are_empty_ = false; // Hash sets are in use. | 537 hash_sets_are_empty_ = false; // Hash sets are in use. |
| 538 for (Address* current = start_; current < top; current++) { | 538 for (Address* current = start_; current < top; current++) { |
| 539 DCHECK(!heap_->cell_space()->Contains(*current)); | 539 DCHECK(!heap_->cell_space()->Contains(*current)); |
| 540 DCHECK(!heap_->code_space()->Contains(*current)); | 540 DCHECK(!heap_->code_space()->Contains(*current)); |
| 541 DCHECK(!heap_->old_data_space()->Contains(*current)); | |
| 542 uintptr_t int_addr = reinterpret_cast<uintptr_t>(*current); | 541 uintptr_t int_addr = reinterpret_cast<uintptr_t>(*current); |
| 543 // Shift out the last bits including any tags. | 542 // Shift out the last bits including any tags. |
| 544 int_addr >>= kPointerSizeLog2; | 543 int_addr >>= kPointerSizeLog2; |
| 545 // The upper part of an address is basically random because of ASLR and OS | 544 // The upper part of an address is basically random because of ASLR and OS |
| 546 // non-determinism, so we use only the bits within a page for hashing to | 545 // non-determinism, so we use only the bits within a page for hashing to |
| 547 // make v8's behavior (more) deterministic. | 546 // make v8's behavior (more) deterministic. |
| 548 uintptr_t hash_addr = | 547 uintptr_t hash_addr = |
| 549 int_addr & (Page::kPageAlignmentMask >> kPointerSizeLog2); | 548 int_addr & (Page::kPageAlignmentMask >> kPointerSizeLog2); |
| 550 int hash1 = ((hash_addr ^ (hash_addr >> kHashSetLengthLog2)) & | 549 int hash1 = ((hash_addr ^ (hash_addr >> kHashSetLengthLog2)) & |
| 551 (kHashSetLength - 1)); | 550 (kHashSetLength - 1)); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 566 } | 565 } |
| 567 old_buffer_is_sorted_ = false; | 566 old_buffer_is_sorted_ = false; |
| 568 old_buffer_is_filtered_ = false; | 567 old_buffer_is_filtered_ = false; |
| 569 *old_top_++ = reinterpret_cast<Address>(int_addr << kPointerSizeLog2); | 568 *old_top_++ = reinterpret_cast<Address>(int_addr << kPointerSizeLog2); |
| 570 DCHECK(old_top_ <= old_limit_); | 569 DCHECK(old_top_ <= old_limit_); |
| 571 } | 570 } |
| 572 heap_->isolate()->counters()->store_buffer_compactions()->Increment(); | 571 heap_->isolate()->counters()->store_buffer_compactions()->Increment(); |
| 573 } | 572 } |
| 574 } | 573 } |
| 575 } // namespace v8::internal | 574 } // namespace v8::internal |
| OLD | NEW |