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

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

Issue 1739963002: Remember token position where a function was inlined (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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
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/aot_optimizer.h" 7 #include "vm/aot_optimizer.h"
8 #include "vm/block_scheduler.h" 8 #include "vm/block_scheduler.h"
9 #include "vm/branch_optimizer.h" 9 #include "vm/branch_optimizer.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 caller_graph()-> 896 caller_graph()->
897 parsed_function().AddToGuardedFields(callee_guarded_fields[i]); 897 parsed_function().AddToGuardedFields(callee_guarded_fields[i]);
898 } 898 }
899 // When inlined, we add the deferred prefixes of the callee to the 899 // When inlined, we add the deferred prefixes of the callee to the
900 // caller's list of deferred prefixes. 900 // caller's list of deferred prefixes.
901 caller_graph()->AddToDeferredPrefixes( 901 caller_graph()->AddToDeferredPrefixes(
902 callee_graph->deferred_prefixes()); 902 callee_graph->deferred_prefixes());
903 903
904 FlowGraphInliner::SetInliningId(callee_graph, 904 FlowGraphInliner::SetInliningId(callee_graph,
905 inliner_->NextInlineId(callee_graph->function(), 905 inliner_->NextInlineId(callee_graph->function(),
906 call_data->call->token_pos(),
906 call_data->caller_inlining_id_)); 907 call_data->caller_inlining_id_));
907 TRACE_INLINING(THR_Print(" Success\n")); 908 TRACE_INLINING(THR_Print(" Success\n"));
908 PRINT_INLINING_TREE(NULL, 909 PRINT_INLINING_TREE(NULL,
909 &call_data->caller, &function, call); 910 &call_data->caller, &function, call);
910 return true; 911 return true;
911 } else { 912 } else {
912 error = thread()->sticky_error(); 913 error = thread()->sticky_error();
913 thread()->clear_sticky_error(); 914 thread()->clear_sticky_error();
914 ASSERT(error.IsLanguageError()); 915 ASSERT(error.IsLanguageError());
915 916
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after
1817 1818
1818 static bool ShouldTraceInlining(FlowGraph* flow_graph) { 1819 static bool ShouldTraceInlining(FlowGraph* flow_graph) {
1819 const Function& top = flow_graph->parsed_function().function(); 1820 const Function& top = flow_graph->parsed_function().function();
1820 return FLAG_trace_inlining && FlowGraphPrinter::ShouldPrint(top); 1821 return FLAG_trace_inlining && FlowGraphPrinter::ShouldPrint(top);
1821 } 1822 }
1822 1823
1823 1824
1824 FlowGraphInliner::FlowGraphInliner( 1825 FlowGraphInliner::FlowGraphInliner(
1825 FlowGraph* flow_graph, 1826 FlowGraph* flow_graph,
1826 GrowableArray<const Function*>* inline_id_to_function, 1827 GrowableArray<const Function*>* inline_id_to_function,
1828 GrowableArray<TokenPosition>* inline_id_to_token_pos,
1827 GrowableArray<intptr_t>* caller_inline_id, 1829 GrowableArray<intptr_t>* caller_inline_id,
1828 bool use_speculative_inlining, 1830 bool use_speculative_inlining,
1829 GrowableArray<intptr_t>* inlining_black_list) 1831 GrowableArray<intptr_t>* inlining_black_list)
1830 : flow_graph_(flow_graph), 1832 : flow_graph_(flow_graph),
1831 inline_id_to_function_(inline_id_to_function), 1833 inline_id_to_function_(inline_id_to_function),
1834 inline_id_to_token_pos_(inline_id_to_token_pos),
1832 caller_inline_id_(caller_inline_id), 1835 caller_inline_id_(caller_inline_id),
1833 trace_inlining_(ShouldTraceInlining(flow_graph)), 1836 trace_inlining_(ShouldTraceInlining(flow_graph)),
1834 use_speculative_inlining_(use_speculative_inlining), 1837 use_speculative_inlining_(use_speculative_inlining),
1835 inlining_black_list_(inlining_black_list) { 1838 inlining_black_list_(inlining_black_list) {
1836 ASSERT(!use_speculative_inlining || (inlining_black_list != NULL)); 1839 ASSERT(!use_speculative_inlining || (inlining_black_list != NULL));
1837 } 1840 }
1838 1841
1839 1842
1840 void FlowGraphInliner::CollectGraphInfo(FlowGraph* flow_graph, bool force) { 1843 void FlowGraphInliner::CollectGraphInfo(FlowGraph* flow_graph, bool force) {
1841 const Function& function = flow_graph->function(); 1844 const Function& function = flow_graph->function();
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1942 function().ToFullyQualifiedCString()); 1945 function().ToFullyQualifiedCString());
1943 FlowGraphPrinter printer(*flow_graph_); 1946 FlowGraphPrinter printer(*flow_graph_);
1944 printer.PrintBlocks(); 1947 printer.PrintBlocks();
1945 } 1948 }
1946 } 1949 }
1947 } 1950 }
1948 } 1951 }
1949 1952
1950 1953
1951 intptr_t FlowGraphInliner::NextInlineId(const Function& function, 1954 intptr_t FlowGraphInliner::NextInlineId(const Function& function,
1955 TokenPosition tp,
1952 intptr_t parent_id) { 1956 intptr_t parent_id) {
1953 const intptr_t id = inline_id_to_function_->length(); 1957 const intptr_t id = inline_id_to_function_->length();
1958 // TODO(johnmccutchan): Do not allow IsNoSource once all nodes have proper
1959 // source positions.
1960 ASSERT(tp.IsReal() || tp.IsSynthetic() || tp.IsNoSource());
1954 inline_id_to_function_->Add(&function); 1961 inline_id_to_function_->Add(&function);
1962 inline_id_to_token_pos_->Add(tp);
1963 ASSERT(inline_id_to_token_pos_->length() == inline_id_to_function_->length());
1955 caller_inline_id_->Add(parent_id); 1964 caller_inline_id_->Add(parent_id);
1956 return id; 1965 return id;
1957 } 1966 }
1958 1967
1959 1968
1960 static bool ShouldInlineSimd() { 1969 static bool ShouldInlineSimd() {
1961 return FlowGraphCompiler::SupportsUnboxedSimd128(); 1970 return FlowGraphCompiler::SupportsUnboxedSimd128();
1962 } 1971 }
1963 1972
1964 1973
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after
3054 return InlineDoubleOp(flow_graph, Token::kMUL, call, entry, last); 3063 return InlineDoubleOp(flow_graph, Token::kMUL, call, entry, last);
3055 case MethodRecognizer::kDoubleDiv: 3064 case MethodRecognizer::kDoubleDiv:
3056 return InlineDoubleOp(flow_graph, Token::kDIV, call, entry, last); 3065 return InlineDoubleOp(flow_graph, Token::kDIV, call, entry, last);
3057 default: 3066 default:
3058 return false; 3067 return false;
3059 } 3068 }
3060 } 3069 }
3061 3070
3062 3071
3063 } // namespace dart 3072 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698