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 "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "test/cctest/compiler/function-tester.h" | 7 #include "test/cctest/compiler/function-tester.h" |
8 | 8 |
9 using namespace v8::internal; | 9 using namespace v8::internal; |
10 using namespace v8::internal::compiler; | 10 using namespace v8::internal::compiler; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 } | 118 } |
119 | 119 |
120 | 120 |
121 TEST(CatchCall) { | 121 TEST(CatchCall) { |
122 i::FLAG_turbo_exceptions = true; | 122 i::FLAG_turbo_exceptions = true; |
123 const char* src = | 123 const char* src = |
124 "(function(fun) {" | 124 "(function(fun) {" |
125 " var r = '-';" | 125 " var r = '-';" |
126 " try {" | 126 " try {" |
127 " r += 'A-';" | 127 " r += 'A-';" |
128 " fun();" | 128 " return 23 + fun();" |
129 " } catch (e) {" | 129 " } catch (e) {" |
130 " r += e;" | 130 " r += e;" |
131 " }" | 131 " }" |
132 " return r;" | 132 " return r;" |
133 "})"; | 133 "})"; |
134 FunctionTester T(src); | 134 FunctionTester T(src); |
135 | 135 |
136 CompileRun("function thrower() { throw 'T-'; }"); | 136 CompileRun("function thrower() { throw 'T-'; }"); |
137 #if 0 // TODO(mstarzinger): Enable once we have exception handlers. | 137 #if 0 // TODO(mstarzinger): Enable once we have exception handlers. |
138 T.CheckCall(T.Val("-A-T-"), T.NewFunction("thrower")); | 138 T.CheckCall(T.Val("-A-T-"), T.NewFunction("thrower")); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 " r += 'D-';" | 173 " r += 'D-';" |
174 " }" | 174 " }" |
175 " return r;" | 175 " return r;" |
176 "})"; | 176 "})"; |
177 FunctionTester T(src); | 177 FunctionTester T(src); |
178 | 178 |
179 T.CheckCall(T.Val("-A-"), T.true_value(), T.false_value()); | 179 T.CheckCall(T.Val("-A-"), T.true_value(), T.false_value()); |
180 T.CheckCall(T.Val("-A-B-D-"), T.false_value(), T.true_value()); | 180 T.CheckCall(T.Val("-A-B-D-"), T.false_value(), T.true_value()); |
181 T.CheckCall(T.Val("-A-B-C-D-"), T.false_value(), T.false_value()); | 181 T.CheckCall(T.Val("-A-B-C-D-"), T.false_value(), T.false_value()); |
182 } | 182 } |
OLD | NEW |