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 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 cha_(NULL), | 612 cha_(NULL), |
613 next_(NULL), | 613 next_(NULL), |
614 pause_loop_monitor_(NULL), | 614 pause_loop_monitor_(NULL), |
615 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS) | 615 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS) |
616 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_INIT) | 616 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_INIT) |
617 reusable_handles_() { | 617 reusable_handles_() { |
618 set_vm_tag(VMTag::kEmbedderTagId); | 618 set_vm_tag(VMTag::kEmbedderTagId); |
619 set_user_tag(UserTags::kDefaultUserTag); | 619 set_user_tag(UserTags::kDefaultUserTag); |
620 } | 620 } |
621 | 621 |
622 Isolate::Isolate(Isolate* original) | |
623 : mutator_thread_(NULL), | |
624 vm_tag_(0), | |
625 store_buffer_(true), | |
626 class_table_(original->class_table()), | |
627 message_notify_callback_(NULL), | |
628 name_(NULL), | |
629 debugger_name_(NULL), | |
630 start_time_(OS::GetCurrentTimeMicros()), | |
631 main_port_(0), | |
632 pause_capability_(0), | |
633 terminate_capability_(0), | |
634 errors_fatal_(true), | |
635 heap_(NULL), | |
636 object_store_(NULL), | |
637 top_exit_frame_info_(0), | |
638 init_callback_data_(NULL), | |
639 environment_callback_(NULL), | |
640 library_tag_handler_(NULL), | |
641 api_state_(NULL), | |
642 stub_code_(NULL), | |
643 debugger_(NULL), | |
644 single_step_(false), | |
645 resume_request_(false), | |
646 random_(), | |
647 simulator_(NULL), | |
648 long_jump_base_(NULL), | |
649 timer_list_(), | |
650 deopt_id_(0), | |
651 mutex_(new Mutex()), | |
652 stack_limit_(0), | |
653 saved_stack_limit_(0), | |
654 stack_overflow_flags_(0), | |
655 stack_overflow_count_(0), | |
656 message_handler_(NULL), | |
657 spawn_state_(NULL), | |
658 is_runnable_(false), | |
659 gc_prologue_callback_(NULL), | |
660 gc_epilogue_callback_(NULL), | |
661 defer_finalization_count_(0), | |
662 deopt_context_(NULL), | |
663 is_service_isolate_(false), | |
664 log_(new class Log()), | |
665 stacktrace_(NULL), | |
666 stack_frame_index_(-1), | |
667 last_allocationprofile_accumulator_reset_timestamp_(0), | |
668 last_allocationprofile_gc_timestamp_(0), | |
669 object_id_ring_(NULL), | |
670 trace_buffer_(NULL), | |
671 profiler_data_(NULL), | |
672 thread_state_(NULL), | |
673 tag_table_(GrowableObjectArray::null()), | |
674 current_tag_(UserTag::null()), | |
675 default_tag_(UserTag::null()), | |
676 metrics_list_head_(NULL), | |
677 cha_(NULL), | |
678 next_(NULL), | |
679 pause_loop_monitor_(NULL), | |
680 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS) | |
681 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_INIT) | |
682 reusable_handles_() { | |
683 } | |
684 #undef REUSABLE_HANDLE_SCOPE_INIT | 622 #undef REUSABLE_HANDLE_SCOPE_INIT |
685 #undef REUSABLE_HANDLE_INITIALIZERS | 623 #undef REUSABLE_HANDLE_INITIALIZERS |
686 | 624 |
687 Isolate::~Isolate() { | 625 Isolate::~Isolate() { |
688 free(name_); | 626 free(name_); |
689 free(debugger_name_); | 627 free(debugger_name_); |
690 delete heap_; | 628 delete heap_; |
691 delete object_store_; | 629 delete object_store_; |
692 delete api_state_; | 630 delete api_state_; |
693 delete stub_code_; | 631 delete stub_code_; |
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1441 } | 1379 } |
1442 } | 1380 } |
1443 | 1381 |
1444 // TODO(5411455): For now just make sure there are no current isolates | 1382 // TODO(5411455): For now just make sure there are no current isolates |
1445 // as we are shutting down the isolate. | 1383 // as we are shutting down the isolate. |
1446 Thread::ExitIsolate(); | 1384 Thread::ExitIsolate(); |
1447 Profiler::ShutdownProfilingForIsolate(this); | 1385 Profiler::ShutdownProfilingForIsolate(this); |
1448 } | 1386 } |
1449 | 1387 |
1450 | 1388 |
1451 Isolate* Isolate::ShallowCopy() { | |
1452 return new Isolate(this); | |
1453 } | |
1454 | |
1455 | |
1456 Dart_IsolateCreateCallback Isolate::create_callback_ = NULL; | 1389 Dart_IsolateCreateCallback Isolate::create_callback_ = NULL; |
1457 Dart_IsolateInterruptCallback Isolate::interrupt_callback_ = NULL; | 1390 Dart_IsolateInterruptCallback Isolate::interrupt_callback_ = NULL; |
1458 Dart_IsolateUnhandledExceptionCallback | 1391 Dart_IsolateUnhandledExceptionCallback |
1459 Isolate::unhandled_exception_callback_ = NULL; | 1392 Isolate::unhandled_exception_callback_ = NULL; |
1460 Dart_IsolateShutdownCallback Isolate::shutdown_callback_ = NULL; | 1393 Dart_IsolateShutdownCallback Isolate::shutdown_callback_ = NULL; |
1461 Dart_FileOpenCallback Isolate::file_open_callback_ = NULL; | 1394 Dart_FileOpenCallback Isolate::file_open_callback_ = NULL; |
1462 Dart_FileReadCallback Isolate::file_read_callback_ = NULL; | 1395 Dart_FileReadCallback Isolate::file_read_callback_ = NULL; |
1463 Dart_FileWriteCallback Isolate::file_write_callback_ = NULL; | 1396 Dart_FileWriteCallback Isolate::file_write_callback_ = NULL; |
1464 Dart_FileCloseCallback Isolate::file_close_callback_ = NULL; | 1397 Dart_FileCloseCallback Isolate::file_close_callback_ = NULL; |
1465 Dart_EntropySource Isolate::entropy_source_callback_ = NULL; | 1398 Dart_EntropySource Isolate::entropy_source_callback_ = NULL; |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2020 serialized_message_, serialized_message_len_); | 1953 serialized_message_, serialized_message_len_); |
2021 } | 1954 } |
2022 | 1955 |
2023 | 1956 |
2024 void IsolateSpawnState::Cleanup() { | 1957 void IsolateSpawnState::Cleanup() { |
2025 SwitchIsolateScope switch_scope(I); | 1958 SwitchIsolateScope switch_scope(I); |
2026 Dart::ShutdownIsolate(); | 1959 Dart::ShutdownIsolate(); |
2027 } | 1960 } |
2028 | 1961 |
2029 } // namespace dart | 1962 } // namespace dart |
OLD | NEW |