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 RUNTIME_VM_COMPILER_H_ | 5 #ifndef RUNTIME_VM_COMPILER_H_ |
6 #define RUNTIME_VM_COMPILER_H_ | 6 #define RUNTIME_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" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 // | 90 // |
91 // Returns Error::null() if there is no compilation error. | 91 // Returns Error::null() if there is no compilation error. |
92 static RawError* Compile(const Library& library, const Script& script); | 92 static RawError* Compile(const Library& library, const Script& script); |
93 | 93 |
94 // Extracts function and field symbols from the class and populates | 94 // Extracts function and field symbols from the class and populates |
95 // the class. | 95 // the class. |
96 // | 96 // |
97 // Returns Error::null() if there is no compilation error. | 97 // Returns Error::null() if there is no compilation error. |
98 static RawError* CompileClass(const Class& cls); | 98 static RawError* CompileClass(const Class& cls); |
99 | 99 |
100 // Generates code for given function and sets its code field. | 100 // Generates code for given function without optimization and sets its code |
| 101 // field. |
101 // | 102 // |
| 103 // Returns the raw code object if compilation succeeds. Otherwise returns a |
| 104 // RawError. Also installs the generated code on the function. |
| 105 static RawObject* CompileFunction(Thread* thread, const Function& function); |
102 // Returns Error::null() if there is no compilation error. | 106 // Returns Error::null() if there is no compilation error. |
103 static RawError* CompileFunction(Thread* thread, const Function& function); | |
104 static RawError* ParseFunction(Thread* thread, const Function& function); | 107 static RawError* ParseFunction(Thread* thread, const Function& function); |
105 | 108 |
106 // Generates unoptimized code if not present, current code is unchanged. | 109 // Generates unoptimized code if not present, current code is unchanged. |
107 static RawError* EnsureUnoptimizedCode(Thread* thread, | 110 static RawError* EnsureUnoptimizedCode(Thread* thread, |
108 const Function& function); | 111 const Function& function); |
109 | 112 |
110 // Generates optimized code for function. | 113 // Generates optimized code for function. |
111 // | 114 // |
112 // Returns Error::null() if there is no compilation error. | 115 // Returns the code object if compilation succeeds. Returns an Error if |
113 // If 'result_code' is not NULL, then the generated code is returned but | 116 // there is a compilation error. If optimization fails, but there is no |
114 // not installed. | 117 // error, returns null. Any generated code is installed unless we are in |
115 static RawError* CompileOptimizedFunction(Thread* thread, | 118 // OSR mode. |
116 const Function& function, | 119 static RawObject* CompileOptimizedFunction(Thread* thread, |
117 intptr_t osr_id = kNoOSRDeoptId); | 120 const Function& function, |
| 121 intptr_t osr_id = kNoOSRDeoptId); |
118 | 122 |
119 // Generates code for given parsed function (without parsing it again) and | 123 // Generates code for given parsed function (without parsing it again) and |
120 // sets its code field. | 124 // sets its code field. |
121 // | 125 // |
122 // Returns Error::null() if there is no compilation error. | 126 // Returns Error::null() if there is no compilation error. |
123 static RawError* CompileParsedFunction(ParsedFunction* parsed_function); | 127 static RawError* CompileParsedFunction(ParsedFunction* parsed_function); |
124 | 128 |
125 // Generates and executes code for a given code fragment, e.g. a | 129 // Generates and executes code for a given code fragment, e.g. a |
126 // compile time constant expression. Returns the result returned | 130 // compile time constant expression. Returns the result returned |
127 // by the fragment. | 131 // by the fragment. |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 Monitor* done_monitor_; // Notify/wait that the thread is done. | 199 Monitor* done_monitor_; // Notify/wait that the thread is done. |
196 | 200 |
197 BackgroundCompilationQueue* function_queue_; | 201 BackgroundCompilationQueue* function_queue_; |
198 | 202 |
199 DISALLOW_IMPLICIT_CONSTRUCTORS(BackgroundCompiler); | 203 DISALLOW_IMPLICIT_CONSTRUCTORS(BackgroundCompiler); |
200 }; | 204 }; |
201 | 205 |
202 } // namespace dart | 206 } // namespace dart |
203 | 207 |
204 #endif // RUNTIME_VM_COMPILER_H_ | 208 #endif // RUNTIME_VM_COMPILER_H_ |
OLD | NEW |