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 "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "platform/json.h" | 9 #include "platform/json.h" |
10 #include "vm/code_observers.h" | 10 #include "vm/code_observers.h" |
(...skipping 1494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1505 IsolateSpawnState* state = spawn_state(); | 1505 IsolateSpawnState* state = spawn_state(); |
1506 if (state != NULL) { | 1506 if (state != NULL) { |
1507 const Object& entry = Object::Handle(this, state->ResolveFunction()); | 1507 const Object& entry = Object::Handle(this, state->ResolveFunction()); |
1508 if (!entry.IsNull() && entry.IsFunction()) { | 1508 if (!entry.IsNull() && entry.IsFunction()) { |
1509 Function& func = Function::Handle(this); | 1509 Function& func = Function::Handle(this); |
1510 func ^= entry.raw(); | 1510 func ^= entry.raw(); |
1511 jsobj.AddProperty("entry", func); | 1511 jsobj.AddProperty("entry", func); |
1512 } | 1512 } |
1513 } | 1513 } |
1514 { | 1514 { |
1515 JSONObject jsheap(&jsobj, "heaps"); | 1515 JSONObject jsheap(&jsobj, "_heaps"); |
1516 heap()->PrintToJSONObject(Heap::kNew, &jsheap); | 1516 heap()->PrintToJSONObject(Heap::kNew, &jsheap); |
1517 heap()->PrintToJSONObject(Heap::kOld, &jsheap); | 1517 heap()->PrintToJSONObject(Heap::kOld, &jsheap); |
1518 } | 1518 } |
1519 | 1519 |
1520 jsobj.AddProperty("livePorts", message_handler()->live_ports()); | 1520 jsobj.AddProperty("livePorts", message_handler()->live_ports()); |
1521 jsobj.AddProperty("pauseOnExit", message_handler()->pause_on_exit()); | 1521 jsobj.AddProperty("pauseOnExit", message_handler()->pause_on_exit()); |
1522 | 1522 |
1523 if (message_handler()->paused_on_start()) { | 1523 if (message_handler()->paused_on_start()) { |
1524 ASSERT(debugger()->PauseEvent() == NULL); | 1524 ASSERT(debugger()->PauseEvent() == NULL); |
1525 ServiceEvent pause_event(this, ServiceEvent::kPauseStart); | 1525 ServiceEvent pause_event(this, ServiceEvent::kPauseStart); |
(...skipping 15 matching lines...) Expand all Loading... |
1541 } | 1541 } |
1542 jsobj.AddProperty("pauseEvent", &pause_event); | 1542 jsobj.AddProperty("pauseEvent", &pause_event); |
1543 } | 1543 } |
1544 | 1544 |
1545 const Library& lib = | 1545 const Library& lib = |
1546 Library::Handle(object_store()->root_library()); | 1546 Library::Handle(object_store()->root_library()); |
1547 jsobj.AddProperty("rootLib", lib); | 1547 jsobj.AddProperty("rootLib", lib); |
1548 | 1548 |
1549 timer_list().PrintTimersToJSONProperty(&jsobj); | 1549 timer_list().PrintTimersToJSONProperty(&jsobj); |
1550 { | 1550 { |
1551 JSONObject tagCounters(&jsobj, "tagCounters"); | 1551 JSONObject tagCounters(&jsobj, "_tagCounters"); |
1552 vm_tag_counters()->PrintToJSONObject(&tagCounters); | 1552 vm_tag_counters()->PrintToJSONObject(&tagCounters); |
1553 } | 1553 } |
1554 if (object_store()->sticky_error() != Object::null()) { | 1554 if (object_store()->sticky_error() != Object::null()) { |
1555 Error& error = Error::Handle(this, object_store()->sticky_error()); | 1555 Error& error = Error::Handle(this, object_store()->sticky_error()); |
1556 ASSERT(!error.IsNull()); | 1556 ASSERT(!error.IsNull()); |
1557 jsobj.AddProperty("error", error, false); | 1557 jsobj.AddProperty("error", error, false); |
1558 } | 1558 } |
1559 | 1559 |
1560 bool is_io_enabled = false; | |
1561 { | 1560 { |
1562 const GrowableObjectArray& libs = | 1561 const GrowableObjectArray& libs = |
1563 GrowableObjectArray::Handle(object_store()->libraries()); | 1562 GrowableObjectArray::Handle(object_store()->libraries()); |
1564 intptr_t num_libs = libs.Length(); | 1563 intptr_t num_libs = libs.Length(); |
1565 Library& lib = Library::Handle(); | 1564 Library& lib = Library::Handle(); |
1566 String& name = String::Handle(); | |
1567 | 1565 |
1568 JSONArray lib_array(&jsobj, "libraries"); | 1566 JSONArray lib_array(&jsobj, "libraries"); |
1569 for (intptr_t i = 0; i < num_libs; i++) { | 1567 for (intptr_t i = 0; i < num_libs; i++) { |
1570 lib ^= libs.At(i); | 1568 lib ^= libs.At(i); |
1571 name = lib.name(); | |
1572 if (name.Equals(Symbols::DartIOLibName())) { | |
1573 is_io_enabled = true; | |
1574 } | |
1575 ASSERT(!lib.IsNull()); | 1569 ASSERT(!lib.IsNull()); |
1576 lib_array.AddValue(lib); | 1570 lib_array.AddValue(lib); |
1577 } | 1571 } |
1578 } | 1572 } |
1579 { | 1573 { |
1580 JSONArray breakpoints(&jsobj, "breakpoints"); | 1574 JSONArray breakpoints(&jsobj, "breakpoints"); |
1581 debugger()->PrintBreakpointsToJSONArray(&breakpoints); | 1575 debugger()->PrintBreakpointsToJSONArray(&breakpoints); |
1582 } | 1576 } |
1583 { | |
1584 JSONArray features_array(&jsobj, "features"); | |
1585 if (is_io_enabled) { | |
1586 features_array.AddValue("io"); | |
1587 } | |
1588 } | |
1589 } | 1577 } |
1590 | 1578 |
1591 | 1579 |
1592 intptr_t Isolate::ProfileInterrupt() { | 1580 intptr_t Isolate::ProfileInterrupt() { |
1593 // Other threads might be modifying these fields. Save them in locals so that | 1581 // Other threads might be modifying these fields. Save them in locals so that |
1594 // we can at least trust the NULL check. | 1582 // we can at least trust the NULL check. |
1595 IsolateProfilerData* prof_data = profiler_data(); | 1583 IsolateProfilerData* prof_data = profiler_data(); |
1596 if (prof_data == NULL) { | 1584 if (prof_data == NULL) { |
1597 // Profiler not setup for isolate. | 1585 // Profiler not setup for isolate. |
1598 return 0; | 1586 return 0; |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1969 serialized_message_, serialized_message_len_); | 1957 serialized_message_, serialized_message_len_); |
1970 } | 1958 } |
1971 | 1959 |
1972 | 1960 |
1973 void IsolateSpawnState::Cleanup() { | 1961 void IsolateSpawnState::Cleanup() { |
1974 SwitchIsolateScope switch_scope(I); | 1962 SwitchIsolateScope switch_scope(I); |
1975 Dart::ShutdownIsolate(); | 1963 Dart::ShutdownIsolate(); |
1976 } | 1964 } |
1977 | 1965 |
1978 } // namespace dart | 1966 } // namespace dart |
OLD | NEW |