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

Side by Side Diff: src/isolate.cc

Issue 2801073006: Decouple root visitors from object visitors. (Closed)
Patch Set: rebase Created 3 years, 8 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/isolate.h ('k') | src/objects.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/isolate.h" 5 #include "src/isolate.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include <fstream> // NOLINT(readability/streams) 9 #include <fstream> // NOLINT(readability/streams)
10 #include <sstream> 10 #include <sstream>
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "src/profiler/cpu-profiler.h" 43 #include "src/profiler/cpu-profiler.h"
44 #include "src/prototype.h" 44 #include "src/prototype.h"
45 #include "src/regexp/regexp-stack.h" 45 #include "src/regexp/regexp-stack.h"
46 #include "src/runtime-profiler.h" 46 #include "src/runtime-profiler.h"
47 #include "src/setup-isolate.h" 47 #include "src/setup-isolate.h"
48 #include "src/simulator.h" 48 #include "src/simulator.h"
49 #include "src/snapshot/deserializer.h" 49 #include "src/snapshot/deserializer.h"
50 #include "src/tracing/tracing-category-observer.h" 50 #include "src/tracing/tracing-category-observer.h"
51 #include "src/v8.h" 51 #include "src/v8.h"
52 #include "src/version.h" 52 #include "src/version.h"
53 #include "src/visitors.h"
53 #include "src/vm-state-inl.h" 54 #include "src/vm-state-inl.h"
54 #include "src/wasm/wasm-module.h" 55 #include "src/wasm/wasm-module.h"
55 #include "src/wasm/wasm-objects.h" 56 #include "src/wasm/wasm-objects.h"
56 #include "src/zone/accounting-allocator.h" 57 #include "src/zone/accounting-allocator.h"
57 58
58 namespace v8 { 59 namespace v8 {
59 namespace internal { 60 namespace internal {
60 61
61 base::Atomic32 ThreadId::highest_thread_id_ = 0; 62 base::Atomic32 ThreadId::highest_thread_id_ = 0;
62 63
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 thread_id_key_ = base::Thread::CreateThreadLocalKey(); 194 thread_id_key_ = base::Thread::CreateThreadLocalKey();
194 per_isolate_thread_data_key_ = base::Thread::CreateThreadLocalKey(); 195 per_isolate_thread_data_key_ = base::Thread::CreateThreadLocalKey();
195 thread_data_table_ = new Isolate::ThreadDataTable(); 196 thread_data_table_ = new Isolate::ThreadDataTable();
196 } 197 }
197 198
198 199
199 Address Isolate::get_address_from_id(Isolate::AddressId id) { 200 Address Isolate::get_address_from_id(Isolate::AddressId id) {
200 return isolate_addresses_[id]; 201 return isolate_addresses_[id];
201 } 202 }
202 203
203 204 char* Isolate::Iterate(RootVisitor* v, char* thread_storage) {
204 char* Isolate::Iterate(ObjectVisitor* v, char* thread_storage) {
205 ThreadLocalTop* thread = reinterpret_cast<ThreadLocalTop*>(thread_storage); 205 ThreadLocalTop* thread = reinterpret_cast<ThreadLocalTop*>(thread_storage);
206 Iterate(v, thread); 206 Iterate(v, thread);
207 return thread_storage + sizeof(ThreadLocalTop); 207 return thread_storage + sizeof(ThreadLocalTop);
208 } 208 }
209 209
210 210
211 void Isolate::IterateThread(ThreadVisitor* v, char* t) { 211 void Isolate::IterateThread(ThreadVisitor* v, char* t) {
212 ThreadLocalTop* thread = reinterpret_cast<ThreadLocalTop*>(t); 212 ThreadLocalTop* thread = reinterpret_cast<ThreadLocalTop*>(t);
213 v->VisitThread(this, thread); 213 v->VisitThread(this, thread);
214 } 214 }
215 215
216 216 void Isolate::Iterate(RootVisitor* v, ThreadLocalTop* thread) {
217 void Isolate::Iterate(ObjectVisitor* v, ThreadLocalTop* thread) {
218 // Visit the roots from the top for a given thread. 217 // Visit the roots from the top for a given thread.
219 v->VisitPointer(&thread->pending_exception_); 218 v->VisitRootPointer(Root::kTop, &thread->pending_exception_);
220 v->VisitPointer(&(thread->pending_message_obj_)); 219 v->VisitRootPointer(Root::kTop, &thread->pending_message_obj_);
221 v->VisitPointer(bit_cast<Object**>(&(thread->context_))); 220 v->VisitRootPointer(Root::kTop, bit_cast<Object**>(&(thread->context_)));
222 v->VisitPointer(&thread->scheduled_exception_); 221 v->VisitRootPointer(Root::kTop, &thread->scheduled_exception_);
223 222
224 for (v8::TryCatch* block = thread->try_catch_handler(); 223 for (v8::TryCatch* block = thread->try_catch_handler();
225 block != NULL; 224 block != NULL;
226 block = block->next_) { 225 block = block->next_) {
227 v->VisitPointer(bit_cast<Object**>(&(block->exception_))); 226 v->VisitRootPointer(Root::kTop, bit_cast<Object**>(&(block->exception_)));
228 v->VisitPointer(bit_cast<Object**>(&(block->message_obj_))); 227 v->VisitRootPointer(Root::kTop, bit_cast<Object**>(&(block->message_obj_)));
229 } 228 }
230 229
231 // Iterate over pointers on native execution stack. 230 // Iterate over pointers on native execution stack.
232 for (StackFrameIterator it(this, thread); !it.done(); it.Advance()) { 231 for (StackFrameIterator it(this, thread); !it.done(); it.Advance()) {
233 it.frame()->Iterate(v); 232 it.frame()->Iterate(v);
234 } 233 }
235 } 234 }
236 235
237 236 void Isolate::Iterate(RootVisitor* v) {
238 void Isolate::Iterate(ObjectVisitor* v) {
239 ThreadLocalTop* current_t = thread_local_top(); 237 ThreadLocalTop* current_t = thread_local_top();
240 Iterate(v, current_t); 238 Iterate(v, current_t);
241 } 239 }
242 240
243 241 void Isolate::IterateDeferredHandles(RootVisitor* visitor) {
244 void Isolate::IterateDeferredHandles(ObjectVisitor* visitor) {
245 for (DeferredHandles* deferred = deferred_handles_head_; 242 for (DeferredHandles* deferred = deferred_handles_head_;
246 deferred != NULL; 243 deferred != NULL;
247 deferred = deferred->next_) { 244 deferred = deferred->next_) {
248 deferred->Iterate(visitor); 245 deferred->Iterate(visitor);
249 } 246 }
250 } 247 }
251 248
252 249
253 #ifdef DEBUG 250 #ifdef DEBUG
254 bool Isolate::IsDeferredHandle(Object** handle) { 251 bool Isolate::IsDeferredHandle(Object** handle) {
(...skipping 3523 matching lines...) Expand 10 before | Expand all | Expand 10 after
3778 // Then check whether this scope intercepts. 3775 // Then check whether this scope intercepts.
3779 if ((flag & intercept_mask_)) { 3776 if ((flag & intercept_mask_)) {
3780 intercepted_flags_ |= flag; 3777 intercepted_flags_ |= flag;
3781 return true; 3778 return true;
3782 } 3779 }
3783 return false; 3780 return false;
3784 } 3781 }
3785 3782
3786 } // namespace internal 3783 } // namespace internal
3787 } // namespace v8 3784 } // namespace v8
OLDNEW
« no previous file with comments | « src/isolate.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698