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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 13867006: Inline binary Float32x4 ops. (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
Index: runtime/vm/flow_graph_optimizer.cc
diff --git a/runtime/vm/flow_graph_optimizer.cc b/runtime/vm/flow_graph_optimizer.cc
index 404caabe73767bafa70a368ac1c61c23abe90912..7a6c914ce994842c575cb44b1cb07ca7e51541c8 100644
--- a/runtime/vm/flow_graph_optimizer.cc
+++ b/runtime/vm/flow_graph_optimizer.cc
@@ -531,6 +531,11 @@ static bool HasOnlyTwoSmis(const ICData& ic_data) {
ICDataHasReceiverArgumentClassIds(ic_data, kSmiCid, kSmiCid);
}
+static bool HasOnlyTwoFloat32x4s(const ICData& ic_data) {
+ return (ic_data.NumberOfChecks() == 1) &&
+ ICDataHasReceiverArgumentClassIds(ic_data, kFloat32x4Cid, kFloat32x4Cid);
+}
+
// Returns false if the ICData contains anything other than the 4 combinations
// of Mint and Smi for the receiver and argument classes.
@@ -965,6 +970,8 @@ bool FlowGraphOptimizer::TryReplaceWithBinaryOp(InstanceCallInstr* call,
operands_type = kMintCid;
} else if (ShouldSpecializeForDouble(ic_data)) {
operands_type = kDoubleCid;
+ } else if (HasOnlyTwoFloat32x4s(ic_data)) {
+ operands_type = kFloat32x4Cid;
} else {
return false;
}
@@ -978,6 +985,8 @@ bool FlowGraphOptimizer::TryReplaceWithBinaryOp(InstanceCallInstr* call,
operands_type = kSmiCid;
} else if (ShouldSpecializeForDouble(ic_data)) {
operands_type = kDoubleCid;
+ } else if (HasOnlyTwoFloat32x4s(ic_data)) {
+ operands_type = kFloat32x4Cid;
} else {
return false;
}
@@ -985,6 +994,8 @@ bool FlowGraphOptimizer::TryReplaceWithBinaryOp(InstanceCallInstr* call,
case Token::kDIV:
if (ShouldSpecializeForDouble(ic_data)) {
operands_type = kDoubleCid;
+ } else if (HasOnlyTwoFloat32x4s(ic_data)) {
+ operands_type = kFloat32x4Cid;
} else {
return false;
}
@@ -1071,6 +1082,11 @@ bool FlowGraphOptimizer::TryReplaceWithBinaryOp(InstanceCallInstr* call,
call);
ReplaceCall(call, bin_op);
}
+ } else if (operands_type == kFloat32x4Cid) {
+ BinaryFloat32x4OpInstr* float32x4_bin_op =
+ new BinaryFloat32x4OpInstr(op_kind, new Value(left), new Value(right),
+ call);
+ ReplaceCall(call, float32x4_bin_op);
Vyacheslav Egorov (Google) 2013/04/15 11:09:35 You also need to emit CheckClass here just like yo
Cutch 2013/04/15 13:34:56 Done.
} else if (op_kind == Token::kMOD) {
// TODO(vegorov): implement fast path code for modulo.
ASSERT(operands_type == kSmiCid);
@@ -4399,6 +4415,19 @@ void ConstantPropagator::VisitBinaryDoubleOp(
}
+void ConstantPropagator::VisitBinaryFloat32x4Op(
+ BinaryFloat32x4OpInstr* instr) {
+ const Object& left = instr->left()->definition()->constant_value();
+ const Object& right = instr->right()->definition()->constant_value();
+ if (IsNonConstant(left) || IsNonConstant(right)) {
+ SetValue(instr, non_constant_);
+ } else if (IsConstant(left) && IsConstant(right)) {
+ // TODO(kmillikin): Handle binary operation.
+ SetValue(instr, non_constant_);
+ }
+}
+
+
void ConstantPropagator::VisitMathSqrt(MathSqrtInstr* instr) {
const Object& value = instr->value()->definition()->constant_value();
if (IsNonConstant(value)) {

Powered by Google App Engine
This is Rietveld 408576698