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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 Handle<Object> args[] = {a, b, c}; | 67 Handle<Object> args[] = {a, b, c}; |
68 return Execution::Call(isolate, function, undefined(), 3, args); | 68 return Execution::Call(isolate, function, undefined(), 3, args); |
69 } | 69 } |
70 | 70 |
71 MaybeHandle<Object> FunctionTester::Call(Handle<Object> a, Handle<Object> b, | 71 MaybeHandle<Object> FunctionTester::Call(Handle<Object> a, Handle<Object> b, |
72 Handle<Object> c, Handle<Object> d) { | 72 Handle<Object> c, Handle<Object> d) { |
73 Handle<Object> args[] = {a, b, c, d}; | 73 Handle<Object> args[] = {a, b, c, d}; |
74 return Execution::Call(isolate, function, undefined(), 4, args); | 74 return Execution::Call(isolate, function, undefined(), 4, args); |
75 } | 75 } |
76 | 76 |
| 77 void FunctionTester::CheckThrows(Handle<Object> a) { |
| 78 TryCatch try_catch(reinterpret_cast<v8::Isolate*>(isolate)); |
| 79 MaybeHandle<Object> no_result = Call(a); |
| 80 CHECK(isolate->has_pending_exception()); |
| 81 CHECK(try_catch.HasCaught()); |
| 82 CHECK(no_result.is_null()); |
| 83 isolate->OptionalRescheduleException(true); |
| 84 } |
| 85 |
77 void FunctionTester::CheckThrows(Handle<Object> a, Handle<Object> b) { | 86 void FunctionTester::CheckThrows(Handle<Object> a, Handle<Object> b) { |
78 TryCatch try_catch(reinterpret_cast<v8::Isolate*>(isolate)); | 87 TryCatch try_catch(reinterpret_cast<v8::Isolate*>(isolate)); |
79 MaybeHandle<Object> no_result = Call(a, b); | 88 MaybeHandle<Object> no_result = Call(a, b); |
80 CHECK(isolate->has_pending_exception()); | 89 CHECK(isolate->has_pending_exception()); |
81 CHECK(try_catch.HasCaught()); | 90 CHECK(try_catch.HasCaught()); |
82 CHECK(no_result.is_null()); | 91 CHECK(no_result.is_null()); |
83 isolate->OptionalRescheduleException(true); | 92 isolate->OptionalRescheduleException(true); |
84 } | 93 } |
85 | 94 |
86 v8::Local<v8::Message> FunctionTester::CheckThrowsReturnMessage( | 95 v8::Local<v8::Message> FunctionTester::CheckThrowsReturnMessage( |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 203 |
195 Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, graph); | 204 Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, graph); |
196 CHECK(!code.is_null()); | 205 CHECK(!code.is_null()); |
197 function->ReplaceCode(*code); | 206 function->ReplaceCode(*code); |
198 return function; | 207 return function; |
199 } | 208 } |
200 | 209 |
201 } // namespace compiler | 210 } // namespace compiler |
202 } // namespace internal | 211 } // namespace internal |
203 } // namespace v8 | 212 } // namespace v8 |
OLD | NEW |