store-buffer.h 1.29 KB
Newer Older
1
// Copyright 2011 the V8 project authors. All rights reserved.
2 3
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
4 5 6 7

#ifndef V8_STORE_BUFFER_H_
#define V8_STORE_BUFFER_H_

8
#include "src/allocation.h"
9 10
#include "src/base/logging.h"
#include "src/base/platform/platform.h"
11
#include "src/globals.h"
ulan's avatar
ulan committed
12
#include "src/heap/slot-set.h"
13 14 15 16

namespace v8 {
namespace internal {

17 18
// Intermediate buffer that accumulates old-to-new stores from the generated
// code. On buffer overflow the slots are moved to the remembered set.
19 20
class StoreBuffer {
 public:
21 22
  static const int kStoreBufferSize = 1 << (14 + kPointerSizeLog2);
  static const int kStoreBufferMask = kStoreBufferSize - 1;
23

24
  static void StoreBufferOverflow(Isolate* isolate);
25 26

  explicit StoreBuffer(Heap* heap);
27
  void SetUp();
28 29
  void TearDown();

30 31
  // Used to add entries from generated code.
  inline Address* top_address() { return reinterpret_cast<Address*>(&top_); }
32

33
  void MoveEntriesToRememberedSet();
34

35 36 37
 private:
  Heap* heap_;

38 39
  Address* top_;

ulan's avatar
ulan committed
40 41
  // The start and the limit of the buffer that contains store slots
  // added from the generated code.
42 43 44
  Address* start_;
  Address* limit_;

45
  base::VirtualMemory* virtual_memory_;
46 47
};

48 49
}  // namespace internal
}  // namespace v8
50 51

#endif  // V8_STORE_BUFFER_H_