| 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 friend class StoreBufferRebuildScope; | 203 friend class StoreBufferRebuildScope; |
| 204 friend class DontMoveStoreBufferEntriesScope; | 204 friend class DontMoveStoreBufferEntriesScope; |
| 205 }; | 205 }; |
| 206 | 206 |
| 207 | 207 |
| 208 class StoreBufferRebuildScope { | 208 class StoreBufferRebuildScope { |
| 209 public: | 209 public: |
| 210 explicit StoreBufferRebuildScope(Heap* heap, | 210 explicit StoreBufferRebuildScope(Heap* heap, |
| 211 StoreBuffer* store_buffer, | 211 StoreBuffer* store_buffer, |
| 212 StoreBufferCallback callback) | 212 StoreBufferCallback callback) |
| 213 : heap_(heap), | 213 : store_buffer_(store_buffer), |
| 214 store_buffer_(store_buffer), | |
| 215 stored_state_(store_buffer->store_buffer_rebuilding_enabled_), | 214 stored_state_(store_buffer->store_buffer_rebuilding_enabled_), |
| 216 stored_callback_(store_buffer->callback_) { | 215 stored_callback_(store_buffer->callback_) { |
| 217 store_buffer_->store_buffer_rebuilding_enabled_ = true; | 216 store_buffer_->store_buffer_rebuilding_enabled_ = true; |
| 218 store_buffer_->callback_ = callback; | 217 store_buffer_->callback_ = callback; |
| 219 (*callback)(heap, NULL, kStoreBufferStartScanningPagesEvent); | 218 (*callback)(heap, NULL, kStoreBufferStartScanningPagesEvent); |
| 220 } | 219 } |
| 221 | 220 |
| 222 ~StoreBufferRebuildScope() { | 221 ~StoreBufferRebuildScope() { |
| 223 store_buffer_->callback_ = stored_callback_; | 222 store_buffer_->callback_ = stored_callback_; |
| 224 store_buffer_->store_buffer_rebuilding_enabled_ = stored_state_; | 223 store_buffer_->store_buffer_rebuilding_enabled_ = stored_state_; |
| 225 store_buffer_->CheckForFullBuffer(); | 224 store_buffer_->CheckForFullBuffer(); |
| 226 } | 225 } |
| 227 | 226 |
| 228 private: | 227 private: |
| 229 Heap* heap_; | |
| 230 StoreBuffer* store_buffer_; | 228 StoreBuffer* store_buffer_; |
| 231 bool stored_state_; | 229 bool stored_state_; |
| 232 StoreBufferCallback stored_callback_; | 230 StoreBufferCallback stored_callback_; |
| 233 }; | 231 }; |
| 234 | 232 |
| 235 | 233 |
| 236 class DontMoveStoreBufferEntriesScope { | 234 class DontMoveStoreBufferEntriesScope { |
| 237 public: | 235 public: |
| 238 explicit DontMoveStoreBufferEntriesScope(StoreBuffer* store_buffer) | 236 explicit DontMoveStoreBufferEntriesScope(StoreBuffer* store_buffer) |
| 239 : store_buffer_(store_buffer), | 237 : store_buffer_(store_buffer), |
| 240 stored_state_(store_buffer->may_move_store_buffer_entries_) { | 238 stored_state_(store_buffer->may_move_store_buffer_entries_) { |
| 241 store_buffer_->may_move_store_buffer_entries_ = false; | 239 store_buffer_->may_move_store_buffer_entries_ = false; |
| 242 } | 240 } |
| 243 | 241 |
| 244 ~DontMoveStoreBufferEntriesScope() { | 242 ~DontMoveStoreBufferEntriesScope() { |
| 245 store_buffer_->may_move_store_buffer_entries_ = stored_state_; | 243 store_buffer_->may_move_store_buffer_entries_ = stored_state_; |
| 246 } | 244 } |
| 247 | 245 |
| 248 private: | 246 private: |
| 249 StoreBuffer* store_buffer_; | 247 StoreBuffer* store_buffer_; |
| 250 bool stored_state_; | 248 bool stored_state_; |
| 251 }; | 249 }; |
| 252 | 250 |
| 253 } } // namespace v8::internal | 251 } } // namespace v8::internal |
| 254 | 252 |
| 255 #endif // V8_STORE_BUFFER_H_ | 253 #endif // V8_STORE_BUFFER_H_ |
| OLD | NEW |