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

Side by Side Diff: runtime/vm/flow_graph_inliner.cc

Issue 1314143002: VM: Don't depend on unoptimized code when inlining and creating deoptimization info. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: addressed comments Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.cc ('k') | runtime/vm/intermediate_language.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/flow_graph_inliner.h" 5 #include "vm/flow_graph_inliner.h"
6 6
7 #include "vm/block_scheduler.h" 7 #include "vm/block_scheduler.h"
8 #include "vm/compiler.h" 8 #include "vm/compiler.h"
9 #include "vm/flags.h" 9 #include "vm/flags.h"
10 #include "vm/flow_graph.h" 10 #include "vm/flow_graph.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 #define PRINT_INLINING_TREE(comment, caller, target, instance_call) \ 75 #define PRINT_INLINING_TREE(comment, caller, target, instance_call) \
76 do { \ 76 do { \
77 if (FLAG_print_inlining_tree) { \ 77 if (FLAG_print_inlining_tree) { \
78 inlined_info_.Add(InlinedInfo( \ 78 inlined_info_.Add(InlinedInfo( \
79 caller, target, inlining_depth_, instance_call, comment)); \ 79 caller, target, inlining_depth_, instance_call, comment)); \
80 } \ 80 } \
81 } while (false) \ 81 } while (false) \
82 82
83 83
84 // Test if a call is recursive by looking in the deoptimization environment. 84 // Test if a call is recursive by looking in the deoptimization environment.
85 static bool IsCallRecursive(const Code& code, Definition* call) { 85 static bool IsCallRecursive(const Function& function, Definition* call) {
86 Environment* env = call->env(); 86 Environment* env = call->env();
87 while (env != NULL) { 87 while (env != NULL) {
88 if (code.raw() == env->code().raw()) { 88 if (function.raw() == env->function().raw()) {
89 return true; 89 return true;
90 } 90 }
91 env = env->outer(); 91 env = env->outer();
92 } 92 }
93 return false; 93 return false;
94 } 94 }
95 95
96 96
97 // Helper to get the default value of a formal parameter. 97 // Helper to get the default value of a formal parameter.
98 static ConstantInstr* GetDefaultValue(intptr_t i, 98 static ConstantInstr* GetDefaultValue(intptr_t i,
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 function.optimized_call_site_count(), 660 function.optimized_call_site_count(),
661 constant_arguments)); 661 constant_arguments));
662 PRINT_INLINING_TREE("Early heuristic", 662 PRINT_INLINING_TREE("Early heuristic",
663 &call_data->caller, &function, call_data->call); 663 &call_data->caller, &function, call_data->call);
664 return false; 664 return false;
665 } 665 }
666 666
667 // Abort if this is a recursive occurrence. 667 // Abort if this is a recursive occurrence.
668 Definition* call = call_data->call; 668 Definition* call = call_data->call;
669 // Added 'volatile' works around a possible GCC 4.9 compiler bug. 669 // Added 'volatile' works around a possible GCC 4.9 compiler bug.
670 volatile bool is_recursive_call = IsCallRecursive(unoptimized_code, call); 670 volatile bool is_recursive_call = IsCallRecursive(function, call);
671 if (is_recursive_call && 671 if (is_recursive_call &&
672 inlining_recursion_depth_ >= FLAG_inlining_recursion_depth_threshold) { 672 inlining_recursion_depth_ >= FLAG_inlining_recursion_depth_threshold) {
673 TRACE_INLINING(ISL_Print(" Bailout: recursive function\n")); 673 TRACE_INLINING(ISL_Print(" Bailout: recursive function\n"));
674 PRINT_INLINING_TREE("Recursive function", 674 PRINT_INLINING_TREE("Recursive function",
675 &call_data->caller, &function, call_data->call); 675 &call_data->caller, &function, call_data->call);
676 return false; 676 return false;
677 } 677 }
678 678
679 // Save and clear deopt id. 679 // Save and clear deopt id.
680 const intptr_t prev_deopt_id = isolate()->deopt_id(); 680 const intptr_t prev_deopt_id = isolate()->deopt_id();
(...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after
1891 intptr_t FlowGraphInliner::NextInlineId(const Function& function, 1891 intptr_t FlowGraphInliner::NextInlineId(const Function& function,
1892 intptr_t parent_id) { 1892 intptr_t parent_id) {
1893 const intptr_t id = inline_id_to_function_->length(); 1893 const intptr_t id = inline_id_to_function_->length();
1894 inline_id_to_function_->Add(&function); 1894 inline_id_to_function_->Add(&function);
1895 caller_inline_id_->Add(parent_id); 1895 caller_inline_id_->Add(parent_id);
1896 return id; 1896 return id;
1897 } 1897 }
1898 1898
1899 1899
1900 } // namespace dart 1900 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.cc ('k') | runtime/vm/intermediate_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698