Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: runtime/vm/isolate.cc

Issue 1665773004: Add necessary support functions so that embedders can implemented pause on start and exit (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "include/dart_native_api.h" 8 #include "include/dart_native_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/text_buffer.h" 10 #include "platform/text_buffer.h"
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 flags_(), 772 flags_(),
773 random_(), 773 random_(),
774 simulator_(NULL), 774 simulator_(NULL),
775 mutex_(new Mutex()), 775 mutex_(new Mutex()),
776 saved_stack_limit_(0), 776 saved_stack_limit_(0),
777 stack_overflow_flags_(0), 777 stack_overflow_flags_(0),
778 stack_overflow_count_(0), 778 stack_overflow_count_(0),
779 message_handler_(NULL), 779 message_handler_(NULL),
780 spawn_state_(NULL), 780 spawn_state_(NULL),
781 is_runnable_(false), 781 is_runnable_(false),
782 pause_isolates_flags_overridden_(false),
782 gc_prologue_callback_(NULL), 783 gc_prologue_callback_(NULL),
783 gc_epilogue_callback_(NULL), 784 gc_epilogue_callback_(NULL),
784 defer_finalization_count_(0), 785 defer_finalization_count_(0),
785 deopt_context_(NULL), 786 deopt_context_(NULL),
786 compiler_stats_(NULL), 787 compiler_stats_(NULL),
787 is_service_isolate_(false), 788 is_service_isolate_(false),
788 stacktrace_(NULL), 789 stacktrace_(NULL),
789 stack_frame_index_(-1), 790 stack_frame_index_(-1),
790 last_allocationprofile_accumulator_reset_timestamp_(0), 791 last_allocationprofile_accumulator_reset_timestamp_(0),
791 last_allocationprofile_gc_timestamp_(0), 792 last_allocationprofile_gc_timestamp_(0),
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
1062 MutexLocker ml(mutex_); 1063 MutexLocker ml(mutex_);
1063 // Check if we are in a valid state to make the isolate runnable. 1064 // Check if we are in a valid state to make the isolate runnable.
1064 if (is_runnable() == true) { 1065 if (is_runnable() == true) {
1065 return false; // Already runnable. 1066 return false; // Already runnable.
1066 } 1067 }
1067 // Set the isolate as runnable and if we are being spawned schedule 1068 // Set the isolate as runnable and if we are being spawned schedule
1068 // isolate on thread pool for execution. 1069 // isolate on thread pool for execution.
1069 ASSERT(object_store()->root_library() != Library::null()); 1070 ASSERT(object_store()->root_library() != Library::null());
1070 set_is_runnable(true); 1071 set_is_runnable(true);
1071 if (!ServiceIsolate::IsServiceIsolate(this)) { 1072 if (!ServiceIsolate::IsServiceIsolate(this)) {
1072 message_handler()->set_pause_on_start(FLAG_pause_isolates_on_start); 1073 if (!pause_isolates_flags_overridden_) {
1073 message_handler()->set_pause_on_exit(FLAG_pause_isolates_on_exit); 1074 message_handler()->set_pause_on_start(FLAG_pause_isolates_on_start);
1075 message_handler()->set_pause_on_exit(FLAG_pause_isolates_on_exit);
1076 }
turnidge 2016/02/03 21:33:36 As discussed offline, we may be able to remove pau
turnidge 2016/02/03 21:35:53 One more thing, we wouldn't want pause_on_start to
Cutch 2016/02/03 23:04:04 Acknowledged.
Cutch 2016/02/03 23:04:05 Done.
1074 if (FLAG_pause_isolates_on_unhandled_exceptions) { 1077 if (FLAG_pause_isolates_on_unhandled_exceptions) {
1075 debugger()->SetExceptionPauseInfo(kPauseOnUnhandledExceptions); 1078 debugger()->SetExceptionPauseInfo(kPauseOnUnhandledExceptions);
1076 } 1079 }
1077 } 1080 }
1078 IsolateSpawnState* state = spawn_state(); 1081 IsolateSpawnState* state = spawn_state();
1079 if (state != NULL) { 1082 if (state != NULL) {
1080 ASSERT(this == state->isolate()); 1083 ASSERT(this == state->isolate());
1081 Run(); 1084 Run();
1082 } 1085 }
1083 TimelineStream* stream = GetIsolateStream(); 1086 TimelineStream* stream = GetIsolateStream();
(...skipping 1548 matching lines...) Expand 10 before | Expand all | Expand 10 after
2632 void IsolateSpawnState::DecrementSpawnCount() { 2635 void IsolateSpawnState::DecrementSpawnCount() {
2633 ASSERT(spawn_count_monitor_ != NULL); 2636 ASSERT(spawn_count_monitor_ != NULL);
2634 ASSERT(spawn_count_ != NULL); 2637 ASSERT(spawn_count_ != NULL);
2635 MonitorLocker ml(spawn_count_monitor_); 2638 MonitorLocker ml(spawn_count_monitor_);
2636 ASSERT(*spawn_count_ > 0); 2639 ASSERT(*spawn_count_ > 0);
2637 *spawn_count_ = *spawn_count_ - 1; 2640 *spawn_count_ = *spawn_count_ - 1;
2638 ml.Notify(); 2641 ml.Notify();
2639 } 2642 }
2640 2643
2641 } // namespace dart 2644 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698