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 "vm/code_observers.h" | 10 #include "vm/code_observers.h" |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
437 tag_table_(GrowableObjectArray::null()), | 437 tag_table_(GrowableObjectArray::null()), |
438 current_tag_(UserTag::null()), | 438 current_tag_(UserTag::null()), |
439 metrics_list_head_(NULL), | 439 metrics_list_head_(NULL), |
440 next_(NULL), | 440 next_(NULL), |
441 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS) | 441 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS) |
442 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_INIT) | 442 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_INIT) |
443 reusable_handles_() { | 443 reusable_handles_() { |
444 set_vm_tag(VMTag::kIdleTagId); | 444 set_vm_tag(VMTag::kIdleTagId); |
445 set_user_tag(UserTags::kDefaultUserTag); | 445 set_user_tag(UserTags::kDefaultUserTag); |
446 } | 446 } |
447 | |
448 Isolate::Isolate(Isolate* original) | |
449 : store_buffer_(true), | |
koda
2014/08/26 23:34:48
add /* shallow_copy = */ to make this slightly les
Ivan Posva
2014/08/27 01:00:22
ditto.
| |
450 class_table_(original->class_table()), | |
451 message_notify_callback_(NULL), | |
452 name_(NULL), | |
453 start_time_(OS::GetCurrentTimeMicros()), | |
454 main_port_(0), | |
455 pause_capability_(0), | |
456 terminate_capability_(0), | |
457 heap_(NULL), | |
458 object_store_(NULL), | |
459 top_context_(Context::null()), | |
460 top_exit_frame_info_(0), | |
461 init_callback_data_(NULL), | |
462 environment_callback_(NULL), | |
463 library_tag_handler_(NULL), | |
464 api_state_(NULL), | |
465 stub_code_(NULL), | |
466 debugger_(NULL), | |
467 single_step_(false), | |
468 resume_request_(false), | |
469 random_(), | |
470 simulator_(NULL), | |
471 long_jump_base_(NULL), | |
472 timer_list_(), | |
473 deopt_id_(0), | |
474 mutex_(new Mutex()), | |
475 stack_limit_(0), | |
476 saved_stack_limit_(0), | |
477 stack_overflow_flags_(0), | |
478 stack_overflow_count_(0), | |
479 message_handler_(NULL), | |
480 spawn_state_(NULL), | |
481 is_runnable_(false), | |
482 gc_prologue_callback_(NULL), | |
483 gc_epilogue_callback_(NULL), | |
484 defer_finalization_count_(0), | |
485 deopt_context_(NULL), | |
486 stacktrace_(NULL), | |
487 stack_frame_index_(-1), | |
488 last_allocationprofile_accumulator_reset_timestamp_(0), | |
489 last_allocationprofile_gc_timestamp_(0), | |
490 cha_(NULL), | |
491 object_id_ring_(NULL), | |
492 trace_buffer_(NULL), | |
493 profiler_data_(NULL), | |
494 thread_state_(NULL), | |
495 tag_table_(GrowableObjectArray::null()), | |
496 current_tag_(UserTag::null()), | |
497 metrics_list_head_(NULL), | |
498 next_(NULL), | |
499 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS) | |
500 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_INIT) | |
501 reusable_handles_() { | |
502 } | |
447 #undef REUSABLE_HANDLE_SCOPE_INIT | 503 #undef REUSABLE_HANDLE_SCOPE_INIT |
448 #undef REUSABLE_HANDLE_INITIALIZERS | 504 #undef REUSABLE_HANDLE_INITIALIZERS |
449 | 505 |
450 | |
451 Isolate::~Isolate() { | 506 Isolate::~Isolate() { |
452 delete [] name_; | 507 delete [] name_; |
453 delete heap_; | 508 delete heap_; |
454 delete object_store_; | 509 delete object_store_; |
455 delete api_state_; | 510 delete api_state_; |
456 delete stub_code_; | 511 delete stub_code_; |
457 delete debugger_; | 512 delete debugger_; |
458 #if defined(USING_SIMULATOR) | 513 #if defined(USING_SIMULATOR) |
459 delete simulator_; | 514 delete simulator_; |
460 #endif | 515 #endif |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
977 } | 1032 } |
978 } | 1033 } |
979 | 1034 |
980 // TODO(5411455): For now just make sure there are no current isolates | 1035 // TODO(5411455): For now just make sure there are no current isolates |
981 // as we are shutting down the isolate. | 1036 // as we are shutting down the isolate. |
982 SetCurrent(NULL); | 1037 SetCurrent(NULL); |
983 Profiler::ShutdownProfilingForIsolate(this); | 1038 Profiler::ShutdownProfilingForIsolate(this); |
984 } | 1039 } |
985 | 1040 |
986 | 1041 |
1042 Isolate* Isolate::ShallowCopy() { | |
1043 return new Isolate(this); | |
1044 } | |
1045 | |
1046 | |
987 Dart_IsolateCreateCallback Isolate::create_callback_ = NULL; | 1047 Dart_IsolateCreateCallback Isolate::create_callback_ = NULL; |
988 Dart_IsolateInterruptCallback Isolate::interrupt_callback_ = NULL; | 1048 Dart_IsolateInterruptCallback Isolate::interrupt_callback_ = NULL; |
989 Dart_IsolateUnhandledExceptionCallback | 1049 Dart_IsolateUnhandledExceptionCallback |
990 Isolate::unhandled_exception_callback_ = NULL; | 1050 Isolate::unhandled_exception_callback_ = NULL; |
991 Dart_IsolateShutdownCallback Isolate::shutdown_callback_ = NULL; | 1051 Dart_IsolateShutdownCallback Isolate::shutdown_callback_ = NULL; |
992 Dart_FileOpenCallback Isolate::file_open_callback_ = NULL; | 1052 Dart_FileOpenCallback Isolate::file_open_callback_ = NULL; |
993 Dart_FileReadCallback Isolate::file_read_callback_ = NULL; | 1053 Dart_FileReadCallback Isolate::file_read_callback_ = NULL; |
994 Dart_FileWriteCallback Isolate::file_write_callback_ = NULL; | 1054 Dart_FileWriteCallback Isolate::file_write_callback_ = NULL; |
995 Dart_FileCloseCallback Isolate::file_close_callback_ = NULL; | 1055 Dart_FileCloseCallback Isolate::file_close_callback_ = NULL; |
996 Dart_EntropySource Isolate::entropy_source_callback_ = NULL; | 1056 Dart_EntropySource Isolate::entropy_source_callback_ = NULL; |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1472 serialized_message_, serialized_message_len_); | 1532 serialized_message_, serialized_message_len_); |
1473 } | 1533 } |
1474 | 1534 |
1475 | 1535 |
1476 void IsolateSpawnState::Cleanup() { | 1536 void IsolateSpawnState::Cleanup() { |
1477 SwitchIsolateScope switch_scope(I); | 1537 SwitchIsolateScope switch_scope(I); |
1478 Dart::ShutdownIsolate(); | 1538 Dart::ShutdownIsolate(); |
1479 } | 1539 } |
1480 | 1540 |
1481 } // namespace dart | 1541 } // namespace dart |
OLD | NEW |