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

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

Issue 2776373002: Initial steps into streaming the kernel flowgraph (Closed)
Patch Set: Rebase + fix lint error Created 3 years, 8 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/kernel_binary_flowgraph.cc ('k') | runtime/vm/kernel_to_il.cc » ('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) 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 #ifndef RUNTIME_VM_KERNEL_TO_IL_H_ 5 #ifndef RUNTIME_VM_KERNEL_TO_IL_H_
6 #define RUNTIME_VM_KERNEL_TO_IL_H_ 6 #define RUNTIME_VM_KERNEL_TO_IL_H_
7 7
8 #if !defined(DART_PRECOMPILED_RUNTIME) 8 #if !defined(DART_PRECOMPILED_RUNTIME)
9 9
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
11 #include "vm/hash_map.h" 11 #include "vm/hash_map.h"
12 12
13 #include "vm/flow_graph.h" 13 #include "vm/flow_graph.h"
14 #include "vm/flow_graph_builder.h" 14 #include "vm/flow_graph_builder.h"
15 #include "vm/intermediate_language.h" 15 #include "vm/intermediate_language.h"
16 #include "vm/kernel.h" 16 #include "vm/kernel.h"
17 17
18 namespace dart { 18 namespace dart {
19 namespace kernel { 19 namespace kernel {
20 20
21 class StreamingFlowGraphBuilder;
22
21 // TODO(27590): Instead of using [dart::kernel::TreeNode]s as keys we 23 // TODO(27590): Instead of using [dart::kernel::TreeNode]s as keys we
22 // should use [TokenPosition]s. 24 // should use [TokenPosition]s.
23 class KernelConstMapKeyEqualsTraits { 25 class KernelConstMapKeyEqualsTraits {
24 public: 26 public:
25 static const char* Name() { return "KernelConstMapKeyEqualsTraits"; } 27 static const char* Name() { return "KernelConstMapKeyEqualsTraits"; }
26 static bool ReportStats() { return false; } 28 static bool ReportStats() { return false; }
27 29
28 static bool IsMatch(const Object& a, const Object& b) { 30 static bool IsMatch(const Object& a, const Object& b) {
29 const Smi& key1 = Smi::Cast(a); 31 const Smi& key1 = Smi::Cast(a);
30 const Smi& key2 = Smi::Cast(b); 32 const Smi& key2 = Smi::Cast(b);
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 DartTypeTranslator type_translator_; 732 DartTypeTranslator type_translator_;
731 733
732 FunctionNode* current_function_node_; 734 FunctionNode* current_function_node_;
733 LocalScope* current_function_scope_; 735 LocalScope* current_function_scope_;
734 LocalScope* scope_; 736 LocalScope* scope_;
735 DepthState depth_; 737 DepthState depth_;
736 738
737 intptr_t name_index_; 739 intptr_t name_index_;
738 }; 740 };
739 741
740
741 class FlowGraphBuilder : public ExpressionVisitor, public StatementVisitor { 742 class FlowGraphBuilder : public ExpressionVisitor, public StatementVisitor {
742 public: 743 public:
743 FlowGraphBuilder(TreeNode* node, 744 FlowGraphBuilder(TreeNode* node,
744 ParsedFunction* parsed_function, 745 ParsedFunction* parsed_function,
745 const ZoneGrowableArray<const ICData*>& ic_data_array, 746 const ZoneGrowableArray<const ICData*>& ic_data_array,
746 InlineExitCollector* exit_collector, 747 InlineExitCollector* exit_collector,
747 intptr_t osr_id, 748 intptr_t osr_id,
748 intptr_t first_block_id = 1); 749 intptr_t first_block_id = 1);
749 virtual ~FlowGraphBuilder(); 750 virtual ~FlowGraphBuilder();
750 751
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 intptr_t next_used_try_index_; 1061 intptr_t next_used_try_index_;
1061 1062
1062 // A chained list of catch blocks. Chaining and lookup is done by the 1063 // A chained list of catch blocks. Chaining and lookup is done by the
1063 // [CatchBlock] class. 1064 // [CatchBlock] class.
1064 CatchBlock* catch_block_; 1065 CatchBlock* catch_block_;
1065 1066
1066 ActiveClass active_class_; 1067 ActiveClass active_class_;
1067 DartTypeTranslator type_translator_; 1068 DartTypeTranslator type_translator_;
1068 ConstantEvaluator constant_evaluator_; 1069 ConstantEvaluator constant_evaluator_;
1069 1070
1071 StreamingFlowGraphBuilder* streaming_flow_graph_builder_;
1072
1070 friend class BreakableBlock; 1073 friend class BreakableBlock;
1071 friend class CatchBlock; 1074 friend class CatchBlock;
1072 friend class ConstantEvaluator; 1075 friend class ConstantEvaluator;
1073 friend class DartTypeTranslator; 1076 friend class DartTypeTranslator;
1077 friend class StreamingFlowGraphBuilder;
1074 friend class ScopeBuilder; 1078 friend class ScopeBuilder;
1075 friend class SwitchBlock; 1079 friend class SwitchBlock;
1076 friend class TryCatchBlock; 1080 friend class TryCatchBlock;
1077 friend class TryFinallyBlock; 1081 friend class TryFinallyBlock;
1078 }; 1082 };
1079 1083
1084
1085 class CatchBlock {
1086 public:
1087 CatchBlock(FlowGraphBuilder* builder,
1088 LocalVariable* exception_var,
1089 LocalVariable* stack_trace_var,
1090 intptr_t catch_try_index)
1091 : builder_(builder),
1092 outer_(builder->catch_block_),
1093 exception_var_(exception_var),
1094 stack_trace_var_(stack_trace_var),
1095 catch_try_index_(catch_try_index) {
1096 builder_->catch_block_ = this;
1097 }
1098 ~CatchBlock() { builder_->catch_block_ = outer_; }
1099
1100 LocalVariable* exception_var() { return exception_var_; }
1101 LocalVariable* stack_trace_var() { return stack_trace_var_; }
1102 intptr_t catch_try_index() { return catch_try_index_; }
1103
1104 private:
1105 FlowGraphBuilder* builder_;
1106 CatchBlock* outer_;
1107 LocalVariable* exception_var_;
1108 LocalVariable* stack_trace_var_;
1109 intptr_t catch_try_index_;
1110 };
1111
1112
1080 RawObject* EvaluateMetadata(TreeNode* const kernel_node); 1113 RawObject* EvaluateMetadata(TreeNode* const kernel_node);
1081 RawObject* BuildParameterDescriptor(TreeNode* const kernel_node); 1114 RawObject* BuildParameterDescriptor(TreeNode* const kernel_node);
1082 1115
1083 1116
1084 } // namespace kernel 1117 } // namespace kernel
1085 } // namespace dart 1118 } // namespace dart
1086 1119
1087 #else // !defined(DART_PRECOMPILED_RUNTIME) 1120 #else // !defined(DART_PRECOMPILED_RUNTIME)
1088 1121
1089 #include "vm/object.h" 1122 #include "vm/object.h"
1090 #include "vm/kernel.h" 1123 #include "vm/kernel.h"
1091 1124
1092 namespace dart { 1125 namespace dart {
1093 namespace kernel { 1126 namespace kernel {
1094 1127
1095 RawObject* EvaluateMetadata(TreeNode* const kernel_node); 1128 RawObject* EvaluateMetadata(TreeNode* const kernel_node);
1096 RawObject* BuildParameterDescriptor(TreeNode* const kernel_node); 1129 RawObject* BuildParameterDescriptor(TreeNode* const kernel_node);
1097 1130
1098 } // namespace kernel 1131 } // namespace kernel
1099 } // namespace dart 1132 } // namespace dart
1100 1133
1101 #endif // !defined(DART_PRECOMPILED_RUNTIME) 1134 #endif // !defined(DART_PRECOMPILED_RUNTIME)
1102 #endif // RUNTIME_VM_KERNEL_TO_IL_H_ 1135 #endif // RUNTIME_VM_KERNEL_TO_IL_H_
OLDNEW
« no previous file with comments | « runtime/vm/kernel_binary_flowgraph.cc ('k') | runtime/vm/kernel_to_il.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698