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

Unified Diff: runtime/vm/constant_propagator.cc

Issue 2894913002: Revert "VM: Constant fold more loads from constants in the optimizer." (Closed)
Patch Set: Created 3 years, 7 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 | runtime/vm/intermediate_language.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/constant_propagator.cc
diff --git a/runtime/vm/constant_propagator.cc b/runtime/vm/constant_propagator.cc
index 3e3831dda45310a7c86d3244ea7c3df0500da0ce..050c0ba2a99606affbf530fab27dbd375b478f8f 100644
--- a/runtime/vm/constant_propagator.cc
+++ b/runtime/vm/constant_propagator.cc
@@ -831,33 +831,30 @@ void ConstantPropagator::VisitLoadField(LoadFieldInstr* instr) {
}
}
- const Object& constant = instance->definition()->constant_value();
- if (IsConstant(constant)) {
- if (instr->IsImmutableLengthLoad()) {
- if (constant.IsString()) {
+ if (instr->IsImmutableLengthLoad()) {
+ ConstantInstr* constant =
+ instance->definition()->OriginalDefinition()->AsConstant();
+ if (constant != NULL) {
+ if (constant->value().IsString()) {
SetValue(instr,
- Smi::ZoneHandle(Z, Smi::New(String::Cast(constant).Length())));
+ Smi::ZoneHandle(
+ Z, Smi::New(String::Cast(constant->value()).Length())));
return;
}
- if (constant.IsArray()) {
+ if (constant->value().IsArray()) {
SetValue(instr,
- Smi::ZoneHandle(Z, Smi::New(Array::Cast(constant).Length())));
+ Smi::ZoneHandle(
+ Z, Smi::New(Array::Cast(constant->value()).Length())));
return;
}
- if (constant.IsTypedData()) {
- SetValue(instr, Smi::ZoneHandle(
- Z, Smi::New(TypedData::Cast(constant).Length())));
- return;
- }
- } else {
- Object& value = Object::Handle();
- if (instr->Evaluate(constant, &value)) {
- SetValue(instr, Object::ZoneHandle(Z, value.raw()));
+ if (constant->value().IsTypedData()) {
+ SetValue(instr,
+ Smi::ZoneHandle(
+ Z, Smi::New(TypedData::Cast(constant->value()).Length())));
return;
}
}
}
-
SetValue(instr, non_constant_);
}
« no previous file with comments | « no previous file | runtime/vm/intermediate_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698