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