| 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 FlowGraph; |
| 16 class Function; | 17 class Function; |
| 17 class Library; | 18 class Library; |
| 18 class ParsedFunction; | 19 class ParsedFunction; |
| 19 class RawInstance; | 20 class RawInstance; |
| 20 class Script; | 21 class Script; |
| 21 class SequenceNode; | 22 class SequenceNode; |
| 22 | 23 |
| 23 DECLARE_RUNTIME_ENTRY(CompileFunction); | 24 DECLARE_RUNTIME_ENTRY(CompileFunction); |
| 24 | 25 |
| 25 class Compiler : public AllStatic { | 26 class Compiler : public AllStatic { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 48 Isolate* isolate, | 49 Isolate* isolate, |
| 49 const Function& function, | 50 const Function& function, |
| 50 intptr_t osr_id = Isolate::kNoDeoptId); | 51 intptr_t osr_id = Isolate::kNoDeoptId); |
| 51 | 52 |
| 52 // Generates code for given parsed function (without parsing it again) and | 53 // Generates code for given parsed function (without parsing it again) and |
| 53 // sets its code field. | 54 // sets its code field. |
| 54 // | 55 // |
| 55 // Returns Error::null() if there is no compilation error. | 56 // Returns Error::null() if there is no compilation error. |
| 56 static RawError* CompileParsedFunction(ParsedFunction* parsed_function); | 57 static RawError* CompileParsedFunction(ParsedFunction* parsed_function); |
| 57 | 58 |
| 59 static RawError* CompileIrregexpFunction(ParsedFunction* parsed_function, |
| 60 FlowGraph* flow_graph); |
| 61 |
| 58 // Generates and executes code for a given code fragment, e.g. a | 62 // Generates and executes code for a given code fragment, e.g. a |
| 59 // compile time constant expression. Returns the result returned | 63 // compile time constant expression. Returns the result returned |
| 60 // by the fragment. | 64 // by the fragment. |
| 61 // | 65 // |
| 62 // The return value is either a RawInstance on success or a RawError | 66 // The return value is either a RawInstance on success or a RawError |
| 63 // on compilation failure. | 67 // on compilation failure. |
| 64 static RawObject* ExecuteOnce(SequenceNode* fragment); | 68 static RawObject* ExecuteOnce(SequenceNode* fragment); |
| 65 | 69 |
| 66 // Evaluates the initializer expression of the given static field. | 70 // Evaluates the initializer expression of the given static field. |
| 67 // | 71 // |
| 68 // The return value is either a RawInstance on success or a RawError | 72 // The return value is either a RawInstance on success or a RawError |
| 69 // on compilation failure. | 73 // on compilation failure. |
| 70 static RawObject* EvaluateStaticInitializer(const Field& field); | 74 static RawObject* EvaluateStaticInitializer(const Field& field); |
| 71 | 75 |
| 72 // Eagerly compiles all functions in a class. | 76 // Eagerly compiles all functions in a class. |
| 73 // | 77 // |
| 74 // Returns Error::null() if there is no compilation error. | 78 // Returns Error::null() if there is no compilation error. |
| 75 static RawError* CompileAllFunctions(const Class& cls); | 79 static RawError* CompileAllFunctions(const Class& cls); |
| 76 }; | 80 }; |
| 77 | 81 |
| 78 } // namespace dart | 82 } // namespace dart |
| 79 | 83 |
| 80 #endif // VM_COMPILER_H_ | 84 #endif // VM_COMPILER_H_ |
| OLD | NEW |