OLD | NEW |
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_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
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 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1071 | 1071 |
1072 // Generate code for doing the condition check. | 1072 // Generate code for doing the condition check. |
1073 __ bind(&loop); | 1073 __ bind(&loop); |
1074 SetExpressionAsStatementPosition(stmt->each()); | 1074 SetExpressionAsStatementPosition(stmt->each()); |
1075 | 1075 |
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 __ lw(a0, MemOperand(sp, 0 * kPointerSize)); | 1077 __ lw(a0, MemOperand(sp, 0 * kPointerSize)); |
1078 __ lw(a1, MemOperand(sp, 1 * kPointerSize)); | 1078 __ lw(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 result_register. |
1082 __ lw(a2, MemOperand(sp, 2 * kPointerSize)); | 1082 __ lw(a2, MemOperand(sp, 2 * kPointerSize)); |
1083 __ Addu(a2, a2, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 1083 __ Addu(a2, a2, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
1084 __ Lsa(t0, a2, a0, kPointerSizeLog2 - kSmiTagSize); | 1084 __ Lsa(t0, a2, a0, kPointerSizeLog2 - kSmiTagSize); |
1085 __ lw(a3, MemOperand(t0)); // Current entry. | 1085 __ lw(result_register(), MemOperand(t0)); // Current entry. |
1086 | 1086 |
1087 // Get the expected map from the stack or a smi in the | 1087 // Get the expected map from the stack or a smi in the |
1088 // permanent slow case into register a2. | 1088 // permanent slow case into register a2. |
1089 __ lw(a2, MemOperand(sp, 3 * kPointerSize)); | 1089 __ lw(a2, MemOperand(sp, 3 * kPointerSize)); |
1090 | 1090 |
1091 // Check if the expected map still matches that of the enumerable. | 1091 // Check if the expected map still matches that of the enumerable. |
1092 // If not, we may have to filter the key. | 1092 // If not, we may have to filter the key. |
1093 Label update_each; | 1093 Label update_each; |
1094 __ lw(a1, MemOperand(sp, 4 * kPointerSize)); | 1094 __ lw(a1, MemOperand(sp, 4 * kPointerSize)); |
1095 __ lw(t0, FieldMemOperand(a1, HeapObject::kMapOffset)); | 1095 __ lw(t0, FieldMemOperand(a1, HeapObject::kMapOffset)); |
1096 __ Branch(&update_each, eq, t0, Operand(a2)); | 1096 __ Branch(&update_each, eq, t0, Operand(a2)); |
1097 | 1097 |
1098 // We need to filter the key, record slow-path here. | 1098 // We need to filter the key, record slow-path here. |
1099 int const vector_index = SmiFromSlot(slot)->value(); | 1099 int const vector_index = SmiFromSlot(slot)->value(); |
1100 __ EmitLoadTypeFeedbackVector(a0); | 1100 __ EmitLoadTypeFeedbackVector(a3); |
1101 __ li(a2, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate()))); | 1101 __ li(a2, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate()))); |
1102 __ sw(a2, FieldMemOperand(a0, FixedArray::OffsetOfElementAt(vector_index))); | 1102 __ sw(a2, FieldMemOperand(a3, FixedArray::OffsetOfElementAt(vector_index))); |
1103 | 1103 |
1104 // Convert the entry to a string or (smi) 0 if it isn't a property | 1104 __ mov(a0, result_register()); |
1105 // any more. If the property has been removed while iterating, we | 1105 // a0 contains the key. The receiver in a1 is the second argument to the |
1106 // just skip it. | 1106 // ForInFilterStub. ForInFilter returns undefined if the receiver doesn't |
1107 __ Push(a1, a3); // Enumerable and current entry. | 1107 // have the key or returns the name-converted key. |
1108 __ CallRuntime(Runtime::kForInFilter); | 1108 ForInFilterStub filter_stub(isolate()); |
| 1109 __ CallStub(&filter_stub); |
| 1110 RestoreContext(); |
1109 PrepareForBailoutForId(stmt->FilterId(), BailoutState::TOS_REGISTER); | 1111 PrepareForBailoutForId(stmt->FilterId(), BailoutState::TOS_REGISTER); |
1110 __ mov(a3, result_register()); | |
1111 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); | 1112 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); |
1112 __ Branch(loop_statement.continue_label(), eq, a3, Operand(at)); | 1113 __ Branch(loop_statement.continue_label(), eq, result_register(), |
| 1114 Operand(at)); |
1113 | 1115 |
1114 // Update the 'each' property or variable from the possibly filtered | 1116 // Update the 'each' property or variable from the possibly filtered |
1115 // entry in register a3. | 1117 // entry in the result_register. |
1116 __ bind(&update_each); | 1118 __ bind(&update_each); |
1117 __ mov(result_register(), a3); | |
1118 // Perform the assignment as if via '='. | 1119 // Perform the assignment as if via '='. |
1119 { EffectContext context(this); | 1120 { EffectContext context(this); |
1120 EmitAssignment(stmt->each(), stmt->EachFeedbackSlot()); | 1121 EmitAssignment(stmt->each(), stmt->EachFeedbackSlot()); |
1121 PrepareForBailoutForId(stmt->AssignmentId(), BailoutState::NO_REGISTERS); | 1122 PrepareForBailoutForId(stmt->AssignmentId(), BailoutState::NO_REGISTERS); |
1122 } | 1123 } |
1123 | 1124 |
1124 // Both Crankshaft and Turbofan expect BodyId to be right before stmt->body(). | 1125 // Both Crankshaft and Turbofan expect BodyId to be right before stmt->body(). |
1125 PrepareForBailoutForId(stmt->BodyId(), BailoutState::NO_REGISTERS); | 1126 PrepareForBailoutForId(stmt->BodyId(), BailoutState::NO_REGISTERS); |
1126 // Generate code for the body of the loop. | 1127 // Generate code for the body of the loop. |
1127 Visit(stmt->body()); | 1128 Visit(stmt->body()); |
(...skipping 2659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3787 reinterpret_cast<uint32_t>( | 3788 reinterpret_cast<uint32_t>( |
3788 isolate->builtins()->OnStackReplacement()->entry())); | 3789 isolate->builtins()->OnStackReplacement()->entry())); |
3789 return ON_STACK_REPLACEMENT; | 3790 return ON_STACK_REPLACEMENT; |
3790 } | 3791 } |
3791 | 3792 |
3792 | 3793 |
3793 } // namespace internal | 3794 } // namespace internal |
3794 } // namespace v8 | 3795 } // namespace v8 |
3795 | 3796 |
3796 #endif // V8_TARGET_ARCH_MIPS | 3797 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |