| 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> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 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 | 30 |
| 31 void EvaluateStaticGet(); |
| 31 void EvaluateSymbolLiteral(); | 32 void EvaluateSymbolLiteral(); |
| 32 void EvaluateDoubleLiteral(); | 33 void EvaluateDoubleLiteral(); |
| 33 | 34 |
| 34 private: | 35 private: |
| 35 RawObject* EvaluateConstConstructorCall(const dart::Class& type_class, | 36 RawObject* EvaluateConstConstructorCall(const dart::Class& type_class, |
| 36 const TypeArguments& type_arguments, | 37 const TypeArguments& type_arguments, |
| 37 const Function& constructor, | 38 const Function& constructor, |
| 38 const Object& argument); | 39 const Object& argument); |
| 39 | 40 |
| 40 bool GetCachedConstant(intptr_t kernel_offset, Instance* value); | 41 bool GetCachedConstant(intptr_t kernel_offset, Instance* value); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 58 : flow_graph_builder_(flow_graph_builder), | 59 : flow_graph_builder_(flow_graph_builder), |
| 59 translation_helper_(flow_graph_builder->translation_helper_), | 60 translation_helper_(flow_graph_builder->translation_helper_), |
| 60 zone_(flow_graph_builder->zone_), | 61 zone_(flow_graph_builder->zone_), |
| 61 reader_(new kernel::Reader(buffer, buffer_length)), | 62 reader_(new kernel::Reader(buffer, buffer_length)), |
| 62 constant_evaluator_(this, | 63 constant_evaluator_(this, |
| 63 flow_graph_builder->zone_, | 64 flow_graph_builder->zone_, |
| 64 &flow_graph_builder->translation_helper_, | 65 &flow_graph_builder->translation_helper_, |
| 65 &flow_graph_builder->type_translator_), | 66 &flow_graph_builder->type_translator_), |
| 66 string_table_offsets_(NULL), | 67 string_table_offsets_(NULL), |
| 67 string_table_size_(-1), | 68 string_table_size_(-1), |
| 68 string_table_entries_read_(0) {} | 69 string_table_entries_read_(0), |
| 70 canonical_names_(NULL), |
| 71 canonical_names_size_(-1), |
| 72 canonical_names_entries_read_(0), |
| 73 canonical_names_next_offset_(-1) {} |
| 69 | 74 |
| 70 virtual ~StreamingFlowGraphBuilder() { | 75 virtual ~StreamingFlowGraphBuilder() { |
| 71 delete reader_; | 76 delete reader_; |
| 72 if (string_table_offsets_ != NULL) { | 77 if (string_table_offsets_ != NULL) { |
| 73 delete[] string_table_offsets_; | 78 delete[] string_table_offsets_; |
| 74 } | 79 } |
| 80 if (canonical_names_ != NULL) { |
| 81 // At least for now we'll leak whatever's inside |
| 82 delete[] canonical_names_; |
| 83 } |
| 75 } | 84 } |
| 76 | 85 |
| 77 Fragment BuildAt(intptr_t kernel_offset); | 86 Fragment BuildAt(intptr_t kernel_offset); |
| 78 | 87 |
| 79 private: | 88 private: |
| 80 intptr_t GetStringTableOffset(intptr_t index); | 89 intptr_t GetStringTableOffset(intptr_t index); |
| 90 CanonicalName* GetCanonicalName(intptr_t index); |
| 81 | 91 |
| 82 intptr_t ReaderOffset(); | 92 intptr_t ReaderOffset(); |
| 83 void SetOffset(intptr_t offset); | 93 void SetOffset(intptr_t offset); |
| 84 void SkipBytes(intptr_t skip); | 94 void SkipBytes(intptr_t skip); |
| 85 uint32_t ReadUInt(); | 95 uint32_t ReadUInt(); |
| 86 intptr_t ReadListLength(); | 96 intptr_t ReadListLength(); |
| 87 TokenPosition ReadPosition(bool record = true); | 97 TokenPosition ReadPosition(bool record = true); |
| 88 Tag ReadTag(uint8_t* payload = NULL); | 98 Tag ReadTag(uint8_t* payload = NULL); |
| 89 | 99 |
| 90 CatchBlock* catch_block(); | 100 CatchBlock* catch_block(); |
| 91 ScopeBuildingResult* scopes(); | 101 ScopeBuildingResult* scopes(); |
| 92 ParsedFunction* parsed_function(); | 102 ParsedFunction* parsed_function(); |
| 93 | 103 |
| 94 dart::String& DartSymbol(intptr_t str_index); | 104 dart::String& DartSymbol(intptr_t str_index); |
| 95 dart::String& DartString(intptr_t str_index); | 105 dart::String& DartString(intptr_t str_index); |
| 106 String* KernelString(intptr_t str_index); |
| 96 | 107 |
| 97 Fragment DebugStepCheck(TokenPosition position); | 108 Fragment DebugStepCheck(TokenPosition position); |
| 98 Fragment LoadLocal(LocalVariable* variable); | 109 Fragment LoadLocal(LocalVariable* variable); |
| 99 Fragment PushArgument(); | 110 Fragment PushArgument(); |
| 100 Fragment RethrowException(TokenPosition position, int catch_try_index); | 111 Fragment RethrowException(TokenPosition position, int catch_try_index); |
| 101 Fragment ThrowNoSuchMethodError(); | 112 Fragment ThrowNoSuchMethodError(); |
| 102 Fragment Constant(const Object& value); | 113 Fragment Constant(const Object& value); |
| 103 Fragment IntConstant(int64_t value); | 114 Fragment IntConstant(int64_t value); |
| 115 Fragment LoadStaticField(); |
| 116 Fragment StaticCall(TokenPosition position, |
| 117 const Function& target, |
| 118 intptr_t argument_count); |
| 104 | 119 |
| 105 Fragment BuildInvalidExpression(); | 120 Fragment BuildInvalidExpression(); |
| 121 Fragment BuildStaticGet(); |
| 106 Fragment BuildSymbolLiteral(); | 122 Fragment BuildSymbolLiteral(); |
| 107 Fragment BuildThisExpression(); | 123 Fragment BuildThisExpression(); |
| 108 Fragment BuildRethrow(); | 124 Fragment BuildRethrow(); |
| 109 Fragment BuildBigIntLiteral(); | 125 Fragment BuildBigIntLiteral(); |
| 110 Fragment BuildStringLiteral(); | 126 Fragment BuildStringLiteral(); |
| 111 Fragment BuildIntLiteral(uint8_t payload); | 127 Fragment BuildIntLiteral(uint8_t payload); |
| 112 Fragment BuildIntLiteral(bool is_negative); | 128 Fragment BuildIntLiteral(bool is_negative); |
| 113 Fragment BuildDoubleLiteral(); | 129 Fragment BuildDoubleLiteral(); |
| 114 Fragment BuildBoolLiteral(bool value); | 130 Fragment BuildBoolLiteral(bool value); |
| 115 Fragment BuildNullLiteral(); | 131 Fragment BuildNullLiteral(); |
| 116 | 132 |
| 117 FlowGraphBuilder* flow_graph_builder_; | 133 FlowGraphBuilder* flow_graph_builder_; |
| 118 TranslationHelper& translation_helper_; | 134 TranslationHelper& translation_helper_; |
| 119 Zone* zone_; | 135 Zone* zone_; |
| 120 kernel::Reader* reader_; | 136 kernel::Reader* reader_; |
| 121 StreamingConstantEvaluator constant_evaluator_; | 137 StreamingConstantEvaluator constant_evaluator_; |
| 122 intptr_t* string_table_offsets_; | 138 intptr_t* string_table_offsets_; |
| 123 intptr_t string_table_size_; | 139 intptr_t string_table_size_; |
| 124 intptr_t string_table_entries_read_; | 140 intptr_t string_table_entries_read_; |
| 141 CanonicalName** canonical_names_; |
| 142 intptr_t canonical_names_size_; |
| 143 intptr_t canonical_names_entries_read_; |
| 144 intptr_t canonical_names_next_offset_; |
| 125 | 145 |
| 126 friend class StreamingConstantEvaluator; | 146 friend class StreamingConstantEvaluator; |
| 127 }; | 147 }; |
| 128 | 148 |
| 129 } // namespace kernel | 149 } // namespace kernel |
| 130 } // namespace dart | 150 } // namespace dart |
| 131 | 151 |
| 132 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 152 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| 133 #endif // RUNTIME_VM_KERNEL_BINARY_FLOWGRAPH_H_ | 153 #endif // RUNTIME_VM_KERNEL_BINARY_FLOWGRAPH_H_ |
| OLD | NEW |