| 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 |
| 11 #include "src/ast-numbering.h" | |
| 12 #include "src/compiler.h" | 11 #include "src/compiler.h" |
| 13 #include "src/compiler/linkage.h" | 12 #include "src/compiler/linkage.h" |
| 14 #include "src/compiler/pipeline.h" | 13 #include "src/compiler/pipeline.h" |
| 15 #include "src/execution.h" | 14 #include "src/execution.h" |
| 16 #include "src/full-codegen.h" | 15 #include "src/full-codegen.h" |
| 17 #include "src/handles.h" | 16 #include "src/handles.h" |
| 18 #include "src/objects-inl.h" | 17 #include "src/objects-inl.h" |
| 19 #include "src/parser.h" | 18 #include "src/parser.h" |
| 20 #include "src/rewriter.h" | 19 #include "src/rewriter.h" |
| 21 #include "src/scopes.h" | 20 #include "src/scopes.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 info.MarkAsContextSpecializing(); | 159 info.MarkAsContextSpecializing(); |
| 161 } | 160 } |
| 162 if (flags_ & CompilationInfo::kInliningEnabled) { | 161 if (flags_ & CompilationInfo::kInliningEnabled) { |
| 163 info.MarkAsInliningEnabled(); | 162 info.MarkAsInliningEnabled(); |
| 164 } | 163 } |
| 165 if (flags_ & CompilationInfo::kTypingEnabled) { | 164 if (flags_ & CompilationInfo::kTypingEnabled) { |
| 166 info.MarkAsTypingEnabled(); | 165 info.MarkAsTypingEnabled(); |
| 167 } | 166 } |
| 168 CHECK(Rewriter::Rewrite(&info)); | 167 CHECK(Rewriter::Rewrite(&info)); |
| 169 CHECK(Scope::Analyze(&info)); | 168 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 29 matching lines...) Expand all Loading... |
| 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(Rewriter::Rewrite(&info)); |
| 219 CHECK(Scope::Analyze(&info)); | 217 CHECK(Scope::Analyze(&info)); |
| 220 CHECK(AstNumbering::Renumber(info.function(), info.zone())); | |
| 221 CHECK(Compiler::EnsureDeoptimizationSupport(&info)); | 218 CHECK(Compiler::EnsureDeoptimizationSupport(&info)); |
| 222 | 219 |
| 223 Pipeline pipeline(&info); | 220 Pipeline pipeline(&info); |
| 224 Linkage linkage(&info); | 221 Linkage linkage(&info); |
| 225 Handle<Code> code = pipeline.GenerateCodeForMachineGraph(&linkage, graph); | 222 Handle<Code> code = pipeline.GenerateCodeForMachineGraph(&linkage, graph); |
| 226 CHECK(!code.is_null()); | 223 CHECK(!code.is_null()); |
| 227 function->ReplaceCode(*code); | 224 function->ReplaceCode(*code); |
| 228 return function; | 225 return function; |
| 229 } | 226 } |
| 230 }; | 227 }; |
| 231 } | 228 } |
| 232 } | 229 } |
| 233 } // namespace v8::internal::compiler | 230 } // namespace v8::internal::compiler |
| 234 | 231 |
| 235 #endif // V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ | 232 #endif // V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ |
| OLD | NEW |