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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 DCHECK(top <= limit_); | 530 DCHECK(top <= limit_); |
531 heap_->public_set_store_buffer_top(start_); | 531 heap_->public_set_store_buffer_top(start_); |
532 EnsureSpace(top - start_); | 532 EnsureSpace(top - start_); |
533 DCHECK(may_move_store_buffer_entries_); | 533 DCHECK(may_move_store_buffer_entries_); |
534 // Goes through the addresses in the store buffer attempting to remove | 534 // Goes through the addresses in the store buffer attempting to remove |
535 // duplicates. In the interest of speed this is a lossy operation. Some | 535 // duplicates. In the interest of speed this is a lossy operation. Some |
536 // duplicates will remain. We have two hash sets with different hash | 536 // duplicates will remain. We have two hash sets with different hash |
537 // functions to reduce the number of unnecessary clashes. | 537 // functions to reduce the number of unnecessary clashes. |
538 hash_sets_are_empty_ = false; // Hash sets are in use. | 538 hash_sets_are_empty_ = false; // Hash sets are in use. |
539 for (Address* current = start_; current < top; current++) { | 539 for (Address* current = start_; current < top; current++) { |
540 DCHECK(!heap_->cell_space()->Contains(*current)); | |
541 DCHECK(!heap_->code_space()->Contains(*current)); | 540 DCHECK(!heap_->code_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)) & |
(...skipping 15 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 |