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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 false)) { // Not executable. | 85 false)) { // Not executable. |
86 V8::FatalProcessOutOfMemory("StoreBuffer::SetUp"); | 86 V8::FatalProcessOutOfMemory("StoreBuffer::SetUp"); |
87 } | 87 } |
88 heap_->public_set_store_buffer_top(start_); | 88 heap_->public_set_store_buffer_top(start_); |
89 | 89 |
90 hash_set_1_ = new uintptr_t[kHashSetLength]; | 90 hash_set_1_ = new uintptr_t[kHashSetLength]; |
91 hash_set_2_ = new uintptr_t[kHashSetLength]; | 91 hash_set_2_ = new uintptr_t[kHashSetLength]; |
92 hash_sets_are_empty_ = false; | 92 hash_sets_are_empty_ = false; |
93 | 93 |
94 ClearFilteringHashSets(); | 94 ClearFilteringHashSets(); |
95 | |
96 heap_->isolate()->set_store_buffer_hash_set_1_address(hash_set_1_); | |
97 heap_->isolate()->set_store_buffer_hash_set_2_address(hash_set_2_); | |
98 } | 95 } |
99 | 96 |
100 | 97 |
101 void StoreBuffer::TearDown() { | 98 void StoreBuffer::TearDown() { |
102 delete virtual_memory_; | 99 delete virtual_memory_; |
103 delete old_virtual_memory_; | 100 delete old_virtual_memory_; |
104 delete[] hash_set_1_; | 101 delete[] hash_set_1_; |
105 delete[] hash_set_2_; | 102 delete[] hash_set_2_; |
106 old_start_ = old_top_ = old_limit_ = old_reserved_limit_ = NULL; | 103 old_start_ = old_top_ = old_limit_ = old_reserved_limit_ = NULL; |
107 start_ = limit_ = NULL; | 104 start_ = limit_ = NULL; |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 } | 519 } |
523 } | 520 } |
524 if (callback_ != NULL) { | 521 if (callback_ != NULL) { |
525 (*callback_)(heap_, NULL, kStoreBufferScanningPageEvent); | 522 (*callback_)(heap_, NULL, kStoreBufferScanningPageEvent); |
526 } | 523 } |
527 } | 524 } |
528 } | 525 } |
529 | 526 |
530 | 527 |
531 void StoreBuffer::Compact() { | 528 void StoreBuffer::Compact() { |
532 CHECK(hash_set_1_ == heap_->isolate()->store_buffer_hash_set_1_address()); | |
533 CHECK(hash_set_2_ == heap_->isolate()->store_buffer_hash_set_2_address()); | |
534 | |
535 Address* top = reinterpret_cast<Address*>(heap_->store_buffer_top()); | 529 Address* top = reinterpret_cast<Address*>(heap_->store_buffer_top()); |
536 | 530 |
537 if (top == start_) return; | 531 if (top == start_) return; |
538 | 532 |
539 // There's no check of the limit in the loop below so we check here for | 533 // There's no check of the limit in the loop below so we check here for |
540 // the worst case (compaction doesn't eliminate any pointers). | 534 // the worst case (compaction doesn't eliminate any pointers). |
541 DCHECK(top <= limit_); | 535 DCHECK(top <= limit_); |
542 heap_->public_set_store_buffer_top(start_); | 536 heap_->public_set_store_buffer_top(start_); |
543 EnsureSpace(top - start_); | 537 EnsureSpace(top - start_); |
544 DCHECK(may_move_store_buffer_entries_); | 538 DCHECK(may_move_store_buffer_entries_); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 } | 570 } |
577 old_buffer_is_sorted_ = false; | 571 old_buffer_is_sorted_ = false; |
578 old_buffer_is_filtered_ = false; | 572 old_buffer_is_filtered_ = false; |
579 *old_top_++ = reinterpret_cast<Address>(int_addr << kPointerSizeLog2); | 573 *old_top_++ = reinterpret_cast<Address>(int_addr << kPointerSizeLog2); |
580 DCHECK(old_top_ <= old_limit_); | 574 DCHECK(old_top_ <= old_limit_); |
581 } | 575 } |
582 heap_->isolate()->counters()->store_buffer_compactions()->Increment(); | 576 heap_->isolate()->counters()->store_buffer_compactions()->Increment(); |
583 } | 577 } |
584 } // namespace internal | 578 } // namespace internal |
585 } // namespace v8 | 579 } // namespace v8 |
OLD | NEW |