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

Unified Diff: test/cctest/interpreter/test-bytecode-generator.cc

Issue 1601153002: [Interpreter] Ensure that block breaks are within the correct context scope. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/interpreter/bytecode-generator.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/interpreter/test-bytecode-generator.cc
diff --git a/test/cctest/interpreter/test-bytecode-generator.cc b/test/cctest/interpreter/test-bytecode-generator.cc
index a14e0c1f76f734eaa554d99fad73781c4ee0b811..9158dc7deb3f4b2829f535a93ab90b947a9ce684 100644
--- a/test/cctest/interpreter/test-bytecode-generator.cc
+++ b/test/cctest/interpreter/test-bytecode-generator.cc
@@ -2188,7 +2188,10 @@ TEST(BreakableBlocks) {
InitializedHandleScope handle_scope;
BytecodeGeneratorHelper helper;
- ExpectedSnippet<int> snippets[] = {
+ int closure = Register::function_closure().index();
+ int context = Register::function_context().index();
+
+ ExpectedSnippet<InstanceType> snippets[] = {
{"var x = 0;\n"
"label: {\n"
" x = x + 1;\n"
@@ -2266,6 +2269,37 @@ TEST(BreakableBlocks) {
B(Ldar), R(0), //
B(Return), //
}},
+ {"outer: {\n"
+ " let y = 10;"
+ " function f() { return y; }\n"
+ " break outer;\n"
+ "}\n",
+ 5 * kPointerSize,
+ 1,
+ 39,
+ {
+ B(LdaConstant), U8(0), //
+ B(Star), R(3), //
+ B(Ldar), R(closure), //
+ B(Star), R(4), //
+ B(CallRuntime), U16(Runtime::kPushBlockContext), R(3), U8(2), //
+ B(PushContext), R(2), //
+ B(LdaTheHole), //
+ B(StaContextSlot), R(2), U8(4), //
+ B(CreateClosure), U8(1), U8(0), //
+ B(Star), R(0), //
+ B(LdaSmi8), U8(10), //
+ B(StaContextSlot), R(2), U8(4), //
+ B(Ldar), R(0), //
+ B(Star), R(1), //
+ B(Jump), U8(2), //
+ B(PopContext), R(context), //
+ B(LdaUndefined), //
+ B(Return), //
+ },
+ 2,
+ {InstanceType::FIXED_ARRAY_TYPE,
+ InstanceType::SHARED_FUNCTION_INFO_TYPE}},
};
for (size_t i = 0; i < arraysize(snippets); i++) {
« no previous file with comments | « src/interpreter/bytecode-generator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698