OLD | NEW |
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" |
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 | 779 |
780 YieldContinuation() | 780 YieldContinuation() |
781 : entry(NULL), try_index(CatchClauseNode::kInvalidTryIndex) {} | 781 : entry(NULL), try_index(CatchClauseNode::kInvalidTryIndex) {} |
782 }; | 782 }; |
783 | 783 |
784 class FlowGraphBuilder : public ExpressionVisitor, public StatementVisitor { | 784 class FlowGraphBuilder : public ExpressionVisitor, public StatementVisitor { |
785 public: | 785 public: |
786 FlowGraphBuilder(TreeNode* node, | 786 FlowGraphBuilder(TreeNode* node, |
787 ParsedFunction* parsed_function, | 787 ParsedFunction* parsed_function, |
788 const ZoneGrowableArray<const ICData*>& ic_data_array, | 788 const ZoneGrowableArray<const ICData*>& ic_data_array, |
| 789 ZoneGrowableArray<intptr_t>* context_level_array, |
789 InlineExitCollector* exit_collector, | 790 InlineExitCollector* exit_collector, |
790 intptr_t osr_id, | 791 intptr_t osr_id, |
791 intptr_t first_block_id = 1); | 792 intptr_t first_block_id = 1); |
792 virtual ~FlowGraphBuilder(); | 793 virtual ~FlowGraphBuilder(); |
793 | 794 |
794 FlowGraph* BuildGraph(); | 795 FlowGraph* BuildGraph(); |
795 | 796 |
796 virtual void VisitDefaultExpression(Expression* node) { UNREACHABLE(); } | 797 virtual void VisitDefaultExpression(Expression* node) { UNREACHABLE(); } |
797 virtual void VisitDefaultStatement(Statement* node) { UNREACHABLE(); } | 798 virtual void VisitDefaultStatement(Statement* node) { UNREACHABLE(); } |
798 | 799 |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1045 Thread* thread_; | 1046 Thread* thread_; |
1046 Zone* zone_; | 1047 Zone* zone_; |
1047 | 1048 |
1048 // The node we are currently compiling (e.g. FunctionNode, Constructor, | 1049 // The node we are currently compiling (e.g. FunctionNode, Constructor, |
1049 // Field) | 1050 // Field) |
1050 TreeNode* node_; | 1051 TreeNode* node_; |
1051 | 1052 |
1052 ParsedFunction* parsed_function_; | 1053 ParsedFunction* parsed_function_; |
1053 intptr_t osr_id_; | 1054 intptr_t osr_id_; |
1054 const ZoneGrowableArray<const ICData*>& ic_data_array_; | 1055 const ZoneGrowableArray<const ICData*>& ic_data_array_; |
| 1056 // Contains (deopt_id, context_level) pairs. |
| 1057 ZoneGrowableArray<intptr_t>* context_level_array_; |
1055 InlineExitCollector* exit_collector_; | 1058 InlineExitCollector* exit_collector_; |
1056 | 1059 |
1057 intptr_t next_block_id_; | 1060 intptr_t next_block_id_; |
1058 intptr_t AllocateBlockId() { return next_block_id_++; } | 1061 intptr_t AllocateBlockId() { return next_block_id_++; } |
1059 | 1062 |
1060 intptr_t GetNextDeoptId() { | 1063 intptr_t GetNextDeoptId() { |
1061 // TODO(rmacnak): Record current scope / context level. | 1064 intptr_t deopt_id = thread_->GetNextDeoptId(); |
1062 return thread_->GetNextDeoptId(); | 1065 if (context_level_array_ != NULL) { |
| 1066 intptr_t level = context_depth_; |
| 1067 context_level_array_->Add(deopt_id); |
| 1068 context_level_array_->Add(level); |
| 1069 } |
| 1070 return deopt_id; |
1063 } | 1071 } |
1064 | 1072 |
1065 intptr_t next_function_id_; | 1073 intptr_t next_function_id_; |
1066 intptr_t AllocateFunctionId() { return next_function_id_++; } | 1074 intptr_t AllocateFunctionId() { return next_function_id_++; } |
1067 | 1075 |
1068 intptr_t context_depth_; | 1076 intptr_t context_depth_; |
1069 intptr_t loop_depth_; | 1077 intptr_t loop_depth_; |
1070 intptr_t try_depth_; | 1078 intptr_t try_depth_; |
1071 intptr_t catch_depth_; | 1079 intptr_t catch_depth_; |
1072 intptr_t for_in_depth_; | 1080 intptr_t for_in_depth_; |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1367 namespace kernel { | 1375 namespace kernel { |
1368 | 1376 |
1369 RawObject* EvaluateMetadata(const dart::Field& metadata_field); | 1377 RawObject* EvaluateMetadata(const dart::Field& metadata_field); |
1370 RawObject* BuildParameterDescriptor(const Function& function); | 1378 RawObject* BuildParameterDescriptor(const Function& function); |
1371 | 1379 |
1372 } // namespace kernel | 1380 } // namespace kernel |
1373 } // namespace dart | 1381 } // namespace dart |
1374 | 1382 |
1375 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 1383 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
1376 #endif // RUNTIME_VM_KERNEL_TO_IL_H_ | 1384 #endif // RUNTIME_VM_KERNEL_TO_IL_H_ |
OLD | NEW |