| 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 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 DCHECK(top <= limit_); | 529 DCHECK(top <= limit_); |
| 530 heap_->public_set_store_buffer_top(start_); | 530 heap_->public_set_store_buffer_top(start_); |
| 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)); | |
| 540 DCHECK(!heap_->code_space()->Contains(*current)); | 539 DCHECK(!heap_->code_space()->Contains(*current)); |
| 541 uintptr_t int_addr = reinterpret_cast<uintptr_t>(*current); | 540 uintptr_t int_addr = reinterpret_cast<uintptr_t>(*current); |
| 542 // Shift out the last bits including any tags. | 541 // Shift out the last bits including any tags. |
| 543 int_addr >>= kPointerSizeLog2; | 542 int_addr >>= kPointerSizeLog2; |
| 544 // The upper part of an address is basically random because of ASLR and OS | 543 // The upper part of an address is basically random because of ASLR and OS |
| 545 // non-determinism, so we use only the bits within a page for hashing to | 544 // non-determinism, so we use only the bits within a page for hashing to |
| 546 // make v8's behavior (more) deterministic. | 545 // make v8's behavior (more) deterministic. |
| 547 uintptr_t hash_addr = | 546 uintptr_t hash_addr = |
| 548 int_addr & (Page::kPageAlignmentMask >> kPointerSizeLog2); | 547 int_addr & (Page::kPageAlignmentMask >> kPointerSizeLog2); |
| 549 int hash1 = ((hash_addr ^ (hash_addr >> kHashSetLengthLog2)) & | 548 int hash1 = ((hash_addr ^ (hash_addr >> kHashSetLengthLog2)) & |
| (...skipping 15 matching lines...) Expand all Loading... |
| 565 } | 564 } |
| 566 old_buffer_is_sorted_ = false; | 565 old_buffer_is_sorted_ = false; |
| 567 old_buffer_is_filtered_ = false; | 566 old_buffer_is_filtered_ = false; |
| 568 *old_top_++ = reinterpret_cast<Address>(int_addr << kPointerSizeLog2); | 567 *old_top_++ = reinterpret_cast<Address>(int_addr << kPointerSizeLog2); |
| 569 DCHECK(old_top_ <= old_limit_); | 568 DCHECK(old_top_ <= old_limit_); |
| 570 } | 569 } |
| 571 heap_->isolate()->counters()->store_buffer_compactions()->Increment(); | 570 heap_->isolate()->counters()->store_buffer_compactions()->Increment(); |
| 572 } | 571 } |
| 573 } | 572 } |
| 574 } // namespace v8::internal | 573 } // namespace v8::internal |
| OLD | NEW |