Commit 54d6d35a authored by mbrandy's avatar mbrandy Committed by Commit bot

PPC: [fullcodegen] Implement control flow across do-expressions.

Port ee8108b7

Original commit message:
    This implements proper handling of local control flow (i.e. break and
    continue) that spans the boundary of a do-expression. We can no longer
    determine the number of operands to be dropped from the nesting of
    statements alone, instead we use the new precise operand stack depth
    tracking.

R=mstarzinger@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
TEST=mjsunit/harmony/do-expressions-control
BUG=v8:4488
LOG=n

Review URL: https://codereview.chromium.org/1735623002

Cr-Commit-Position: refs/heads/master@{#34264}
parent a0198f2c
......@@ -955,14 +955,14 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
FeedbackVectorSlot slot = stmt->ForInFeedbackSlot();
Label loop, exit;
ForIn loop_statement(this, stmt);
increment_loop_depth();
// Get the object to enumerate over.
SetExpressionAsStatementPosition(stmt->enumerable());
VisitForAccumulatorValue(stmt->enumerable());
OperandStackDepthIncrement(ForIn::kElementCount);
OperandStackDepthIncrement(5);
Label loop, exit;
Iteration loop_statement(this, stmt);
increment_loop_depth();
// If the object is null or undefined, skip over the loop, otherwise convert
// it to a JS receiver. See ECMA-262 version 5, section 12.6.4.
......@@ -1825,7 +1825,7 @@ void FullCodeGenerator::VisitYield(Yield* expr) {
case Yield::kSuspend:
// Pop value from top-of-stack slot; box result into result register.
EmitCreateIteratorResult(false);
__ push(result_register());
PushOperand(result_register());
// Fall through.
case Yield::kInitial: {
Label suspend, continuation, post_runtime, resume;
......@@ -1844,6 +1844,7 @@ void FullCodeGenerator::VisitYield(Yield* expr) {
EmitUnwindAndReturn();
__ bind(&suspend);
OperandStackDepthIncrement(1); // Not popped on this path.
VisitForAccumulatorValue(expr->generator_object());
DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos()));
__ LoadSmiLiteral(r4, Smi::FromInt(continuation.pos()));
......@@ -1870,7 +1871,6 @@ void FullCodeGenerator::VisitYield(Yield* expr) {
case Yield::kFinal: {
// Pop value from top-of-stack slot, box result into result register.
OperandStackDepthDecrement(1);
EmitCreateIteratorResult(true);
EmitUnwindAndReturn();
break;
......@@ -2038,7 +2038,7 @@ void FullCodeGenerator::EmitCreateIteratorResult(bool done) {
__ bind(&done_allocate);
__ LoadNativeContextSlot(Context::ITERATOR_RESULT_MAP_INDEX, r4);
__ pop(r5);
PopOperand(r5);
__ LoadRoot(r6,
done ? Heap::kTrueValueRootIndex : Heap::kFalseValueRootIndex);
__ LoadRoot(r7, Heap::kEmptyFixedArrayRootIndex);
......
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