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 "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 27 matching lines...) Expand all Loading... |
38 #include "vm/stack_frame.h" | 38 #include "vm/stack_frame.h" |
39 #include "vm/store_buffer.h" | 39 #include "vm/store_buffer.h" |
40 #include "vm/stub_code.h" | 40 #include "vm/stub_code.h" |
41 #include "vm/symbols.h" | 41 #include "vm/symbols.h" |
42 #include "vm/tags.h" | 42 #include "vm/tags.h" |
43 #include "vm/thread_interrupter.h" | 43 #include "vm/thread_interrupter.h" |
44 #include "vm/thread_registry.h" | 44 #include "vm/thread_registry.h" |
45 #include "vm/timeline.h" | 45 #include "vm/timeline.h" |
46 #include "vm/timeline_analysis.h" | 46 #include "vm/timeline_analysis.h" |
47 #include "vm/timer.h" | 47 #include "vm/timer.h" |
| 48 #include "vm/verifier.h" |
48 #include "vm/visitor.h" | 49 #include "vm/visitor.h" |
49 | 50 |
50 | 51 |
51 namespace dart { | 52 namespace dart { |
52 | 53 |
53 DECLARE_FLAG(bool, print_metrics); | 54 DECLARE_FLAG(bool, print_metrics); |
54 DECLARE_FLAG(bool, timing); | 55 DECLARE_FLAG(bool, timing); |
55 DECLARE_FLAG(bool, trace_service); | 56 DECLARE_FLAG(bool, trace_service); |
56 DECLARE_FLAG(bool, warn_on_pause_with_no_debugger); | 57 DECLARE_FLAG(bool, warn_on_pause_with_no_debugger); |
57 | 58 |
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1084 #ifndef PRODUCT | 1085 #ifndef PRODUCT |
1085 void Isolate::ReportReloadError(const Error& error) { | 1086 void Isolate::ReportReloadError(const Error& error) { |
1086 ASSERT(IsReloading()); | 1087 ASSERT(IsReloading()); |
1087 reload_context_->AbortReload(error); | 1088 reload_context_->AbortReload(error); |
1088 delete reload_context_; | 1089 delete reload_context_; |
1089 reload_context_ = NULL; | 1090 reload_context_ = NULL; |
1090 } | 1091 } |
1091 | 1092 |
1092 | 1093 |
1093 void Isolate::ReloadSources(bool test_mode) { | 1094 void Isolate::ReloadSources(bool test_mode) { |
| 1095 // TODO(asiva): Add verification of canonical objects. |
1094 ASSERT(!IsReloading()); | 1096 ASSERT(!IsReloading()); |
1095 has_attempted_reload_ = true; | 1097 has_attempted_reload_ = true; |
1096 reload_context_ = new IsolateReloadContext(this, test_mode); | 1098 reload_context_ = new IsolateReloadContext(this, test_mode); |
1097 reload_context_->StartReload(); | 1099 reload_context_->StartReload(); |
| 1100 // TODO(asiva): Add verification of canonical objects. |
1098 } | 1101 } |
1099 #endif // !PRODUCT | 1102 #endif // !PRODUCT |
1100 | 1103 |
1101 | 1104 |
1102 void Isolate::DoneFinalizing() { | 1105 void Isolate::DoneFinalizing() { |
1103 NOT_IN_PRODUCT( | 1106 NOT_IN_PRODUCT( |
1104 if (IsReloading()) { | 1107 if (IsReloading()) { |
1105 reload_context_->FinishReload(); | 1108 reload_context_->FinishReload(); |
1106 if (reload_context_->has_error() && reload_context_->test_mode()) { | 1109 if (reload_context_->has_error() && reload_context_->test_mode()) { |
1107 // If the reload has an error and we are in test mode keep the reload | 1110 // If the reload has an error and we are in test mode keep the reload |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1485 // running the shutdown callback. | 1488 // running the shutdown callback. |
1486 isolate->WaitForOutstandingSpawns(); | 1489 isolate->WaitForOutstandingSpawns(); |
1487 { | 1490 { |
1488 // Print the error if there is one. This may execute dart code to | 1491 // Print the error if there is one. This may execute dart code to |
1489 // print the exception object, so we need to use a StartIsolateScope. | 1492 // print the exception object, so we need to use a StartIsolateScope. |
1490 StartIsolateScope start_scope(isolate); | 1493 StartIsolateScope start_scope(isolate); |
1491 Thread* thread = Thread::Current(); | 1494 Thread* thread = Thread::Current(); |
1492 ASSERT(thread->isolate() == isolate); | 1495 ASSERT(thread->isolate() == isolate); |
1493 StackZone zone(thread); | 1496 StackZone zone(thread); |
1494 HandleScope handle_scope(thread); | 1497 HandleScope handle_scope(thread); |
| 1498 #if defined(DEBUG) |
| 1499 if (!isolate->HasAttemptedReload()) { |
| 1500 isolate->heap()->CollectAllGarbage(); |
| 1501 VerifyCanonicalVisitor check_canonical(thread); |
| 1502 isolate->heap()->IterateObjects(&check_canonical); |
| 1503 } |
| 1504 #endif // DEBUG |
1495 const Error& error = Error::Handle(thread->sticky_error()); | 1505 const Error& error = Error::Handle(thread->sticky_error()); |
1496 if (!error.IsNull() && !error.IsUnwindError()) { | 1506 if (!error.IsNull() && !error.IsUnwindError()) { |
1497 OS::PrintErr("in ShutdownIsolate: %s\n", error.ToErrorCString()); | 1507 OS::PrintErr("in ShutdownIsolate: %s\n", error.ToErrorCString()); |
1498 } | 1508 } |
1499 Dart::RunShutdownCallback(); | 1509 Dart::RunShutdownCallback(); |
1500 } | 1510 } |
1501 // Shut the isolate down. | 1511 // Shut the isolate down. |
1502 Dart::ShutdownIsolate(isolate); | 1512 Dart::ShutdownIsolate(isolate); |
1503 } | 1513 } |
1504 | 1514 |
(...skipping 1369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2874 void IsolateSpawnState::DecrementSpawnCount() { | 2884 void IsolateSpawnState::DecrementSpawnCount() { |
2875 ASSERT(spawn_count_monitor_ != NULL); | 2885 ASSERT(spawn_count_monitor_ != NULL); |
2876 ASSERT(spawn_count_ != NULL); | 2886 ASSERT(spawn_count_ != NULL); |
2877 MonitorLocker ml(spawn_count_monitor_); | 2887 MonitorLocker ml(spawn_count_monitor_); |
2878 ASSERT(*spawn_count_ > 0); | 2888 ASSERT(*spawn_count_ > 0); |
2879 *spawn_count_ = *spawn_count_ - 1; | 2889 *spawn_count_ = *spawn_count_ - 1; |
2880 ml.Notify(); | 2890 ml.Notify(); |
2881 } | 2891 } |
2882 | 2892 |
2883 } // namespace dart | 2893 } // namespace dart |
OLD | NEW |