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/store-buffer.h" | 8 #include "src/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 ASSERT(!heap_->cell_space()->Contains(addr)); | 19 DCHECK(!heap_->cell_space()->Contains(addr)); |
20 ASSERT(!heap_->code_space()->Contains(addr)); | 20 DCHECK(!heap_->code_space()->Contains(addr)); |
21 ASSERT(!heap_->old_data_space()->Contains(addr)); | 21 DCHECK(!heap_->old_data_space()->Contains(addr)); |
22 Address* top = reinterpret_cast<Address*>(heap_->store_buffer_top()); | 22 Address* top = reinterpret_cast<Address*>(heap_->store_buffer_top()); |
23 *top++ = addr; | 23 *top++ = addr; |
24 heap_->public_set_store_buffer_top(top); | 24 heap_->public_set_store_buffer_top(top); |
25 if ((reinterpret_cast<uintptr_t>(top) & kStoreBufferOverflowBit) != 0) { | 25 if ((reinterpret_cast<uintptr_t>(top) & kStoreBufferOverflowBit) != 0) { |
26 ASSERT(top == limit_); | 26 DCHECK(top == limit_); |
27 Compact(); | 27 Compact(); |
28 } else { | 28 } else { |
29 ASSERT(top < limit_); | 29 DCHECK(top < limit_); |
30 } | 30 } |
31 } | 31 } |
32 | 32 |
33 | 33 |
34 void StoreBuffer::EnterDirectlyIntoStoreBuffer(Address addr) { | 34 void StoreBuffer::EnterDirectlyIntoStoreBuffer(Address addr) { |
35 if (store_buffer_rebuilding_enabled_) { | 35 if (store_buffer_rebuilding_enabled_) { |
36 SLOW_ASSERT(!heap_->cell_space()->Contains(addr) && | 36 SLOW_DCHECK(!heap_->cell_space()->Contains(addr) && |
37 !heap_->code_space()->Contains(addr) && | 37 !heap_->code_space()->Contains(addr) && |
38 !heap_->old_data_space()->Contains(addr) && | 38 !heap_->old_data_space()->Contains(addr) && |
39 !heap_->new_space()->Contains(addr)); | 39 !heap_->new_space()->Contains(addr)); |
40 Address* top = old_top_; | 40 Address* top = old_top_; |
41 *top++ = addr; | 41 *top++ = addr; |
42 old_top_ = top; | 42 old_top_ = top; |
43 old_buffer_is_sorted_ = false; | 43 old_buffer_is_sorted_ = false; |
44 old_buffer_is_filtered_ = false; | 44 old_buffer_is_filtered_ = false; |
45 if (top >= old_limit_) { | 45 if (top >= old_limit_) { |
46 ASSERT(callback_ != NULL); | 46 DCHECK(callback_ != NULL); |
47 (*callback_)(heap_, | 47 (*callback_)(heap_, |
48 MemoryChunk::FromAnyPointerAddress(heap_, addr), | 48 MemoryChunk::FromAnyPointerAddress(heap_, addr), |
49 kStoreBufferFullEvent); | 49 kStoreBufferFullEvent); |
50 } | 50 } |
51 } | 51 } |
52 } | 52 } |
53 | 53 |
54 | 54 |
55 void StoreBuffer::ClearDeadObject(HeapObject* object) { | 55 void StoreBuffer::ClearDeadObject(HeapObject* object) { |
56 Address& map_field = Memory::Address_at(object->address()); | 56 Address& map_field = Memory::Address_at(object->address()); |
57 if (heap_->map_space()->Contains(map_field)) { | 57 if (heap_->map_space()->Contains(map_field)) { |
58 map_field = NULL; | 58 map_field = NULL; |
59 } | 59 } |
60 } | 60 } |
61 | 61 |
62 | 62 |
63 } } // namespace v8::internal | 63 } } // namespace v8::internal |
64 | 64 |
65 #endif // V8_STORE_BUFFER_INL_H_ | 65 #endif // V8_STORE_BUFFER_INL_H_ |
OLD | NEW |