OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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_BINARY_FLOWGRAPH_H_ | 5 #ifndef RUNTIME_VM_KERNEL_BINARY_FLOWGRAPH_H_ |
6 #define RUNTIME_VM_KERNEL_BINARY_FLOWGRAPH_H_ | 6 #define RUNTIME_VM_KERNEL_BINARY_FLOWGRAPH_H_ |
7 | 7 |
8 #if !defined(DART_PRECOMPILED_RUNTIME) | 8 #if !defined(DART_PRECOMPILED_RUNTIME) |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 | 11 |
12 #include "vm/kernel.h" | 12 #include "vm/kernel.h" |
13 #include "vm/kernel_binary.h" | 13 #include "vm/kernel_binary.h" |
14 #include "vm/kernel_to_il.h" | 14 #include "vm/kernel_to_il.h" |
15 #include "vm/object.h" | 15 #include "vm/object.h" |
16 | 16 |
17 namespace dart { | 17 namespace dart { |
18 namespace kernel { | 18 namespace kernel { |
19 | 19 |
20 class StreamingConstantEvaluator { | 20 class StreamingConstantEvaluator { |
21 public: | 21 public: |
22 StreamingConstantEvaluator(StreamingFlowGraphBuilder* builder, | 22 StreamingConstantEvaluator(StreamingFlowGraphBuilder* builder, |
23 Zone* zone, | 23 Zone* zone, |
24 TranslationHelper* h, | 24 TranslationHelper* h, |
25 DartTypeTranslator* type_translator); | 25 DartTypeTranslator* type_translator); |
26 | 26 |
27 virtual ~StreamingConstantEvaluator() {} | 27 virtual ~StreamingConstantEvaluator() {} |
28 | 28 |
29 Instance& EvaluateExpression(); | 29 Instance& EvaluateExpression(); |
| 30 |
| 31 void EvaluateSymbolLiteral(); |
30 void EvaluateDoubleLiteral(); | 32 void EvaluateDoubleLiteral(); |
31 | 33 |
32 private: | 34 private: |
| 35 RawObject* EvaluateConstConstructorCall(const dart::Class& type_class, |
| 36 const TypeArguments& type_arguments, |
| 37 const Function& constructor, |
| 38 const Object& argument); |
| 39 |
33 bool GetCachedConstant(intptr_t kernel_offset, Instance* value); | 40 bool GetCachedConstant(intptr_t kernel_offset, Instance* value); |
34 void CacheConstantValue(intptr_t kernel_offset, const Instance& value); | 41 void CacheConstantValue(intptr_t kernel_offset, const Instance& value); |
35 | 42 |
36 StreamingFlowGraphBuilder* builder_; | 43 StreamingFlowGraphBuilder* builder_; |
37 Isolate* isolate_; | 44 Isolate* isolate_; |
38 Zone* zone_; | 45 Zone* zone_; |
39 TranslationHelper& translation_helper_; | 46 TranslationHelper& translation_helper_; |
40 // DartTypeTranslator& type_translator_; | 47 // DartTypeTranslator& type_translator_; |
41 | 48 |
42 Script& script_; | 49 Script& script_; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 96 |
90 Fragment DebugStepCheck(TokenPosition position); | 97 Fragment DebugStepCheck(TokenPosition position); |
91 Fragment LoadLocal(LocalVariable* variable); | 98 Fragment LoadLocal(LocalVariable* variable); |
92 Fragment PushArgument(); | 99 Fragment PushArgument(); |
93 Fragment RethrowException(TokenPosition position, int catch_try_index); | 100 Fragment RethrowException(TokenPosition position, int catch_try_index); |
94 Fragment ThrowNoSuchMethodError(); | 101 Fragment ThrowNoSuchMethodError(); |
95 Fragment Constant(const Object& value); | 102 Fragment Constant(const Object& value); |
96 Fragment IntConstant(int64_t value); | 103 Fragment IntConstant(int64_t value); |
97 | 104 |
98 Fragment BuildInvalidExpression(); | 105 Fragment BuildInvalidExpression(); |
| 106 Fragment BuildSymbolLiteral(); |
99 Fragment BuildThisExpression(); | 107 Fragment BuildThisExpression(); |
100 Fragment BuildRethrow(); | 108 Fragment BuildRethrow(); |
| 109 Fragment BuildBigIntLiteral(); |
101 Fragment BuildStringLiteral(); | 110 Fragment BuildStringLiteral(); |
102 Fragment BuildIntLiteral(uint8_t payload); | 111 Fragment BuildIntLiteral(uint8_t payload); |
103 Fragment BuildIntLiteral(bool is_negative); | 112 Fragment BuildIntLiteral(bool is_negative); |
104 Fragment BuildDoubleLiteral(); | 113 Fragment BuildDoubleLiteral(); |
105 Fragment BuildBoolLiteral(bool value); | 114 Fragment BuildBoolLiteral(bool value); |
106 Fragment BuildNullLiteral(); | 115 Fragment BuildNullLiteral(); |
107 | 116 |
108 FlowGraphBuilder* flow_graph_builder_; | 117 FlowGraphBuilder* flow_graph_builder_; |
109 TranslationHelper& translation_helper_; | 118 TranslationHelper& translation_helper_; |
110 Zone* zone_; | 119 Zone* zone_; |
111 kernel::Reader* reader_; | 120 kernel::Reader* reader_; |
112 StreamingConstantEvaluator constant_evaluator_; | 121 StreamingConstantEvaluator constant_evaluator_; |
113 intptr_t* string_table_offsets_; | 122 intptr_t* string_table_offsets_; |
114 intptr_t string_table_size_; | 123 intptr_t string_table_size_; |
115 intptr_t string_table_entries_read_; | 124 intptr_t string_table_entries_read_; |
116 | 125 |
117 friend class StreamingConstantEvaluator; | 126 friend class StreamingConstantEvaluator; |
118 }; | 127 }; |
119 | 128 |
120 } // namespace kernel | 129 } // namespace kernel |
121 } // namespace dart | 130 } // namespace dart |
122 | 131 |
123 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 132 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
124 #endif // RUNTIME_VM_KERNEL_BINARY_FLOWGRAPH_H_ | 133 #endif // RUNTIME_VM_KERNEL_BINARY_FLOWGRAPH_H_ |
OLD | NEW |