| OLD | NEW | 
|---|
| 1 // Copyright (c) 2011, the Dart project authors.  Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 | 8 | 
| 9 #include "vm/assert.h" | 9 #include "vm/assert.h" | 
| 10 #include "vm/bigint_store.h" | 10 #include "vm/bigint_store.h" | 
| (...skipping 18 matching lines...) Expand all  Loading... | 
| 29 DEFINE_FLAG(bool, report_invocation_count, false, | 29 DEFINE_FLAG(bool, report_invocation_count, false, | 
| 30     "Count function invocations and report."); | 30     "Count function invocations and report."); | 
| 31 DECLARE_FLAG(bool, generate_gdb_symbols); | 31 DECLARE_FLAG(bool, generate_gdb_symbols); | 
| 32 | 32 | 
| 33 | 33 | 
| 34 Isolate::Isolate() | 34 Isolate::Isolate() | 
| 35     : store_buffer_(), | 35     : store_buffer_(), | 
| 36       message_queue_(NULL), | 36       message_queue_(NULL), | 
| 37       post_message_callback_(NULL), | 37       post_message_callback_(NULL), | 
| 38       close_port_callback_(NULL), | 38       close_port_callback_(NULL), | 
| 39       active_ports_(0), | 39       num_ports_(0), | 
|  | 40       live_ports_(0), | 
|  | 41       main_port_(0), | 
| 40       heap_(NULL), | 42       heap_(NULL), | 
| 41       object_store_(NULL), | 43       object_store_(NULL), | 
| 42       top_resource_(NULL), | 44       top_resource_(NULL), | 
| 43       top_context_(Context::null()), | 45       top_context_(Context::null()), | 
| 44       current_zone_(NULL), | 46       current_zone_(NULL), | 
| 45 #if defined(DEBUG) | 47 #if defined(DEBUG) | 
| 46       no_gc_scope_depth_(0), | 48       no_gc_scope_depth_(0), | 
| 47       no_handle_scope_depth_(0), | 49       no_handle_scope_depth_(0), | 
| 48       top_handle_scope_(NULL), | 50       top_handle_scope_(NULL), | 
| 49 #endif | 51 #endif | 
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 118   // Setup the Dart API state. | 120   // Setup the Dart API state. | 
| 119   ApiState* state = new ApiState(); | 121   ApiState* state = new ApiState(); | 
| 120   ASSERT(state != NULL); | 122   ASSERT(state != NULL); | 
| 121   result->set_api_state(state); | 123   result->set_api_state(state); | 
| 122 | 124 | 
| 123   // Initialize stack top and limit in case we are running the isolate in the | 125   // Initialize stack top and limit in case we are running the isolate in the | 
| 124   // main thread. | 126   // main thread. | 
| 125   // TODO(5411455): Need to figure out how to set the stack limit for the | 127   // TODO(5411455): Need to figure out how to set the stack limit for the | 
| 126   // main thread. | 128   // main thread. | 
| 127   result->SetStackLimitFromCurrentTOS(reinterpret_cast<uword>(&result)); | 129   result->SetStackLimitFromCurrentTOS(reinterpret_cast<uword>(&result)); | 
|  | 130   result->set_main_port(PortMap::CreatePort()); | 
| 128 | 131 | 
| 129   return result; | 132   return result; | 
| 130 } | 133 } | 
| 131 | 134 | 
| 132 | 135 | 
| 133 // TODO(5411455): Use flag to override default value and Validate the | 136 // TODO(5411455): Use flag to override default value and Validate the | 
| 134 // stack size by querying OS. | 137 // stack size by querying OS. | 
| 135 uword Isolate::GetSpecifiedStackSize() { | 138 uword Isolate::GetSpecifiedStackSize() { | 
| 136   uword stack_size = Isolate::kDefaultStackSize - Isolate::kStackSizeBuffer; | 139   uword stack_size = Isolate::kDefaultStackSize - Isolate::kStackSizeBuffer; | 
| 137   return stack_size; | 140   return stack_size; | 
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 234 Dart_IsolateInitCallback Isolate::InitCallback() { | 237 Dart_IsolateInitCallback Isolate::InitCallback() { | 
| 235   return init_callback_; | 238   return init_callback_; | 
| 236 } | 239 } | 
| 237 | 240 | 
| 238 | 241 | 
| 239 void Isolate::StandardRunLoop() { | 242 void Isolate::StandardRunLoop() { | 
| 240   ASSERT(long_jump_base() != NULL); | 243   ASSERT(long_jump_base() != NULL); | 
| 241   ASSERT(post_message_callback() == &StandardPostMessageCallback); | 244   ASSERT(post_message_callback() == &StandardPostMessageCallback); | 
| 242   ASSERT(close_port_callback() == &StandardClosePortCallback); | 245   ASSERT(close_port_callback() == &StandardClosePortCallback); | 
| 243 | 246 | 
| 244   while (active_ports() > 0) { | 247   while (live_ports() > 0) { | 
| 245     ASSERT(this == Isolate::Current()); | 248     ASSERT(this == Isolate::Current()); | 
| 246     Zone zone(this); | 249     Zone zone(this); | 
| 247     HandleScope handle_scope(this); | 250     HandleScope handle_scope(this); | 
| 248 | 251 | 
| 249     PortMessage* message = message_queue()->Dequeue(0); | 252     PortMessage* message = message_queue()->Dequeue(0); | 
| 250     if (message != NULL) { | 253     if (message != NULL) { | 
| 251       Dart_EnterScope(); | 254       Dart_EnterScope(); | 
| 252       Dart_Handle result = Dart_HandleMessage( | 255       Dart_Handle result = Dart_HandleMessage( | 
| 253           message->dest_port(), message->reply_port(), message->data()); | 256           message->dest_port(), message->reply_port(), message->data()); | 
| 254       if (Dart_IsError(result)) { | 257       if (Dart_IsError(result)) { | 
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 295   // Visit all objects in the code index table. | 298   // Visit all objects in the code index table. | 
| 296   if (code_index_table() != NULL) { | 299   if (code_index_table() != NULL) { | 
| 297     code_index_table()->VisitObjectPointers(visitor); | 300     code_index_table()->VisitObjectPointers(visitor); | 
| 298   } | 301   } | 
| 299 | 302 | 
| 300   // Visit the top context which is stored in the isolate. | 303   // Visit the top context which is stored in the isolate. | 
| 301   visitor->VisitPointer(reinterpret_cast<RawObject**>(&top_context_)); | 304   visitor->VisitPointer(reinterpret_cast<RawObject**>(&top_context_)); | 
| 302 } | 305 } | 
| 303 | 306 | 
| 304 }  // namespace dart | 307 }  // namespace dart | 
| OLD | NEW | 
|---|