OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/isolate.h" | 5 #include "vm/isolate.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "lib/mirrors.h" | 9 #include "lib/mirrors.h" |
10 #include "vm/compiler_stats.h" | 10 #include "vm/compiler_stats.h" |
11 #include "vm/dart_api_state.h" | 11 #include "vm/dart_api_state.h" |
12 #include "vm/dart_entry.h" | 12 #include "vm/dart_entry.h" |
13 #include "vm/debugger.h" | 13 #include "vm/debugger.h" |
14 #include "vm/debuginfo.h" | 14 #include "vm/debuginfo.h" |
15 #include "vm/heap.h" | 15 #include "vm/heap.h" |
16 #include "vm/message_handler.h" | 16 #include "vm/message_handler.h" |
17 #include "vm/object_store.h" | 17 #include "vm/object_store.h" |
18 #include "vm/parser.h" | 18 #include "vm/parser.h" |
19 #include "vm/port.h" | 19 #include "vm/port.h" |
20 #include "vm/random.h" | 20 #include "vm/random.h" |
21 #include "vm/stack_frame.h" | 21 #include "vm/stack_frame.h" |
22 #include "vm/stub_code.h" | 22 #include "vm/stub_code.h" |
| 23 #include "vm/symbols.h" |
23 #include "vm/thread.h" | 24 #include "vm/thread.h" |
24 #include "vm/timer.h" | 25 #include "vm/timer.h" |
25 #include "vm/visitor.h" | 26 #include "vm/visitor.h" |
26 | 27 |
27 namespace dart { | 28 namespace dart { |
28 | 29 |
29 DEFINE_FLAG(bool, report_usage_count, false, | 30 DEFINE_FLAG(bool, report_usage_count, false, |
30 "Track function usage and report."); | 31 "Track function usage and report."); |
31 DEFINE_FLAG(bool, trace_isolates, false, | 32 DEFINE_FLAG(bool, trace_isolates, false, |
32 "Trace isolate creation and shut down."); | 33 "Trace isolate creation and shut down."); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 debugger_(NULL), | 157 debugger_(NULL), |
157 long_jump_base_(NULL), | 158 long_jump_base_(NULL), |
158 timer_list_(), | 159 timer_list_(), |
159 ast_node_id_(AstNode::kNoId), | 160 ast_node_id_(AstNode::kNoId), |
160 computation_id_(AstNode::kNoId), | 161 computation_id_(AstNode::kNoId), |
161 ic_data_array_(Array::null()), | 162 ic_data_array_(Array::null()), |
162 mutex_(new Mutex()), | 163 mutex_(new Mutex()), |
163 stack_limit_(0), | 164 stack_limit_(0), |
164 saved_stack_limit_(0), | 165 saved_stack_limit_(0), |
165 message_handler_(NULL), | 166 message_handler_(NULL), |
166 spawn_data_(NULL) { | 167 spawn_data_(NULL), |
| 168 gc_prologue_callbacks_(), |
| 169 gc_epilogue_callbacks_(), |
| 170 symbols_(NULL) { |
167 } | 171 } |
168 | 172 |
169 | 173 |
170 Isolate::~Isolate() { | 174 Isolate::~Isolate() { |
171 delete [] name_; | 175 delete [] name_; |
172 delete heap_; | 176 delete heap_; |
173 delete object_store_; | 177 delete object_store_; |
174 delete api_state_; | 178 delete api_state_; |
175 delete stub_code_; | 179 delete stub_code_; |
176 delete debugger_; | 180 delete debugger_; |
177 delete mutex_; | 181 delete mutex_; |
178 mutex_ = NULL; // Fail fast if interrupts are scheduled on a dead isolate. | 182 mutex_ = NULL; // Fail fast if interrupts are scheduled on a dead isolate. |
179 delete message_handler_; | 183 delete message_handler_; |
180 message_handler_ = NULL; // Fail fast if we send messages to a dead isolate. | 184 message_handler_ = NULL; // Fail fast if we send messages to a dead isolate. |
| 185 delete symbols_; |
181 } | 186 } |
182 | 187 |
183 void Isolate::SetCurrent(Isolate* current) { | 188 void Isolate::SetCurrent(Isolate* current) { |
184 Thread::SetThreadLocal(isolate_key, reinterpret_cast<uword>(current)); | 189 Thread::SetThreadLocal(isolate_key, reinterpret_cast<uword>(current)); |
185 } | 190 } |
186 | 191 |
187 | 192 |
188 // The single thread local key which stores all the thread local data | 193 // The single thread local key which stores all the thread local data |
189 // for a thread. Since an Isolate is the central repository for | 194 // for a thread. Since an Isolate is the central repository for |
190 // storing all isolate specific information a single thread local key | 195 // storing all isolate specific information a single thread local key |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 | 409 |
405 | 410 |
406 void Isolate::VisitObjectPointers(ObjectPointerVisitor* visitor, | 411 void Isolate::VisitObjectPointers(ObjectPointerVisitor* visitor, |
407 bool visit_prologue_weak_handles, | 412 bool visit_prologue_weak_handles, |
408 bool validate_frames) { | 413 bool validate_frames) { |
409 ASSERT(visitor != NULL); | 414 ASSERT(visitor != NULL); |
410 | 415 |
411 // Visit objects in the object store. | 416 // Visit objects in the object store. |
412 object_store()->VisitObjectPointers(visitor); | 417 object_store()->VisitObjectPointers(visitor); |
413 | 418 |
| 419 // Visit cached symbols if any. |
| 420 if (symbols() != NULL) { |
| 421 symbols()->VisitObjectPointers(visitor); |
| 422 } |
| 423 |
414 // Visit objects in the class table. | 424 // Visit objects in the class table. |
415 class_table()->VisitObjectPointers(visitor); | 425 class_table()->VisitObjectPointers(visitor); |
416 | 426 |
417 // Visit objects in per isolate stubs. | 427 // Visit objects in per isolate stubs. |
418 StubCode::VisitObjectPointers(visitor); | 428 StubCode::VisitObjectPointers(visitor); |
419 | 429 |
420 // Visit objects in zones. | 430 // Visit objects in zones. |
421 current_zone()->VisitObjectPointers(visitor); | 431 current_zone()->VisitObjectPointers(visitor); |
422 | 432 |
423 // Iterate over all the stack frames and visit objects on the stack. | 433 // Iterate over all the stack frames and visit objects on the stack. |
(...skipping 21 matching lines...) Expand all Loading... |
445 | 455 |
446 | 456 |
447 void Isolate::VisitWeakPersistentHandles(HandleVisitor* visitor, | 457 void Isolate::VisitWeakPersistentHandles(HandleVisitor* visitor, |
448 bool visit_prologue_weak_handles) { | 458 bool visit_prologue_weak_handles) { |
449 if (api_state() != NULL) { | 459 if (api_state() != NULL) { |
450 api_state()->VisitWeakHandles(visitor, visit_prologue_weak_handles); | 460 api_state()->VisitWeakHandles(visitor, visit_prologue_weak_handles); |
451 } | 461 } |
452 } | 462 } |
453 | 463 |
454 } // namespace dart | 464 } // namespace dart |
OLD | NEW |