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 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
692 message_handler_(NULL), | 692 message_handler_(NULL), |
693 spawn_state_(NULL), | 693 spawn_state_(NULL), |
694 is_runnable_(false), | 694 is_runnable_(false), |
695 gc_prologue_callback_(NULL), | 695 gc_prologue_callback_(NULL), |
696 gc_epilogue_callback_(NULL), | 696 gc_epilogue_callback_(NULL), |
697 defer_finalization_count_(0), | 697 defer_finalization_count_(0), |
698 deopt_context_(NULL), | 698 deopt_context_(NULL), |
699 edge_counter_increment_size_(-1), | 699 edge_counter_increment_size_(-1), |
700 compiler_stats_(NULL), | 700 compiler_stats_(NULL), |
701 is_service_isolate_(false), | 701 is_service_isolate_(false), |
702 log_(new class Log()), | 702 log_(new class Log()), |
Ivan Posva
2015/09/08 21:22:21
Why does the isolate still carry around a log_ aft
koda
2015/09/09 00:26:57
Removed.
| |
703 stacktrace_(NULL), | 703 stacktrace_(NULL), |
704 stack_frame_index_(-1), | 704 stack_frame_index_(-1), |
705 last_allocationprofile_accumulator_reset_timestamp_(0), | 705 last_allocationprofile_accumulator_reset_timestamp_(0), |
706 last_allocationprofile_gc_timestamp_(0), | 706 last_allocationprofile_gc_timestamp_(0), |
707 object_id_ring_(NULL), | 707 object_id_ring_(NULL), |
708 trace_buffer_(NULL), | 708 trace_buffer_(NULL), |
709 profiler_data_(NULL), | 709 profiler_data_(NULL), |
710 tag_table_(GrowableObjectArray::null()), | 710 tag_table_(GrowableObjectArray::null()), |
711 current_tag_(UserTag::null()), | 711 current_tag_(UserTag::null()), |
712 default_tag_(UserTag::null()), | 712 default_tag_(UserTag::null()), |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
900 name_ = strdup(name_prefix); | 900 name_ = strdup(name_prefix); |
901 return; | 901 return; |
902 } | 902 } |
903 const char* kFormat = "%s-%lld"; | 903 const char* kFormat = "%s-%lld"; |
904 intptr_t len = OS::SNPrint(NULL, 0, kFormat, name_prefix, main_port()) + 1; | 904 intptr_t len = OS::SNPrint(NULL, 0, kFormat, name_prefix, main_port()) + 1; |
905 name_ = reinterpret_cast<char*>(malloc(len)); | 905 name_ = reinterpret_cast<char*>(malloc(len)); |
906 OS::SNPrint(name_, len, kFormat, name_prefix, main_port()); | 906 OS::SNPrint(name_, len, kFormat, name_prefix, main_port()); |
907 } | 907 } |
908 | 908 |
909 | 909 |
910 Log* Isolate::Log() const { | 910 bool Isolate::ShouldLog() const { |
Ivan Posva
2015/09/08 21:22:21
We might want to move this functionality into the
koda
2015/09/09 00:26:57
Done.
| |
911 if (FLAG_isolate_log_filter == NULL) { | 911 if (FLAG_isolate_log_filter == NULL) { |
912 if (is_service_isolate_) { | 912 if (is_service_isolate_) { |
913 // By default, do not log for the service isolate. | 913 // By default, do not log for the service isolate. |
914 return Log::NoOpLog(); | 914 return false; |
915 } | 915 } |
916 return log_; | 916 return true; |
917 } | 917 } |
918 ASSERT(name_ != NULL); | 918 ASSERT(name_ != NULL); |
919 if (strstr(name_, FLAG_isolate_log_filter) == NULL) { | 919 if (strstr(name_, FLAG_isolate_log_filter) == NULL) { |
920 // Filter does not match, do not log for this isolate. | 920 // Filter does not match, do not log for this isolate. |
921 return Log::NoOpLog(); | 921 return false; |
922 } | 922 } |
923 return log_; | 923 return true; |
924 } | 924 } |
925 | 925 |
926 | 926 |
927 // TODO(5411455): Use flag to override default value and Validate the | 927 // TODO(5411455): Use flag to override default value and Validate the |
928 // stack size by querying OS. | 928 // stack size by querying OS. |
929 uword Isolate::GetSpecifiedStackSize() { | 929 uword Isolate::GetSpecifiedStackSize() { |
930 ASSERT(Isolate::kStackSizeBuffer < OSThread::GetMaxStackSize()); | 930 ASSERT(Isolate::kStackSizeBuffer < OSThread::GetMaxStackSize()); |
931 uword stack_size = OSThread::GetMaxStackSize() - Isolate::kStackSizeBuffer; | 931 uword stack_size = OSThread::GetMaxStackSize() - Isolate::kStackSizeBuffer; |
932 return stack_size; | 932 return stack_size; |
933 } | 933 } |
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1558 api_state()->prologue_weak_persistent_handles().VisitHandles(&visitor); | 1558 api_state()->prologue_weak_persistent_handles().VisitHandles(&visitor); |
1559 | 1559 |
1560 if (FLAG_trace_isolates) { | 1560 if (FLAG_trace_isolates) { |
1561 heap()->PrintSizes(); | 1561 heap()->PrintSizes(); |
1562 megamorphic_cache_table()->PrintSizes(); | 1562 megamorphic_cache_table()->PrintSizes(); |
1563 Symbols::DumpStats(); | 1563 Symbols::DumpStats(); |
1564 OS::Print("[-] Stopping isolate:\n" | 1564 OS::Print("[-] Stopping isolate:\n" |
1565 "\tisolate: %s\n", name()); | 1565 "\tisolate: %s\n", name()); |
1566 } | 1566 } |
1567 if (FLAG_print_metrics) { | 1567 if (FLAG_print_metrics) { |
1568 LogBlock lb(this); | 1568 LogBlock lb(thread); |
1569 ISL_Print("Printing metrics for %s\n", name()); | 1569 ISL_Print("Printing metrics for %s\n", name()); |
1570 #define ISOLATE_METRIC_PRINT(type, variable, name, unit) \ | 1570 #define ISOLATE_METRIC_PRINT(type, variable, name, unit) \ |
1571 ISL_Print("%s\n", metric_##variable##_.ToString()); | 1571 ISL_Print("%s\n", metric_##variable##_.ToString()); |
1572 ISOLATE_METRIC_LIST(ISOLATE_METRIC_PRINT); | 1572 ISOLATE_METRIC_LIST(ISOLATE_METRIC_PRINT); |
1573 #undef ISOLATE_METRIC_PRINT | 1573 #undef ISOLATE_METRIC_PRINT |
1574 ISL_Print("\n"); | 1574 ISL_Print("\n"); |
1575 } | 1575 } |
1576 } | 1576 } |
1577 | 1577 |
1578 #if defined(DEBUG) | 1578 #if defined(DEBUG) |
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2353 serialized_message_, serialized_message_len_); | 2353 serialized_message_, serialized_message_len_); |
2354 } | 2354 } |
2355 | 2355 |
2356 | 2356 |
2357 void IsolateSpawnState::Cleanup() { | 2357 void IsolateSpawnState::Cleanup() { |
2358 SwitchIsolateScope switch_scope(I); | 2358 SwitchIsolateScope switch_scope(I); |
2359 Dart::ShutdownIsolate(); | 2359 Dart::ShutdownIsolate(); |
2360 } | 2360 } |
2361 | 2361 |
2362 } // namespace dart | 2362 } // namespace dart |
OLD | NEW |