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 3511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3559 RUNNABLE_ISOLATE_PARAMETER, | 3560 RUNNABLE_ISOLATE_PARAMETER, |
3560 NULL, | 3561 NULL, |
3561 }; | 3562 }; |
3562 | 3563 |
3563 | 3564 |
3564 static bool GetTypeArgumentsList(Thread* thread, JSONStream* js) { | 3565 static bool GetTypeArgumentsList(Thread* thread, JSONStream* js) { |
3565 bool only_with_instantiations = false; | 3566 bool only_with_instantiations = false; |
3566 if (js->ParamIs("onlyWithInstantiations", "true")) { | 3567 if (js->ParamIs("onlyWithInstantiations", "true")) { |
3567 only_with_instantiations = true; | 3568 only_with_instantiations = true; |
3568 } | 3569 } |
| 3570 Zone* zone = thread->zone(); |
3569 ObjectStore* object_store = thread->isolate()->object_store(); | 3571 ObjectStore* object_store = thread->isolate()->object_store(); |
3570 const Array& table = Array::Handle(object_store->canonical_type_arguments()); | 3572 CanonicalTypeArgumentsSet typeargs_table( |
3571 ASSERT(table.Length() > 0); | 3573 zone, object_store->canonical_type_arguments()); |
3572 TypeArguments& type_args = TypeArguments::Handle(); | 3574 const intptr_t table_size = typeargs_table.NumEntries(); |
3573 const intptr_t table_size = table.Length() - 1; | 3575 const intptr_t table_used = typeargs_table.NumOccupied(); |
3574 const intptr_t table_used = Smi::Value(Smi::RawCast(table.At(table_size))); | 3576 const Array& typeargs_array = Array::Handle( |
| 3577 zone, HashTables::ToArray(typeargs_table, false)); |
| 3578 ASSERT(typeargs_array.Length() == table_used); |
| 3579 TypeArguments& typeargs = TypeArguments::Handle(zone); |
3575 JSONObject jsobj(js); | 3580 JSONObject jsobj(js); |
3576 jsobj.AddProperty("type", "TypeArgumentsList"); | 3581 jsobj.AddProperty("type", "TypeArgumentsList"); |
3577 jsobj.AddProperty("canonicalTypeArgumentsTableSize", table_size); | 3582 jsobj.AddProperty("canonicalTypeArgumentsTableSize", table_size); |
3578 jsobj.AddProperty("canonicalTypeArgumentsTableUsed", table_used); | 3583 jsobj.AddProperty("canonicalTypeArgumentsTableUsed", table_used); |
3579 JSONArray members(&jsobj, "typeArguments"); | 3584 JSONArray members(&jsobj, "typeArguments"); |
3580 for (intptr_t i = 0; i < table_size; i++) { | 3585 for (intptr_t i = 0; i < table_used; i++) { |
3581 type_args ^= table.At(i); | 3586 typeargs ^= typeargs_array.At(i); |
3582 if (!type_args.IsNull()) { | 3587 if (!typeargs.IsNull()) { |
3583 if (!only_with_instantiations || type_args.HasInstantiations()) { | 3588 if (!only_with_instantiations || typeargs.HasInstantiations()) { |
3584 members.AddValue(type_args); | 3589 members.AddValue(typeargs); |
3585 } | 3590 } |
3586 } | 3591 } |
3587 } | 3592 } |
| 3593 typeargs_table.Release(); |
3588 return true; | 3594 return true; |
3589 } | 3595 } |
3590 | 3596 |
3591 | 3597 |
3592 static const MethodParameter* get_version_params[] = { | 3598 static const MethodParameter* get_version_params[] = { |
3593 NO_ISOLATE_PARAMETER, | 3599 NO_ISOLATE_PARAMETER, |
3594 NULL, | 3600 NULL, |
3595 }; | 3601 }; |
3596 | 3602 |
3597 | 3603 |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3979 if (strcmp(method_name, method.name) == 0) { | 3985 if (strcmp(method_name, method.name) == 0) { |
3980 return &method; | 3986 return &method; |
3981 } | 3987 } |
3982 } | 3988 } |
3983 return NULL; | 3989 return NULL; |
3984 } | 3990 } |
3985 | 3991 |
3986 #endif // !PRODUCT | 3992 #endif // !PRODUCT |
3987 | 3993 |
3988 } // namespace dart | 3994 } // namespace dart |
OLD | NEW |