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

Unified Diff: runtime/vm/intermediate_language.cc

Issue 23584002: Replace guarded list length field loads with constants (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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/flow_graph_optimizer.cc ('k') | 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
diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc
index b681cd70f7edf22162f8a9226765859c265c4a7c..e49542354c42d846cdd6a4b37bc55b2696eb5a99 100644
--- a/runtime/vm/intermediate_language.cc
+++ b/runtime/vm/intermediate_language.cc
@@ -1366,6 +1366,16 @@ Definition* LoadFieldInstr::Canonicalize(FlowGraph* flow_graph) {
IsFixedLengthArrayCid(call->Type()->ToCid())) {
return call->ArgumentAt(1);
}
+ // For arrays with guarded lengths, replace the length load
+ // with a constant.
+ LoadFieldInstr* load_array = instance()->definition()->AsLoadField();
+ if (load_array != NULL) {
+ const Field* field = load_array->field();
srdjan 2013/08/28 15:15:08 'field' can be null, do you need to check?
Cutch 2013/08/29 07:23:26 Done. Conceptual/context question: What does a Loa
+ if (field->guarded_list_length() >= 0) {
+ return flow_graph->GetConstant(
+ Smi::Handle(Smi::New(field->guarded_list_length())));
+ }
+ }
return this;
}
« no previous file with comments | « runtime/vm/flow_graph_optimizer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698