| 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 #ifndef V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ | 5 #ifndef V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ |
| 6 #define V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ | 6 #define V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 #include "test/cctest/cctest.h" | 9 #include "test/cctest/cctest.h" |
| 10 | 10 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 return Execution::Call(isolate, function, undefined(), 2, args, false); | 56 return Execution::Call(isolate, function, undefined(), 2, args, false); |
| 57 } | 57 } |
| 58 | 58 |
| 59 MaybeHandle<Object> Call(Handle<Object> a, Handle<Object> b, Handle<Object> c, | 59 MaybeHandle<Object> Call(Handle<Object> a, Handle<Object> b, Handle<Object> c, |
| 60 Handle<Object> d) { | 60 Handle<Object> d) { |
| 61 Handle<Object> args[] = {a, b, c, d}; | 61 Handle<Object> args[] = {a, b, c, d}; |
| 62 return Execution::Call(isolate, function, undefined(), 4, args, false); | 62 return Execution::Call(isolate, function, undefined(), 4, args, false); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void CheckThrows(Handle<Object> a, Handle<Object> b) { | 65 void CheckThrows(Handle<Object> a, Handle<Object> b) { |
| 66 TryCatch try_catch; | 66 TryCatch try_catch(reinterpret_cast<v8::Isolate*>(isolate)); |
| 67 MaybeHandle<Object> no_result = Call(a, b); | 67 MaybeHandle<Object> no_result = Call(a, b); |
| 68 CHECK(isolate->has_pending_exception()); | 68 CHECK(isolate->has_pending_exception()); |
| 69 CHECK(try_catch.HasCaught()); | 69 CHECK(try_catch.HasCaught()); |
| 70 CHECK(no_result.is_null()); | 70 CHECK(no_result.is_null()); |
| 71 isolate->OptionalRescheduleException(true); | 71 isolate->OptionalRescheduleException(true); |
| 72 } | 72 } |
| 73 | 73 |
| 74 v8::Handle<v8::Message> CheckThrowsReturnMessage(Handle<Object> a, | 74 v8::Handle<v8::Message> CheckThrowsReturnMessage(Handle<Object> a, |
| 75 Handle<Object> b) { | 75 Handle<Object> b) { |
| 76 TryCatch try_catch; | 76 TryCatch try_catch(reinterpret_cast<v8::Isolate*>(isolate)); |
| 77 MaybeHandle<Object> no_result = Call(a, b); | 77 MaybeHandle<Object> no_result = Call(a, b); |
| 78 CHECK(isolate->has_pending_exception()); | 78 CHECK(isolate->has_pending_exception()); |
| 79 CHECK(try_catch.HasCaught()); | 79 CHECK(try_catch.HasCaught()); |
| 80 CHECK(no_result.is_null()); | 80 CHECK(no_result.is_null()); |
| 81 isolate->OptionalRescheduleException(true); | 81 isolate->OptionalRescheduleException(true); |
| 82 CHECK(!try_catch.Message().IsEmpty()); | 82 CHECK(!try_catch.Message().IsEmpty()); |
| 83 return try_catch.Message(); | 83 return try_catch.Message(); |
| 84 } | 84 } |
| 85 | 85 |
| 86 void CheckCall(Handle<Object> expected, Handle<Object> a, Handle<Object> b) { | 86 void CheckCall(Handle<Object> expected, Handle<Object> a, Handle<Object> b) { |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 CHECK(!code.is_null()); | 227 CHECK(!code.is_null()); |
| 228 function->ReplaceCode(*code); | 228 function->ReplaceCode(*code); |
| 229 return function; | 229 return function; |
| 230 } | 230 } |
| 231 }; | 231 }; |
| 232 } | 232 } |
| 233 } | 233 } |
| 234 } // namespace v8::internal::compiler | 234 } // namespace v8::internal::compiler |
| 235 | 235 |
| 236 #endif // V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ | 236 #endif // V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ |
| OLD | NEW |