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

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

Issue 1796893002: [Interpreter] Pops the context to the correct level on return. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased the patch. Created 4 years, 9 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 "} return a + i;", 2068 "} return a + i;",
2069 factory->NewStringFromStaticChars("R13")), 2069 factory->NewStringFromStaticChars("R13")),
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; continue; } finally { a = 3; }" 2071 " try { a = 2; continue; } finally { a = 3; }"
2072 "} return a + i;", 2072 "} return a + i;",
2073 factory->NewStringFromStaticChars("R23")), 2073 factory->NewStringFromStaticChars("R23")),
2074 std::make_pair("var a = 1; try { a = 2;" 2074 std::make_pair("var a = 1; try { a = 2;"
2075 " try { a = 3; throw 23; } finally { a = 4; }" 2075 " try { a = 3; throw 23; } finally { a = 4; }"
2076 "} catch(e) { a = a + e; } return a;", 2076 "} catch(e) { a = a + e; } return a;",
2077 factory->NewStringFromStaticChars("R27")), 2077 factory->NewStringFromStaticChars("R27")),
2078 std::make_pair("var func_name;"
2079 "function tcf2(a) {"
2080 " try { throw new Error('boom');} "
2081 " catch(e) {return 153; } "
2082 " finally {func_name = tcf2.name;}"
2083 "}"
2084 "tcf2();"
2085 "return func_name;",
2086 factory->NewStringFromStaticChars("Rtcf2")),
2078 }; 2087 };
2079 2088
2080 const char* try_wrapper = 2089 const char* try_wrapper =
2081 "(function() { try { return 'R' + f() } catch(e) { return 'E' + e }})()"; 2090 "(function() { try { return 'R' + f() } catch(e) { return 'E' + e }})()";
2082 2091
2083 for (size_t i = 0; i < arraysize(finallies); i++) { 2092 for (size_t i = 0; i < arraysize(finallies); i++) {
2084 std::string source(InterpreterTester::SourceForBody(finallies[i].first)); 2093 std::string source(InterpreterTester::SourceForBody(finallies[i].first));
2085 InterpreterTester tester(handles.main_isolate(), source.c_str()); 2094 InterpreterTester tester(handles.main_isolate(), source.c_str());
2086 tester.GetCallable<>(); 2095 tester.GetCallable<>();
2087 Handle<Object> wrapped = v8::Utils::OpenHandle(*CompileRun(try_wrapper)); 2096 Handle<Object> wrapped = v8::Utils::OpenHandle(*CompileRun(try_wrapper));
(...skipping 2138 matching lines...) Expand 10 before | Expand all | Expand 10 after
4226 Handle<i::Object> return_value = callable().ToHandleChecked(); 4235 Handle<i::Object> return_value = callable().ToHandleChecked();
4227 CHECK(return_value->SameValue(*const_decl[i].second)); 4236 CHECK(return_value->SameValue(*const_decl[i].second));
4228 } 4237 }
4229 4238
4230 FLAG_legacy_const = old_flag_legacy_const; 4239 FLAG_legacy_const = old_flag_legacy_const;
4231 } 4240 }
4232 4241
4233 } // namespace interpreter 4242 } // namespace interpreter
4234 } // namespace internal 4243 } // namespace internal
4235 } // namespace v8 4244 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698