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

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

Issue 2464953002: Add support for OSR in kernel-based FlowGraphBuilder (Closed)
Patch Set: address comments Created 4 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 unified diff | Download patch
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | no next file » | 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 <map> 5 #include <map>
6 #include <set> 6 #include <set>
7 #include <string> 7 #include <string>
8 8
9 #include "vm/kernel_to_il.h" 9 #include "vm/kernel_to_il.h"
10 10
(...skipping 2732 matching lines...) Expand 10 before | Expand all | Expand 10 after
2743 UNREACHABLE(); 2743 UNREACHABLE();
2744 return NULL; 2744 return NULL;
2745 } 2745 }
2746 2746
2747 2747
2748 FlowGraph* FlowGraphBuilder::BuildGraphOfFunction(FunctionNode* function, 2748 FlowGraph* FlowGraphBuilder::BuildGraphOfFunction(FunctionNode* function,
2749 Constructor* constructor) { 2749 Constructor* constructor) {
2750 const Function& dart_function = parsed_function_->function(); 2750 const Function& dart_function = parsed_function_->function();
2751 TargetEntryInstr* normal_entry = BuildTargetEntry(); 2751 TargetEntryInstr* normal_entry = BuildTargetEntry();
2752 graph_entry_ = new (Z) 2752 graph_entry_ = new (Z)
2753 GraphEntryInstr(*parsed_function_, normal_entry, Compiler::kNoOSRDeoptId); 2753 GraphEntryInstr(*parsed_function_, normal_entry, osr_id_);
2754 2754
2755 SetupDefaultParameterValues(function); 2755 SetupDefaultParameterValues(function);
2756 2756
2757 Fragment body; 2757 Fragment body;
2758 if (!dart_function.is_native()) body += CheckStackOverflowInPrologue(); 2758 if (!dart_function.is_native()) body += CheckStackOverflowInPrologue();
2759 intptr_t context_size = 2759 intptr_t context_size =
2760 parsed_function_->node_sequence()->scope()->num_context_variables(); 2760 parsed_function_->node_sequence()->scope()->num_context_variables();
2761 if (context_size > 0) { 2761 if (context_size > 0) {
2762 body += PushContext(context_size); 2762 body += PushContext(context_size);
2763 LocalVariable* context = MakeTemporary(); 2763 LocalVariable* context = MakeTemporary();
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
2910 // False branch will contain the next comparison. 2910 // False branch will contain the next comparison.
2911 dispatch = Fragment(dispatch.entry, otherwise); 2911 dispatch = Fragment(dispatch.entry, otherwise);
2912 block = otherwise; 2912 block = otherwise;
2913 } 2913 }
2914 body = dispatch; 2914 body = dispatch;
2915 2915
2916 context_depth_ = current_context_depth; 2916 context_depth_ = current_context_depth;
2917 } 2917 }
2918 normal_entry->LinkTo(body.entry); 2918 normal_entry->LinkTo(body.entry);
2919 2919
2920 // When compiling for OSR, use a depth first search to prune instructions
2921 // unreachable from the OSR entry. Catch entries are always considered
2922 // reachable, even if they become unreachable after OSR.
2923 if (osr_id_ != Compiler::kNoOSRDeoptId) {
2924 BitVector* block_marks = new(Z) BitVector(Z, next_block_id_);
2925 bool found = graph_entry_->PruneUnreachable(graph_entry_, NULL, osr_id_,
2926 block_marks);
2927 ASSERT(found);
2928 }
2920 return new (Z) FlowGraph(*parsed_function_, graph_entry_, next_block_id_ - 1); 2929 return new (Z) FlowGraph(*parsed_function_, graph_entry_, next_block_id_ - 1);
2921 } 2930 }
2922 2931
2923 2932
2924 Fragment FlowGraphBuilder::NativeFunctionBody(FunctionNode* kernel_function, 2933 Fragment FlowGraphBuilder::NativeFunctionBody(FunctionNode* kernel_function,
2925 const Function& function) { 2934 const Function& function) {
2926 ASSERT(function.is_native()); 2935 ASSERT(function.is_native());
2927 // We explicitly build the graph for native functions in the same way that the 2936 // We explicitly build the graph for native functions in the same way that the
2928 // from-source backend does. We should find a way to have a single component 2937 // from-source backend does. We should find a way to have a single component
2929 // to build these graphs so that this code is not duplicated. 2938 // to build these graphs so that this code is not duplicated.
(...skipping 2639 matching lines...) Expand 10 before | Expand all | Expand 10 after
5569 instructions += LoadLocal(closure); 5578 instructions += LoadLocal(closure);
5570 instructions += LoadLocal(parsed_function_->current_context_var()); 5579 instructions += LoadLocal(parsed_function_->current_context_var());
5571 instructions += StoreInstanceField(Closure::context_offset()); 5580 instructions += StoreInstanceField(Closure::context_offset());
5572 5581
5573 return instructions; 5582 return instructions;
5574 } 5583 }
5575 5584
5576 5585
5577 } // namespace kernel 5586 } // namespace kernel
5578 } // namespace dart 5587 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698