Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Unified Diff: runtime/vm/object_service.cc

Issue 1965493004: Canonicalize generic types in an isolate specific hash table (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: address-merge-conflicts Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/object_reload.cc ('k') | runtime/vm/object_store.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object_service.cc
diff --git a/runtime/vm/object_service.cc b/runtime/vm/object_service.cc
index 1a861a370519b5b39766f6c7ff0474fee78656ba..7eab800fca551018bbb01e41470f74c682ce30a2 100644
--- a/runtime/vm/object_service.cc
+++ b/runtime/vm/object_service.cc
@@ -8,6 +8,7 @@
#include "vm/object_store.h"
#include "vm/stub_code.h"
#include "vm/symbols.h"
+#include "vm/type_table.h"
namespace dart {
@@ -187,9 +188,15 @@ void TypeArguments::PrintJSONImpl(JSONStream* stream, bool ref) const {
// The index in the canonical_type_arguments table cannot be used as part of
// the object id (as in typearguments/id), because the indices are not
// preserved when the table grows and the entries get rehashed. Use the ring.
- Isolate* isolate = Isolate::Current();
+ Thread* thread = Thread::Current();
+ Zone* zone = thread->zone();
+ Isolate* isolate = thread->isolate();
ObjectStore* object_store = isolate->object_store();
- const Array& table = Array::Handle(object_store->canonical_type_arguments());
+ CanonicalTypeArgumentsSet typeargs_table(
+ zone, object_store->canonical_type_arguments());
+ const Array& table =
+ Array::Handle(HashTables::ToArray(typeargs_table, false));
+ typeargs_table.Release();
ASSERT(table.Length() > 0);
AddCommonObjectProperties(&jsobj, "TypeArguments", ref);
jsobj.AddServiceId(*this);
@@ -1130,11 +1137,13 @@ void Type::PrintJSONImpl(JSONStream* stream, bool ref) const {
jsobj.AddProperty("kind", "Type");
if (IsCanonical()) {
const Class& type_cls = Class::Handle(type_class());
- intptr_t id = type_cls.FindCanonicalTypeIndex(*this);
- ASSERT(id >= 0);
- intptr_t cid = type_cls.id();
- jsobj.AddFixedServiceId("classes/%" Pd "/types/%" Pd "", cid, id);
- jsobj.AddProperty("typeClass", type_cls);
+ if (type_cls.CanonicalType() == raw()) {
+ intptr_t cid = type_cls.id();
+ jsobj.AddFixedServiceId("classes/%" Pd "/types/%d", cid, 0);
+ jsobj.AddProperty("typeClass", type_cls);
+ } else {
+ jsobj.AddServiceId(*this);
+ }
} else {
jsobj.AddServiceId(*this);
}
« no previous file with comments | « runtime/vm/object_reload.cc ('k') | runtime/vm/object_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698