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

Unified Diff: runtime/vm/flow_graph_inliner.cc

Issue 2423843002: Add DoubleTestOp instruction (Closed)
Patch Set: Cleanup Created 4 years, 2 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_inliner.cc
diff --git a/runtime/vm/flow_graph_inliner.cc b/runtime/vm/flow_graph_inliner.cc
index 726f6e82a4a43642376c9f9a7d76d1fa636250c6..39facac59d4d70bc9ca597bfbf61641df461a74c 100644
--- a/runtime/vm/flow_graph_inliner.cc
+++ b/runtime/vm/flow_graph_inliner.cc
@@ -2402,6 +2402,34 @@ static bool InlineDoubleOp(FlowGraph* flow_graph,
}
+static bool InlineDoubleTestOp(FlowGraph* flow_graph,
+ Instruction* call,
+ MethodRecognizer::Kind kind,
+ TargetEntryInstr** entry,
+ Definition** last) {
+ if (!CanUnboxDouble()) {
+ return false;
+ }
+ Definition* d = call->ArgumentAt(0);
+
+ *entry = new(Z) TargetEntryInstr(flow_graph->allocate_block_id(),
+ call->GetBlock()->try_index());
+ (*entry)->InheritDeoptTarget(Z, call);
+ // Arguments are checked. No need for class check.
+
+ DoubleTestOpInstr* double_test_op =
+ new(Z) DoubleTestOpInstr(kind,
+ new(Z) Value(d),
+ call->deopt_id(),
+ call->token_pos());
+ flow_graph->AppendTo(
+ *entry, double_test_op, call->env(), FlowGraph::kValue);
+ *last = double_test_op;
+
+ return true;
+}
+
+
static bool InlineSmiBitAndFromSmi(FlowGraph* flow_graph,
Instruction* call,
TargetEntryInstr** entry,
@@ -3649,6 +3677,9 @@ bool FlowGraphInliner::TryInlineRecognizedMethod(FlowGraph* flow_graph,
return InlineDoubleOp(flow_graph, Token::kMUL, call, entry, last);
case MethodRecognizer::kDoubleDiv:
return InlineDoubleOp(flow_graph, Token::kDIV, call, entry, last);
+ case MethodRecognizer::kDoubleIsNaN:
Florian Schneider 2016/10/18 20:34:20 Handle DoubleIsNegative?
zra 2016/10/18 22:36:32 Acknowledged.
+ case MethodRecognizer::kDoubleIsInfinite:
+ return InlineDoubleTestOp(flow_graph, call, kind, entry, last);
case MethodRecognizer::kGrowableArraySetData:
ASSERT(receiver_cid == kGrowableObjectArrayCid);
ASSERT(ic_data.NumberOfChecks() == 1);

Powered by Google App Engine
This is Rietveld 408576698