Commit 74d6c64c authored by bmeurer's avatar bmeurer Committed by Commit bot

[for-in] Record slow path feedback only when we hit %ForInFilter.

The only place in fullcodegen, where we know for sure that a for-in loop
entered the slow-path is right before the potential call to %ForInFilter.
So there's no point in also updating the mode eagerly during ForInPrepare.

R=yangguo@chromium.org
BUG=v8:3650
LOG=n

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

Cr-Commit-Position: refs/heads/master@{#34377}
parent b01cd96e
......@@ -1076,10 +1076,6 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
// We got a fixed array in register r0. Iterate through that.
__ bind(&fixed_array);
int const vector_index = SmiFromSlot(slot)->value();
__ EmitLoadTypeFeedbackVector(r1);
__ mov(r2, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate())));
__ str(r2, FieldMemOperand(r1, FixedArray::OffsetOfElementAt(vector_index)));
__ mov(r1, Operand(Smi::FromInt(1))); // Smi(1) indicates slow check
__ Push(r1, r0); // Smi and array
__ ldr(r1, FieldMemOperand(r0, FixedArray::kLengthOffset));
......@@ -1114,12 +1110,8 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
__ cmp(r4, Operand(r2));
__ b(eq, &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).
// We need to filter the key, record slow-path here.
int const vector_index = SmiFromSlot(slot)->value();
__ EmitLoadTypeFeedbackVector(r0);
__ mov(r2, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate())));
__ str(r2, FieldMemOperand(r0, FixedArray::OffsetOfElementAt(vector_index)));
......
......@@ -1072,10 +1072,6 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
// We got a fixed array in register x0. Iterate through that.
__ Bind(&fixed_array);
int const vector_index = SmiFromSlot(slot)->value();
__ EmitLoadTypeFeedbackVector(x1);
__ Mov(x10, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate())));
__ Str(x10, FieldMemOperand(x1, FixedArray::OffsetOfElementAt(vector_index)));
__ Mov(x1, Smi::FromInt(1)); // Smi(1) indicates slow check.
__ Ldr(x2, FieldMemOperand(x0, FixedArray::kLengthOffset));
__ Push(x1, x0, x2); // Smi and array, fixed array length (as smi).
......@@ -1108,12 +1104,8 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
__ Cmp(x11, x2);
__ B(eq, &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).
// We need to filter the key, record slow-path here.
int const vector_index = SmiFromSlot(slot)->value();
__ EmitLoadTypeFeedbackVector(x0);
__ Mov(x10, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate())));
__ Str(x10, FieldMemOperand(x0, FixedArray::OffsetOfElementAt(vector_index)));
......
......@@ -1008,11 +1008,6 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
// We got a fixed array in register eax. Iterate through that.
__ bind(&fixed_array);
// No need for a write barrier, we are storing a Smi in the feedback vector.
int const vector_index = SmiFromSlot(slot)->value();
__ EmitLoadTypeFeedbackVector(ebx);
__ mov(FieldOperand(ebx, FixedArray::OffsetOfElementAt(vector_index)),
Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate())));
__ push(Immediate(Smi::FromInt(1))); // Smi(1) indicates slow check
__ push(eax); // Array
__ mov(eax, FieldOperand(eax, FixedArray::kLengthOffset));
......@@ -1043,12 +1038,8 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
__ cmp(edx, FieldOperand(ecx, HeapObject::kMapOffset));
__ j(equal, &update_each, Label::kNear);
// 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).
// We need to filter the key, record slow-path here.
int const vector_index = SmiFromSlot(slot)->value();
__ EmitLoadTypeFeedbackVector(edx);
__ mov(FieldOperand(edx, FixedArray::OffsetOfElementAt(vector_index)),
Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate())));
......
......@@ -1072,11 +1072,6 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
// We got a fixed array in register v0. Iterate through that.
__ bind(&fixed_array);
int const vector_index = SmiFromSlot(slot)->value();
__ EmitLoadTypeFeedbackVector(a1);
__ li(a2, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate())));
__ sw(a2, FieldMemOperand(a1, FixedArray::OffsetOfElementAt(vector_index)));
__ li(a1, Operand(Smi::FromInt(1))); // Smi(1) indicates slow check
__ Push(a1, v0); // Smi and array
__ lw(a1, FieldMemOperand(v0, FixedArray::kLengthOffset));
......@@ -1111,12 +1106,8 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
__ lw(t0, FieldMemOperand(a1, HeapObject::kMapOffset));
__ Branch(&update_each, eq, t0, Operand(a2));
// 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).
// We need to filter the key, record slow-path here.
int const vector_index = SmiFromSlot(slot)->value();
__ EmitLoadTypeFeedbackVector(a0);
__ li(a2, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate())));
__ sw(a2, FieldMemOperand(a0, FixedArray::OffsetOfElementAt(vector_index)));
......
......@@ -1073,11 +1073,6 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
// We got a fixed array in register v0. Iterate through that.
__ bind(&fixed_array);
int const vector_index = SmiFromSlot(slot)->value();
__ EmitLoadTypeFeedbackVector(a1);
__ li(a2, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate())));
__ sd(a2, FieldMemOperand(a1, FixedArray::OffsetOfElementAt(vector_index)));
__ li(a1, Operand(Smi::FromInt(1))); // Smi(1) indicates slow check
__ Push(a1, v0); // Smi and array
__ ld(a1, FieldMemOperand(v0, FixedArray::kLengthOffset));
......@@ -1113,12 +1108,8 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
__ ld(a4, FieldMemOperand(a1, HeapObject::kMapOffset));
__ Branch(&update_each, eq, a4, Operand(a2));
// 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).
// We need to filter the key, record slow-path here.
int const vector_index = SmiFromSlot(slot)->value();
__ EmitLoadTypeFeedbackVector(a0);
__ li(a2, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate())));
__ sd(a2, FieldMemOperand(a0, FixedArray::OffsetOfElementAt(vector_index)));
......
......@@ -1038,11 +1038,6 @@ 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())));
__ StoreP(
r5, FieldMemOperand(r4, FixedArray::OffsetOfElementAt(vector_index)), r0);
__ LoadSmiLiteral(r4, Smi::FromInt(1)); // Smi(1) indicates slow check
__ Push(r4, r3); // Smi and array
__ LoadP(r4, FieldMemOperand(r3, FixedArray::kLengthOffset));
......@@ -1079,12 +1074,8 @@ 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).
// We need to filter the key, record slow-path here.
int const vector_index = SmiFromSlot(slot)->value();
__ EmitLoadTypeFeedbackVector(r3);
__ mov(r5, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate())));
__ StoreP(
......
......@@ -1029,11 +1029,6 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
// We got a fixed array in register rax. Iterate through that.
__ bind(&fixed_array);
// No need for a write barrier, we are storing a Smi in the feedback vector.
int const vector_index = SmiFromSlot(slot)->value();
__ EmitLoadTypeFeedbackVector(rbx);
__ Move(FieldOperand(rbx, FixedArray::OffsetOfElementAt(vector_index)),
TypeFeedbackVector::MegamorphicSentinel(isolate()));
__ movp(rcx, Operand(rsp, 0 * kPointerSize)); // Get enumerated object
__ Push(Smi::FromInt(1)); // Smi(1) indicates slow check
__ Push(rax); // Array
......@@ -1069,12 +1064,8 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
__ cmpp(rdx, FieldOperand(rcx, HeapObject::kMapOffset));
__ j(equal, &update_each, Label::kNear);
// 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).
// We need to filter the key, record slow-path here.
int const vector_index = SmiFromSlot(slot)->value();
__ EmitLoadTypeFeedbackVector(rdx);
__ Move(FieldOperand(rdx, FixedArray::OffsetOfElementAt(vector_index)),
TypeFeedbackVector::MegamorphicSentinel(isolate()));
......
......@@ -1000,11 +1000,6 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
// We got a fixed array in register eax. Iterate through that.
__ bind(&fixed_array);
// No need for a write barrier, we are storing a Smi in the feedback vector.
int const vector_index = SmiFromSlot(slot)->value();
__ EmitLoadTypeFeedbackVector(ebx);
__ mov(FieldOperand(ebx, FixedArray::OffsetOfElementAt(vector_index)),
Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate())));
__ push(Immediate(Smi::FromInt(1))); // Smi(1) undicates slow check
__ push(eax); // Array
__ mov(eax, FieldOperand(eax, FixedArray::kLengthOffset));
......@@ -1035,12 +1030,8 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
__ cmp(edx, FieldOperand(ecx, HeapObject::kMapOffset));
__ j(equal, &update_each, Label::kNear);
// 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).
// We need to filter the key, record slow-path here.
int const vector_index = SmiFromSlot(slot)->value();
__ EmitLoadTypeFeedbackVector(edx);
__ mov(FieldOperand(edx, FixedArray::OffsetOfElementAt(vector_index)),
Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate())));
......
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