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