Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: src/heap/store-buffer-inl.h

Issue 1608583002: New page local store buffer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase and fix signed unsigned conversion Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/heap/store-buffer.cc ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_INL_H_ 5 #ifndef V8_STORE_BUFFER_INL_H_
6 #define V8_STORE_BUFFER_INL_H_ 6 #define V8_STORE_BUFFER_INL_H_
7 7
8 #include "src/heap/heap.h" 8 #include "src/heap/heap.h"
9 #include "src/heap/spaces-inl.h" 9 #include "src/heap/spaces-inl.h"
10 #include "src/heap/store-buffer.h" 10 #include "src/heap/store-buffer.h"
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace internal { 13 namespace internal {
14 14
15 void StoreBuffer::Mark(Address addr) { 15 uint32_t StoreBuffer::AddressToSlotSetAndOffset(Address addr, SlotSet** slots) {
16 DCHECK(!heap_->code_space()->Contains(addr)); 16 MemoryChunk* chunk = MemoryChunk::FromAddress(addr);
17 Address* top = reinterpret_cast<Address*>(heap_->store_buffer_top()); 17 uintptr_t offset = addr - chunk->address();
18 *top++ = addr; 18 if (offset < MemoryChunk::kHeaderSize || chunk->owner() == nullptr) {
19 heap_->set_store_buffer_top(reinterpret_cast<Smi*>(top)); 19 chunk = heap_->lo_space()->FindPage(addr);
20 if ((reinterpret_cast<uintptr_t>(top) & kStoreBufferOverflowBit) != 0) { 20 offset = addr - chunk->address();
21 DCHECK(top == limit_); 21 }
22 Compact(); 22 if (chunk->old_to_new_slots() == nullptr) {
23 chunk->AllocateOldToNewSlots();
24 }
25 if (offset < Page::kPageSize) {
26 *slots = chunk->old_to_new_slots();
23 } else { 27 } else {
24 DCHECK(top < limit_); 28 *slots = &chunk->old_to_new_slots()[offset / Page::kPageSize];
29 offset = offset % Page::kPageSize;
25 } 30 }
31 return static_cast<uint32_t>(offset);
26 } 32 }
27 33
28 34
29 void StoreBuffer::EnterDirectlyIntoStoreBuffer(Address addr) {
30 if (store_buffer_rebuilding_enabled_) {
31 SLOW_DCHECK(!heap_->code_space()->Contains(addr) &&
32 !heap_->new_space()->Contains(addr));
33 Address* top = old_top_;
34 *top++ = addr;
35 old_top_ = top;
36 old_buffer_is_sorted_ = false;
37 old_buffer_is_filtered_ = false;
38 if (top >= old_limit_) {
39 DCHECK(callback_ != NULL);
40 (*callback_)(heap_, MemoryChunk::FromAnyPointerAddress(heap_, addr),
41 kStoreBufferFullEvent);
42 }
43 }
44 }
45
46 void LocalStoreBuffer::Record(Address addr) { 35 void LocalStoreBuffer::Record(Address addr) {
47 if (top_->is_full()) top_ = new Node(top_); 36 if (top_->is_full()) top_ = new Node(top_);
48 top_->buffer[top_->count++] = addr; 37 top_->buffer[top_->count++] = addr;
49 } 38 }
50 39
51 void LocalStoreBuffer::Process(StoreBuffer* store_buffer) { 40 void LocalStoreBuffer::Process(StoreBuffer* store_buffer) {
52 Node* current = top_; 41 Node* current = top_;
53 while (current != nullptr) { 42 while (current != nullptr) {
54 for (int i = 0; i < current->count; i++) { 43 for (int i = 0; i < current->count; i++) {
55 store_buffer->Mark(current->buffer[i]); 44 store_buffer->Mark(current->buffer[i]);
56 } 45 }
57 current = current->next; 46 current = current->next;
58 } 47 }
59 } 48 }
60 49
50 void StoreBuffer::Mark(Address addr) {
51 SlotSet* slots;
52 uint32_t offset;
53 offset = AddressToSlotSetAndOffset(addr, &slots);
54 slots->Insert(offset);
55 }
56
61 } // namespace internal 57 } // namespace internal
62 } // namespace v8 58 } // namespace v8
63 59
64 #endif // V8_STORE_BUFFER_INL_H_ 60 #endif // V8_STORE_BUFFER_INL_H_
OLDNEW
« no previous file with comments | « src/heap/store-buffer.cc ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698