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

Unified Diff: runtime/vm/intermediate_language.cc

Issue 10823022: Improve static type propagation. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 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/intermediate_language.h ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language.cc
===================================================================
--- runtime/vm/intermediate_language.cc (revision 9904)
+++ runtime/vm/intermediate_language.cc (working copy)
@@ -319,6 +319,12 @@
}
+RawAbstractType* PhiInstr::StaticType() const {
+ // TODO(regis): Return the least upper bound of the input static types.
+ return Type::DynamicType();
+}
+
+
intptr_t ParameterInstr::InputCount() const {
return 0;
}
@@ -335,6 +341,13 @@
}
+RawAbstractType* ParameterInstr::StaticType() const {
+ // TODO(regis): Can type feedback provide information about the static type
+ // of a passed-in parameter?
srdjan 2012/07/25 21:50:06 I guess with FLAG_enable_type_checks we can use th
regis 2012/07/26 15:08:50 Good point. You probably mean the type of the form
+ return Type::DynamicType();
+}
+
+
intptr_t GraphEntryInstr::InputCount() const {
return 0;
}
@@ -628,6 +641,11 @@
RawAbstractType* AssertAssignableComp::StaticType() const {
+ const AbstractType& value_static_type =
+ AbstractType::Handle(value()->StaticType());
+ if (value_static_type.IsMoreSpecificThan(dst_type(), NULL)) {
+ return value_static_type.raw();
+ }
return dst_type().raw();
}
@@ -659,6 +677,8 @@
RawAbstractType* InstanceCallComp::StaticType() const {
+ // TODO(regis): Return a more specific type than Dynamic for recognized
+ // combinations of receiver static type and method name.
return Type::DynamicType();
}
@@ -679,13 +699,7 @@
RawAbstractType* StoreLocalComp::StaticType() const {
- const AbstractType& assigned_value_type =
- AbstractType::Handle(value()->StaticType());
- if (assigned_value_type.IsDynamicType()) {
- // Static type of assigned value is unknown, return static type of local.
- return local().type().raw();
- }
- return assigned_value_type.raw();
+ return value()->StaticType();
}
@@ -729,14 +743,7 @@
RawAbstractType* StaticSetterComp::StaticType() const {
- const AbstractType& assigned_value_type =
- AbstractType::Handle(value()->StaticType());
- if (assigned_value_type.IsDynamicType()) {
- // Static type of assigned value is unknown, return static type of setter
- // value parameter.
- return setter_function().ParameterTypeAt(0);
- }
- return assigned_value_type.raw();
+ return value()->StaticType();
}
@@ -746,13 +753,7 @@
RawAbstractType* StoreInstanceFieldComp::StaticType() const {
- const AbstractType& assigned_value_type =
- AbstractType::Handle(value()->StaticType());
- if (assigned_value_type.IsDynamicType()) {
- // Static type of assigned value is unknown, return static type of field.
- return field().type();
- }
- return assigned_value_type.raw();
+ return value()->StaticType();
}
@@ -762,13 +763,7 @@
RawAbstractType* StoreStaticFieldComp::StaticType() const {
- const AbstractType& assigned_value_type =
- AbstractType::Handle(value()->StaticType());
- if (assigned_value_type.IsDynamicType()) {
- // Static type of assigned value is unknown, return static type of field.
- return field().type();
- }
- return assigned_value_type.raw();
+ return value()->StaticType();
}
@@ -814,14 +809,7 @@
RawAbstractType* StoreVMFieldComp::StaticType() const {
- ASSERT(!type().IsNull());
- const AbstractType& assigned_value_type =
- AbstractType::Handle(value()->StaticType());
- if (assigned_value_type.IsDynamicType()) {
- // Static type of assigned value is unknown, return static type of field.
- return type().raw();
- }
- return assigned_value_type.raw();
+ return value()->StaticType();
}
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698