| 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" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 FunctionTester::FunctionTester(Handle<Code> code, int param_count) | 40 FunctionTester::FunctionTester(Handle<Code> code, int param_count) |
| 41 : isolate(main_isolate()), | 41 : isolate(main_isolate()), |
| 42 function((FLAG_allow_natives_syntax = true, | 42 function((FLAG_allow_natives_syntax = true, |
| 43 NewFunction(BuildFunction(param_count).c_str()))), | 43 NewFunction(BuildFunction(param_count).c_str()))), |
| 44 flags_(0) { | 44 flags_(0) { |
| 45 Compile(function); | 45 Compile(function); |
| 46 function->ReplaceCode(*code); | 46 function->ReplaceCode(*code); |
| 47 } | 47 } |
| 48 | 48 |
| 49 FunctionTester::FunctionTester(Handle<Code> code) : FunctionTester(code, 0) {} | 49 FunctionTester::FunctionTester(const CallInterfaceDescriptor& descriptor, |
| 50 Handle<Code> code) |
| 51 : FunctionTester(code, descriptor.GetParameterCount()) {} |
| 50 | 52 |
| 51 MaybeHandle<Object> FunctionTester::Call() { | 53 MaybeHandle<Object> FunctionTester::Call() { |
| 52 return Execution::Call(isolate, function, undefined(), 0, nullptr); | 54 return Execution::Call(isolate, function, undefined(), 0, nullptr); |
| 53 } | 55 } |
| 54 | 56 |
| 55 MaybeHandle<Object> FunctionTester::Call(Handle<Object> a) { | 57 MaybeHandle<Object> FunctionTester::Call(Handle<Object> a) { |
| 56 Handle<Object> args[] = {a}; | 58 Handle<Object> args[] = {a}; |
| 57 return Execution::Call(isolate, function, undefined(), 1, args); | 59 return Execution::Call(isolate, function, undefined(), 1, args); |
| 58 } | 60 } |
| 59 | 61 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 194 |
| 193 Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, graph); | 195 Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, graph); |
| 194 CHECK(!code.is_null()); | 196 CHECK(!code.is_null()); |
| 195 function->ReplaceCode(*code); | 197 function->ReplaceCode(*code); |
| 196 return function; | 198 return function; |
| 197 } | 199 } |
| 198 | 200 |
| 199 } // namespace compiler | 201 } // namespace compiler |
| 200 } // namespace internal | 202 } // namespace internal |
| 201 } // namespace v8 | 203 } // namespace v8 |
| OLD | NEW |