Chromium Code Reviews| 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 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 587 stack_overflow_flags_(0), | 587 stack_overflow_flags_(0), |
| 588 stack_overflow_count_(0), | 588 stack_overflow_count_(0), |
| 589 message_handler_(NULL), | 589 message_handler_(NULL), |
| 590 spawn_state_(NULL), | 590 spawn_state_(NULL), |
| 591 is_runnable_(false), | 591 is_runnable_(false), |
| 592 gc_prologue_callback_(NULL), | 592 gc_prologue_callback_(NULL), |
| 593 gc_epilogue_callback_(NULL), | 593 gc_epilogue_callback_(NULL), |
| 594 defer_finalization_count_(0), | 594 defer_finalization_count_(0), |
| 595 deopt_context_(NULL), | 595 deopt_context_(NULL), |
| 596 edge_counter_increment_size_(-1), | 596 edge_counter_increment_size_(-1), |
| 597 compiler_stats_(NULL), | |
| 597 is_service_isolate_(false), | 598 is_service_isolate_(false), |
| 598 log_(new class Log()), | 599 log_(new class Log()), |
| 599 stacktrace_(NULL), | 600 stacktrace_(NULL), |
| 600 stack_frame_index_(-1), | 601 stack_frame_index_(-1), |
| 601 last_allocationprofile_accumulator_reset_timestamp_(0), | 602 last_allocationprofile_accumulator_reset_timestamp_(0), |
| 602 last_allocationprofile_gc_timestamp_(0), | 603 last_allocationprofile_gc_timestamp_(0), |
| 603 object_id_ring_(NULL), | 604 object_id_ring_(NULL), |
| 604 trace_buffer_(NULL), | 605 trace_buffer_(NULL), |
| 605 profiler_data_(NULL), | 606 profiler_data_(NULL), |
| 606 thread_state_(NULL), | 607 thread_state_(NULL), |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 653 saved_stack_limit_(0), | 654 saved_stack_limit_(0), |
| 654 stack_overflow_flags_(0), | 655 stack_overflow_flags_(0), |
| 655 stack_overflow_count_(0), | 656 stack_overflow_count_(0), |
| 656 message_handler_(NULL), | 657 message_handler_(NULL), |
| 657 spawn_state_(NULL), | 658 spawn_state_(NULL), |
| 658 is_runnable_(false), | 659 is_runnable_(false), |
| 659 gc_prologue_callback_(NULL), | 660 gc_prologue_callback_(NULL), |
| 660 gc_epilogue_callback_(NULL), | 661 gc_epilogue_callback_(NULL), |
| 661 defer_finalization_count_(0), | 662 defer_finalization_count_(0), |
| 662 deopt_context_(NULL), | 663 deopt_context_(NULL), |
| 664 edge_counter_increment_size_(-1), | |
| 665 compiler_stats_(NULL), | |
| 663 is_service_isolate_(false), | 666 is_service_isolate_(false), |
| 664 log_(new class Log()), | 667 log_(new class Log()), |
| 665 stacktrace_(NULL), | 668 stacktrace_(NULL), |
| 666 stack_frame_index_(-1), | 669 stack_frame_index_(-1), |
| 667 last_allocationprofile_accumulator_reset_timestamp_(0), | 670 last_allocationprofile_accumulator_reset_timestamp_(0), |
| 668 last_allocationprofile_gc_timestamp_(0), | 671 last_allocationprofile_gc_timestamp_(0), |
| 669 object_id_ring_(NULL), | 672 object_id_ring_(NULL), |
| 670 trace_buffer_(NULL), | 673 trace_buffer_(NULL), |
| 671 profiler_data_(NULL), | 674 profiler_data_(NULL), |
| 672 thread_state_(NULL), | 675 thread_state_(NULL), |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 698 delete mutex_; | 701 delete mutex_; |
| 699 mutex_ = NULL; // Fail fast if interrupts are scheduled on a dead isolate. | 702 mutex_ = NULL; // Fail fast if interrupts are scheduled on a dead isolate. |
| 700 delete message_handler_; | 703 delete message_handler_; |
| 701 message_handler_ = NULL; // Fail fast if we send messages to a dead isolate. | 704 message_handler_ = NULL; // Fail fast if we send messages to a dead isolate. |
| 702 ASSERT(deopt_context_ == NULL); // No deopt in progress when isolate deleted. | 705 ASSERT(deopt_context_ == NULL); // No deopt in progress when isolate deleted. |
| 703 delete spawn_state_; | 706 delete spawn_state_; |
| 704 delete log_; | 707 delete log_; |
| 705 log_ = NULL; | 708 log_ = NULL; |
| 706 delete pause_loop_monitor_; | 709 delete pause_loop_monitor_; |
| 707 pause_loop_monitor_ = NULL; | 710 pause_loop_monitor_ = NULL; |
| 711 if (compiler_stats_ != NULL) { | |
| 712 delete compiler_stats_; | |
| 713 compiler_stats_ = NULL; | |
| 714 } | |
| 708 } | 715 } |
| 709 | 716 |
| 710 | 717 |
| 711 #if defined(DEBUG) | 718 #if defined(DEBUG) |
| 712 bool Isolate::IsIsolateOf(Thread* thread) { | 719 bool Isolate::IsIsolateOf(Thread* thread) { |
| 713 return this == thread->isolate(); | 720 return this == thread->isolate(); |
| 714 } | 721 } |
| 715 #endif // DEBUG | 722 #endif // DEBUG |
| 716 | 723 |
| 717 | 724 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 769 | 776 |
| 770 result->BuildName(name_prefix); | 777 result->BuildName(name_prefix); |
| 771 result->debugger_ = new Debugger(); | 778 result->debugger_ = new Debugger(); |
| 772 result->debugger_->Initialize(result); | 779 result->debugger_->Initialize(result); |
| 773 if (FLAG_trace_isolates) { | 780 if (FLAG_trace_isolates) { |
| 774 if (name_prefix == NULL || strcmp(name_prefix, "vm-isolate") != 0) { | 781 if (name_prefix == NULL || strcmp(name_prefix, "vm-isolate") != 0) { |
| 775 OS::Print("[+] Starting isolate:\n" | 782 OS::Print("[+] Starting isolate:\n" |
| 776 "\tisolate: %s\n", result->name()); | 783 "\tisolate: %s\n", result->name()); |
| 777 } | 784 } |
| 778 } | 785 } |
| 779 | 786 if (FLAG_compiler_stats) { |
| 787 result->compiler_stats_ = new CompilerStats(result); | |
| 788 } | |
| 780 // Add to isolate list. | 789 // Add to isolate list. |
| 781 AddIsolateTolist(result); | 790 AddIsolateTolist(result); |
| 782 | 791 |
| 783 return result; | 792 return result; |
| 784 } | 793 } |
| 785 | 794 |
| 786 | 795 |
| 787 void Isolate::InitializeStackLimit() { | 796 void Isolate::InitializeStackLimit() { |
| 788 SetStackLimitFromStackBase(Isolate::GetCurrentStackPointer()); | 797 SetStackLimitFromStackBase(Isolate::GetCurrentStackPointer()); |
| 789 } | 798 } |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1424 timer_list_.ReportTimers(); | 1433 timer_list_.ReportTimers(); |
| 1425 | 1434 |
| 1426 // Write out the coverage data if collection has been enabled. | 1435 // Write out the coverage data if collection has been enabled. |
| 1427 CodeCoverage::Write(this); | 1436 CodeCoverage::Write(this); |
| 1428 | 1437 |
| 1429 // Finalize any weak persistent handles with a non-null referent. | 1438 // Finalize any weak persistent handles with a non-null referent. |
| 1430 FinalizeWeakPersistentHandlesVisitor visitor; | 1439 FinalizeWeakPersistentHandlesVisitor visitor; |
| 1431 api_state()->weak_persistent_handles().VisitHandles(&visitor); | 1440 api_state()->weak_persistent_handles().VisitHandles(&visitor); |
| 1432 api_state()->prologue_weak_persistent_handles().VisitHandles(&visitor); | 1441 api_state()->prologue_weak_persistent_handles().VisitHandles(&visitor); |
| 1433 | 1442 |
| 1434 CompilerStats::Print(); | 1443 compiler_stats()->Print(); |
|
siva
2015/05/12 22:12:32
Shouldn't this also be conditional under FLAG_comp
hausner
2015/05/12 22:49:53
Ah, good catch.
| |
| 1435 if (FLAG_trace_isolates) { | 1444 if (FLAG_trace_isolates) { |
| 1436 heap()->PrintSizes(); | 1445 heap()->PrintSizes(); |
| 1437 megamorphic_cache_table()->PrintSizes(); | 1446 megamorphic_cache_table()->PrintSizes(); |
| 1438 Symbols::DumpStats(); | 1447 Symbols::DumpStats(); |
| 1439 OS::Print("[-] Stopping isolate:\n" | 1448 OS::Print("[-] Stopping isolate:\n" |
| 1440 "\tisolate: %s\n", name()); | 1449 "\tisolate: %s\n", name()); |
| 1441 } | 1450 } |
| 1442 } | 1451 } |
| 1443 | 1452 |
| 1444 // TODO(5411455): For now just make sure there are no current isolates | 1453 // TODO(5411455): For now just make sure there are no current isolates |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2020 serialized_message_, serialized_message_len_); | 2029 serialized_message_, serialized_message_len_); |
| 2021 } | 2030 } |
| 2022 | 2031 |
| 2023 | 2032 |
| 2024 void IsolateSpawnState::Cleanup() { | 2033 void IsolateSpawnState::Cleanup() { |
| 2025 SwitchIsolateScope switch_scope(I); | 2034 SwitchIsolateScope switch_scope(I); |
| 2026 Dart::ShutdownIsolate(); | 2035 Dart::ShutdownIsolate(); |
| 2027 } | 2036 } |
| 2028 | 2037 |
| 2029 } // namespace dart | 2038 } // namespace dart |
| OLD | NEW |