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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 172293004: Explicit conversions for Float32 array loads/stores. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 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
Index: runtime/vm/flow_graph_optimizer.cc
===================================================================
--- runtime/vm/flow_graph_optimizer.cc (revision 32793)
+++ runtime/vm/flow_graph_optimizer.cc (working copy)
@@ -1220,6 +1220,15 @@
Definition::kEffect);
}
+ if (array_cid == kTypedDataFloat32ArrayCid) {
+ stored_value =
+ new DoubleToFloatInstr(new Value(stored_value), call->deopt_id());
+ cursor = flow_graph()->AppendTo(cursor,
+ stored_value,
+ NULL,
+ Definition::kValue);
+ }
+
intptr_t index_scale = FlowGraphCompiler::ElementSizeFor(array_cid);
*last = new StoreIndexedInstr(new Value(array),
new Value(index),
@@ -1516,10 +1525,19 @@
index_scale,
array_cid,
deopt_id);
- flow_graph()->AppendTo(cursor,
- *last,
- deopt_id != Isolate::kNoDeoptId ? call->env() : NULL,
- Definition::kValue);
+ cursor = flow_graph()->AppendTo(
+ cursor,
+ *last,
+ deopt_id != Isolate::kNoDeoptId ? call->env() : NULL,
+ Definition::kValue);
+
+ if (array_cid == kTypedDataFloat32ArrayCid) {
+ *last = new FloatToDoubleInstr(new Value(*last), deopt_id);
+ flow_graph()->AppendTo(cursor,
+ *last,
+ deopt_id != Isolate::kNoDeoptId ? call->env() : NULL,
+ Definition::kValue);
+ }
return true;
}
@@ -3165,10 +3183,19 @@
1,
view_cid,
deopt_id);
- flow_graph()->AppendTo(cursor,
- *last,
- deopt_id != Isolate::kNoDeoptId ? call->env() : NULL,
- Definition::kValue);
+ cursor = flow_graph()->AppendTo(
+ cursor,
+ *last,
+ deopt_id != Isolate::kNoDeoptId ? call->env() : NULL,
+ Definition::kValue);
+
+ if (view_cid == kTypedDataFloat32ArrayCid) {
+ *last = new FloatToDoubleInstr(new Value(*last), deopt_id);
+ flow_graph()->AppendTo(cursor,
+ *last,
+ deopt_id != Isolate::kNoDeoptId ? call->env() : NULL,
+ Definition::kValue);
+ }
return true;
}
@@ -3279,6 +3306,16 @@
AddCheckClass(stored_value, value_check, call->deopt_id(), call->env(),
call);
}
+
+ if (view_cid == kTypedDataFloat32ArrayCid) {
+ stored_value =
+ new DoubleToFloatInstr(new Value(stored_value), call->deopt_id());
+ cursor = flow_graph()->AppendTo(cursor,
+ stored_value,
+ NULL,
+ Definition::kValue);
+ }
+
StoreBarrierType needs_store_barrier = kNoStoreBarrier;
*last = new StoreIndexedInstr(new Value(array),
new Value(index),
@@ -5263,8 +5300,8 @@
const PhiPlaceMoves* phi_moves() const { return phi_moves_; }
- // Returns true if the result of AllocateObject can be aliased by some
- // other SSA variable and false otherwise. Currently simply checks if
+ // Returns true if the result of an allocation instruction can be aliased by
+ // some other SSA variable and false otherwise. Currently simply checks if
// this value is stored in a field, escapes to another function or
// participates in a phi.
static bool CanBeAliased(AllocateObjectInstr* alloc) {
@@ -5725,6 +5762,7 @@
if ((array_store == NULL) ||
(array_store->class_id() == kArrayCid) ||
(array_store->class_id() == kTypedDataFloat64ArrayCid) ||
+ (array_store->class_id() == kTypedDataFloat32ArrayCid) ||
(array_store->class_id() == kTypedDataFloat32x4ArrayCid)) {
bool is_load = false;
Place store_place(instr, &is_load);
@@ -7440,6 +7478,18 @@
}
+void ConstantPropagator::VisitDoubleToFloat(DoubleToFloatInstr* instr) {
+ // TODO(kmillikin): Handle conversion.
+ SetValue(instr, non_constant_);
+}
+
+
+void ConstantPropagator::VisitFloatToDouble(FloatToDoubleInstr* instr) {
+ // TODO(kmillikin): Handle conversion.
+ SetValue(instr, non_constant_);
+}
+
+
void ConstantPropagator::VisitInvokeMathCFunction(
InvokeMathCFunctionInstr* instr) {
// TODO(kmillikin): Handle conversion.

Powered by Google App Engine
This is Rietveld 408576698