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

Unified Diff: runtime/vm/object.cc

Issue 3007603002: [VM generic function reification] Support generic functions in Invocation class. (Closed)
Patch Set: address review comment Created 3 years, 4 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.h ('k') | runtime/vm/object_graph.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index c625db24d0b2f8fe929db5c81d997bf8e2bee874..79c16ee4c63dd750ba28b98520096c8521f5e03b 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -913,6 +913,15 @@ void Object::InitOnce(Isolate* isolate) {
cls = vector_class_;
*vector_type_ = Type::NewNonParameterizedType(cls);
+ // Since TypeArguments objects are passed as function arguments, make them
+ // behave as Dart instances, although they are just VM objects.
+ // Note that we cannot set the super type to ObjectType, which does not live
+ // in the vm isolate. See special handling in Class::SuperClass().
+ cls = type_arguments_class_;
+ cls.set_interfaces(Object::empty_array());
+ cls.SetFields(Object::empty_array());
+ cls.SetFunctions(Object::empty_array());
+
// Allocate and initialize singleton true and false boolean objects.
cls = Class::New<Bool>();
isolate->object_store()->set_bool_class(cls);
@@ -2082,7 +2091,8 @@ RawClass* Class::New() {
COMPILE_ASSERT((FakeObject::kClassId != kInstanceCid));
result.set_id(FakeObject::kClassId);
result.set_state_bits(0);
- if (FakeObject::kClassId < kInstanceCid) {
+ if ((FakeObject::kClassId < kInstanceCid) ||
+ (FakeObject::kClassId == kTypeArgumentsCid)) {
// VM internal classes are done. There is no finalization needed or
// possible in this case.
result.set_is_finalized();
@@ -2514,6 +2524,10 @@ RawClass* Class::SuperClass(bool original_classes) const {
Zone* zone = thread->zone();
Isolate* isolate = thread->isolate();
if (super_type() == AbstractType::null()) {
+ if (id() == kTypeArgumentsCid) {
+ // Pretend TypeArguments objects are Dart instances.
+ return isolate->class_table()->At(kInstanceCid);
+ }
return Class::null();
}
const AbstractType& sup_type = AbstractType::Handle(zone, super_type());
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/object_graph.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698