| 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" | 9 #include "vm/code_index_table.h" |
| 10 #include "vm/compiler_stats.h" | 10 #include "vm/compiler_stats.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 } | 76 } |
| 77 | 77 |
| 78 | 78 |
| 79 #if defined(DEBUG) | 79 #if defined(DEBUG) |
| 80 void IsolateMessageHandler::CheckAccess() { | 80 void IsolateMessageHandler::CheckAccess() { |
| 81 ASSERT(isolate_ == Isolate::Current()); | 81 ASSERT(isolate_ == Isolate::Current()); |
| 82 } | 82 } |
| 83 #endif | 83 #endif |
| 84 | 84 |
| 85 | 85 |
| 86 #if defined(DEBUG) |
| 87 // static |
| 88 void BaseIsolate::AssertCurrent(BaseIsolate* isolate) { |
| 89 ASSERT(isolate == Isolate::Current()); |
| 90 } |
| 91 #endif |
| 92 |
| 93 |
| 86 Isolate::Isolate() | 94 Isolate::Isolate() |
| 87 : store_buffer_(), | 95 : store_buffer_(), |
| 88 message_notify_callback_(NULL), | 96 message_notify_callback_(NULL), |
| 89 name_(NULL), | 97 name_(NULL), |
| 90 main_port_(0), | 98 main_port_(0), |
| 91 heap_(NULL), | 99 heap_(NULL), |
| 92 object_store_(NULL), | 100 object_store_(NULL), |
| 93 top_resource_(NULL), | |
| 94 top_context_(Context::null()), | 101 top_context_(Context::null()), |
| 95 current_zone_(NULL), | |
| 96 #if defined(DEBUG) | |
| 97 no_gc_scope_depth_(0), | |
| 98 no_handle_scope_depth_(0), | |
| 99 top_handle_scope_(NULL), | |
| 100 #endif | |
| 101 random_seed_(Random::kDefaultRandomSeed), | 102 random_seed_(Random::kDefaultRandomSeed), |
| 102 top_exit_frame_info_(0), | 103 top_exit_frame_info_(0), |
| 103 init_callback_data_(NULL), | 104 init_callback_data_(NULL), |
| 104 library_tag_handler_(NULL), | 105 library_tag_handler_(NULL), |
| 105 api_state_(NULL), | 106 api_state_(NULL), |
| 106 stub_code_(NULL), | 107 stub_code_(NULL), |
| 107 code_index_table_(NULL), | 108 code_index_table_(NULL), |
| 108 debugger_(NULL), | 109 debugger_(NULL), |
| 109 long_jump_base_(NULL), | 110 long_jump_base_(NULL), |
| 110 timer_list_(), | 111 timer_list_(), |
| 111 ast_node_id_(AstNode::kNoId), | 112 ast_node_id_(AstNode::kNoId), |
| 112 mutex_(new Mutex()), | 113 mutex_(new Mutex()), |
| 113 stack_limit_(0), | 114 stack_limit_(0), |
| 114 saved_stack_limit_(0) { | 115 saved_stack_limit_(0) { |
| 115 } | 116 } |
| 116 | 117 |
| 117 | 118 |
| 118 Isolate::~Isolate() { | 119 Isolate::~Isolate() { |
| 119 delete [] name_; | 120 delete [] name_; |
| 120 delete heap_; | 121 delete heap_; |
| 121 delete object_store_; | 122 delete object_store_; |
| 122 // Do not delete stack resources: top_resource_ and current_zone_. | |
| 123 delete api_state_; | 123 delete api_state_; |
| 124 delete stub_code_; | 124 delete stub_code_; |
| 125 delete code_index_table_; | 125 delete code_index_table_; |
| 126 delete debugger_; | 126 delete debugger_; |
| 127 delete mutex_; | 127 delete mutex_; |
| 128 mutex_ = NULL; // Fail fast if interrupts are scheduled on a dead isolate. | 128 mutex_ = NULL; // Fail fast if interrupts are scheduled on a dead isolate. |
| 129 delete message_handler_; | 129 delete message_handler_; |
| 130 message_handler_ = NULL; // Fail fast if we send messages to a dead isolate. | 130 message_handler_ = NULL; // Fail fast if we send messages to a dead isolate. |
| 131 } | 131 } |
| 132 | 132 |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 for (int i = 0; i < invoked_functions.length(); i++) { | 301 for (int i = 0; i < invoked_functions.length(); i++) { |
| 302 OS::Print("%10d x %s\n", | 302 OS::Print("%10d x %s\n", |
| 303 invoked_functions[i]->usage_counter(), | 303 invoked_functions[i]->usage_counter(), |
| 304 invoked_functions[i]->ToFullyQualifiedCString()); | 304 invoked_functions[i]->ToFullyQualifiedCString()); |
| 305 } | 305 } |
| 306 } | 306 } |
| 307 | 307 |
| 308 | 308 |
| 309 void Isolate::Shutdown() { | 309 void Isolate::Shutdown() { |
| 310 ASSERT(this == Isolate::Current()); | 310 ASSERT(this == Isolate::Current()); |
| 311 ASSERT(top_resource_ == NULL); | 311 ASSERT(top_resource() == NULL); |
| 312 ASSERT((heap_ == NULL) || heap_->Verify()); | 312 ASSERT((heap_ == NULL) || heap_->Verify()); |
| 313 | 313 |
| 314 // Clean up debugger resources. Shutting down the debugger | 314 // Clean up debugger resources. Shutting down the debugger |
| 315 // requires a handle zone. We must set up a temporary zone because | 315 // requires a handle zone. We must set up a temporary zone because |
| 316 // Isolate::Shutdown is called without a zone. | 316 // Isolate::Shutdown is called without a zone. |
| 317 { | 317 { |
| 318 Zone zone(this); | 318 Zone zone(this); |
| 319 HandleScope handle_scope(this); | 319 HandleScope handle_scope(this); |
| 320 debugger_->Shutdown(); | 320 debugger_->Shutdown(); |
| 321 } | 321 } |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 | 472 |
| 473 | 473 |
| 474 void Isolate::VisitWeakPersistentHandles(HandleVisitor* visitor, | 474 void Isolate::VisitWeakPersistentHandles(HandleVisitor* visitor, |
| 475 bool visit_prologue_weak_handles) { | 475 bool visit_prologue_weak_handles) { |
| 476 if (api_state() != NULL) { | 476 if (api_state() != NULL) { |
| 477 api_state()->VisitWeakHandles(visitor, visit_prologue_weak_handles); | 477 api_state()->VisitWeakHandles(visitor, visit_prologue_weak_handles); |
| 478 } | 478 } |
| 479 } | 479 } |
| 480 | 480 |
| 481 } // namespace dart | 481 } // namespace dart |
| OLD | NEW |