blob: 920ec3411dc16687efc604441a3f3037818f4c9d [file] [log] [blame]
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001// 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_INL_H_
6#define V8_STORE_BUFFER_INL_H_
7
Ben Murdoch014dc512016-03-22 12:00:34 +00008#include "src/heap/heap.h"
Ben Murdoch109988c2016-05-18 11:27:45 +01009#include "src/heap/remembered-set.h"
Ben Murdoch014dc512016-03-22 12:00:34 +000010#include "src/heap/spaces-inl.h"
Ben Murdochb8a8cc12014-11-26 15:28:44 +000011#include "src/heap/store-buffer.h"
12
13namespace v8 {
14namespace internal {
15
Ben Murdoch109988c2016-05-18 11:27:45 +010016void LocalStoreBuffer::Record(Address addr) {
17 if (top_->is_full()) top_ = new Node(top_);
18 top_->buffer[top_->count++] = addr;
Ben Murdochb8a8cc12014-11-26 15:28:44 +000019}
Ben Murdoch83897452016-05-17 11:12:09 +010020
Ben Murdoch109988c2016-05-18 11:27:45 +010021void LocalStoreBuffer::Process(StoreBuffer* store_buffer) {
22 Node* current = top_;
23 while (current != nullptr) {
24 for (int i = 0; i < current->count; i++) {
25 Address slot = current->buffer[i];
26 Page* page = Page::FromAnyPointerAddress(heap_, slot);
27 RememberedSet<OLD_TO_NEW>::Insert(page, slot);
Ben Murdochf2e39942016-05-18 10:25:55 +000028 }
Ben Murdoch109988c2016-05-18 11:27:45 +010029 current = current->next;
Ben Murdochf2e39942016-05-18 10:25:55 +000030 }
31}
Ben Murdoch109988c2016-05-18 11:27:45 +010032
Ben Murdoch014dc512016-03-22 12:00:34 +000033} // namespace internal
34} // namespace v8
Ben Murdochb8a8cc12014-11-26 15:28:44 +000035
36#endif // V8_STORE_BUFFER_INL_H_