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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 const dart::String& DartString(const char* content, Heap::Space space); | 294 const dart::String& DartString(const char* content, Heap::Space space); |
295 | 295 |
296 dart::String& DartString(String* content) { | 296 dart::String& DartString(String* content) { |
297 return DartString(content, allocation_space_); | 297 return DartString(content, allocation_space_); |
298 } | 298 } |
299 dart::String& DartString(String* content, Heap::Space space); | 299 dart::String& DartString(String* content, Heap::Space space); |
300 | 300 |
301 const dart::String& DartSymbol(const char* content) const; | 301 const dart::String& DartSymbol(const char* content) const; |
302 dart::String& DartSymbol(String* content) const; | 302 dart::String& DartSymbol(String* content) const; |
303 | 303 |
304 const dart::String& DartClassName(CanonicalName* kernel_class); | 304 const dart::String& DartClassName(CanonicalName* kernel_klass); |
| 305 const dart::String& DartConstructorName(Constructor* node); |
| 306 const dart::String& DartProcedureName(Procedure* procedure); |
305 | 307 |
306 const dart::String& DartConstructorName(CanonicalName* constructor); | 308 const dart::String& DartSetterName(Name* kernel_name); |
307 | 309 const dart::String& DartGetterName(Name* kernel_name); |
308 const dart::String& DartProcedureName(CanonicalName* procedure); | |
309 | |
310 const dart::String& DartSetterName(CanonicalName* setter); | |
311 const dart::String& DartSetterName(Name* setter_name); | |
312 | |
313 const dart::String& DartGetterName(CanonicalName* getter); | |
314 const dart::String& DartGetterName(Name* getter_name); | |
315 | |
316 const dart::String& DartFieldName(Name* kernel_name); | 310 const dart::String& DartFieldName(Name* kernel_name); |
317 | |
318 const dart::String& DartInitializerName(Name* kernel_name); | 311 const dart::String& DartInitializerName(Name* kernel_name); |
319 | 312 const dart::String& DartMethodName(Name* kernel_name); |
320 const dart::String& DartMethodName(CanonicalName* method); | 313 const dart::String& DartFactoryName(Class* klass, Name* kernel_name); |
321 const dart::String& DartMethodName(Name* method_name); | |
322 | |
323 const dart::String& DartFactoryName(CanonicalName* factory); | |
324 | 314 |
325 const Array& ArgumentNames(List<NamedExpression>* named); | 315 const Array& ArgumentNames(List<NamedExpression>* named); |
326 | 316 |
327 // A subclass overrides these when reading in the Kernel program in order to | 317 // A subclass overrides these when reading in the Kernel program in order to |
328 // support recursive type expressions (e.g. for "implements X" ... | 318 // support recursive type expressions (e.g. for "implements X" ... |
329 // annotations). | 319 // annotations). |
330 virtual RawLibrary* LookupLibraryByKernelLibrary(CanonicalName* library); | 320 virtual RawLibrary* LookupLibraryByKernelLibrary(CanonicalName* library); |
331 virtual RawClass* LookupClassByKernelClass(CanonicalName* klass); | 321 virtual RawClass* LookupClassByKernelClass(CanonicalName* klass); |
332 | 322 |
333 RawField* LookupFieldByKernelField(CanonicalName* field); | 323 RawField* LookupFieldByKernelField(Field* field); |
334 RawFunction* LookupStaticMethodByKernelProcedure(CanonicalName* procedure); | 324 RawFunction* LookupStaticMethodByKernelProcedure(Procedure* procedure); |
335 RawFunction* LookupConstructorByKernelConstructor(CanonicalName* constructor); | 325 RawFunction* LookupConstructorByKernelConstructor(Constructor* constructor); |
336 dart::RawFunction* LookupConstructorByKernelConstructor( | 326 dart::RawFunction* LookupConstructorByKernelConstructor( |
337 const dart::Class& owner, | 327 const dart::Class& owner, |
338 CanonicalName* constructor); | 328 Constructor* constructor); |
339 | 329 |
340 dart::Type& GetCanonicalType(const dart::Class& klass); | 330 dart::Type& GetCanonicalType(const dart::Class& klass); |
341 | 331 |
342 void ReportError(const char* format, ...); | 332 void ReportError(const char* format, ...); |
343 void ReportError(const Error& prev_error, const char* format, ...); | 333 void ReportError(const Error& prev_error, const char* format, ...); |
344 | 334 |
345 private: | 335 private: |
346 // This will mangle [name_to_modify] if necessary and make the result a symbol | 336 // This will mangle [kernel_name] (if necessary) and make the result a symbol. |
347 // if asked. The result will be avilable in [name_to_modify] and it is also | 337 // The result will be avilable in [name_to_modify] and it is also returned. |
348 // returned. If the name is private, the canonical name [parent] will be used | 338 dart::String& ManglePrivateName(CanonicalName* kernel_library, |
349 // to get the import URI of the library where the name is visible. | |
350 dart::String& ManglePrivateName(CanonicalName* parent, | |
351 dart::String* name_to_modify, | 339 dart::String* name_to_modify, |
352 bool symbolize = true); | 340 bool symbolize = true); |
353 | 341 |
354 const dart::String& DartSetterName(CanonicalName* parent, String* setter); | |
355 const dart::String& DartGetterName(CanonicalName* parent, String* getter); | |
356 const dart::String& DartMethodName(CanonicalName* parent, String* method); | |
357 | |
358 dart::Thread* thread_; | 342 dart::Thread* thread_; |
359 dart::Zone* zone_; | 343 dart::Zone* zone_; |
360 dart::Isolate* isolate_; | 344 dart::Isolate* isolate_; |
361 Heap::Space allocation_space_; | 345 Heap::Space allocation_space_; |
362 }; | 346 }; |
363 | 347 |
364 // Regarding malformed types: | 348 // Regarding malformed types: |
365 // The spec says in section "19.1 Static Types" roughly: | 349 // The spec says in section "19.1 Static Types" roughly: |
366 // | 350 // |
367 // A type T is malformed iff: | 351 // A type T is malformed iff: |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 | 810 |
827 void SetupDefaultParameterValues(FunctionNode* function); | 811 void SetupDefaultParameterValues(FunctionNode* function); |
828 | 812 |
829 TargetEntryInstr* BuildTargetEntry(); | 813 TargetEntryInstr* BuildTargetEntry(); |
830 JoinEntryInstr* BuildJoinEntry(); | 814 JoinEntryInstr* BuildJoinEntry(); |
831 JoinEntryInstr* BuildJoinEntry(intptr_t try_index); | 815 JoinEntryInstr* BuildJoinEntry(intptr_t try_index); |
832 | 816 |
833 Fragment TranslateArguments(Arguments* node, Array* argument_names); | 817 Fragment TranslateArguments(Arguments* node, Array* argument_names); |
834 ArgumentArray GetArguments(int count); | 818 ArgumentArray GetArguments(int count); |
835 | 819 |
836 Fragment TranslateInitializers(Class* kernel_class, | 820 Fragment TranslateInitializers(Class* kernel_klass, |
837 List<Initializer>* initialiers); | 821 List<Initializer>* initialiers); |
838 | 822 |
839 Fragment TranslateStatement(Statement* statement); | 823 Fragment TranslateStatement(Statement* statement); |
840 Fragment TranslateCondition(Expression* expression, bool* negate); | 824 Fragment TranslateCondition(Expression* expression, bool* negate); |
841 Fragment TranslateExpression(Expression* expression); | 825 Fragment TranslateExpression(Expression* expression); |
842 | 826 |
843 Fragment TranslateFinallyFinalizers(TryFinallyBlock* outer_finally, | 827 Fragment TranslateFinallyFinalizers(TryFinallyBlock* outer_finally, |
844 intptr_t target_context_depth); | 828 intptr_t target_context_depth); |
845 | 829 |
846 Fragment TranslateFunctionNode(FunctionNode* node, TreeNode* parent); | 830 Fragment TranslateFunctionNode(FunctionNode* node, TreeNode* parent); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
953 const dart::String& dst_name); | 937 const dart::String& dst_name); |
954 | 938 |
955 Fragment AssertBool(); | 939 Fragment AssertBool(); |
956 Fragment AssertAssignable(const dart::AbstractType& dst_type, | 940 Fragment AssertAssignable(const dart::AbstractType& dst_type, |
957 const dart::String& dst_name); | 941 const dart::String& dst_name); |
958 | 942 |
959 bool NeedsDebugStepCheck(const Function& function, TokenPosition position); | 943 bool NeedsDebugStepCheck(const Function& function, TokenPosition position); |
960 bool NeedsDebugStepCheck(Value* value, TokenPosition position); | 944 bool NeedsDebugStepCheck(Value* value, TokenPosition position); |
961 Fragment DebugStepCheck(TokenPosition position); | 945 Fragment DebugStepCheck(TokenPosition position); |
962 | 946 |
963 dart::RawFunction* LookupMethodByMember(CanonicalName* target, | 947 dart::RawFunction* LookupMethodByMember(Member* target, |
964 const dart::String& method_name); | 948 const dart::String& method_name); |
965 | 949 |
966 LocalVariable* MakeTemporary(); | 950 LocalVariable* MakeTemporary(); |
967 LocalVariable* MakeNonTemporary(const dart::String& symbol); | 951 LocalVariable* MakeNonTemporary(const dart::String& symbol); |
968 | 952 |
969 intptr_t CurrentTryIndex(); | 953 intptr_t CurrentTryIndex(); |
970 intptr_t AllocateTryIndex() { return next_used_try_index_++; } | 954 intptr_t AllocateTryIndex() { return next_used_try_index_++; } |
971 | 955 |
972 void AddVariable(VariableDeclaration* declaration, LocalVariable* variable); | 956 void AddVariable(VariableDeclaration* declaration, LocalVariable* variable); |
973 void AddParameter(VariableDeclaration* declaration, | 957 void AddParameter(VariableDeclaration* declaration, |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1093 namespace kernel { | 1077 namespace kernel { |
1094 | 1078 |
1095 RawObject* EvaluateMetadata(TreeNode* const kernel_node); | 1079 RawObject* EvaluateMetadata(TreeNode* const kernel_node); |
1096 RawObject* BuildParameterDescriptor(TreeNode* const kernel_node); | 1080 RawObject* BuildParameterDescriptor(TreeNode* const kernel_node); |
1097 | 1081 |
1098 } // namespace kernel | 1082 } // namespace kernel |
1099 } // namespace dart | 1083 } // namespace dart |
1100 | 1084 |
1101 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 1085 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
1102 #endif // RUNTIME_VM_KERNEL_TO_IL_H_ | 1086 #endif // RUNTIME_VM_KERNEL_TO_IL_H_ |
OLD | NEW |