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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 1423063005: VM: Speculative inlining in precompiled code. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: add retry Created 5 years, 1 month 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 9240358c6b9ebb9bc7224bc442041e349605fe5d..b3ec3f0aea14fa09af86956c3a375a70a3e6c2ef 100644
--- a/runtime/vm/flow_graph_optimizer.cc
+++ b/runtime/vm/flow_graph_optimizer.cc
@@ -4202,6 +4202,13 @@ void FlowGraphOptimizer::ReplaceWithTypeCast(InstanceCallInstr* call) {
}
+bool FlowGraphOptimizer::IsBlackListed(intptr_t deopt_id) {
srdjan 2015/11/17 17:35:23 s/deopt_id/call_deopt_id/ makes it clearer IMO.
srdjan 2015/11/17 17:35:23 s/IsBlackListed/ IsBlackListedForInlining/
Florian Schneider 2015/11/17 19:38:56 Done.
Florian Schneider 2015/11/17 19:38:56 Done.
+ for (intptr_t i = 0; i < inlining_black_list_->length(); ++i) {
+ if ((*inlining_black_list_)[i] == deopt_id) return true;
+ }
+ return false;
+}
+
// Special optimizations when running in --noopt mode.
void FlowGraphOptimizer::InstanceCallNoopt(InstanceCallInstr* instr) {
// TODO(srdjan): Investigate other attempts, as they are not allowed to
@@ -4230,6 +4237,34 @@ void FlowGraphOptimizer::InstanceCallNoopt(InstanceCallInstr* instr) {
return;
}
+ if (use_speculative_inlining_ &&
+ !IsBlackListed(instr->deopt_id()) &&
+ unary_checks.NumberOfChecks() > 0) {
srdjan 2015/11/17 17:35:23 Add parentheses
Florian Schneider 2015/11/17 19:38:56 Done.
+ if ((op_kind == Token::kINDEX) && TryReplaceWithIndexedOp(instr)) {
+ return;
+ }
+ if ((op_kind == Token::kASSIGN_INDEX) && TryReplaceWithIndexedOp(instr)) {
+ return;
+ }
+ if (op_kind == Token::kEQ && TryReplaceWithEqualityOp(instr, op_kind)) {
srdjan 2015/11/17 17:35:23 Add parentheses
Florian Schneider 2015/11/17 19:38:56 Done.
+ return;
+ }
+
+ if (Token::IsRelationalOperator(op_kind) &&
+ TryReplaceWithRelationalOp(instr, op_kind)) {
+ return;
+ }
+
+ if (Token::IsBinaryOperator(op_kind) &&
+ TryReplaceWithBinaryOp(instr, op_kind)) {
+ return;
+ }
+ if (Token::IsUnaryOperator(op_kind) &&
+ TryReplaceWithUnaryOp(instr, op_kind)) {
+ return;
+ }
+ }
+
bool has_one_target =
(unary_checks.NumberOfChecks() > 0) && unary_checks.HasOneTarget();
if (has_one_target) {
@@ -5176,7 +5211,8 @@ static bool IsLoopInvariantLoad(ZoneGrowableArray<BitVector*>* sets,
void LICM::OptimisticallySpecializeSmiPhis() {
- if (!flow_graph()->function().allows_hoisting_check_class()) {
+ if (!flow_graph()->function().allows_hoisting_check_class() ||
+ Compiler::always_optimize()) {
srdjan 2015/11/17 17:35:23 Add comment why not do it for precompilation.
Florian Schneider 2015/11/17 19:38:56 Done.
// Do not hoist any.
return;
}

Powered by Google App Engine
This is Rietveld 408576698