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 #ifndef V8_STORE_BUFFER_INL_H_ | 5 #ifndef V8_STORE_BUFFER_INL_H_ |
6 #define V8_STORE_BUFFER_INL_H_ | 6 #define V8_STORE_BUFFER_INL_H_ |
7 | 7 |
8 #include "src/heap/heap.h" | 8 #include "src/heap/heap.h" |
9 #include "src/heap/spaces-inl.h" | 9 #include "src/heap/spaces-inl.h" |
10 #include "src/heap/store-buffer.h" | 10 #include "src/heap/store-buffer.h" |
11 | 11 |
12 namespace v8 { | 12 namespace v8 { |
13 namespace internal { | 13 namespace internal { |
14 | 14 |
15 Address StoreBuffer::TopAddress() { | |
16 return reinterpret_cast<Address>(heap_->store_buffer_top_address()); | |
17 } | |
18 | |
19 | |
20 void StoreBuffer::Mark(Address addr) { | 15 void StoreBuffer::Mark(Address addr) { |
21 DCHECK(!heap_->code_space()->Contains(addr)); | 16 DCHECK(!heap_->code_space()->Contains(addr)); |
22 Address* top = reinterpret_cast<Address*>(heap_->store_buffer_top()); | 17 Address* top = reinterpret_cast<Address*>(heap_->store_buffer_top()); |
23 *top++ = addr; | 18 *top++ = addr; |
24 heap_->public_set_store_buffer_top(top); | 19 heap_->set_store_buffer_top(reinterpret_cast<Smi*>(top)); |
25 if ((reinterpret_cast<uintptr_t>(top) & kStoreBufferOverflowBit) != 0) { | 20 if ((reinterpret_cast<uintptr_t>(top) & kStoreBufferOverflowBit) != 0) { |
26 DCHECK(top == limit_); | 21 DCHECK(top == limit_); |
27 Compact(); | 22 Compact(); |
28 } else { | 23 } else { |
29 DCHECK(top < limit_); | 24 DCHECK(top < limit_); |
30 } | 25 } |
31 } | 26 } |
32 | 27 |
33 | 28 |
34 void StoreBuffer::EnterDirectlyIntoStoreBuffer(Address addr) { | 29 void StoreBuffer::EnterDirectlyIntoStoreBuffer(Address addr) { |
35 if (store_buffer_rebuilding_enabled_) { | 30 if (store_buffer_rebuilding_enabled_) { |
36 SLOW_DCHECK(!heap_->code_space()->Contains(addr) && | 31 SLOW_DCHECK(!heap_->code_space()->Contains(addr) && |
37 !heap_->new_space()->Contains(addr)); | 32 !heap_->new_space()->Contains(addr)); |
38 Address* top = old_top_; | 33 Address* top = old_top_; |
39 *top++ = addr; | 34 *top++ = addr; |
40 old_top_ = top; | 35 old_top_ = top; |
41 old_buffer_is_sorted_ = false; | 36 old_buffer_is_sorted_ = false; |
42 old_buffer_is_filtered_ = false; | 37 old_buffer_is_filtered_ = false; |
43 if (top >= old_limit_) { | 38 if (top >= old_limit_) { |
44 DCHECK(callback_ != NULL); | 39 DCHECK(callback_ != NULL); |
45 (*callback_)(heap_, MemoryChunk::FromAnyPointerAddress(heap_, addr), | 40 (*callback_)(heap_, MemoryChunk::FromAnyPointerAddress(heap_, addr), |
46 kStoreBufferFullEvent); | 41 kStoreBufferFullEvent); |
47 } | 42 } |
48 } | 43 } |
49 } | 44 } |
50 } | 45 } |
51 } // namespace v8::internal | 46 } // namespace v8::internal |
52 | 47 |
53 #endif // V8_STORE_BUFFER_INL_H_ | 48 #endif // V8_STORE_BUFFER_INL_H_ |
OLD | NEW |