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/json.h" | 10 #include "platform/json.h" |
(...skipping 1436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1447 StartIsolateScope start_scope(isolate); | 1447 StartIsolateScope start_scope(isolate); |
1448 ASSERT(thread->isolate() == isolate); | 1448 ASSERT(thread->isolate() == isolate); |
1449 StackZone zone(thread); | 1449 StackZone zone(thread); |
1450 HandleScope handle_scope(thread); | 1450 HandleScope handle_scope(thread); |
1451 const Error& error = Error::Handle(isolate->object_store()->sticky_error()); | 1451 const Error& error = Error::Handle(isolate->object_store()->sticky_error()); |
1452 if (!error.IsNull() && !error.IsUnwindError()) { | 1452 if (!error.IsNull() && !error.IsUnwindError()) { |
1453 OS::PrintErr("in ShutdownIsolate: %s\n", error.ToErrorCString()); | 1453 OS::PrintErr("in ShutdownIsolate: %s\n", error.ToErrorCString()); |
1454 } | 1454 } |
1455 Dart::RunShutdownCallback(); | 1455 Dart::RunShutdownCallback(); |
1456 } | 1456 } |
1457 { | 1457 // Shut the isolate down. |
1458 // Shut the isolate down. | 1458 Dart::ShutdownIsolate(isolate); |
1459 SwitchIsolateScope switch_scope(isolate); | |
1460 Dart::ShutdownIsolate(); | |
1461 } | |
1462 } | 1459 } |
1463 | 1460 |
1464 | 1461 |
1465 void Isolate::Run() { | 1462 void Isolate::Run() { |
1466 message_handler()->Run(Dart::thread_pool(), | 1463 message_handler()->Run(Dart::thread_pool(), |
1467 RunIsolate, | 1464 RunIsolate, |
1468 ShutdownIsolate, | 1465 ShutdownIsolate, |
1469 reinterpret_cast<uword>(this)); | 1466 reinterpret_cast<uword>(this)); |
1470 } | 1467 } |
1471 | 1468 |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1657 // The VM isolate keeps all objects marked. | 1654 // The VM isolate keeps all objects marked. |
1658 heap_->Verify(this == Dart::vm_isolate() ? kRequireMarked : kForbidMarked); | 1655 heap_->Verify(this == Dart::vm_isolate() ? kRequireMarked : kForbidMarked); |
1659 } | 1656 } |
1660 #endif // DEBUG | 1657 #endif // DEBUG |
1661 | 1658 |
1662 // Wait until all background compilation has finished. | 1659 // Wait until all background compilation has finished. |
1663 BackgroundCompiler::Stop(background_compiler_); | 1660 BackgroundCompiler::Stop(background_compiler_); |
1664 | 1661 |
1665 Thread* thread = Thread::Current(); | 1662 Thread* thread = Thread::Current(); |
1666 | 1663 |
| 1664 // Don't allow anymore dart code to execution on this isolate. |
| 1665 ClearStackLimit(); |
| 1666 |
1667 // First, perform higher-level cleanup that may need to allocate. | 1667 // First, perform higher-level cleanup that may need to allocate. |
1668 { | 1668 { |
1669 // Ensure we have a zone and handle scope so that we can call VM functions. | 1669 // Ensure we have a zone and handle scope so that we can call VM functions. |
1670 StackZone stack_zone(thread); | 1670 StackZone stack_zone(thread); |
1671 HandleScope handle_scope(thread); | 1671 HandleScope handle_scope(thread); |
1672 | 1672 |
1673 // Write out the coverage data if collection has been enabled. | 1673 // Write out the coverage data if collection has been enabled. |
1674 if ((this != Dart::vm_isolate()) && | 1674 if ((this != Dart::vm_isolate()) && |
1675 !ServiceIsolate::IsServiceIsolateDescendant(this)) { | 1675 !ServiceIsolate::IsServiceIsolateDescendant(this)) { |
1676 CodeCoverage::Write(thread); | 1676 CodeCoverage::Write(thread); |
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2607 } | 2607 } |
2608 | 2608 |
2609 | 2609 |
2610 RawInstance* IsolateSpawnState::BuildMessage(Thread* thread) { | 2610 RawInstance* IsolateSpawnState::BuildMessage(Thread* thread) { |
2611 return DeserializeObject(thread, | 2611 return DeserializeObject(thread, |
2612 serialized_message_, serialized_message_len_); | 2612 serialized_message_, serialized_message_len_); |
2613 } | 2613 } |
2614 | 2614 |
2615 | 2615 |
2616 } // namespace dart | 2616 } // namespace dart |
OLD | NEW |