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 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 cha_(NULL), | 613 cha_(NULL), |
614 next_(NULL), | 614 next_(NULL), |
615 pause_loop_monitor_(NULL), | 615 pause_loop_monitor_(NULL), |
616 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS) | 616 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS) |
617 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_INIT) | 617 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_INIT) |
618 reusable_handles_() { | 618 reusable_handles_() { |
619 set_vm_tag(VMTag::kEmbedderTagId); | 619 set_vm_tag(VMTag::kEmbedderTagId); |
620 set_user_tag(UserTags::kDefaultUserTag); | 620 set_user_tag(UserTags::kDefaultUserTag); |
621 } | 621 } |
622 | 622 |
623 Isolate::Isolate(Isolate* original) | |
624 : mutator_thread_(NULL), | |
625 vm_tag_(0), | |
626 store_buffer_(true), | |
627 class_table_(original->class_table()), | |
628 message_notify_callback_(NULL), | |
629 name_(NULL), | |
630 debugger_name_(NULL), | |
631 start_time_(OS::GetCurrentTimeMicros()), | |
632 main_port_(0), | |
633 pause_capability_(0), | |
634 terminate_capability_(0), | |
635 errors_fatal_(true), | |
636 heap_(NULL), | |
637 object_store_(NULL), | |
638 top_exit_frame_info_(0), | |
639 init_callback_data_(NULL), | |
640 environment_callback_(NULL), | |
641 library_tag_handler_(NULL), | |
642 api_state_(NULL), | |
643 stub_code_(NULL), | |
644 debugger_(NULL), | |
645 single_step_(false), | |
646 resume_request_(false), | |
647 random_(), | |
648 simulator_(NULL), | |
649 long_jump_base_(NULL), | |
650 timer_list_(), | |
651 deopt_id_(0), | |
652 mutex_(new Mutex()), | |
653 stack_limit_(0), | |
654 saved_stack_limit_(0), | |
655 stack_overflow_flags_(0), | |
656 stack_overflow_count_(0), | |
657 message_handler_(NULL), | |
658 spawn_state_(NULL), | |
659 is_runnable_(false), | |
660 gc_prologue_callback_(NULL), | |
661 gc_epilogue_callback_(NULL), | |
662 defer_finalization_count_(0), | |
663 deopt_context_(NULL), | |
664 edge_counter_increment_size_(-1), | |
665 compiler_stats_(NULL), | |
666 is_service_isolate_(false), | |
667 log_(new class Log()), | |
668 stacktrace_(NULL), | |
669 stack_frame_index_(-1), | |
670 last_allocationprofile_accumulator_reset_timestamp_(0), | |
671 last_allocationprofile_gc_timestamp_(0), | |
672 object_id_ring_(NULL), | |
673 trace_buffer_(NULL), | |
674 profiler_data_(NULL), | |
675 thread_state_(NULL), | |
676 tag_table_(GrowableObjectArray::null()), | |
677 current_tag_(UserTag::null()), | |
678 default_tag_(UserTag::null()), | |
679 deoptimized_code_array_(GrowableObjectArray::null()), | |
680 metrics_list_head_(NULL), | |
681 cha_(NULL), | |
682 next_(NULL), | |
683 pause_loop_monitor_(NULL), | |
684 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS) | |
685 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_INIT) | |
686 reusable_handles_() { | |
687 } | |
688 #undef REUSABLE_HANDLE_SCOPE_INIT | 623 #undef REUSABLE_HANDLE_SCOPE_INIT |
689 #undef REUSABLE_HANDLE_INITIALIZERS | 624 #undef REUSABLE_HANDLE_INITIALIZERS |
690 | 625 |
691 Isolate::~Isolate() { | 626 Isolate::~Isolate() { |
692 free(name_); | 627 free(name_); |
693 free(debugger_name_); | 628 free(debugger_name_); |
694 delete heap_; | 629 delete heap_; |
695 delete object_store_; | 630 delete object_store_; |
696 delete api_state_; | 631 delete api_state_; |
697 delete stub_code_; | 632 delete stub_code_; |
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1457 } | 1392 } |
1458 } | 1393 } |
1459 | 1394 |
1460 // TODO(5411455): For now just make sure there are no current isolates | 1395 // TODO(5411455): For now just make sure there are no current isolates |
1461 // as we are shutting down the isolate. | 1396 // as we are shutting down the isolate. |
1462 Thread::ExitIsolate(); | 1397 Thread::ExitIsolate(); |
1463 Profiler::ShutdownProfilingForIsolate(this); | 1398 Profiler::ShutdownProfilingForIsolate(this); |
1464 } | 1399 } |
1465 | 1400 |
1466 | 1401 |
1467 Isolate* Isolate::ShallowCopy() { | |
1468 return new Isolate(this); | |
1469 } | |
1470 | |
1471 | |
1472 Dart_IsolateCreateCallback Isolate::create_callback_ = NULL; | 1402 Dart_IsolateCreateCallback Isolate::create_callback_ = NULL; |
1473 Dart_IsolateInterruptCallback Isolate::interrupt_callback_ = NULL; | 1403 Dart_IsolateInterruptCallback Isolate::interrupt_callback_ = NULL; |
1474 Dart_IsolateUnhandledExceptionCallback | 1404 Dart_IsolateUnhandledExceptionCallback |
1475 Isolate::unhandled_exception_callback_ = NULL; | 1405 Isolate::unhandled_exception_callback_ = NULL; |
1476 Dart_IsolateShutdownCallback Isolate::shutdown_callback_ = NULL; | 1406 Dart_IsolateShutdownCallback Isolate::shutdown_callback_ = NULL; |
1477 Dart_FileOpenCallback Isolate::file_open_callback_ = NULL; | 1407 Dart_FileOpenCallback Isolate::file_open_callback_ = NULL; |
1478 Dart_FileReadCallback Isolate::file_read_callback_ = NULL; | 1408 Dart_FileReadCallback Isolate::file_read_callback_ = NULL; |
1479 Dart_FileWriteCallback Isolate::file_write_callback_ = NULL; | 1409 Dart_FileWriteCallback Isolate::file_write_callback_ = NULL; |
1480 Dart_FileCloseCallback Isolate::file_close_callback_ = NULL; | 1410 Dart_FileCloseCallback Isolate::file_close_callback_ = NULL; |
1481 Dart_EntropySource Isolate::entropy_source_callback_ = NULL; | 1411 Dart_EntropySource Isolate::entropy_source_callback_ = NULL; |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2039 serialized_message_, serialized_message_len_); | 1969 serialized_message_, serialized_message_len_); |
2040 } | 1970 } |
2041 | 1971 |
2042 | 1972 |
2043 void IsolateSpawnState::Cleanup() { | 1973 void IsolateSpawnState::Cleanup() { |
2044 SwitchIsolateScope switch_scope(I); | 1974 SwitchIsolateScope switch_scope(I); |
2045 Dart::ShutdownIsolate(); | 1975 Dart::ShutdownIsolate(); |
2046 } | 1976 } |
2047 | 1977 |
2048 } // namespace dart | 1978 } // namespace dart |
OLD | NEW |