X87: [fullcodegen] [crankshaft] Avoid jumping to the runtime for ForInFilter.
port 4b59bf5313
(r37934)
original commit message:
Use the ForInFilterStub directly. Hence we will only jump to the runtime for
special receivers (instance_type <= LAST_SPECIAL_RECEIVER_TYPE) and for
converting element indices which are not in the string cache.
BUG=
Review-Url: https://codereview.chromium.org/2176473002
Cr-Commit-Position: refs/heads/master@{#37963}
This commit is contained in:
parent
277838b1f0
commit
abff40a485
@ -1005,9 +1005,9 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
|
|||||||
__ cmp(eax, Operand(esp, 1 * kPointerSize)); // Compare to the array length.
|
__ cmp(eax, Operand(esp, 1 * kPointerSize)); // Compare to the array length.
|
||||||
__ j(above_equal, loop_statement.break_label());
|
__ j(above_equal, loop_statement.break_label());
|
||||||
|
|
||||||
// Get the current entry of the array into register ebx.
|
// Get the current entry of the array into register eax.
|
||||||
__ mov(ebx, Operand(esp, 2 * kPointerSize));
|
__ mov(ebx, Operand(esp, 2 * kPointerSize));
|
||||||
__ mov(ebx, FieldOperand(ebx, eax, times_2, FixedArray::kHeaderSize));
|
__ mov(eax, FieldOperand(ebx, eax, times_2, FixedArray::kHeaderSize));
|
||||||
|
|
||||||
// Get the expected map from the stack or a smi in the
|
// Get the expected map from the stack or a smi in the
|
||||||
// permanent slow case into register edx.
|
// permanent slow case into register edx.
|
||||||
@ -1016,8 +1016,8 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
|
|||||||
// Check if the expected map still matches that of the enumerable.
|
// Check if the expected map still matches that of the enumerable.
|
||||||
// If not, we may have to filter the key.
|
// If not, we may have to filter the key.
|
||||||
Label update_each;
|
Label update_each;
|
||||||
__ mov(ecx, Operand(esp, 4 * kPointerSize));
|
__ mov(ebx, Operand(esp, 4 * kPointerSize));
|
||||||
__ cmp(edx, FieldOperand(ecx, HeapObject::kMapOffset));
|
__ cmp(edx, FieldOperand(ebx, HeapObject::kMapOffset));
|
||||||
__ j(equal, &update_each, Label::kNear);
|
__ j(equal, &update_each, Label::kNear);
|
||||||
|
|
||||||
// We need to filter the key, record slow-path here.
|
// We need to filter the key, record slow-path here.
|
||||||
@ -1026,21 +1026,19 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
|
|||||||
__ mov(FieldOperand(edx, FixedArray::OffsetOfElementAt(vector_index)),
|
__ mov(FieldOperand(edx, FixedArray::OffsetOfElementAt(vector_index)),
|
||||||
Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate())));
|
Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate())));
|
||||||
|
|
||||||
// Convert the entry to a string or null if it isn't a property
|
// eax contains the key. The receiver in ebx is the second argument to the
|
||||||
// anymore. If the property has been removed while iterating, we
|
// ForInFilterStub. ForInFilter returns undefined if the receiver doesn't
|
||||||
// just skip it.
|
// have the key or returns the name-converted key.
|
||||||
__ push(ecx); // Enumerable.
|
ForInFilterStub filter_stub(isolate());
|
||||||
__ push(ebx); // Current entry.
|
__ CallStub(&filter_stub);
|
||||||
__ CallRuntime(Runtime::kForInFilter);
|
RestoreContext();
|
||||||
PrepareForBailoutForId(stmt->FilterId(), BailoutState::TOS_REGISTER);
|
PrepareForBailoutForId(stmt->FilterId(), BailoutState::TOS_REGISTER);
|
||||||
__ cmp(eax, isolate()->factory()->undefined_value());
|
__ JumpIfRoot(result_register(), Heap::kUndefinedValueRootIndex,
|
||||||
__ j(equal, loop_statement.continue_label());
|
loop_statement.continue_label());
|
||||||
__ mov(ebx, eax);
|
|
||||||
|
|
||||||
// Update the 'each' property or variable from the possibly filtered
|
// Update the 'each' property or variable from the possibly filtered
|
||||||
// entry in register ebx.
|
// entry in register eax.
|
||||||
__ bind(&update_each);
|
__ bind(&update_each);
|
||||||
__ mov(result_register(), ebx);
|
|
||||||
// Perform the assignment as if via '='.
|
// Perform the assignment as if via '='.
|
||||||
{ EffectContext context(this);
|
{ EffectContext context(this);
|
||||||
EmitAssignment(stmt->each(), stmt->EachFeedbackSlot());
|
EmitAssignment(stmt->each(), stmt->EachFeedbackSlot());
|
||||||
|
Loading…
Reference in New Issue
Block a user