|
@@ -1,99 +0,0 @@
|
|
|
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
-From: Shu-yu Guo <[email protected]>
|
|
|
-Date: Thu, 31 Aug 2023 08:59:12 -0700
|
|
|
-Subject: Merged: [interpreter] Fix TDZ elision in do-while tests
|
|
|
-
|
|
|
-(cherry picked from commit 1626e229a8965f975db6e9da0e7ab85f8c74333f)
|
|
|
-
|
|
|
-Change-Id: Ifb7461b6cfd62a10936470a760cb505cc5e1c60f
|
|
|
-Fixed: chromium:1477588
|
|
|
-Bug: v8:13723
|
|
|
-Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4862981
|
|
|
-Auto-Submit: Shu-yu Guo <[email protected]>
|
|
|
-Commit-Queue: Shu-yu Guo <[email protected]>
|
|
|
-Reviewed-by: Adam Klein <[email protected]>
|
|
|
-Cr-Commit-Position: refs/branch-heads/11.6@{#38}
|
|
|
-Cr-Branched-From: e29c028f391389a7a60ee37097e3ca9e396d6fa4-refs/heads/11.6.189@{#3}
|
|
|
-Cr-Branched-From: 95cbef20e2aa556a1ea75431a48b36c4de6b9934-refs/heads/main@{#88340}
|
|
|
-
|
|
|
-diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc
|
|
|
-index bd6c01047f9656c96f4fdc5fe6173d774219098d..751411a809c01329d59b3d310292ab0a997842cc 100644
|
|
|
---- a/src/interpreter/bytecode-generator.cc
|
|
|
-+++ b/src/interpreter/bytecode-generator.cc
|
|
|
-@@ -2435,8 +2435,16 @@ void BytecodeGenerator::VisitDoWhileStatement(DoWhileStatement* stmt) {
|
|
|
- VisitIterationBodyInHoleCheckElisionScope(stmt, &loop_builder);
|
|
|
- builder()->SetExpressionAsStatementPosition(stmt->cond());
|
|
|
- BytecodeLabels loop_backbranch(zone());
|
|
|
-- VisitForTest(stmt->cond(), &loop_backbranch, loop_builder.break_labels(),
|
|
|
-- TestFallthrough::kThen);
|
|
|
-+ if (!loop_builder.break_labels()->empty()) {
|
|
|
-+ // The test may be conditionally executed if there was a break statement
|
|
|
-+ // inside the loop body, and therefore requires its own elision scope.
|
|
|
-+ HoleCheckElisionScope elider(this);
|
|
|
-+ VisitForTest(stmt->cond(), &loop_backbranch, loop_builder.break_labels(),
|
|
|
-+ TestFallthrough::kThen);
|
|
|
-+ } else {
|
|
|
-+ VisitForTest(stmt->cond(), &loop_backbranch, loop_builder.break_labels(),
|
|
|
-+ TestFallthrough::kThen);
|
|
|
-+ }
|
|
|
- loop_backbranch.Bind(builder());
|
|
|
- }
|
|
|
- }
|
|
|
-diff --git a/test/unittests/interpreter/bytecode-generator-unittest.cc b/test/unittests/interpreter/bytecode-generator-unittest.cc
|
|
|
-index add6f7711f564bbee177b8640d13db730723af6f..c6cd6d87ad9ab81278fda33c4d887bfc7865daa1 100644
|
|
|
---- a/test/unittests/interpreter/bytecode-generator-unittest.cc
|
|
|
-+++ b/test/unittests/interpreter/bytecode-generator-unittest.cc
|
|
|
-@@ -3231,6 +3231,10 @@ TEST_F(BytecodeGeneratorTest, ElideRedundantHoleChecks) {
|
|
|
- "do { x; } while (y);\n"
|
|
|
- "x; y;\n",
|
|
|
-
|
|
|
-+ // do-while with break
|
|
|
-+ "do { x; break; } while (y);\n"
|
|
|
-+ "x; y;\n",
|
|
|
-+
|
|
|
- // C-style for
|
|
|
- "for (x; y; z) { w; }\n"
|
|
|
- "x; y; z; w;\n",
|
|
|
-diff --git a/test/unittests/interpreter/bytecode_expectations/ElideRedundantHoleChecks.golden b/test/unittests/interpreter/bytecode_expectations/ElideRedundantHoleChecks.golden
|
|
|
-index 21819d9247e810b1ca77a3d368c7f7af3a3a3a18..eaca674347108d365d37b26120334fb50debb46b 100644
|
|
|
---- a/test/unittests/interpreter/bytecode_expectations/ElideRedundantHoleChecks.golden
|
|
|
-+++ b/test/unittests/interpreter/bytecode_expectations/ElideRedundantHoleChecks.golden
|
|
|
-@@ -176,6 +176,38 @@ constant pool: [
|
|
|
- handlers: [
|
|
|
- ]
|
|
|
-
|
|
|
-+---
|
|
|
-+snippet: "
|
|
|
-+ {
|
|
|
-+ f = function f(a) {
|
|
|
-+ do { x; break; } while (y);
|
|
|
-+ x; y;
|
|
|
-+ }
|
|
|
-+ let w, x, y, z;
|
|
|
-+ f();
|
|
|
-+ }
|
|
|
-+"
|
|
|
-+frame size: 0
|
|
|
-+parameter count: 2
|
|
|
-+bytecode array length: 16
|
|
|
-+bytecodes: [
|
|
|
-+ /* 29 S> */ B(LdaImmutableCurrentContextSlot), U8(2),
|
|
|
-+ B(ThrowReferenceErrorIfHole), U8(0),
|
|
|
-+ /* 32 S> */ B(Jump), U8(2),
|
|
|
-+ /* 52 S> */ B(LdaImmutableCurrentContextSlot), U8(2),
|
|
|
-+ B(ThrowReferenceErrorIfHole), U8(0),
|
|
|
-+ /* 55 S> */ B(LdaImmutableCurrentContextSlot), U8(3),
|
|
|
-+ B(ThrowReferenceErrorIfHole), U8(1),
|
|
|
-+ B(LdaUndefined),
|
|
|
-+ /* 60 S> */ B(Return),
|
|
|
-+]
|
|
|
-+constant pool: [
|
|
|
-+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"],
|
|
|
-+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["y"],
|
|
|
-+]
|
|
|
-+handlers: [
|
|
|
-+]
|
|
|
-+
|
|
|
- ---
|
|
|
- snippet: "
|
|
|
- {
|