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 "src/store-buffer.h" | 5 #include "src/store-buffer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "src/v8.h" | 9 #include "src/v8.h" |
10 | 10 |
11 #include "src/base/atomicops.h" | 11 #include "src/base/atomicops.h" |
12 #include "src/counters.h" | 12 #include "src/counters.h" |
13 #include "src/store-buffer-inl.h" | 13 #include "src/store-buffer-inl.h" |
| 14 #include "src/utils.h" |
14 | 15 |
15 namespace v8 { | 16 namespace v8 { |
16 namespace internal { | 17 namespace internal { |
17 | 18 |
18 StoreBuffer::StoreBuffer(Heap* heap) | 19 StoreBuffer::StoreBuffer(Heap* heap) |
19 : heap_(heap), | 20 : heap_(heap), |
20 start_(NULL), | 21 start_(NULL), |
21 limit_(NULL), | 22 limit_(NULL), |
22 old_start_(NULL), | 23 old_start_(NULL), |
23 old_limit_(NULL), | 24 old_limit_(NULL), |
(...skipping 20 matching lines...) Expand all Loading... |
44 uintptr_t start_as_int = | 45 uintptr_t start_as_int = |
45 reinterpret_cast<uintptr_t>(virtual_memory_->address()); | 46 reinterpret_cast<uintptr_t>(virtual_memory_->address()); |
46 start_ = | 47 start_ = |
47 reinterpret_cast<Address*>(RoundUp(start_as_int, kStoreBufferSize * 2)); | 48 reinterpret_cast<Address*>(RoundUp(start_as_int, kStoreBufferSize * 2)); |
48 limit_ = start_ + (kStoreBufferSize / kPointerSize); | 49 limit_ = start_ + (kStoreBufferSize / kPointerSize); |
49 | 50 |
50 // We set the maximum store buffer size to the maximum size of a semi-space. | 51 // We set the maximum store buffer size to the maximum size of a semi-space. |
51 // The store buffer may reach this limit during a full garbage collection. | 52 // The store buffer may reach this limit during a full garbage collection. |
52 // Note that half of the semi-space should be good enough since half of the | 53 // Note that half of the semi-space should be good enough since half of the |
53 // memory in the semi-space are not object pointers. | 54 // memory in the semi-space are not object pointers. |
54 old_store_buffer_length_ = heap_->MaxSemiSpaceSize() / sizeof(Address); | 55 old_store_buffer_length_ = |
| 56 Max(static_cast<int>(heap_->MaxSemiSpaceSize() / sizeof(Address)), |
| 57 kOldRegularStoreBufferLength); |
55 | 58 |
56 old_virtual_memory_ = | 59 old_virtual_memory_ = |
57 new base::VirtualMemory(old_store_buffer_length_ * kPointerSize); | 60 new base::VirtualMemory(old_store_buffer_length_ * kPointerSize); |
58 old_top_ = old_start_ = | 61 old_top_ = old_start_ = |
59 reinterpret_cast<Address*>(old_virtual_memory_->address()); | 62 reinterpret_cast<Address*>(old_virtual_memory_->address()); |
60 // Don't know the alignment requirements of the OS, but it is certainly not | 63 // Don't know the alignment requirements of the OS, but it is certainly not |
61 // less than 0xfff. | 64 // less than 0xfff. |
62 ASSERT((reinterpret_cast<uintptr_t>(old_start_) & 0xfff) == 0); | 65 ASSERT((reinterpret_cast<uintptr_t>(old_start_) & 0xfff) == 0); |
63 int initial_length = | 66 int initial_length = |
64 static_cast<int>(base::OS::CommitPageSize() / kPointerSize); | 67 static_cast<int>(base::OS::CommitPageSize() / kPointerSize); |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 } | 596 } |
594 old_buffer_is_sorted_ = false; | 597 old_buffer_is_sorted_ = false; |
595 old_buffer_is_filtered_ = false; | 598 old_buffer_is_filtered_ = false; |
596 *old_top_++ = reinterpret_cast<Address>(int_addr << kPointerSizeLog2); | 599 *old_top_++ = reinterpret_cast<Address>(int_addr << kPointerSizeLog2); |
597 ASSERT(old_top_ <= old_limit_); | 600 ASSERT(old_top_ <= old_limit_); |
598 } | 601 } |
599 heap_->isolate()->counters()->store_buffer_compactions()->Increment(); | 602 heap_->isolate()->counters()->store_buffer_compactions()->Increment(); |
600 } | 603 } |
601 | 604 |
602 } } // namespace v8::internal | 605 } } // namespace v8::internal |
OLD | NEW |