| 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 #include "test/cctest/compiler/function-tester.h" | 5 #include "test/cctest/compiler/function-tester.h" |
| 6 | 6 |
| 7 #include "src/ast/ast-numbering.h" | 7 #include "src/ast/ast-numbering.h" |
| 8 #include "src/compilation-info.h" | 8 #include "src/compilation-info.h" |
| 9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
| 10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
| 11 #include "src/compiler/pipeline.h" | 11 #include "src/compiler/pipeline.h" |
| 12 #include "src/execution.h" | 12 #include "src/execution.h" |
| 13 #include "src/full-codegen/full-codegen.h" | 13 #include "src/full-codegen/full-codegen.h" |
| 14 #include "src/handles.h" | 14 #include "src/handles.h" |
| 15 #include "src/objects-inl.h" | 15 #include "src/objects-inl.h" |
| 16 #include "src/parsing/parse-info.h" | 16 #include "src/parsing/parse-info.h" |
| 17 #include "src/parsing/parser.h" | 17 #include "src/parsing/parsing.h" |
| 18 #include "test/cctest/cctest.h" | 18 #include "test/cctest/cctest.h" |
| 19 | 19 |
| 20 namespace v8 { | 20 namespace v8 { |
| 21 namespace internal { | 21 namespace internal { |
| 22 namespace compiler { | 22 namespace compiler { |
| 23 | 23 |
| 24 FunctionTester::FunctionTester(const char* source, uint32_t flags) | 24 FunctionTester::FunctionTester(const char* source, uint32_t flags) |
| 25 : isolate(main_isolate()), | 25 : isolate(main_isolate()), |
| 26 function((FLAG_allow_natives_syntax = true, NewFunction(source))), | 26 function((FLAG_allow_natives_syntax = true, NewFunction(source))), |
| 27 flags_(flags) { | 27 flags_(flags) { |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 return function; | 182 return function; |
| 183 } | 183 } |
| 184 | 184 |
| 185 // Compile the given machine graph instead of the source of the function | 185 // Compile the given machine graph instead of the source of the function |
| 186 // and replace the JSFunction's code with the result. | 186 // and replace the JSFunction's code with the result. |
| 187 Handle<JSFunction> FunctionTester::CompileGraph(Graph* graph) { | 187 Handle<JSFunction> FunctionTester::CompileGraph(Graph* graph) { |
| 188 Zone zone(function->GetIsolate()->allocator(), ZONE_NAME); | 188 Zone zone(function->GetIsolate()->allocator(), ZONE_NAME); |
| 189 ParseInfo parse_info(&zone, handle(function->shared())); | 189 ParseInfo parse_info(&zone, handle(function->shared())); |
| 190 CompilationInfo info(&parse_info, function); | 190 CompilationInfo info(&parse_info, function); |
| 191 | 191 |
| 192 CHECK(Parser::ParseStatic(info.parse_info())); | 192 CHECK(parsing::ParseFunction(info.parse_info())); |
| 193 info.SetOptimizing(); | 193 info.SetOptimizing(); |
| 194 | 194 |
| 195 Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, graph); | 195 Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, graph); |
| 196 CHECK(!code.is_null()); | 196 CHECK(!code.is_null()); |
| 197 function->ReplaceCode(*code); | 197 function->ReplaceCode(*code); |
| 198 return function; | 198 return function; |
| 199 } | 199 } |
| 200 | 200 |
| 201 } // namespace compiler | 201 } // namespace compiler |
| 202 } // namespace internal | 202 } // namespace internal |
| 203 } // namespace v8 | 203 } // namespace v8 |
| OLD | NEW |