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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 697 #endif | 698 #endif |
| 698 delete mutex_; | 699 delete mutex_; |
| 699 mutex_ = NULL; // Fail fast if interrupts are scheduled on a dead isolate. | 700 mutex_ = NULL; // Fail fast if interrupts are scheduled on a dead isolate. |
| 700 delete message_handler_; | 701 delete message_handler_; |
| 701 message_handler_ = NULL; // Fail fast if we send messages to a dead isolate. | 702 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. | 703 ASSERT(deopt_context_ == NULL); // No deopt in progress when isolate deleted. |
| 703 delete spawn_state_; | 704 delete spawn_state_; |
| 704 delete log_; | 705 delete log_; |
| 705 log_ = NULL; | 706 log_ = NULL; |
| 706 delete pause_loop_monitor_; | 707 delete pause_loop_monitor_; |
| 707 pause_loop_monitor_ = NULL; | 708 pause_loop_monitor_ = NULL; |
|
siva
2015/05/12 17:39:52
free compiler_stats_ here?
hausner
2015/05/12 21:52:16
Done.
| |
| 708 } | 709 } |
| 709 | 710 |
| 710 | 711 |
| 711 #if defined(DEBUG) | 712 #if defined(DEBUG) |
| 712 bool Isolate::IsIsolateOf(Thread* thread) { | 713 bool Isolate::IsIsolateOf(Thread* thread) { |
| 713 return this == thread->isolate(); | 714 return this == thread->isolate(); |
| 714 } | 715 } |
| 715 #endif // DEBUG | 716 #endif // DEBUG |
| 716 | 717 |
| 717 | 718 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 770 result->BuildName(name_prefix); | 771 result->BuildName(name_prefix); |
| 771 result->debugger_ = new Debugger(); | 772 result->debugger_ = new Debugger(); |
| 772 result->debugger_->Initialize(result); | 773 result->debugger_->Initialize(result); |
| 773 if (FLAG_trace_isolates) { | 774 if (FLAG_trace_isolates) { |
| 774 if (name_prefix == NULL || strcmp(name_prefix, "vm-isolate") != 0) { | 775 if (name_prefix == NULL || strcmp(name_prefix, "vm-isolate") != 0) { |
| 775 OS::Print("[+] Starting isolate:\n" | 776 OS::Print("[+] Starting isolate:\n" |
| 776 "\tisolate: %s\n", result->name()); | 777 "\tisolate: %s\n", result->name()); |
| 777 } | 778 } |
| 778 } | 779 } |
| 779 | 780 |
| 781 result->compiler_stats_ = new CompilerStats(result); | |
|
siva
2015/05/12 17:39:52
Should this be done conditionally under FLAG_compi
hausner
2015/05/12 21:52:16
Yes.
| |
| 782 | |
| 780 // Add to isolate list. | 783 // Add to isolate list. |
| 781 AddIsolateTolist(result); | 784 AddIsolateTolist(result); |
| 782 | 785 |
| 783 return result; | 786 return result; |
| 784 } | 787 } |
| 785 | 788 |
| 786 | 789 |
| 787 void Isolate::InitializeStackLimit() { | 790 void Isolate::InitializeStackLimit() { |
| 788 SetStackLimitFromStackBase(Isolate::GetCurrentStackPointer()); | 791 SetStackLimitFromStackBase(Isolate::GetCurrentStackPointer()); |
| 789 } | 792 } |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1424 timer_list_.ReportTimers(); | 1427 timer_list_.ReportTimers(); |
| 1425 | 1428 |
| 1426 // Write out the coverage data if collection has been enabled. | 1429 // Write out the coverage data if collection has been enabled. |
| 1427 CodeCoverage::Write(this); | 1430 CodeCoverage::Write(this); |
| 1428 | 1431 |
| 1429 // Finalize any weak persistent handles with a non-null referent. | 1432 // Finalize any weak persistent handles with a non-null referent. |
| 1430 FinalizeWeakPersistentHandlesVisitor visitor; | 1433 FinalizeWeakPersistentHandlesVisitor visitor; |
| 1431 api_state()->weak_persistent_handles().VisitHandles(&visitor); | 1434 api_state()->weak_persistent_handles().VisitHandles(&visitor); |
| 1432 api_state()->prologue_weak_persistent_handles().VisitHandles(&visitor); | 1435 api_state()->prologue_weak_persistent_handles().VisitHandles(&visitor); |
| 1433 | 1436 |
| 1434 CompilerStats::Print(); | 1437 compiler_stats()->Print(); |
| 1435 if (FLAG_trace_isolates) { | 1438 if (FLAG_trace_isolates) { |
| 1436 heap()->PrintSizes(); | 1439 heap()->PrintSizes(); |
| 1437 megamorphic_cache_table()->PrintSizes(); | 1440 megamorphic_cache_table()->PrintSizes(); |
| 1438 Symbols::DumpStats(); | 1441 Symbols::DumpStats(); |
| 1439 OS::Print("[-] Stopping isolate:\n" | 1442 OS::Print("[-] Stopping isolate:\n" |
| 1440 "\tisolate: %s\n", name()); | 1443 "\tisolate: %s\n", name()); |
| 1441 } | 1444 } |
| 1442 } | 1445 } |
| 1443 | 1446 |
| 1444 // TODO(5411455): For now just make sure there are no current isolates | 1447 // 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_); | 2023 serialized_message_, serialized_message_len_); |
| 2021 } | 2024 } |
| 2022 | 2025 |
| 2023 | 2026 |
| 2024 void IsolateSpawnState::Cleanup() { | 2027 void IsolateSpawnState::Cleanup() { |
| 2025 SwitchIsolateScope switch_scope(I); | 2028 SwitchIsolateScope switch_scope(I); |
| 2026 Dart::ShutdownIsolate(); | 2029 Dart::ShutdownIsolate(); |
| 2027 } | 2030 } |
| 2028 | 2031 |
| 2029 } // namespace dart | 2032 } // namespace dart |
| OLD | NEW |