Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(936)

Side by Side Diff: src/full-codegen/mips64/full-codegen-mips64.cc

Issue 2151773002: Avoid jumping to the runtime for ForInFilter (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: remove double label Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/full-codegen/mips/full-codegen-mips.cc ('k') | src/full-codegen/x64/full-codegen-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_MIPS64 5 #if V8_TARGET_ARCH_MIPS64
6 6
7 // Note on Mips implementation: 7 // Note on Mips implementation:
8 // 8 //
9 // The result_register() for mips is the 'v0' register, which is defined 9 // The result_register() for mips is the 'v0' register, which is defined
10 // by the ABI to contain function return values. However, the first 10 // by the ABI to contain function return values. However, the first
(...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 // Load the current count to a0, load the length to a1. 1076 // Load the current count to a0, load the length to a1.
1077 __ ld(a0, MemOperand(sp, 0 * kPointerSize)); 1077 __ ld(a0, MemOperand(sp, 0 * kPointerSize));
1078 __ ld(a1, MemOperand(sp, 1 * kPointerSize)); 1078 __ ld(a1, MemOperand(sp, 1 * kPointerSize));
1079 __ Branch(loop_statement.break_label(), hs, a0, Operand(a1)); 1079 __ Branch(loop_statement.break_label(), hs, a0, Operand(a1));
1080 1080
1081 // Get the current entry of the array into register a3. 1081 // Get the current entry of the array into register a3.
1082 __ ld(a2, MemOperand(sp, 2 * kPointerSize)); 1082 __ ld(a2, MemOperand(sp, 2 * kPointerSize));
1083 __ Daddu(a2, a2, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 1083 __ Daddu(a2, a2, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
1084 __ SmiScale(a4, a0, kPointerSizeLog2); 1084 __ SmiScale(a4, a0, kPointerSizeLog2);
1085 __ daddu(a4, a2, a4); // Array base + scaled (smi) index. 1085 __ daddu(a4, a2, a4); // Array base + scaled (smi) index.
1086 __ ld(a3, MemOperand(a4)); // Current entry. 1086 __ ld(result_register(), MemOperand(a4)); // Current entry.
1087 1087
1088 // Get the expected map from the stack or a smi in the 1088 // Get the expected map from the stack or a smi in the
1089 // permanent slow case into register a2. 1089 // permanent slow case into register a2.
1090 __ ld(a2, MemOperand(sp, 3 * kPointerSize)); 1090 __ ld(a2, MemOperand(sp, 3 * kPointerSize));
1091 1091
1092 // Check if the expected map still matches that of the enumerable. 1092 // Check if the expected map still matches that of the enumerable.
1093 // If not, we may have to filter the key. 1093 // If not, we may have to filter the key.
1094 Label update_each; 1094 Label update_each;
1095 __ ld(a1, MemOperand(sp, 4 * kPointerSize)); 1095 __ ld(a1, MemOperand(sp, 4 * kPointerSize));
1096 __ ld(a4, FieldMemOperand(a1, HeapObject::kMapOffset)); 1096 __ ld(a4, FieldMemOperand(a1, HeapObject::kMapOffset));
1097 __ Branch(&update_each, eq, a4, Operand(a2)); 1097 __ Branch(&update_each, eq, a4, Operand(a2));
1098 1098
1099 // We need to filter the key, record slow-path here. 1099 // We need to filter the key, record slow-path here.
1100 int const vector_index = SmiFromSlot(slot)->value(); 1100 int const vector_index = SmiFromSlot(slot)->value();
1101 __ EmitLoadTypeFeedbackVector(a0); 1101 __ EmitLoadTypeFeedbackVector(a3);
1102 __ li(a2, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate()))); 1102 __ li(a2, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate())));
1103 __ sd(a2, FieldMemOperand(a0, FixedArray::OffsetOfElementAt(vector_index))); 1103 __ sd(a2, FieldMemOperand(a3, FixedArray::OffsetOfElementAt(vector_index)));
1104 1104
1105 // Convert the entry to a string or (smi) 0 if it isn't a property 1105 __ mov(a0, result_register());
1106 // any more. If the property has been removed while iterating, we 1106 // a0 contains the key. The receiver in a1 is the second argument to the
1107 // just skip it. 1107 // ForInFilterStub. ForInFilter returns undefined if the receiver doesn't
1108 __ Push(a1, a3); // Enumerable and current entry. 1108 // have the key or returns the name-converted key.
1109 __ CallRuntime(Runtime::kForInFilter); 1109 ForInFilterStub filter_stub(isolate());
1110 __ CallStub(&filter_stub);
1111 RestoreContext();
1110 PrepareForBailoutForId(stmt->FilterId(), BailoutState::TOS_REGISTER); 1112 PrepareForBailoutForId(stmt->FilterId(), BailoutState::TOS_REGISTER);
1111 __ mov(a3, result_register());
1112 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); 1113 __ LoadRoot(at, Heap::kUndefinedValueRootIndex);
1113 __ Branch(loop_statement.continue_label(), eq, a3, Operand(at)); 1114 __ Branch(loop_statement.continue_label(), eq, result_register(),
1115 Operand(at));
1114 1116
1115 // Update the 'each' property or variable from the possibly filtered 1117 // Update the 'each' property or variable from the possibly filtered
1116 // entry in register a3. 1118 // entry in the result_register.
1117 __ bind(&update_each); 1119 __ bind(&update_each);
1118 __ mov(result_register(), a3);
1119 // Perform the assignment as if via '='. 1120 // Perform the assignment as if via '='.
1120 { EffectContext context(this); 1121 { EffectContext context(this);
1121 EmitAssignment(stmt->each(), stmt->EachFeedbackSlot()); 1122 EmitAssignment(stmt->each(), stmt->EachFeedbackSlot());
1122 PrepareForBailoutForId(stmt->AssignmentId(), BailoutState::NO_REGISTERS); 1123 PrepareForBailoutForId(stmt->AssignmentId(), BailoutState::NO_REGISTERS);
1123 } 1124 }
1124 1125
1125 // Both Crankshaft and Turbofan expect BodyId to be right before stmt->body(). 1126 // Both Crankshaft and Turbofan expect BodyId to be right before stmt->body().
1126 PrepareForBailoutForId(stmt->BodyId(), BailoutState::NO_REGISTERS); 1127 PrepareForBailoutForId(stmt->BodyId(), BailoutState::NO_REGISTERS);
1127 // Generate code for the body of the loop. 1128 // Generate code for the body of the loop.
1128 Visit(stmt->body()); 1129 Visit(stmt->body());
(...skipping 2665 matching lines...) Expand 10 before | Expand all | Expand 10 after
3794 reinterpret_cast<uint64_t>( 3795 reinterpret_cast<uint64_t>(
3795 isolate->builtins()->OnStackReplacement()->entry())); 3796 isolate->builtins()->OnStackReplacement()->entry()));
3796 return ON_STACK_REPLACEMENT; 3797 return ON_STACK_REPLACEMENT;
3797 } 3798 }
3798 3799
3799 3800
3800 } // namespace internal 3801 } // namespace internal
3801 } // namespace v8 3802 } // namespace v8
3802 3803
3803 #endif // V8_TARGET_ARCH_MIPS64 3804 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/full-codegen/mips/full-codegen-mips.cc ('k') | src/full-codegen/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698