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" |
(...skipping 22 matching lines...) Expand all Loading... |
33 Heap* heap_; | 33 Heap* heap_; |
34 | 34 |
35 // The start and the limit of the buffer that contains store slots | 35 // The start and the limit of the buffer that contains store slots |
36 // added from the generated code. | 36 // added from the generated code. |
37 Address* start_; | 37 Address* start_; |
38 Address* limit_; | 38 Address* limit_; |
39 | 39 |
40 base::VirtualMemory* virtual_memory_; | 40 base::VirtualMemory* virtual_memory_; |
41 }; | 41 }; |
42 | 42 |
43 | |
44 class LocalStoreBuffer BASE_EMBEDDED { | |
45 public: | |
46 explicit LocalStoreBuffer(Heap* heap) | |
47 : top_(new Node(nullptr)), heap_(heap) {} | |
48 | |
49 ~LocalStoreBuffer() { | |
50 Node* current = top_; | |
51 while (current != nullptr) { | |
52 Node* tmp = current->next; | |
53 delete current; | |
54 current = tmp; | |
55 } | |
56 } | |
57 | |
58 inline void Record(Address addr); | |
59 inline void Process(StoreBuffer* store_buffer); | |
60 | |
61 private: | |
62 static const int kBufferSize = 16 * KB; | |
63 | |
64 struct Node : Malloced { | |
65 explicit Node(Node* next_node) : next(next_node), count(0) {} | |
66 | |
67 inline bool is_full() { return count == kBufferSize; } | |
68 | |
69 Node* next; | |
70 Address buffer[kBufferSize]; | |
71 int count; | |
72 }; | |
73 | |
74 Node* top_; | |
75 Heap* heap_; | |
76 }; | |
77 | |
78 } // namespace internal | 43 } // namespace internal |
79 } // namespace v8 | 44 } // namespace v8 |
80 | 45 |
81 #endif // V8_STORE_BUFFER_H_ | 46 #endif // V8_STORE_BUFFER_H_ |
OLD | NEW |