| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 function(NewFunction("(function(a,b,c,d){})")), | 44 function(NewFunction("(function(a,b,c,d){})")), |
| 45 flags_(0) { | 45 flags_(0) { |
| 46 CompileGraph(graph); | 46 CompileGraph(graph); |
| 47 } | 47 } |
| 48 | 48 |
| 49 Isolate* isolate; | 49 Isolate* isolate; |
| 50 Handle<JSFunction> function; | 50 Handle<JSFunction> function; |
| 51 | 51 |
| 52 MaybeHandle<Object> Call(Handle<Object> a, Handle<Object> b) { | 52 MaybeHandle<Object> Call(Handle<Object> a, Handle<Object> b) { |
| 53 Handle<Object> args[] = {a, b}; | 53 Handle<Object> args[] = {a, b}; |
| 54 return Execution::Call(isolate, function, undefined(), 2, args, false); | 54 return Execution::Call(isolate, function, undefined(), 2, args); |
| 55 } | 55 } |
| 56 | 56 |
| 57 MaybeHandle<Object> Call(Handle<Object> a, Handle<Object> b, Handle<Object> c, | 57 MaybeHandle<Object> Call(Handle<Object> a, Handle<Object> b, Handle<Object> c, |
| 58 Handle<Object> d) { | 58 Handle<Object> d) { |
| 59 Handle<Object> args[] = {a, b, c, d}; | 59 Handle<Object> args[] = {a, b, c, d}; |
| 60 return Execution::Call(isolate, function, undefined(), 4, args, false); | 60 return Execution::Call(isolate, function, undefined(), 4, args); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void CheckThrows(Handle<Object> a, Handle<Object> b) { | 63 void CheckThrows(Handle<Object> a, Handle<Object> b) { |
| 64 TryCatch try_catch(reinterpret_cast<v8::Isolate*>(isolate)); | 64 TryCatch try_catch(reinterpret_cast<v8::Isolate*>(isolate)); |
| 65 MaybeHandle<Object> no_result = Call(a, b); | 65 MaybeHandle<Object> no_result = Call(a, b); |
| 66 CHECK(isolate->has_pending_exception()); | 66 CHECK(isolate->has_pending_exception()); |
| 67 CHECK(try_catch.HasCaught()); | 67 CHECK(try_catch.HasCaught()); |
| 68 CHECK(no_result.is_null()); | 68 CHECK(no_result.is_null()); |
| 69 isolate->OptionalRescheduleException(true); | 69 isolate->OptionalRescheduleException(true); |
| 70 } | 70 } |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 CHECK(!code.is_null()); | 210 CHECK(!code.is_null()); |
| 211 function->ReplaceCode(*code); | 211 function->ReplaceCode(*code); |
| 212 return function; | 212 return function; |
| 213 } | 213 } |
| 214 }; | 214 }; |
| 215 } | 215 } |
| 216 } | 216 } |
| 217 } // namespace v8::internal::compiler | 217 } // namespace v8::internal::compiler |
| 218 | 218 |
| 219 #endif // V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ | 219 #endif // V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ |
| OLD | NEW |