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

Unified Diff: runtime/vm/object.cc

Issue 10832401: Gentle start with removing explicit interfaces (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 11192)
+++ runtime/vm/object.cc (working copy)
@@ -753,15 +753,20 @@
cls = object_store->stacktrace_class();
cls.set_super_type(type);
- cls = CreateAndRegisterInterface("Function", script, core_lib);
+ // Note: The abstract class Function is represented by VM class
+ // DartFunction, not VM class Function.
+ name = Symbols::Function();
+ cls = Class::New<DartFunction>();
+ RegisterClass(cls, name, core_lib);
pending_classes.Add(cls, Heap::kOld);
type = Type::NewNonParameterizedType(cls);
- object_store->set_function_interface(type);
+ object_store->set_function_type(type);
- cls = CreateAndRegisterInterface("num", script, core_lib);
- pending_classes.Add(cls, Heap::kOld);
+ cls = Class::New<Number>();
+ name = Symbols::Number();
+ RegisterClass(cls, name, core_lib);
type = Type::NewNonParameterizedType(cls);
- object_store->set_number_interface(type);
+ object_store->set_number_type(type);
cls = CreateAndRegisterInterface("int", script, core_lib);
pending_classes.Add(cls, Heap::kOld);
@@ -1033,6 +1038,12 @@
cls = Class::New<JSRegExp>();
object_store->set_jsregexp_class(cls);
+ // Some classes are not stored in the object store. Yet we still need to
+ // create their Class object so that they get put into the class_table
+ // (as a side effect of Class::New()).
+ cls = Class::New<DartFunction>();
+ cls = Class::New<Number>();
+
cls = Class::New<WeakProperty>();
object_store->set_weak_property_class(cls);
@@ -1745,9 +1756,9 @@
result.set_type_arguments_instance_field_offset(
Closure::type_arguments_offset());
// Implements interface "Function".
- const Type& function_interface = Type::Handle(Type::FunctionInterface());
+ const Type& function_type = Type::Handle(Type::Function());
const Array& interfaces = Array::Handle(Array::New(1, Heap::kOld));
- interfaces.SetAt(0, function_interface);
+ interfaces.SetAt(0, function_type);
result.set_interfaces(interfaces);
// Unless the signature function already has a signature class, create a
// canonical signature class by having the signature function point back to
@@ -2560,9 +2571,9 @@
}
-bool AbstractType::IsNumberInterface() const {
+bool AbstractType::IsNumberType() const {
return HasResolvedTypeClass() &&
- (type_class() == Type::Handle(Type::NumberInterface()).type_class());
+ (type_class() == Type::Handle(Type::Number()).type_class());
}
@@ -2572,9 +2583,9 @@
}
-bool AbstractType::IsFunctionInterface() const {
+bool AbstractType::IsFunctionType() const {
return HasResolvedTypeClass() &&
- (type_class() == Type::Handle(Type::FunctionInterface()).type_class());
+ (type_class() == Type::Handle(Type::Function()).type_class());
}
@@ -2690,8 +2701,8 @@
}
-RawType* Type::NumberInterface() {
- return Isolate::Current()->object_store()->number_interface();
+RawType* Type::Number() {
+ return Isolate::Current()->object_store()->number_type();
}
@@ -2700,8 +2711,8 @@
}
-RawType* Type::FunctionInterface() {
- return Isolate::Current()->object_store()->function_interface();
+RawType* Type::Function() {
+ return Isolate::Current()->object_store()->function_type();
}
@@ -10857,6 +10868,11 @@
}
+const char* DartFunction::ToCString() const {
+ return "Function";
regis 2012/08/23 03:53:10 This is only used for debugging, so I would be mor
hausner 2012/08/23 18:34:10 Done.
+}
+
+
const char* Closure::ToCString() const {
const Function& fun = Function::Handle(function());
const bool is_implicit_closure = fun.IsImplicitClosureFunction();

Powered by Google App Engine
This is Rietveld 408576698