Chromium Code Reviews| Index: src/full-codegen/x64/full-codegen-x64.cc |
| diff --git a/src/full-codegen/x64/full-codegen-x64.cc b/src/full-codegen/x64/full-codegen-x64.cc |
| index 7f08ef04450fbe8c6a519539f12d7a2d130f0175..ce7551429a7d2814ace0d18396505f8b72d12212 100644 |
| --- a/src/full-codegen/x64/full-codegen-x64.cc |
| +++ b/src/full-codegen/x64/full-codegen-x64.cc |
| @@ -983,6 +983,7 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { |
| __ bind(&call_runtime); |
| __ Push(rax); // Duplicate the enumerable object on the stack. |
| __ CallRuntime(Runtime::kForInEnumerate); |
| + |
|
Igor Sheludko
2016/07/20 11:06:51
Spurious change?
|
| PrepareForBailoutForId(stmt->EnumId(), BailoutState::TOS_REGISTER); |
| // If we got a map from the runtime call, we can do a fast |
| @@ -1036,13 +1037,11 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { |
| __ cmpp(rax, Operand(rsp, 1 * kPointerSize)); // Compare to the array length. |
| __ j(above_equal, loop_statement.break_label()); |
| - // Get the current entry of the array into register rbx. |
| + // Get the current entry of the array into register rax. |
| __ movp(rbx, Operand(rsp, 2 * kPointerSize)); |
| SmiIndex index = masm()->SmiToIndex(rax, rax, kPointerSizeLog2); |
| - __ movp(rbx, FieldOperand(rbx, |
| - index.reg, |
| - index.scale, |
| - FixedArray::kHeaderSize)); |
| + __ movp(rax, |
| + FieldOperand(rbx, index.reg, index.scale, FixedArray::kHeaderSize)); |
| // Get the expected map from the stack or a smi in the |
| // permanent slow case into register rdx. |
| @@ -1051,8 +1050,8 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { |
| // Check if the expected map still matches that of the enumerable. |
| // If not, we may have to filter the key. |
| Label update_each; |
| - __ movp(rcx, Operand(rsp, 4 * kPointerSize)); |
| - __ cmpp(rdx, FieldOperand(rcx, HeapObject::kMapOffset)); |
| + __ movp(rbx, Operand(rsp, 4 * kPointerSize)); |
| + __ cmpp(rdx, FieldOperand(rbx, HeapObject::kMapOffset)); |
| __ j(equal, &update_each, Label::kNear); |
| // We need to filter the key, record slow-path here. |
| @@ -1061,21 +1060,19 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { |
| __ Move(FieldOperand(rdx, FixedArray::OffsetOfElementAt(vector_index)), |
| TypeFeedbackVector::MegamorphicSentinel(isolate())); |
| - // Convert the entry to a string or null if it isn't a property |
| - // anymore. If the property has been removed while iterating, we |
| - // just skip it. |
| - __ Push(rcx); // Enumerable. |
| - __ Push(rbx); // Current entry. |
| - __ CallRuntime(Runtime::kForInFilter); |
| + // rax contains the key. The receiver in rbx is the second argument to the |
| + // ForInFilterStub. ForInFilter returns undefined if the receiver doesn't |
| + // have the key or returns the name-converted key. |
| + ForInFilterStub has_stub(isolate()); |
| + __ CallStub(&has_stub); |
| PrepareForBailoutForId(stmt->FilterId(), BailoutState::TOS_REGISTER); |
| - __ CompareRoot(rax, Heap::kUndefinedValueRootIndex); |
| + __ CompareRoot(result_register(), Heap::kUndefinedValueRootIndex); |
| + RestoreContext(); |
|
Igor Sheludko
2016/07/20 11:06:51
I would prefer to see the RestoreContext() call ri
Camillo Bruni
2016/07/20 12:42:42
right, changed.
|
| __ j(equal, loop_statement.continue_label()); |
| - __ movp(rbx, rax); |
| // Update the 'each' property or variable from the possibly filtered |
| - // entry in register rbx. |
| + // entry in register rax. |
| __ bind(&update_each); |
| - __ movp(result_register(), rbx); |
| // Perform the assignment as if via '='. |
| { EffectContext context(this); |
| EmitAssignment(stmt->each(), stmt->EachFeedbackSlot()); |