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

Side by Side Diff: src/heap/slots-buffer.cc

Issue 1341973003: [heap] Scalable slots buffer for parallel compaction. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 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/slots-buffer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 #include "src/heap/slots-buffer.h" 5 #include "src/heap/slots-buffer.h"
6 6
7 #include "src/assembler.h" 7 #include "src/assembler.h"
8 #include "src/heap/heap.h" 8 #include "src/heap/heap.h"
9 #include "src/objects-inl.h" 9 #include "src/objects-inl.h"
10 10
11 namespace v8 { 11 namespace v8 {
12 namespace internal { 12 namespace internal {
13 13
14 bool SlotsBuffer::IsTypedSlot(ObjectSlot slot) { 14 bool SlotsBuffer::IsTypedSlot(ObjectSlot slot) {
15 return reinterpret_cast<uintptr_t>(slot) < NUMBER_OF_SLOT_TYPES; 15 return reinterpret_cast<uintptr_t>(slot) < NUMBER_OF_SLOT_TYPES;
16 } 16 }
17 17
18 18
19 bool SlotsBuffer::AddToSynchronized(SlotsBufferAllocator* allocator,
20 SlotsBuffer** buffer_address,
21 base::Mutex* buffer_mutex, SlotType type,
22 Address addr, AdditionMode mode) {
23 base::LockGuard<base::Mutex> lock_guard(buffer_mutex);
24 return AddTo(allocator, buffer_address, type, addr, mode);
25 }
26
27
28 bool SlotsBuffer::AddTo(SlotsBufferAllocator* allocator, 19 bool SlotsBuffer::AddTo(SlotsBufferAllocator* allocator,
29 SlotsBuffer** buffer_address, SlotType type, 20 SlotsBuffer** buffer_address, SlotType type,
30 Address addr, AdditionMode mode) { 21 Address addr, AdditionMode mode) {
31 SlotsBuffer* buffer = *buffer_address; 22 SlotsBuffer* buffer = *buffer_address;
32 if (buffer == NULL || !buffer->HasSpaceForTypedSlot()) { 23 if (buffer == NULL || !buffer->HasSpaceForTypedSlot()) {
33 if (mode == FAIL_ON_OVERFLOW && ChainLengthThresholdReached(buffer)) { 24 if (mode == FAIL_ON_OVERFLOW && ChainLengthThresholdReached(buffer)) {
34 allocator->DeallocateChain(buffer_address); 25 allocator->DeallocateChain(buffer_address);
35 return false; 26 return false;
36 } 27 }
37 buffer = allocator->AllocateBuffer(buffer); 28 buffer = allocator->AllocateBuffer(buffer);
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 while (buffer != NULL) { 152 while (buffer != NULL) {
162 SlotsBuffer* next_buffer = buffer->next(); 153 SlotsBuffer* next_buffer = buffer->next();
163 DeallocateBuffer(buffer); 154 DeallocateBuffer(buffer);
164 buffer = next_buffer; 155 buffer = next_buffer;
165 } 156 }
166 *buffer_address = NULL; 157 *buffer_address = NULL;
167 } 158 }
168 159
169 } // namespace internal 160 } // namespace internal
170 } // namespace v8 161 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/slots-buffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698