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

Unified Diff: runtime/vm/intermediate_language.cc

Issue 10823279: Cache the first evaluation of the compile time type of a definition as the (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
« no previous file with comments | « no previous file | no next file » | 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 10586)
+++ runtime/vm/intermediate_language.cc (working copy)
@@ -222,10 +222,8 @@
RawAbstractType* PhiInstr::CompileType() const {
- if (HasPropagatedType()) {
- return PropagatedType();
- }
- // If type propagation has not yet occured, we are reaching this phi via a
+ ASSERT(!HasPropagatedType());
+ // Since type propagation has not yet occured, we are reaching this phi via a
// back edge phi input. Return null as compile type so that this input is
// ignored in the first iteration of type propagation.
return AbstractType::null();
@@ -260,12 +258,7 @@
RawAbstractType* ParameterInstr::CompileType() const {
- // TODO(regis): Can type feedback provide information about the compile type
- // of a passed-in parameter? In that case, it would be stored in the
- // propagated_type_ field.
- if (HasPropagatedType()) {
- return PropagatedType();
- }
+ ASSERT(!HasPropagatedType());
// Note that returning the declared type of the formal parameter would be
// incorrect, because ParameterInstr is used as input to the type check
// verifying the run time type of the passed-in parameter and this check would
@@ -326,9 +319,7 @@
RawAbstractType* BindInstr::CompileType() const {
- if (HasPropagatedType()) {
- return PropagatedType();
- }
+ ASSERT(!HasPropagatedType());
// The compile type may be requested when building the flow graph, i.e. before
// type propagation has occurred.
return computation()->CompileType();
@@ -575,7 +566,15 @@
RawAbstractType* UseVal::CompileType() const {
- return definition()->CompileType();
+ if (definition()->HasPropagatedType()) {
+ return definition()->PropagatedType();
+ }
+ // The compile type may be requested when building the flow graph, i.e. before
+ // type propagation has occurred. To avoid repeatedly computing the compile
+ // type of the definition, we store it as initial propagated type.
+ AbstractType& type = AbstractType::Handle(definition()->CompileType());
+ definition()->SetPropagatedType(type);
+ return type.raw();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698