| 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/service.h" | 5 #include "vm/service.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/globals.h" | 9 #include "platform/globals.h" |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "vm/parser.h" | 28 #include "vm/parser.h" |
| 29 #include "vm/port.h" | 29 #include "vm/port.h" |
| 30 #include "vm/profiler_service.h" | 30 #include "vm/profiler_service.h" |
| 31 #include "vm/reusable_handles.h" | 31 #include "vm/reusable_handles.h" |
| 32 #include "vm/service_event.h" | 32 #include "vm/service_event.h" |
| 33 #include "vm/service_isolate.h" | 33 #include "vm/service_isolate.h" |
| 34 #include "vm/source_report.h" | 34 #include "vm/source_report.h" |
| 35 #include "vm/stack_frame.h" | 35 #include "vm/stack_frame.h" |
| 36 #include "vm/symbols.h" | 36 #include "vm/symbols.h" |
| 37 #include "vm/timeline.h" | 37 #include "vm/timeline.h" |
| 38 #include "vm/type_table.h" |
| 38 #include "vm/unicode.h" | 39 #include "vm/unicode.h" |
| 39 #include "vm/version.h" | 40 #include "vm/version.h" |
| 40 | 41 |
| 41 namespace dart { | 42 namespace dart { |
| 42 | 43 |
| 43 #define Z (T->zone()) | 44 #define Z (T->zone()) |
| 44 | 45 |
| 45 | 46 |
| 46 DECLARE_FLAG(bool, trace_service); | 47 DECLARE_FLAG(bool, trace_service); |
| 47 DECLARE_FLAG(bool, trace_service_pause_events); | 48 DECLARE_FLAG(bool, trace_service_pause_events); |
| (...skipping 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1590 | 1591 |
| 1591 } else if (strcmp(parts[2], "types") == 0) { | 1592 } else if (strcmp(parts[2], "types") == 0) { |
| 1592 // Type ids look like: "classes/17/types/11" | 1593 // Type ids look like: "classes/17/types/11" |
| 1593 if (num_parts != 4) { | 1594 if (num_parts != 4) { |
| 1594 return Object::sentinel().raw(); | 1595 return Object::sentinel().raw(); |
| 1595 } | 1596 } |
| 1596 intptr_t id; | 1597 intptr_t id; |
| 1597 if (!GetIntegerId(parts[3], &id)) { | 1598 if (!GetIntegerId(parts[3], &id)) { |
| 1598 return Object::sentinel().raw(); | 1599 return Object::sentinel().raw(); |
| 1599 } | 1600 } |
| 1600 Type& type = Type::Handle(zone); | 1601 if (id != 0) { |
| 1601 type ^= cls.CanonicalTypeFromIndex(id); | |
| 1602 if (type.IsNull()) { | |
| 1603 return Object::sentinel().raw(); | 1602 return Object::sentinel().raw(); |
| 1604 } | 1603 } |
| 1605 return type.raw(); | 1604 const Type& type = Type::Handle(zone, cls.CanonicalType()); |
| 1605 if (!type.IsNull()) { |
| 1606 return type.raw(); |
| 1607 } |
| 1606 } | 1608 } |
| 1607 | 1609 |
| 1608 // Not found. | 1610 // Not found. |
| 1609 return Object::sentinel().raw(); | 1611 return Object::sentinel().raw(); |
| 1610 } | 1612 } |
| 1611 | 1613 |
| 1612 | 1614 |
| 1613 static RawObject* LookupHeapObjectTypeArguments(Thread* thread, | 1615 static RawObject* LookupHeapObjectTypeArguments(Thread* thread, |
| 1614 char** parts, int num_parts) { | 1616 char** parts, int num_parts) { |
| 1615 Isolate* isolate = thread->isolate(); | 1617 Isolate* isolate = thread->isolate(); |
| (...skipping 1997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3613 RUNNABLE_ISOLATE_PARAMETER, | 3615 RUNNABLE_ISOLATE_PARAMETER, |
| 3614 NULL, | 3616 NULL, |
| 3615 }; | 3617 }; |
| 3616 | 3618 |
| 3617 | 3619 |
| 3618 static bool GetTypeArgumentsList(Thread* thread, JSONStream* js) { | 3620 static bool GetTypeArgumentsList(Thread* thread, JSONStream* js) { |
| 3619 bool only_with_instantiations = false; | 3621 bool only_with_instantiations = false; |
| 3620 if (js->ParamIs("onlyWithInstantiations", "true")) { | 3622 if (js->ParamIs("onlyWithInstantiations", "true")) { |
| 3621 only_with_instantiations = true; | 3623 only_with_instantiations = true; |
| 3622 } | 3624 } |
| 3625 Zone* zone = thread->zone(); |
| 3623 ObjectStore* object_store = thread->isolate()->object_store(); | 3626 ObjectStore* object_store = thread->isolate()->object_store(); |
| 3624 const Array& table = Array::Handle(object_store->canonical_type_arguments()); | 3627 CanonicalTypeArgumentsSet typeargs_table( |
| 3625 ASSERT(table.Length() > 0); | 3628 zone, object_store->canonical_type_arguments()); |
| 3626 TypeArguments& type_args = TypeArguments::Handle(); | 3629 const intptr_t table_size = typeargs_table.NumEntries(); |
| 3627 const intptr_t table_size = table.Length() - 1; | 3630 const intptr_t table_used = typeargs_table.NumOccupied(); |
| 3628 const intptr_t table_used = Smi::Value(Smi::RawCast(table.At(table_size))); | 3631 const Array& typeargs_array = Array::Handle( |
| 3632 zone, HashTables::ToArray(typeargs_table, false)); |
| 3633 ASSERT(typeargs_array.Length() == table_used); |
| 3634 TypeArguments& typeargs = TypeArguments::Handle(zone); |
| 3629 JSONObject jsobj(js); | 3635 JSONObject jsobj(js); |
| 3630 jsobj.AddProperty("type", "TypeArgumentsList"); | 3636 jsobj.AddProperty("type", "TypeArgumentsList"); |
| 3631 jsobj.AddProperty("canonicalTypeArgumentsTableSize", table_size); | 3637 jsobj.AddProperty("canonicalTypeArgumentsTableSize", table_size); |
| 3632 jsobj.AddProperty("canonicalTypeArgumentsTableUsed", table_used); | 3638 jsobj.AddProperty("canonicalTypeArgumentsTableUsed", table_used); |
| 3633 JSONArray members(&jsobj, "typeArguments"); | 3639 JSONArray members(&jsobj, "typeArguments"); |
| 3634 for (intptr_t i = 0; i < table_size; i++) { | 3640 for (intptr_t i = 0; i < table_used; i++) { |
| 3635 type_args ^= table.At(i); | 3641 typeargs ^= typeargs_array.At(i); |
| 3636 if (!type_args.IsNull()) { | 3642 if (!typeargs.IsNull()) { |
| 3637 if (!only_with_instantiations || type_args.HasInstantiations()) { | 3643 if (!only_with_instantiations || typeargs.HasInstantiations()) { |
| 3638 members.AddValue(type_args); | 3644 members.AddValue(typeargs); |
| 3639 } | 3645 } |
| 3640 } | 3646 } |
| 3641 } | 3647 } |
| 3648 typeargs_table.Release(); |
| 3642 return true; | 3649 return true; |
| 3643 } | 3650 } |
| 3644 | 3651 |
| 3645 | 3652 |
| 3646 static const MethodParameter* get_version_params[] = { | 3653 static const MethodParameter* get_version_params[] = { |
| 3647 NO_ISOLATE_PARAMETER, | 3654 NO_ISOLATE_PARAMETER, |
| 3648 NULL, | 3655 NULL, |
| 3649 }; | 3656 }; |
| 3650 | 3657 |
| 3651 | 3658 |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4035 if (strcmp(method_name, method.name) == 0) { | 4042 if (strcmp(method_name, method.name) == 0) { |
| 4036 return &method; | 4043 return &method; |
| 4037 } | 4044 } |
| 4038 } | 4045 } |
| 4039 return NULL; | 4046 return NULL; |
| 4040 } | 4047 } |
| 4041 | 4048 |
| 4042 #endif // !PRODUCT | 4049 #endif // !PRODUCT |
| 4043 | 4050 |
| 4044 } // namespace dart | 4051 } // namespace dart |
| OLD | NEW |