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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 783683002: Better constant folding of length-loads in checked mode. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years 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 | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_optimizer.cc
===================================================================
--- runtime/vm/flow_graph_optimizer.cc (revision 42103)
+++ runtime/vm/flow_graph_optimizer.cc (working copy)
@@ -8238,10 +8238,11 @@
void ConstantPropagator::VisitLoadField(LoadFieldInstr* instr) {
+ Value* instance = instr->instance();
if ((instr->recognized_kind() == MethodRecognizer::kObjectArrayLength) &&
- (instr->instance()->definition()->IsCreateArray())) {
+ instance->definition()->OriginalDefinition()->IsCreateArray()) {
Value* num_elements =
- instr->instance()->definition()->AsCreateArray()->num_elements();
+ instance->definition()->AsCreateArray()->num_elements();
if (num_elements->BindsToConstant() &&
Vyacheslav Egorov (Google) 2014/12/05 13:45:16 Maybe BindsToConstant/BoundConstant should also be
num_elements->BoundConstant().IsSmi()) {
intptr_t length = Smi::Cast(num_elements->BoundConstant()).Value();
@@ -8252,7 +8253,8 @@
}
if (instr->IsImmutableLengthLoad()) {
- ConstantInstr* constant = instr->instance()->definition()->AsConstant();
+ ConstantInstr* constant =
+ instance->definition()->OriginalDefinition()->AsConstant();
if (constant != NULL) {
if (constant->value().IsString()) {
SetValue(instr, Smi::ZoneHandle(I,
« no previous file with comments | « no previous file | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698