| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 VM_COMPILER_H_ | 5 #ifndef VM_COMPILER_H_ |
| 6 #define VM_COMPILER_H_ | 6 #define VM_COMPILER_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/growable_array.h" | 9 #include "vm/growable_array.h" |
| 10 #include "vm/runtime_entry.h" | 10 #include "vm/runtime_entry.h" |
| 11 | 11 |
| 12 namespace dart { | 12 namespace dart { |
| 13 | 13 |
| 14 // Forward declarations. | 14 // Forward declarations. |
| 15 class Class; | 15 class Class; |
| 16 class Function; | 16 class Function; |
| 17 class Library; | 17 class Library; |
| 18 class ParsedFunction; | 18 class ParsedFunction; |
| 19 class RawInstance; | 19 class RawInstance; |
| 20 class Script; | 20 class Script; |
| 21 class SequenceNode; | 21 class SequenceNode; |
| 22 | 22 |
| 23 DECLARE_RUNTIME_ENTRY(CompileFunction); | 23 DECLARE_RUNTIME_ENTRY(CompileFunction); |
| 24 | 24 |
| 25 class Compiler : public AllStatic { | 25 class Compiler : public AllStatic { |
| 26 public: | 26 public: |
| 27 // Extracts class, interface, function symbols from the script and populates | 27 // Extracts top level entities from the script and populates |
| 28 // the symbol tables and the class dictionary of the library. | 28 // the class dictionary of the library. |
| 29 // | 29 // |
| 30 // Returns Error::null() if there is no compilation error. | 30 // Returns Error::null() if there is no compilation error. |
| 31 static RawError* Compile(const Library& library, const Script& script); | 31 static RawError* Compile(const Library& library, const Script& script); |
| 32 | 32 |
| 33 // Extracts function and field symbols from the class and populates |
| 34 // the class. |
| 35 // |
| 36 // Returns Error::null() if there is no compilation error. |
| 37 static RawError* CompileClass(const Class& cls); |
| 38 |
| 33 // Generates code for given function and sets its code field. | 39 // Generates code for given function and sets its code field. |
| 34 // | 40 // |
| 35 // Returns Error::null() if there is no compilation error. | 41 // Returns Error::null() if there is no compilation error. |
| 36 static RawError* CompileFunction(const Function& function); | 42 static RawError* CompileFunction(const Function& function); |
| 37 | 43 |
| 38 // Generates optimized code for function. | 44 // Generates optimized code for function. |
| 39 // | 45 // |
| 40 // Returns Error::null() if there is no compilation error. | 46 // Returns Error::null() if there is no compilation error. |
| 41 static RawError* CompileOptimizedFunction(const Function& function); | 47 static RawError* CompileOptimizedFunction(const Function& function); |
| 42 | 48 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 56 | 62 |
| 57 // Eagerly compiles all functions in a class. | 63 // Eagerly compiles all functions in a class. |
| 58 // | 64 // |
| 59 // Returns Error::null() if there is no compilation error. | 65 // Returns Error::null() if there is no compilation error. |
| 60 static RawError* CompileAllFunctions(const Class& cls); | 66 static RawError* CompileAllFunctions(const Class& cls); |
| 61 }; | 67 }; |
| 62 | 68 |
| 63 } // namespace dart | 69 } // namespace dart |
| 64 | 70 |
| 65 #endif // VM_COMPILER_H_ | 71 #endif // VM_COMPILER_H_ |
| OLD | NEW |