OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 78 |
79 // Iterates over all pointers that go from old space to new space. It will | 79 // Iterates over all pointers that go from old space to new space. It will |
80 // delete the store buffer as it starts so the callback should reenter | 80 // delete the store buffer as it starts so the callback should reenter |
81 // surviving old-to-new pointers into the store buffer to rebuild it. | 81 // surviving old-to-new pointers into the store buffer to rebuild it. |
82 void IteratePointersToNewSpace(ObjectSlotCallback callback); | 82 void IteratePointersToNewSpace(ObjectSlotCallback callback); |
83 | 83 |
84 static const int kStoreBufferOverflowBit = 1 << (14 + kPointerSizeLog2); | 84 static const int kStoreBufferOverflowBit = 1 << (14 + kPointerSizeLog2); |
85 static const int kStoreBufferSize = kStoreBufferOverflowBit; | 85 static const int kStoreBufferSize = kStoreBufferOverflowBit; |
86 static const int kStoreBufferLength = kStoreBufferSize / sizeof(Address); | 86 static const int kStoreBufferLength = kStoreBufferSize / sizeof(Address); |
87 static const int kOldStoreBufferLength = kStoreBufferLength * 16; | 87 static const int kOldStoreBufferLength = kStoreBufferLength * 16; |
| 88 static const int kInitialOldStoreBufferLength = kOldStoreBufferLength >> 9; |
88 static const int kHashMapLengthLog2 = 12; | 89 static const int kHashMapLengthLog2 = 12; |
89 static const int kHashMapLength = 1 << kHashMapLengthLog2; | 90 static const int kHashMapLength = 1 << kHashMapLengthLog2; |
90 | 91 |
91 void Compact(); | 92 void Compact(); |
92 | 93 |
93 void GCPrologue(); | 94 void GCPrologue(); |
94 void GCEpilogue(); | 95 void GCEpilogue(); |
95 | 96 |
96 Object*** Limit() { return reinterpret_cast<Object***>(old_limit_); } | 97 Object*** Limit() { return reinterpret_cast<Object***>(old_limit_); } |
97 Object*** Start() { return reinterpret_cast<Object***>(old_start_); } | 98 Object*** Start() { return reinterpret_cast<Object***>(old_start_); } |
98 Object*** Top() { return reinterpret_cast<Object***>(old_top_); } | 99 Object*** Top() { return reinterpret_cast<Object***>(old_top_); } |
99 void SetTop(Object*** top) { | 100 void SetTop(Object*** top) { |
100 ASSERT(top >= Start()); | 101 ASSERT(top >= Start()); |
101 ASSERT(top <= Limit()); | 102 ASSERT(top <= Limit()); |
102 old_top_ = reinterpret_cast<Address*>(top); | 103 old_top_ = reinterpret_cast<Address*>(top); |
103 } | 104 } |
104 | 105 |
105 bool old_buffer_is_sorted() { return old_buffer_is_sorted_; } | 106 bool old_buffer_is_sorted() { return old_buffer_is_sorted_; } |
106 bool old_buffer_is_filtered() { return old_buffer_is_filtered_; } | 107 bool old_buffer_is_filtered() { return old_buffer_is_filtered_; } |
107 | 108 |
108 // Goes through the store buffer removing pointers to things that have | 109 // Goes through the store buffer removing pointers to things that have |
109 // been promoted. Rebuilds the store buffer completely if it overflowed. | 110 // been promoted. Rebuilds the store buffer completely if it overflowed. |
110 void SortUniq(); | 111 void SortUniq(); |
111 | 112 |
112 void HandleFullness(); | 113 void EnsureSpace(intptr_t space_needed); |
113 void Verify(); | 114 void Verify(); |
114 | 115 |
115 bool PrepareForIteration(); | 116 bool PrepareForIteration(); |
116 | 117 |
117 #ifdef DEBUG | 118 #ifdef DEBUG |
118 void Clean(); | 119 void Clean(); |
119 // Slow, for asserts only. | 120 // Slow, for asserts only. |
120 bool CellIsInStoreBuffer(Address cell); | 121 bool CellIsInStoreBuffer(Address cell); |
121 #endif | 122 #endif |
122 | 123 |
123 void Filter(int flag); | 124 void Filter(int flag); |
124 | 125 |
125 private: | 126 private: |
126 Heap* heap_; | 127 Heap* heap_; |
127 | 128 |
128 // The store buffer is divided up into a new buffer that is constantly being | 129 // The store buffer is divided up into a new buffer that is constantly being |
129 // filled by mutator activity and an old buffer that is filled with the data | 130 // filled by mutator activity and an old buffer that is filled with the data |
130 // from the new buffer after compression. | 131 // from the new buffer after compression. |
131 Address* start_; | 132 Address* start_; |
132 Address* limit_; | 133 Address* limit_; |
133 | 134 |
134 Address* old_start_; | 135 Address* old_start_; |
135 Address* old_limit_; | 136 Address* old_limit_; |
136 Address* old_top_; | 137 Address* old_top_; |
| 138 Address* old_reserved_limit_; |
| 139 VirtualMemory* old_virtual_memory_; |
137 | 140 |
138 bool old_buffer_is_sorted_; | 141 bool old_buffer_is_sorted_; |
139 bool old_buffer_is_filtered_; | 142 bool old_buffer_is_filtered_; |
140 bool during_gc_; | 143 bool during_gc_; |
141 // The garbage collector iterates over many pointers to new space that are not | 144 // The garbage collector iterates over many pointers to new space that are not |
142 // handled by the store buffer. This flag indicates whether the pointers | 145 // handled by the store buffer. This flag indicates whether the pointers |
143 // found by the callbacks should be added to the store buffer or not. | 146 // found by the callbacks should be added to the store buffer or not. |
144 bool store_buffer_rebuilding_enabled_; | 147 bool store_buffer_rebuilding_enabled_; |
145 StoreBufferCallback callback_; | 148 StoreBufferCallback callback_; |
146 bool may_move_store_buffer_entries_; | 149 bool may_move_store_buffer_entries_; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 } | 242 } |
240 | 243 |
241 private: | 244 private: |
242 StoreBuffer* store_buffer_; | 245 StoreBuffer* store_buffer_; |
243 bool stored_state_; | 246 bool stored_state_; |
244 }; | 247 }; |
245 | 248 |
246 } } // namespace v8::internal | 249 } } // namespace v8::internal |
247 | 250 |
248 #endif // V8_STORE_BUFFER_H_ | 251 #endif // V8_STORE_BUFFER_H_ |
OLD | NEW |