OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/interpreter/interpreter-tester.h" | 5 #include "test/cctest/interpreter/interpreter-tester.h" |
6 | 6 |
7 namespace v8 { | 7 namespace v8 { |
8 namespace internal { | 8 namespace internal { |
9 namespace interpreter { | 9 namespace interpreter { |
10 | 10 |
11 MaybeHandle<Object> CallInterpreter(Isolate* isolate, | 11 MaybeHandle<Object> CallInterpreter(Isolate* isolate, |
12 Handle<JSFunction> function) { | 12 Handle<JSFunction> function) { |
13 return Execution::Call(isolate, function, | 13 return Execution::Call(isolate, function, |
14 isolate->factory()->undefined_value(), 0, nullptr); | 14 isolate->factory()->undefined_value(), 0, nullptr); |
15 } | 15 } |
16 | 16 |
17 InterpreterTester::InterpreterTester( | 17 InterpreterTester::InterpreterTester( |
18 Isolate* isolate, const char* source, MaybeHandle<BytecodeArray> bytecode, | 18 Isolate* isolate, const char* source, MaybeHandle<BytecodeArray> bytecode, |
19 MaybeHandle<TypeFeedbackVector> feedback_vector, const char* filter) | 19 MaybeHandle<TypeFeedbackVector> feedback_vector, const char* filter) |
20 : isolate_(isolate), | 20 : isolate_(isolate), |
21 source_(source), | 21 source_(source), |
22 bytecode_(bytecode), | 22 bytecode_(bytecode), |
23 feedback_vector_(feedback_vector) { | 23 feedback_vector_(feedback_vector) { |
24 i::FLAG_ignition = true; | 24 i::FLAG_ignition = true; |
25 i::FLAG_always_opt = false; | 25 i::FLAG_always_opt = false; |
26 // Ensure handler table is generated. | |
27 isolate->interpreter()->Initialize(); | |
28 } | 26 } |
29 | 27 |
30 InterpreterTester::InterpreterTester( | 28 InterpreterTester::InterpreterTester( |
31 Isolate* isolate, Handle<BytecodeArray> bytecode, | 29 Isolate* isolate, Handle<BytecodeArray> bytecode, |
32 MaybeHandle<TypeFeedbackVector> feedback_vector, const char* filter) | 30 MaybeHandle<TypeFeedbackVector> feedback_vector, const char* filter) |
33 : InterpreterTester(isolate, nullptr, bytecode, feedback_vector, filter) {} | 31 : InterpreterTester(isolate, nullptr, bytecode, feedback_vector, filter) {} |
34 | 32 |
35 InterpreterTester::InterpreterTester(Isolate* isolate, const char* source, | 33 InterpreterTester::InterpreterTester(Isolate* isolate, const char* source, |
36 const char* filter) | 34 const char* filter) |
37 : InterpreterTester(isolate, source, MaybeHandle<BytecodeArray>(), | 35 : InterpreterTester(isolate, source, MaybeHandle<BytecodeArray>(), |
(...skipping 26 matching lines...) Expand all Loading... |
64 return "function " + function_name() + "() {\n" + std::string(body) + "\n}"; | 62 return "function " + function_name() + "() {\n" + std::string(body) + "\n}"; |
65 } | 63 } |
66 | 64 |
67 std::string InterpreterTester::function_name() { | 65 std::string InterpreterTester::function_name() { |
68 return std::string(kFunctionName); | 66 return std::string(kFunctionName); |
69 } | 67 } |
70 | 68 |
71 } // namespace interpreter | 69 } // namespace interpreter |
72 } // namespace internal | 70 } // namespace internal |
73 } // namespace v8 | 71 } // namespace v8 |
OLD | NEW |