Commit 02a42939 authored by HyeockJinKim's avatar HyeockJinKim Committed by Commit Bot

Fixed bytecode generation of spread operation

During spread operation, after VisitForAccumulatorValue,
set the position of the current expression again

Bug: chromium:929844
Change-Id: I6e9ca87587789f9cb21e939d4405414c8170b232
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2379531
Commit-Queue: HyeockJin Kim <kherootz@gmail.com>
Reviewed-by: 's avatarShu-yu Guo <syg@chromium.org>
Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69677}
parent 78b04f24
......@@ -104,6 +104,7 @@ Henrique Ferreiro <henrique.ferreiro@gmail.com>
Hirofumi Mako <mkhrfm@gmail.com>
Honggyu Kim <honggyu.kp@gmail.com>
Huáng Jùnliàng <jlhwung@gmail.com>
HyeockJin Kim <kherootz@gmail.com>
Iain Ireland <iireland@mozilla.com>
Ingvar Stepanyan <me@rreverser.com>
Ioseb Dzmanashvili <ioseb.dzmanashvili@gmail.com>
......
......@@ -2921,6 +2921,7 @@ void BytecodeGenerator::BuildCreateArrayLiteral(
// If we have a leading spread, use CreateArrayFromIterable to create
// an array from it and then add the remaining components to that array.
VisitForAccumulatorValue(*current);
builder()->SetExpressionPosition((*current)->AsSpread()->expression());
builder()->CreateArrayFromIterable().StoreAccumulatorInRegister(array);
if (++current != end) {
......@@ -3021,6 +3022,7 @@ void BytecodeGenerator::BuildCreateArrayLiteral(
builder()->SetExpressionAsStatementPosition(
subexpr->AsSpread()->expression());
VisitForAccumulatorValue(subexpr->AsSpread()->expression());
builder()->SetExpressionPosition(subexpr->AsSpread()->expression());
IteratorRecord iterator = BuildGetIteratorRecord(IteratorType::kNormal);
Register value = register_allocator()->NewRegister();
......
......@@ -123,7 +123,7 @@ bytecode array length: 8
bytecodes: [
/* 42 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37),
B(Star), R(0),
/* 52 S> */ B(CreateArrayFromIterable),
/* 64 S> */ B(CreateArrayFromIterable),
/* 68 S> */ B(Return),
]
constant pool: [
......@@ -146,7 +146,7 @@ bytecodes: [
B(Star), R(2),
B(LdaConstant), U8(2),
/* 67 S> */ B(Star), R(1),
B(GetIterator), R(0), U8(2), U8(4),
/* 67 E> */ B(GetIterator), R(0), U8(2), U8(4),
B(JumpIfJSReceiver), U8(7),
B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0),
B(Star), R(4),
......@@ -188,7 +188,7 @@ bytecode array length: 24
bytecodes: [
/* 42 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37),
B(Star), R(0),
/* 52 S> */ B(CreateArrayFromIterable),
/* 64 S> */ B(CreateArrayFromIterable),
B(Star), R(2),
B(LdaNamedProperty), R(2), U8(1), U8(1),
B(Star), R(1),
......
......@@ -77,7 +77,7 @@ bytecodes: [
B(Star), R(3),
/* 49 S> */ B(CreateArrayLiteral), U8(4), U8(5), U8(37),
B(Star), R(7),
B(GetIterator), R(7), U8(6), U8(8),
/* 49 E> */ B(GetIterator), R(7), U8(6), U8(8),
B(Mov), R(0), R(2),
B(JumpIfJSReceiver), U8(7),
B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0),
......
......@@ -111,7 +111,7 @@ bytecodes: [
B(Star), R(2),
/* 101 S> */ B(CreateArrayLiteral), U8(5), U8(1), U8(37),
B(Star), R(6),
B(GetIterator), R(6), U8(2), U8(4),
/* 101 E> */ B(GetIterator), R(6), U8(2), U8(4),
B(Mov), R(4), R(1),
B(JumpIfJSReceiver), U8(7),
B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0),
......
......@@ -108,7 +108,7 @@ bytecodes: [
B(Ldar), R(6),
B(Inc), U8(3),
/* 152 S> */ B(Star), R(6),
B(GetIterator), R(3), U8(4), U8(6),
/* 152 E> */ B(GetIterator), R(3), U8(4), U8(6),
B(Mov), R(1), R(4),
B(JumpIfJSReceiver), U8(7),
B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment