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 "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/execution.h" | 7 #include "src/execution.h" |
8 #include "src/handles.h" | 8 #include "src/handles.h" |
9 #include "src/interpreter/bytecode-array-builder.h" | 9 #include "src/interpreter/bytecode-array-builder.h" |
10 #include "src/interpreter/interpreter.h" | 10 #include "src/interpreter/interpreter.h" |
(...skipping 2012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2023 HandleAndZoneScope handles; | 2023 HandleAndZoneScope handles; |
2024 i::Isolate* isolate = handles.main_isolate(); | 2024 i::Isolate* isolate = handles.main_isolate(); |
2025 | 2025 |
2026 std::pair<const char*, Handle<Object>> catches[] = { | 2026 std::pair<const char*, Handle<Object>> catches[] = { |
2027 std::make_pair("var a = 1; try { a = 2 } catch(e) { a = 3 }; return a;", | 2027 std::make_pair("var a = 1; try { a = 2 } catch(e) { a = 3 }; return a;", |
2028 handle(Smi::FromInt(2), isolate)), | 2028 handle(Smi::FromInt(2), isolate)), |
2029 std::make_pair("var a; try { undef.x } catch(e) { a = 2 }; return a;", | 2029 std::make_pair("var a; try { undef.x } catch(e) { a = 2 }; return a;", |
2030 handle(Smi::FromInt(2), isolate)), | 2030 handle(Smi::FromInt(2), isolate)), |
2031 std::make_pair("var a; try { throw 1 } catch(e) { a = e + 2 }; return a;", | 2031 std::make_pair("var a; try { throw 1 } catch(e) { a = e + 2 }; return a;", |
2032 handle(Smi::FromInt(3), isolate)), | 2032 handle(Smi::FromInt(3), isolate)), |
| 2033 std::make_pair("var a; try { throw 1 } catch(e) { a = e + 2 };" |
| 2034 " try { throw a } catch(e) { a = e + 3 }; return a;", |
| 2035 handle(Smi::FromInt(6), isolate)), |
2033 }; | 2036 }; |
2034 | 2037 |
2035 for (size_t i = 0; i < arraysize(catches); i++) { | 2038 for (size_t i = 0; i < arraysize(catches); i++) { |
2036 std::string source(InterpreterTester::SourceForBody(catches[i].first)); | 2039 std::string source(InterpreterTester::SourceForBody(catches[i].first)); |
2037 InterpreterTester tester(handles.main_isolate(), source.c_str()); | 2040 InterpreterTester tester(handles.main_isolate(), source.c_str()); |
2038 auto callable = tester.GetCallable<>(); | 2041 auto callable = tester.GetCallable<>(); |
2039 | 2042 |
2040 Handle<i::Object> return_value = callable().ToHandleChecked(); | 2043 Handle<i::Object> return_value = callable().ToHandleChecked(); |
2041 CHECK(return_value->SameValue(*catches[i].second)); | 2044 CHECK(return_value->SameValue(*catches[i].second)); |
2042 } | 2045 } |
(...skipping 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3530 auto callable = tester.GetCallable<>(); | 3533 auto callable = tester.GetCallable<>(); |
3531 | 3534 |
3532 Handle<i::Object> return_value = callable().ToHandleChecked(); | 3535 Handle<i::Object> return_value = callable().ToHandleChecked(); |
3533 CHECK(return_value->SameValue(*eval_func_decl[i].second)); | 3536 CHECK(return_value->SameValue(*eval_func_decl[i].second)); |
3534 } | 3537 } |
3535 } | 3538 } |
3536 | 3539 |
3537 } // namespace interpreter | 3540 } // namespace interpreter |
3538 } // namespace internal | 3541 } // namespace internal |
3539 } // namespace v8 | 3542 } // namespace v8 |
OLD | NEW |