| 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 #include "src/objects-inl.h" | 7 #include "src/objects-inl.h" |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| 11 namespace interpreter { | 11 namespace interpreter { |
| 12 | 12 |
| 13 MaybeHandle<Object> CallInterpreter(Isolate* isolate, | 13 MaybeHandle<Object> CallInterpreter(Isolate* isolate, |
| 14 Handle<JSFunction> function) { | 14 Handle<JSFunction> function) { |
| 15 return Execution::Call(isolate, function, | 15 return Execution::Call(isolate, function, |
| 16 isolate->factory()->undefined_value(), 0, nullptr); | 16 isolate->factory()->undefined_value(), 0, nullptr); |
| 17 } | 17 } |
| 18 | 18 |
| 19 InterpreterTester::InterpreterTester( | 19 InterpreterTester::InterpreterTester( |
| 20 Isolate* isolate, const char* source, MaybeHandle<BytecodeArray> bytecode, | 20 Isolate* isolate, const char* source, MaybeHandle<BytecodeArray> bytecode, |
| 21 MaybeHandle<TypeFeedbackVector> feedback_vector, const char* filter) | 21 MaybeHandle<TypeFeedbackMetadata> feedback_metadata, const char* filter) |
| 22 : isolate_(isolate), | 22 : isolate_(isolate), |
| 23 source_(source), | 23 source_(source), |
| 24 bytecode_(bytecode), | 24 bytecode_(bytecode), |
| 25 feedback_vector_(feedback_vector) { | 25 feedback_metadata_(feedback_metadata) { |
| 26 i::FLAG_ignition = true; | 26 i::FLAG_ignition = true; |
| 27 i::FLAG_always_opt = false; | 27 i::FLAG_always_opt = false; |
| 28 } | 28 } |
| 29 | 29 |
| 30 InterpreterTester::InterpreterTester( | 30 InterpreterTester::InterpreterTester( |
| 31 Isolate* isolate, Handle<BytecodeArray> bytecode, | 31 Isolate* isolate, Handle<BytecodeArray> bytecode, |
| 32 MaybeHandle<TypeFeedbackVector> feedback_vector, const char* filter) | 32 MaybeHandle<TypeFeedbackMetadata> feedback_metadata, const char* filter) |
| 33 : InterpreterTester(isolate, nullptr, bytecode, feedback_vector, filter) {} | 33 : InterpreterTester(isolate, nullptr, bytecode, feedback_metadata, filter) { |
| 34 } |
| 34 | 35 |
| 35 InterpreterTester::InterpreterTester(Isolate* isolate, const char* source, | 36 InterpreterTester::InterpreterTester(Isolate* isolate, const char* source, |
| 36 const char* filter) | 37 const char* filter) |
| 37 : InterpreterTester(isolate, source, MaybeHandle<BytecodeArray>(), | 38 : InterpreterTester(isolate, source, MaybeHandle<BytecodeArray>(), |
| 38 MaybeHandle<TypeFeedbackVector>(), filter) {} | 39 MaybeHandle<TypeFeedbackMetadata>(), filter) {} |
| 39 | 40 |
| 40 InterpreterTester::~InterpreterTester() {} | 41 InterpreterTester::~InterpreterTester() {} |
| 41 | 42 |
| 42 Local<Message> InterpreterTester::CheckThrowsReturnMessage() { | 43 Local<Message> InterpreterTester::CheckThrowsReturnMessage() { |
| 43 TryCatch try_catch(reinterpret_cast<v8::Isolate*>(isolate_)); | 44 TryCatch try_catch(reinterpret_cast<v8::Isolate*>(isolate_)); |
| 44 auto callable = GetCallable<>(); | 45 auto callable = GetCallable<>(); |
| 45 MaybeHandle<Object> no_result = callable(); | 46 MaybeHandle<Object> no_result = callable(); |
| 46 CHECK(isolate_->has_pending_exception()); | 47 CHECK(isolate_->has_pending_exception()); |
| 47 CHECK(try_catch.HasCaught()); | 48 CHECK(try_catch.HasCaught()); |
| 48 CHECK(no_result.is_null()); | 49 CHECK(no_result.is_null()); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 64 return "function " + function_name() + "() {\n" + std::string(body) + "\n}"; | 65 return "function " + function_name() + "() {\n" + std::string(body) + "\n}"; |
| 65 } | 66 } |
| 66 | 67 |
| 67 std::string InterpreterTester::function_name() { | 68 std::string InterpreterTester::function_name() { |
| 68 return std::string(kFunctionName); | 69 return std::string(kFunctionName); |
| 69 } | 70 } |
| 70 | 71 |
| 71 } // namespace interpreter | 72 } // namespace interpreter |
| 72 } // namespace internal | 73 } // namespace internal |
| 73 } // namespace v8 | 74 } // namespace v8 |
| OLD | NEW |