Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(328)

Side by Side Diff: test/cctest/interpreter/test-interpreter.cc

Issue 1621673002: [interpreter] Add ReThrow bytecode for try-finally support. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_int-6
Patch Set: Rebased. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 2057 matching lines...) Expand 10 before | Expand all | Expand 10 after
2068 "var a = 1; try { a = 2; throw 23; } finally { throw 42; };", 2068 "var a = 1; try { a = 2; throw 23; } finally { throw 42; };",
2069 factory->NewStringFromStaticChars("E42")), 2069 factory->NewStringFromStaticChars("E42")),
2070 std::make_pair("var a = 1; for (var i = 10; i < 20; i += 5) {" 2070 std::make_pair("var a = 1; for (var i = 10; i < 20; i += 5) {"
2071 " try { a = 2; break; } finally { a = 3; }" 2071 " try { a = 2; break; } finally { a = 3; }"
2072 "} return a + i;", 2072 "} return a + i;",
2073 factory->NewStringFromStaticChars("R13")), 2073 factory->NewStringFromStaticChars("R13")),
2074 std::make_pair("var a = 1; for (var i = 10; i < 20; i += 5) {" 2074 std::make_pair("var a = 1; for (var i = 10; i < 20; i += 5) {"
2075 " try { a = 2; continue; } finally { a = 3; }" 2075 " try { a = 2; continue; } finally { a = 3; }"
2076 "} return a + i;", 2076 "} return a + i;",
2077 factory->NewStringFromStaticChars("R23")), 2077 factory->NewStringFromStaticChars("R23")),
2078 std::make_pair("var a = 1; try { a = 2;"
2079 " try { a = 3; throw 23; } finally { a = 4; }"
2080 "} catch(e) { a = a + e; } return a;",
2081 factory->NewStringFromStaticChars("R27")),
2078 }; 2082 };
2079 2083
2080 const char* try_wrapper = 2084 const char* try_wrapper =
2081 "(function() { try { return 'R' + f() } catch(e) { return 'E' + e }})()"; 2085 "(function() { try { return 'R' + f() } catch(e) { return 'E' + e }})()";
2082 2086
2083 for (size_t i = 0; i < arraysize(finallies); i++) { 2087 for (size_t i = 0; i < arraysize(finallies); i++) {
2084 std::string source(InterpreterTester::SourceForBody(finallies[i].first)); 2088 std::string source(InterpreterTester::SourceForBody(finallies[i].first));
2085 InterpreterTester tester(handles.main_isolate(), source.c_str()); 2089 InterpreterTester tester(handles.main_isolate(), source.c_str());
2086 tester.GetCallable<>(); 2090 tester.GetCallable<>();
2087 Handle<Object> wrapped = v8::Utils::OpenHandle(*CompileRun(try_wrapper)); 2091 Handle<Object> wrapped = v8::Utils::OpenHandle(*CompileRun(try_wrapper));
(...skipping 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after
3563 auto callable = tester.GetCallable<>(); 3567 auto callable = tester.GetCallable<>();
3564 3568
3565 Handle<i::Object> return_value = callable().ToHandleChecked(); 3569 Handle<i::Object> return_value = callable().ToHandleChecked();
3566 CHECK(return_value->SameValue(*eval_func_decl[i].second)); 3570 CHECK(return_value->SameValue(*eval_func_decl[i].second));
3567 } 3571 }
3568 } 3572 }
3569 3573
3570 } // namespace interpreter 3574 } // namespace interpreter
3571 } // namespace internal 3575 } // namespace internal
3572 } // namespace v8 3576 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/interpreter/test-bytecode-generator.cc ('k') | test/unittests/interpreter/bytecode-array-builder-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698