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/dart.h" | 5 #include "vm/dart.h" |
6 | 6 |
7 #include "vm/code_observers.h" | 7 #include "vm/code_observers.h" |
8 #include "vm/cpu.h" | 8 #include "vm/cpu.h" |
9 #include "vm/dart_api_state.h" | 9 #include "vm/dart_api_state.h" |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
11 #include "vm/debugger.h" | 11 #include "vm/debugger.h" |
12 #include "vm/flags.h" | 12 #include "vm/flags.h" |
13 #include "vm/freelist.h" | 13 #include "vm/freelist.h" |
14 #include "vm/handles.h" | 14 #include "vm/handles.h" |
15 #include "vm/heap.h" | 15 #include "vm/heap.h" |
16 #include "vm/isolate.h" | 16 #include "vm/isolate.h" |
| 17 #include "vm/message_handler.h" |
17 #include "vm/metrics.h" | 18 #include "vm/metrics.h" |
18 #include "vm/object.h" | 19 #include "vm/object.h" |
19 #include "vm/object_store.h" | 20 #include "vm/object_store.h" |
20 #include "vm/object_id_ring.h" | 21 #include "vm/object_id_ring.h" |
21 #include "vm/port.h" | 22 #include "vm/port.h" |
22 #include "vm/profiler.h" | 23 #include "vm/profiler.h" |
23 #include "vm/service_isolate.h" | 24 #include "vm/service_isolate.h" |
24 #include "vm/simulator.h" | 25 #include "vm/simulator.h" |
25 #include "vm/snapshot.h" | 26 #include "vm/snapshot.h" |
26 #include "vm/store_buffer.h" | 27 #include "vm/store_buffer.h" |
27 #include "vm/stub_code.h" | 28 #include "vm/stub_code.h" |
28 #include "vm/symbols.h" | 29 #include "vm/symbols.h" |
29 #include "vm/thread_interrupter.h" | 30 #include "vm/thread_interrupter.h" |
30 #include "vm/thread_pool.h" | 31 #include "vm/thread_pool.h" |
31 #include "vm/virtual_memory.h" | 32 #include "vm/virtual_memory.h" |
32 #include "vm/zone.h" | 33 #include "vm/zone.h" |
33 | 34 |
34 namespace dart { | 35 namespace dart { |
35 | 36 |
36 DECLARE_FLAG(bool, print_class_table); | 37 DECLARE_FLAG(bool, print_class_table); |
37 DECLARE_FLAG(bool, trace_isolates); | 38 DECLARE_FLAG(bool, trace_isolates); |
38 DECLARE_FLAG(bool, trace_time_all); | 39 DECLARE_FLAG(bool, trace_time_all); |
| 40 DECLARE_FLAG(bool, pause_isolates_on_start); |
| 41 DECLARE_FLAG(bool, pause_isolates_on_exit); |
39 DEFINE_FLAG(bool, keep_code, false, | 42 DEFINE_FLAG(bool, keep_code, false, |
40 "Keep deoptimized code for profiling."); | 43 "Keep deoptimized code for profiling."); |
41 DEFINE_FLAG(bool, shutdown, true, "Do a clean shutdown of the VM"); | 44 DEFINE_FLAG(bool, shutdown, true, "Do a clean shutdown of the VM"); |
42 | 45 |
43 Isolate* Dart::vm_isolate_ = NULL; | 46 Isolate* Dart::vm_isolate_ = NULL; |
44 ThreadPool* Dart::thread_pool_ = NULL; | 47 ThreadPool* Dart::thread_pool_ = NULL; |
45 DebugInfo* Dart::pprof_symbol_generator_ = NULL; | 48 DebugInfo* Dart::pprof_symbol_generator_ = NULL; |
46 ReadOnlyHandles* Dart::predefined_handles_ = NULL; | 49 ReadOnlyHandles* Dart::predefined_handles_ = NULL; |
47 const uint8_t* Dart::instructions_snapshot_buffer_ = NULL; | 50 const uint8_t* Dart::instructions_snapshot_buffer_ = NULL; |
48 | 51 |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 } | 384 } |
382 | 385 |
383 I->heap()->EnableGrowthControl(); | 386 I->heap()->EnableGrowthControl(); |
384 I->set_init_callback_data(data); | 387 I->set_init_callback_data(data); |
385 Api::SetupAcquiredError(I); | 388 Api::SetupAcquiredError(I); |
386 if (FLAG_print_class_table) { | 389 if (FLAG_print_class_table) { |
387 I->class_table()->Print(); | 390 I->class_table()->Print(); |
388 } | 391 } |
389 | 392 |
390 ServiceIsolate::MaybeMakeServiceIsolate(I); | 393 ServiceIsolate::MaybeMakeServiceIsolate(I); |
391 | 394 if (!ServiceIsolate::IsServiceIsolate(I)) { |
| 395 I->message_handler()->set_should_pause_on_start( |
| 396 FLAG_pause_isolates_on_start); |
| 397 I->message_handler()->set_should_pause_on_exit( |
| 398 FLAG_pause_isolates_on_exit); |
| 399 } |
392 ServiceIsolate::SendIsolateStartupMessage(); | 400 ServiceIsolate::SendIsolateStartupMessage(); |
393 I->debugger()->NotifyIsolateCreated(); | 401 I->debugger()->NotifyIsolateCreated(); |
394 | 402 |
395 // Create tag table. | 403 // Create tag table. |
396 I->set_tag_table(GrowableObjectArray::Handle(GrowableObjectArray::New())); | 404 I->set_tag_table(GrowableObjectArray::Handle(GrowableObjectArray::New())); |
397 // Set up default UserTag. | 405 // Set up default UserTag. |
398 const UserTag& default_tag = UserTag::Handle(UserTag::DefaultTag()); | 406 const UserTag& default_tag = UserTag::Handle(UserTag::DefaultTag()); |
399 I->set_current_tag(default_tag); | 407 I->set_current_tag(default_tag); |
400 | 408 |
401 if (FLAG_keep_code) { | 409 if (FLAG_keep_code) { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 return predefined_handles_->handles_.IsValidScopedHandle(address); | 463 return predefined_handles_->handles_.IsValidScopedHandle(address); |
456 } | 464 } |
457 | 465 |
458 | 466 |
459 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) { | 467 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) { |
460 ASSERT(predefined_handles_ != NULL); | 468 ASSERT(predefined_handles_ != NULL); |
461 return predefined_handles_->api_handles_.IsValidHandle(handle); | 469 return predefined_handles_->api_handles_.IsValidHandle(handle); |
462 } | 470 } |
463 | 471 |
464 } // namespace dart | 472 } // namespace dart |
OLD | NEW |