| 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 "vm/code_index_table.h" | |
| 10 #include "vm/compiler_stats.h" | 9 #include "vm/compiler_stats.h" |
| 11 #include "vm/dart_api_state.h" | 10 #include "vm/dart_api_state.h" |
| 12 #include "vm/dart_entry.h" | 11 #include "vm/dart_entry.h" |
| 13 #include "vm/debugger.h" | 12 #include "vm/debugger.h" |
| 14 #include "vm/debuginfo.h" | 13 #include "vm/debuginfo.h" |
| 15 #include "vm/heap.h" | 14 #include "vm/heap.h" |
| 16 #include "vm/message.h" | 15 #include "vm/message.h" |
| 17 #include "vm/object_store.h" | 16 #include "vm/object_store.h" |
| 18 #include "vm/parser.h" | 17 #include "vm/parser.h" |
| 19 #include "vm/port.h" | 18 #include "vm/port.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 main_port_(0), | 97 main_port_(0), |
| 99 heap_(NULL), | 98 heap_(NULL), |
| 100 object_store_(NULL), | 99 object_store_(NULL), |
| 101 top_context_(Context::null()), | 100 top_context_(Context::null()), |
| 102 random_seed_(Random::kDefaultRandomSeed), | 101 random_seed_(Random::kDefaultRandomSeed), |
| 103 top_exit_frame_info_(0), | 102 top_exit_frame_info_(0), |
| 104 init_callback_data_(NULL), | 103 init_callback_data_(NULL), |
| 105 library_tag_handler_(NULL), | 104 library_tag_handler_(NULL), |
| 106 api_state_(NULL), | 105 api_state_(NULL), |
| 107 stub_code_(NULL), | 106 stub_code_(NULL), |
| 108 code_index_table_(NULL), | |
| 109 debugger_(NULL), | 107 debugger_(NULL), |
| 110 long_jump_base_(NULL), | 108 long_jump_base_(NULL), |
| 111 timer_list_(), | 109 timer_list_(), |
| 112 ast_node_id_(AstNode::kNoId), | 110 ast_node_id_(AstNode::kNoId), |
| 113 mutex_(new Mutex()), | 111 mutex_(new Mutex()), |
| 114 stack_limit_(0), | 112 stack_limit_(0), |
| 115 saved_stack_limit_(0) { | 113 saved_stack_limit_(0) { |
| 116 } | 114 } |
| 117 | 115 |
| 118 | 116 |
| 119 Isolate::~Isolate() { | 117 Isolate::~Isolate() { |
| 120 delete [] name_; | 118 delete [] name_; |
| 121 delete heap_; | 119 delete heap_; |
| 122 delete object_store_; | 120 delete object_store_; |
| 123 delete api_state_; | 121 delete api_state_; |
| 124 delete stub_code_; | 122 delete stub_code_; |
| 125 delete code_index_table_; | |
| 126 delete debugger_; | 123 delete debugger_; |
| 127 delete mutex_; | 124 delete mutex_; |
| 128 mutex_ = NULL; // Fail fast if interrupts are scheduled on a dead isolate. | 125 mutex_ = NULL; // Fail fast if interrupts are scheduled on a dead isolate. |
| 129 delete message_handler_; | 126 delete message_handler_; |
| 130 message_handler_ = NULL; // Fail fast if we send messages to a dead isolate. | 127 message_handler_ = NULL; // Fail fast if we send messages to a dead isolate. |
| 131 } | 128 } |
| 132 | 129 |
| 133 void Isolate::SetCurrent(Isolate* current) { | 130 void Isolate::SetCurrent(Isolate* current) { |
| 134 Thread::SetThreadLocal(isolate_key, reinterpret_cast<uword>(current)); | 131 Thread::SetThreadLocal(isolate_key, reinterpret_cast<uword>(current)); |
| 135 } | 132 } |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 while (frame != NULL) { | 448 while (frame != NULL) { |
| 452 frame->VisitObjectPointers(visitor); | 449 frame->VisitObjectPointers(visitor); |
| 453 frame = frames_iterator.NextFrame(); | 450 frame = frames_iterator.NextFrame(); |
| 454 } | 451 } |
| 455 | 452 |
| 456 // Visit the dart api state for all local and persistent handles. | 453 // Visit the dart api state for all local and persistent handles. |
| 457 if (api_state() != NULL) { | 454 if (api_state() != NULL) { |
| 458 api_state()->VisitObjectPointers(visitor, visit_prologue_weak_handles); | 455 api_state()->VisitObjectPointers(visitor, visit_prologue_weak_handles); |
| 459 } | 456 } |
| 460 | 457 |
| 461 // Visit all objects in the code index table. | |
| 462 if (code_index_table() != NULL) { | |
| 463 code_index_table()->VisitObjectPointers(visitor); | |
| 464 } | |
| 465 | |
| 466 // Visit the top context which is stored in the isolate. | 458 // Visit the top context which is stored in the isolate. |
| 467 visitor->VisitPointer(reinterpret_cast<RawObject**>(&top_context_)); | 459 visitor->VisitPointer(reinterpret_cast<RawObject**>(&top_context_)); |
| 468 | 460 |
| 469 // Visit objects in the debugger. | 461 // Visit objects in the debugger. |
| 470 debugger()->VisitObjectPointers(visitor); | 462 debugger()->VisitObjectPointers(visitor); |
| 471 } | 463 } |
| 472 | 464 |
| 473 | 465 |
| 474 void Isolate::VisitWeakPersistentHandles(HandleVisitor* visitor, | 466 void Isolate::VisitWeakPersistentHandles(HandleVisitor* visitor, |
| 475 bool visit_prologue_weak_handles) { | 467 bool visit_prologue_weak_handles) { |
| 476 if (api_state() != NULL) { | 468 if (api_state() != NULL) { |
| 477 api_state()->VisitWeakHandles(visitor, visit_prologue_weak_handles); | 469 api_state()->VisitWeakHandles(visitor, visit_prologue_weak_handles); |
| 478 } | 470 } |
| 479 } | 471 } |
| 480 | 472 |
| 481 } // namespace dart | 473 } // namespace dart |
| OLD | NEW |