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 1478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1489 | 1489 |
1490 | 1490 |
1491 void Isolate::LowLevelShutdown() { | 1491 void Isolate::LowLevelShutdown() { |
1492 // Ensure we have a zone and handle scope so that we can call VM functions, | 1492 // Ensure we have a zone and handle scope so that we can call VM functions, |
1493 // but we no longer allocate new heap objects. | 1493 // but we no longer allocate new heap objects. |
1494 Thread* thread = Thread::Current(); | 1494 Thread* thread = Thread::Current(); |
1495 StackZone stack_zone(thread); | 1495 StackZone stack_zone(thread); |
1496 HandleScope handle_scope(thread); | 1496 HandleScope handle_scope(thread); |
1497 NoSafepointScope no_safepoint_scope; | 1497 NoSafepointScope no_safepoint_scope; |
1498 | 1498 |
1499 if (FLAG_compiler_stats | |
1500 && !ServiceIsolate::IsServiceIsolate(this) | |
1501 && (this != Dart::vm_isolate())) { | |
1502 OS::Print("%s", compiler_stats()->PrintToZone()); | |
1503 } | |
1504 | |
1505 // Notify exit listeners that this isolate is shutting down. | 1499 // Notify exit listeners that this isolate is shutting down. |
1506 if (object_store() != NULL) { | 1500 if (object_store() != NULL) { |
1507 NotifyExitListeners(); | 1501 NotifyExitListeners(); |
1508 } | 1502 } |
1509 | 1503 |
1510 // Clean up debugger resources. | 1504 // Clean up debugger resources. |
1511 debugger()->Shutdown(); | 1505 debugger()->Shutdown(); |
1512 | 1506 |
1513 // Close all the ports owned by this isolate. | 1507 // Close all the ports owned by this isolate. |
1514 PortMap::ClosePorts(message_handler()); | 1508 PortMap::ClosePorts(message_handler()); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1570 { | 1564 { |
1571 // Ensure we have a zone and handle scope so that we can call VM functions. | 1565 // Ensure we have a zone and handle scope so that we can call VM functions. |
1572 StackZone stack_zone(thread); | 1566 StackZone stack_zone(thread); |
1573 HandleScope handle_scope(thread); | 1567 HandleScope handle_scope(thread); |
1574 | 1568 |
1575 // Write out the coverage data if collection has been enabled. | 1569 // Write out the coverage data if collection has been enabled. |
1576 if ((this != Dart::vm_isolate()) && | 1570 if ((this != Dart::vm_isolate()) && |
1577 !ServiceIsolate::IsServiceIsolateDescendant(this)) { | 1571 !ServiceIsolate::IsServiceIsolateDescendant(this)) { |
1578 CodeCoverage::Write(this); | 1572 CodeCoverage::Write(this); |
1579 } | 1573 } |
| 1574 |
| 1575 // Write compiler stats data if enabled. |
| 1576 if (FLAG_compiler_stats |
| 1577 && !ServiceIsolate::IsServiceIsolateDescendant(this) |
| 1578 && (this != Dart::vm_isolate())) { |
| 1579 OS::Print("%s", compiler_stats()->PrintToZone()); |
| 1580 } |
1580 } | 1581 } |
1581 | 1582 |
1582 // Remove this isolate from the list *before* we start tearing it down, to | 1583 // Remove this isolate from the list *before* we start tearing it down, to |
1583 // avoid exposing it in a state of decay. | 1584 // avoid exposing it in a state of decay. |
1584 RemoveIsolateFromList(this); | 1585 RemoveIsolateFromList(this); |
1585 | 1586 |
1586 if (heap_ != NULL) { | 1587 if (heap_ != NULL) { |
1587 // Wait for any concurrent GC tasks to finish before shutting down. | 1588 // Wait for any concurrent GC tasks to finish before shutting down. |
1588 // TODO(koda): Support faster sweeper shutdown (e.g., after current page). | 1589 // TODO(koda): Support faster sweeper shutdown (e.g., after current page). |
1589 PageSpace* old_space = heap_->old_space(); | 1590 PageSpace* old_space = heap_->old_space(); |
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2492 serialized_message_, serialized_message_len_); | 2493 serialized_message_, serialized_message_len_); |
2493 } | 2494 } |
2494 | 2495 |
2495 | 2496 |
2496 void IsolateSpawnState::Cleanup() { | 2497 void IsolateSpawnState::Cleanup() { |
2497 SwitchIsolateScope switch_scope(I); | 2498 SwitchIsolateScope switch_scope(I); |
2498 Dart::ShutdownIsolate(); | 2499 Dart::ShutdownIsolate(); |
2499 } | 2500 } |
2500 | 2501 |
2501 } // namespace dart | 2502 } // namespace dart |
OLD | NEW |