OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ | 5 #ifndef V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ |
6 #define V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ | 6 #define V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 #include "test/cctest/cctest.h" | 9 #include "test/cctest/cctest.h" |
10 | 10 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 info.SetOptimizing(BailoutId::None(), Handle<Code>(function->code())); | 158 info.SetOptimizing(BailoutId::None(), Handle<Code>(function->code())); |
159 if (flags_ & CompilationInfo::kContextSpecializing) { | 159 if (flags_ & CompilationInfo::kContextSpecializing) { |
160 info.MarkAsContextSpecializing(); | 160 info.MarkAsContextSpecializing(); |
161 } | 161 } |
162 if (flags_ & CompilationInfo::kInliningEnabled) { | 162 if (flags_ & CompilationInfo::kInliningEnabled) { |
163 info.MarkAsInliningEnabled(); | 163 info.MarkAsInliningEnabled(); |
164 } | 164 } |
165 if (flags_ & CompilationInfo::kTypingEnabled) { | 165 if (flags_ & CompilationInfo::kTypingEnabled) { |
166 info.MarkAsTypingEnabled(); | 166 info.MarkAsTypingEnabled(); |
167 } | 167 } |
168 CHECK(Compiler::Analyze(&info)); | 168 CHECK(Rewriter::Rewrite(&info)); |
| 169 CHECK(Scope::Analyze(&info)); |
| 170 CHECK(AstNumbering::Renumber(info.function(), info.zone())); |
169 CHECK(Compiler::EnsureDeoptimizationSupport(&info)); | 171 CHECK(Compiler::EnsureDeoptimizationSupport(&info)); |
170 | 172 |
171 Pipeline pipeline(&info); | 173 Pipeline pipeline(&info); |
172 Handle<Code> code = pipeline.GenerateCode(); | 174 Handle<Code> code = pipeline.GenerateCode(); |
173 if (FLAG_turbo_deoptimization) { | 175 if (FLAG_turbo_deoptimization) { |
174 info.context()->native_context()->AddOptimizedCode(*code); | 176 info.context()->native_context()->AddOptimizedCode(*code); |
175 } | 177 } |
176 | 178 |
177 CHECK(!code.is_null()); | 179 CHECK(!code.is_null()); |
178 function->ReplaceCode(*code); | 180 function->ReplaceCode(*code); |
(...skipping 27 matching lines...) Expand all Loading... |
206 | 208 |
207 // Compile the given machine graph instead of the source of the function | 209 // Compile the given machine graph instead of the source of the function |
208 // and replace the JSFunction's code with the result. | 210 // and replace the JSFunction's code with the result. |
209 Handle<JSFunction> CompileGraph(Graph* graph) { | 211 Handle<JSFunction> CompileGraph(Graph* graph) { |
210 CHECK(Pipeline::SupportedTarget()); | 212 CHECK(Pipeline::SupportedTarget()); |
211 CompilationInfoWithZone info(function); | 213 CompilationInfoWithZone info(function); |
212 | 214 |
213 CHECK(Parser::Parse(&info)); | 215 CHECK(Parser::Parse(&info)); |
214 info.SetOptimizing(BailoutId::None(), | 216 info.SetOptimizing(BailoutId::None(), |
215 Handle<Code>(function->shared()->code())); | 217 Handle<Code>(function->shared()->code())); |
216 CHECK(Compiler::Analyze(&info)); | 218 CHECK(Rewriter::Rewrite(&info)); |
| 219 CHECK(Scope::Analyze(&info)); |
| 220 CHECK(AstNumbering::Renumber(info.function(), info.zone())); |
217 CHECK(Compiler::EnsureDeoptimizationSupport(&info)); | 221 CHECK(Compiler::EnsureDeoptimizationSupport(&info)); |
218 | 222 |
219 Pipeline pipeline(&info); | 223 Pipeline pipeline(&info); |
220 Linkage linkage(info.zone(), &info); | 224 Linkage linkage(info.zone(), &info); |
221 Handle<Code> code = pipeline.GenerateCodeForMachineGraph(&linkage, graph); | 225 Handle<Code> code = pipeline.GenerateCodeForMachineGraph(&linkage, graph); |
222 CHECK(!code.is_null()); | 226 CHECK(!code.is_null()); |
223 function->ReplaceCode(*code); | 227 function->ReplaceCode(*code); |
224 return function; | 228 return function; |
225 } | 229 } |
226 }; | 230 }; |
227 } | 231 } |
228 } | 232 } |
229 } // namespace v8::internal::compiler | 233 } // namespace v8::internal::compiler |
230 | 234 |
231 #endif // V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ | 235 #endif // V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ |
OLD | NEW |