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