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(Rewriter::Rewrite(&info)); | 168 CHECK(Compiler::Analyze(&info)); |
169 CHECK(Scope::Analyze(&info)); | |
170 CHECK(AstNumbering::Renumber(info.function(), info.zone())); | |
171 CHECK(Compiler::EnsureDeoptimizationSupport(&info)); | 169 CHECK(Compiler::EnsureDeoptimizationSupport(&info)); |
172 | 170 |
173 Pipeline pipeline(&info); | 171 Pipeline pipeline(&info); |
174 Handle<Code> code = pipeline.GenerateCode(); | 172 Handle<Code> code = pipeline.GenerateCode(); |
175 if (FLAG_turbo_deoptimization) { | 173 if (FLAG_turbo_deoptimization) { |
176 info.context()->native_context()->AddOptimizedCode(*code); | 174 info.context()->native_context()->AddOptimizedCode(*code); |
177 } | 175 } |
178 | 176 |
179 CHECK(!code.is_null()); | 177 CHECK(!code.is_null()); |
180 function->ReplaceCode(*code); | 178 function->ReplaceCode(*code); |
(...skipping 27 matching lines...) Expand all Loading... |
208 | 206 |
209 // Compile the given machine graph instead of the source of the function | 207 // Compile the given machine graph instead of the source of the function |
210 // and replace the JSFunction's code with the result. | 208 // and replace the JSFunction's code with the result. |
211 Handle<JSFunction> CompileGraph(Graph* graph) { | 209 Handle<JSFunction> CompileGraph(Graph* graph) { |
212 CHECK(Pipeline::SupportedTarget()); | 210 CHECK(Pipeline::SupportedTarget()); |
213 CompilationInfoWithZone info(function); | 211 CompilationInfoWithZone info(function); |
214 | 212 |
215 CHECK(Parser::Parse(&info)); | 213 CHECK(Parser::Parse(&info)); |
216 info.SetOptimizing(BailoutId::None(), | 214 info.SetOptimizing(BailoutId::None(), |
217 Handle<Code>(function->shared()->code())); | 215 Handle<Code>(function->shared()->code())); |
218 CHECK(Rewriter::Rewrite(&info)); | 216 CHECK(Compiler::Analyze(&info)); |
219 CHECK(Scope::Analyze(&info)); | |
220 CHECK(AstNumbering::Renumber(info.function(), info.zone())); | |
221 CHECK(Compiler::EnsureDeoptimizationSupport(&info)); | 217 CHECK(Compiler::EnsureDeoptimizationSupport(&info)); |
222 | 218 |
223 Pipeline pipeline(&info); | 219 Pipeline pipeline(&info); |
224 Linkage linkage(info.zone(), &info); | 220 Linkage linkage(info.zone(), &info); |
225 Handle<Code> code = pipeline.GenerateCodeForMachineGraph(&linkage, graph); | 221 Handle<Code> code = pipeline.GenerateCodeForMachineGraph(&linkage, graph); |
226 CHECK(!code.is_null()); | 222 CHECK(!code.is_null()); |
227 function->ReplaceCode(*code); | 223 function->ReplaceCode(*code); |
228 return function; | 224 return function; |
229 } | 225 } |
230 }; | 226 }; |
231 } | 227 } |
232 } | 228 } |
233 } // namespace v8::internal::compiler | 229 } // namespace v8::internal::compiler |
234 | 230 |
235 #endif // V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ | 231 #endif // V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ |
OLD | NEW |