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

Side by Side Diff: src/heap/array-buffer-tracker.cc

Issue 1640563004: Reland of "[heap] Parallel newspace evacuation, semispace copy, and compaction \o/" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Convert bogus DCHECK into proper branch Created 4 years, 11 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/array-buffer-tracker.h ('k') | src/heap/heap.h » ('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 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/array-buffer-tracker.h" 5 #include "src/heap/array-buffer-tracker.h"
6 #include "src/heap/heap.h" 6 #include "src/heap/heap.h"
7 #include "src/isolate.h" 7 #include "src/isolate.h"
8 #include "src/objects.h" 8 #include "src/objects.h"
9 #include "src/objects-inl.h" 9 #include "src/objects-inl.h"
10 #include "src/v8.h" 10 #include "src/v8.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 size_t length = (*live_buffers)[data]; 70 size_t length = (*live_buffers)[data];
71 live_buffers->erase(data); 71 live_buffers->erase(data);
72 not_yet_discovered_buffers->erase(data); 72 not_yet_discovered_buffers->erase(data);
73 73
74 heap()->update_amount_of_external_allocated_memory( 74 heap()->update_amount_of_external_allocated_memory(
75 -static_cast<int64_t>(length)); 75 -static_cast<int64_t>(length));
76 } 76 }
77 77
78 78
79 void ArrayBufferTracker::MarkLive(JSArrayBuffer* buffer) { 79 void ArrayBufferTracker::MarkLive(JSArrayBuffer* buffer) {
80 base::LockGuard<base::Mutex> guard(&mutex_);
80 void* data = buffer->backing_store(); 81 void* data = buffer->backing_store();
81 82
82 // ArrayBuffer might be in the middle of being constructed. 83 // ArrayBuffer might be in the middle of being constructed.
83 if (data == heap()->undefined_value()) return; 84 if (data == heap()->undefined_value()) return;
84 if (heap()->InNewSpace(buffer)) { 85 if (heap()->InNewSpace(buffer)) {
85 not_yet_discovered_array_buffers_for_scavenge_.erase(data); 86 not_yet_discovered_array_buffers_for_scavenge_.erase(data);
86 } else { 87 } else {
87 not_yet_discovered_array_buffers_.erase(data); 88 not_yet_discovered_array_buffers_.erase(data);
88 } 89 }
89 } 90 }
(...skipping 26 matching lines...) Expand all
116 } 117 }
117 118
118 119
119 void ArrayBufferTracker::PrepareDiscoveryInNewSpace() { 120 void ArrayBufferTracker::PrepareDiscoveryInNewSpace() {
120 not_yet_discovered_array_buffers_for_scavenge_ = 121 not_yet_discovered_array_buffers_for_scavenge_ =
121 live_array_buffers_for_scavenge_; 122 live_array_buffers_for_scavenge_;
122 } 123 }
123 124
124 125
125 void ArrayBufferTracker::Promote(JSArrayBuffer* buffer) { 126 void ArrayBufferTracker::Promote(JSArrayBuffer* buffer) {
127 base::LockGuard<base::Mutex> guard(&mutex_);
128
126 if (buffer->is_external()) return; 129 if (buffer->is_external()) return;
127 void* data = buffer->backing_store(); 130 void* data = buffer->backing_store();
128 if (!data) return; 131 if (!data) return;
129 // ArrayBuffer might be in the middle of being constructed. 132 // ArrayBuffer might be in the middle of being constructed.
130 if (data == heap()->undefined_value()) return; 133 if (data == heap()->undefined_value()) return;
131 DCHECK(live_array_buffers_for_scavenge_.count(data) > 0); 134 DCHECK(live_array_buffers_for_scavenge_.count(data) > 0);
132 live_array_buffers_[data] = live_array_buffers_for_scavenge_[data]; 135 live_array_buffers_[data] = live_array_buffers_for_scavenge_[data];
133 live_array_buffers_for_scavenge_.erase(data); 136 live_array_buffers_for_scavenge_.erase(data);
134 not_yet_discovered_array_buffers_for_scavenge_.erase(data); 137 not_yet_discovered_array_buffers_for_scavenge_.erase(data);
135 } 138 }
136 139
137 } // namespace internal 140 } // namespace internal
138 } // namespace v8 141 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/array-buffer-tracker.h ('k') | src/heap/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698