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

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: addressed comments 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
« no previous file with comments | « runtime/vm/flow_graph_optimizer.h ('k') | runtime/vm/flow_graph_range_analysis.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 9240358c6b9ebb9bc7224bc442041e349605fe5d..feb72c182727dddb0a72b8a412e2644f09e3e015 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::IsBlackListedForInlining(intptr_t call_deopt_id) {
+ for (intptr_t i = 0; i < inlining_black_list_->length(); ++i) {
+ if ((*inlining_black_list_)[i] == call_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_ &&
+ !IsBlackListedForInlining(instr->deopt_id()) &&
+ (unary_checks.NumberOfChecks() > 0)) {
+ 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)) {
+ 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,8 +5211,11 @@ static bool IsLoopInvariantLoad(ZoneGrowableArray<BitVector*>* sets,
void LICM::OptimisticallySpecializeSmiPhis() {
- if (!flow_graph()->function().allows_hoisting_check_class()) {
- // Do not hoist any.
+ if (!flow_graph()->function().allows_hoisting_check_class() ||
+ Compiler::always_optimize()) {
+ // Do not hoist any: Either deoptimized on a hoisted check,
+ // or compiling precompiled code where we can't do optimistic
+ // hoisting of checks.
return;
}
« no previous file with comments | « runtime/vm/flow_graph_optimizer.h ('k') | runtime/vm/flow_graph_range_analysis.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698