| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "platform/json.h" | 9 #include "platform/json.h" |
| 10 #include "lib/mirrors.h" | 10 #include "lib/mirrors.h" |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 isolate_->object_store()->set_sticky_error(result); | 266 isolate_->object_store()->set_sticky_error(result); |
| 267 return false; | 267 return false; |
| 268 } | 268 } |
| 269 | 269 |
| 270 | 270 |
| 271 #if defined(DEBUG) | 271 #if defined(DEBUG) |
| 272 // static | 272 // static |
| 273 void BaseIsolate::AssertCurrent(BaseIsolate* isolate) { | 273 void BaseIsolate::AssertCurrent(BaseIsolate* isolate) { |
| 274 ASSERT(isolate == Isolate::Current()); | 274 ASSERT(isolate == Isolate::Current()); |
| 275 } | 275 } |
| 276 #endif | 276 #endif // defined(DEBUG) |
| 277 | 277 |
| 278 #if defined(DEBUG) |
| 279 #define REUSABLE_HANDLE_SCOPE_INIT(object) \ |
| 280 reusable_##object##_handle_scope_active_(false), |
| 281 #else |
| 282 #define REUSABLE_HANDLE_SCOPE_INIT(object) |
| 283 #endif // defined(DEBUG) |
| 278 | 284 |
| 279 #define REUSABLE_HANDLE_INITIALIZERS(object) \ | 285 #define REUSABLE_HANDLE_INITIALIZERS(object) \ |
| 280 object##_handle_(NULL), | 286 object##_handle_(NULL), |
| 281 | 287 |
| 282 Isolate::Isolate() | 288 Isolate::Isolate() |
| 283 : store_buffer_(), | 289 : store_buffer_(), |
| 284 message_notify_callback_(NULL), | 290 message_notify_callback_(NULL), |
| 285 name_(NULL), | 291 name_(NULL), |
| 286 start_time_(OS::GetCurrentTimeMicros()), | 292 start_time_(OS::GetCurrentTimeMicros()), |
| 287 pin_port_(0), | 293 pin_port_(0), |
| (...skipping 26 matching lines...) Expand all Loading... |
| 314 deopt_context_(NULL), | 320 deopt_context_(NULL), |
| 315 stacktrace_(NULL), | 321 stacktrace_(NULL), |
| 316 stack_frame_index_(-1), | 322 stack_frame_index_(-1), |
| 317 object_histogram_(NULL), | 323 object_histogram_(NULL), |
| 318 cha_used_(false), | 324 cha_used_(false), |
| 319 object_id_ring_(NULL), | 325 object_id_ring_(NULL), |
| 320 profiler_data_(NULL), | 326 profiler_data_(NULL), |
| 321 thread_state_(NULL), | 327 thread_state_(NULL), |
| 322 next_(NULL), | 328 next_(NULL), |
| 323 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS) | 329 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS) |
| 330 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_INIT) |
| 324 reusable_handles_() { | 331 reusable_handles_() { |
| 325 if (FLAG_print_object_histogram && (Dart::vm_isolate() != NULL)) { | 332 if (FLAG_print_object_histogram && (Dart::vm_isolate() != NULL)) { |
| 326 object_histogram_ = new ObjectHistogram(this); | 333 object_histogram_ = new ObjectHistogram(this); |
| 327 } | 334 } |
| 328 } | 335 } |
| 336 #undef REUSABLE_HANDLE_SCOPE_INIT |
| 329 #undef REUSABLE_HANDLE_INITIALIZERS | 337 #undef REUSABLE_HANDLE_INITIALIZERS |
| 330 | 338 |
| 331 | 339 |
| 332 Isolate::~Isolate() { | 340 Isolate::~Isolate() { |
| 333 delete [] name_; | 341 delete [] name_; |
| 334 delete heap_; | 342 delete heap_; |
| 335 delete object_store_; | 343 delete object_store_; |
| 336 delete api_state_; | 344 delete api_state_; |
| 337 delete stub_code_; | 345 delete stub_code_; |
| 338 delete debugger_; | 346 delete debugger_; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 | 403 |
| 396 // Add to isolate list. | 404 // Add to isolate list. |
| 397 AddIsolateTolist(result); | 405 AddIsolateTolist(result); |
| 398 | 406 |
| 399 // TODO(5411455): For now just set the recently created isolate as | 407 // TODO(5411455): For now just set the recently created isolate as |
| 400 // the current isolate. | 408 // the current isolate. |
| 401 SetCurrent(result); | 409 SetCurrent(result); |
| 402 | 410 |
| 403 // Setup the isolate specific resuable handles. | 411 // Setup the isolate specific resuable handles. |
| 404 #define REUSABLE_HANDLE_ALLOCATION(object) \ | 412 #define REUSABLE_HANDLE_ALLOCATION(object) \ |
| 405 result->object##_handle_ = result->AllocateReusableHandle<object>(); \ | 413 result->object##_handle_ = result->AllocateReusableHandle<object>(); |
| 406 | |
| 407 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_ALLOCATION) | 414 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_ALLOCATION) |
| 408 #undef REUSABLE_HANDLE_ALLOCATION | 415 #undef REUSABLE_HANDLE_ALLOCATION |
| 409 | 416 |
| 410 // Setup the isolate message handler. | 417 // Setup the isolate message handler. |
| 411 MessageHandler* handler = new IsolateMessageHandler(result); | 418 MessageHandler* handler = new IsolateMessageHandler(result); |
| 412 ASSERT(handler != NULL); | 419 ASSERT(handler != NULL); |
| 413 result->set_message_handler(handler); | 420 result->set_message_handler(handler); |
| 414 | 421 |
| 415 // Setup the Dart API state. | 422 // Setup the Dart API state. |
| 416 ApiState* state = new ApiState(); | 423 ApiState* state = new ApiState(); |
| (...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1080 return func.raw(); | 1087 return func.raw(); |
| 1081 } | 1088 } |
| 1082 | 1089 |
| 1083 | 1090 |
| 1084 void IsolateSpawnState::Cleanup() { | 1091 void IsolateSpawnState::Cleanup() { |
| 1085 SwitchIsolateScope switch_scope(isolate()); | 1092 SwitchIsolateScope switch_scope(isolate()); |
| 1086 Dart::ShutdownIsolate(); | 1093 Dart::ShutdownIsolate(); |
| 1087 } | 1094 } |
| 1088 | 1095 |
| 1089 } // namespace dart | 1096 } // namespace dart |
| OLD | NEW |