Commit 0dc1e186 authored by mbrandy's avatar mbrandy Committed by Commit bot

PPC: [for-in] Ensure that we learn from deopts within for-in loop bodies.

Port 0637f5f6

Original commit message:
    If we deoptimize from TurboFan or Crankshaft into the body of a for-in
    loop and that for-in mode then switches to slow mode (i.e. has to call
    %ForInFilter), we have to record that feedback, because otherwise we
    might actually OSR into that loop assuming that it's fast mode still,
    or even worse recompile the function later when we call it again w/o
    having rerun the for-in loop in fullcodegen from the beginning (where
    was previously the only place we could learn).

R=bmeurer@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=v8:3650
LOG=n

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

Cr-Commit-Position: refs/heads/master@{#33617}
parent f4872f74
......@@ -1076,9 +1076,9 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
// We got a fixed array in register r3. Iterate through that.
__ bind(&fixed_array);
int const vector_index = SmiFromSlot(slot)->value();
__ EmitLoadTypeFeedbackVector(r4);
__ mov(r5, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate())));
int vector_index = SmiFromSlot(slot)->value();
__ StoreP(
r5, FieldMemOperand(r4, FixedArray::OffsetOfElementAt(vector_index)), r0);
__ LoadSmiLiteral(r4, Smi::FromInt(1)); // Smi(1) indicates slow check
......@@ -1117,6 +1117,17 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
__ cmp(r7, r5);
__ beq(&update_each);
// We might get here from TurboFan or Crankshaft when something in the
// for-in loop body deopts and only now notice in fullcodegen, that we
// can now longer use the enum cache, i.e. left fast mode. So better record
// this information here, in case we later OSR back into this loop or
// reoptimize the whole function w/o rerunning the loop with the slow
// mode object in fullcodegen (which would result in a deopt loop).
__ EmitLoadTypeFeedbackVector(r3);
__ mov(r5, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate())));
__ StoreP(
r5, FieldMemOperand(r3, FixedArray::OffsetOfElementAt(vector_index)), r0);
// Convert the entry to a string or (smi) 0 if it isn't a property
// any more. If the property has been removed while iterating, we
// just skip it.
......
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