diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc index cbb0b34757f..b7cfd49497d 100644 --- a/src/interpreter/bytecode-generator.cc +++ b/src/interpreter/bytecode-generator.cc @@ -696,7 +696,10 @@ void BytecodeGenerator::VisitGeneratorPrologue() { BuildIndexedJump(generator_state_, 0, generator_resume_points_.size(), generator_resume_points_); - builder()->Bind(®ular_call); + builder() + ->Bind(®ular_call) + .LoadLiteral(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting)) + .StoreAccumulatorInRegister(generator_state_); // This is a regular call. Fall through to the ordinary function prologue, // after which we will run into the generator object creation and other extra // code inserted by the parser. diff --git a/test/cctest/interpreter/bytecode_expectations/Generators.golden b/test/cctest/interpreter/bytecode_expectations/Generators.golden index 310ac4ff830..f75b47edaeb 100644 --- a/test/cctest/interpreter/bytecode_expectations/Generators.golden +++ b/test/cctest/interpreter/bytecode_expectations/Generators.golden @@ -16,7 +16,7 @@ snippet: " " frame size: 11 parameter count: 1 -bytecode array length: 200 +bytecode array length: 204 bytecodes: [ B(Ldar), R(new_target), B(JumpIfUndefined), U8(20), @@ -24,10 +24,12 @@ bytecodes: [ B(Star), R(1), B(LdaZero), B(TestEqualStrict), R(1), - B(JumpIfTrue), U8(56), + B(JumpIfTrue), U8(60), B(LdaSmi), U8(76), B(Star), R(2), B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1), + B(LdaSmi), U8(-2), + B(Star), R(1), B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1), B(PushContext), R(0), B(Ldar), R(this), @@ -109,7 +111,7 @@ bytecodes: [ constant pool: [ ] handlers: [ - [38, 137, 143], + [42, 141, 147], ] --- @@ -119,7 +121,7 @@ snippet: " " frame size: 11 parameter count: 1 -bytecode array length: 293 +bytecode array length: 297 bytecodes: [ B(Ldar), R(new_target), B(JumpIfUndefined), U8(26), @@ -127,13 +129,15 @@ bytecodes: [ B(Star), R(1), B(LdaZero), B(TestEqualStrict), R(1), - B(JumpIfTrue), U8(62), + B(JumpIfTrue), U8(66), B(LdaSmi), U8(1), B(TestEqualStrict), R(1), B(JumpIfTrueConstant), U8(0), B(LdaSmi), U8(76), B(Star), R(2), B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1), + B(LdaSmi), U8(-2), + B(Star), R(1), B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1), B(PushContext), R(0), B(Ldar), R(this), @@ -255,7 +259,7 @@ constant pool: [ kInstanceTypeDontCare, ] handlers: [ - [44, 221, 227], + [48, 225, 231], ] --- @@ -265,7 +269,7 @@ snippet: " " frame size: 17 parameter count: 1 -bytecode array length: 775 +bytecode array length: 779 bytecodes: [ B(Ldar), R(new_target), B(JumpIfUndefined), U8(26), @@ -273,13 +277,15 @@ bytecodes: [ B(Star), R(3), B(LdaZero), B(TestEqualStrict), R(3), - B(JumpIfTrue), U8(62), + B(JumpIfTrue), U8(66), B(LdaSmi), U8(1), B(TestEqualStrict), R(3), B(JumpIfTrueConstant), U8(3), B(LdaSmi), U8(76), B(Star), R(4), B(CallRuntime), U16(Runtime::kAbort), R(4), U8(1), + B(LdaSmi), U8(-2), + B(Star), R(3), B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), U8(1), B(PushContext), R(0), B(Ldar), R(this), @@ -601,9 +607,9 @@ constant pool: [ kInstanceTypeDontCare, ] handlers: [ - [44, 694, 700], - [154, 448, 454], - [157, 402, 404], - [551, 563, 565], + [48, 698, 704], + [158, 452, 458], + [161, 406, 408], + [555, 567, 569], ] diff --git a/test/mjsunit/harmony/async-await-basic.js b/test/mjsunit/harmony/async-await-basic.js index 35bcb109ed3..ba0350fc83c 100644 --- a/test/mjsunit/harmony/async-await-basic.js +++ b/test/mjsunit/harmony/async-await-basic.js @@ -360,3 +360,10 @@ assertEqualsAsync( "20", () => (async(foo, { a = "0" }) => foo + a)("2", { a: undefined })); assertThrows(() => eval("async({ foo = 1 })"), SyntaxError); assertThrows(() => eval("async(a, { foo = 1 })"), SyntaxError); + +// https://bugs.chromium.org/p/chromium/issues/detail?id=638019 +async function gaga() { + let i = 1; + while (i-- > 0) { await 42 } +} +assertDoesNotThrow(gaga);