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_H_ | 5 #ifndef V8_STORE_BUFFER_H_ |
6 #define V8_STORE_BUFFER_H_ | 6 #define V8_STORE_BUFFER_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/base/logging.h" | 9 #include "src/base/logging.h" |
10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
11 #include "src/globals.h" | 11 #include "src/globals.h" |
12 #include "src/heap/slot-set.h" | 12 #include "src/heap/slot-set.h" |
13 | 13 |
14 namespace v8 { | 14 namespace v8 { |
15 namespace internal { | 15 namespace internal { |
16 | 16 |
17 // Intermediate buffer that accumulates old-to-new stores from the generated | 17 // Intermediate buffer that accumulates old-to-new stores from the generated |
18 // code. On buffer overflow the slots are moved to the remembered set. | 18 // code. On buffer overflow the slots are moved to the remembered set. |
19 class StoreBuffer { | 19 class StoreBuffer { |
20 public: | 20 public: |
21 static const int kStoreBufferOverflowBit = 1 << (14 + kPointerSizeLog2); | 21 static const int kStoreBufferSize = 1 << (14 + kPointerSizeLog2); |
22 static const int kStoreBufferSize = kStoreBufferOverflowBit; | 22 static const int kStoreBufferMask = kStoreBufferSize - 1; |
23 static const int kStoreBufferLength = kStoreBufferSize / sizeof(Address); | |
24 | 23 |
25 static void StoreBufferOverflow(Isolate* isolate); | 24 static void StoreBufferOverflow(Isolate* isolate); |
26 | 25 |
27 explicit StoreBuffer(Heap* heap); | 26 explicit StoreBuffer(Heap* heap); |
28 void SetUp(); | 27 void SetUp(); |
29 void TearDown(); | 28 void TearDown(); |
30 | 29 |
31 // Used to add entries from generated code. | 30 // Used to add entries from generated code. |
32 inline Address* top_address() { return reinterpret_cast<Address*>(&top_); } | 31 inline Address* top_address() { return reinterpret_cast<Address*>(&top_); } |
33 | 32 |
34 void MoveEntriesToRememberedSet(); | 33 void MoveEntriesToRememberedSet(); |
35 | 34 |
36 private: | 35 private: |
37 Heap* heap_; | 36 Heap* heap_; |
38 | 37 |
39 Address* top_; | 38 Address* top_; |
40 | 39 |
41 // The start and the limit of the buffer that contains store slots | 40 // The start and the limit of the buffer that contains store slots |
42 // added from the generated code. | 41 // added from the generated code. |
43 Address* start_; | 42 Address* start_; |
44 Address* limit_; | 43 Address* limit_; |
45 | 44 |
46 base::VirtualMemory* virtual_memory_; | 45 base::VirtualMemory* virtual_memory_; |
47 }; | 46 }; |
48 | 47 |
49 } // namespace internal | 48 } // namespace internal |
50 } // namespace v8 | 49 } // namespace v8 |
51 | 50 |
52 #endif // V8_STORE_BUFFER_H_ | 51 #endif // V8_STORE_BUFFER_H_ |
OLD | NEW |