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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 14288006: Inline Float32x4 comparison. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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_compiler.cc ('k') | runtime/vm/flow_graph_type_propagator.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
diff --git a/runtime/vm/flow_graph_optimizer.cc b/runtime/vm/flow_graph_optimizer.cc
index f8288dd332d0ea839083709e48534daaa1e558e6..38bbf2e15b0a2f26a9b7d6455dff023c02c118e5 100644
--- a/runtime/vm/flow_graph_optimizer.cc
+++ b/runtime/vm/flow_graph_optimizer.cc
@@ -374,6 +374,13 @@ void FlowGraphOptimizer::InsertConversion(Representation from,
converted = new UnboxFloat32x4Instr(use->CopyWithType(), deopt_id);
} else if ((from == kUnboxedFloat32x4) && (to == kTagged)) {
converted = new BoxFloat32x4Instr(use->CopyWithType());
+ } else if ((from == kTagged) && (to == kUnboxedUint32x4)) {
+ ASSERT((deopt_target != NULL) || (use->Type()->ToCid() == kUint32x4Cid));
+ const intptr_t deopt_id = (deopt_target != NULL) ?
+ deopt_target->DeoptimizationTarget() : Isolate::kNoDeoptId;
+ converted = new UnboxUint32x4Instr(use->CopyWithType(), deopt_id);
+ } else if ((from == kUnboxedUint32x4) && (to == kTagged)) {
+ converted = new BoxUint32x4Instr(use->CopyWithType());
}
ASSERT(converted != NULL);
use->BindTo(converted);
@@ -1729,6 +1736,35 @@ bool FlowGraphOptimizer::TryInlineInstanceMethod(InstanceCallInstr* call) {
return false;
}
}
+
+ if ((class_ids[0] == kFloat32x4Cid) && (ic_data.NumberOfChecks() == 1)) {
+ switch (recognized_kind) {
+ case MethodRecognizer::kFloat32x4Equal:
+ case MethodRecognizer::kFloat32x4GreaterThan:
+ case MethodRecognizer::kFloat32x4GreaterThanOrEqual:
+ case MethodRecognizer::kFloat32x4LessThan:
+ case MethodRecognizer::kFloat32x4LessThanOrEqual:
+ case MethodRecognizer::kFloat32x4NotEqual: {
+ Definition* left = call->ArgumentAt(0);
+ Definition* right = call->ArgumentAt(1);
+ // Type check left.
+ AddCheckClass(left,
+ ICData::ZoneHandle(
+ call->ic_data()->AsUnaryClassChecksForArgNr(0)),
+ call->deopt_id(),
+ call->env(),
+ call);
+ // Replace call.
+ Float32x4ComparisonInstr* cmp =
+ new Float32x4ComparisonInstr(recognized_kind, new Value(left),
+ new Value(right), call);
+ ReplaceCall(call, cmp);
+ return true;
+ }
+ default:
+ return false;
+ }
+ }
return false;
}
@@ -4766,6 +4802,12 @@ void ConstantPropagator::VisitFloat32x4Splat(Float32x4SplatInstr* instr) {
}
+void ConstantPropagator::VisitFloat32x4Comparison(
+ Float32x4ComparisonInstr* instr) {
+ SetValue(instr, non_constant_);
+}
+
+
void ConstantPropagator::VisitMathSqrt(MathSqrtInstr* instr) {
const Object& value = instr->value()->definition()->constant_value();
if (IsNonConstant(value)) {
@@ -4821,6 +4863,28 @@ void ConstantPropagator::VisitBoxFloat32x4(BoxFloat32x4Instr* instr) {
}
+void ConstantPropagator::VisitUnboxUint32x4(UnboxUint32x4Instr* instr) {
+ const Object& value = instr->value()->definition()->constant_value();
+ if (IsNonConstant(value)) {
+ SetValue(instr, non_constant_);
+ } else if (IsConstant(value)) {
+ // TODO(kmillikin): Handle conversion.
+ SetValue(instr, non_constant_);
+ }
+}
+
+
+void ConstantPropagator::VisitBoxUint32x4(BoxUint32x4Instr* instr) {
+ const Object& value = instr->value()->definition()->constant_value();
+ if (IsNonConstant(value)) {
+ SetValue(instr, non_constant_);
+ } else if (IsConstant(value)) {
+ // TODO(kmillikin): Handle conversion.
+ SetValue(instr, non_constant_);
+ }
+}
+
+
void ConstantPropagator::Analyze() {
GraphEntryInstr* entry = graph_->graph_entry();
reachable_->Add(entry->preorder_number());
« no previous file with comments | « runtime/vm/flow_graph_compiler.cc ('k') | runtime/vm/flow_graph_type_propagator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698