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

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

Issue 1638303008: [for-in] Ensure that we learn from deopts within for-in loop bodies. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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
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_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 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 __ Push(v0, a2, a1, a0); 1107 __ Push(v0, a2, a1, a0);
1108 __ jmp(&loop); 1108 __ jmp(&loop);
1109 1109
1110 __ bind(&no_descriptors); 1110 __ bind(&no_descriptors);
1111 __ Drop(1); 1111 __ Drop(1);
1112 __ jmp(&exit); 1112 __ jmp(&exit);
1113 1113
1114 // We got a fixed array in register v0. Iterate through that. 1114 // We got a fixed array in register v0. Iterate through that.
1115 __ bind(&fixed_array); 1115 __ bind(&fixed_array);
1116 1116
1117 int const vector_index = SmiFromSlot(slot)->value();
1117 __ EmitLoadTypeFeedbackVector(a1); 1118 __ EmitLoadTypeFeedbackVector(a1);
1118 __ li(a2, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate()))); 1119 __ li(a2, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate())));
1119 int vector_index = SmiFromSlot(slot)->value();
1120 __ sw(a2, FieldMemOperand(a1, FixedArray::OffsetOfElementAt(vector_index))); 1120 __ sw(a2, FieldMemOperand(a1, FixedArray::OffsetOfElementAt(vector_index)));
1121 1121
1122 __ li(a1, Operand(Smi::FromInt(1))); // Smi(1) indicates slow check 1122 __ li(a1, Operand(Smi::FromInt(1))); // Smi(1) indicates slow check
1123 __ Push(a1, v0); // Smi and array 1123 __ Push(a1, v0); // Smi and array
1124 __ lw(a1, FieldMemOperand(v0, FixedArray::kLengthOffset)); 1124 __ lw(a1, FieldMemOperand(v0, FixedArray::kLengthOffset));
1125 __ Push(a1); // Fixed array length (as smi). 1125 __ Push(a1); // Fixed array length (as smi).
1126 PrepareForBailoutForId(stmt->PrepareId(), NO_REGISTERS); 1126 PrepareForBailoutForId(stmt->PrepareId(), NO_REGISTERS);
1127 __ li(a0, Operand(Smi::FromInt(0))); 1127 __ li(a0, Operand(Smi::FromInt(0)));
1128 __ Push(a0); // Initial index. 1128 __ Push(a0); // Initial index.
1129 1129
(...skipping 16 matching lines...) Expand all
1146 // permanent slow case into register a2. 1146 // permanent slow case into register a2.
1147 __ lw(a2, MemOperand(sp, 3 * kPointerSize)); 1147 __ lw(a2, MemOperand(sp, 3 * kPointerSize));
1148 1148
1149 // Check if the expected map still matches that of the enumerable. 1149 // Check if the expected map still matches that of the enumerable.
1150 // If not, we may have to filter the key. 1150 // If not, we may have to filter the key.
1151 Label update_each; 1151 Label update_each;
1152 __ lw(a1, MemOperand(sp, 4 * kPointerSize)); 1152 __ lw(a1, MemOperand(sp, 4 * kPointerSize));
1153 __ lw(t0, FieldMemOperand(a1, HeapObject::kMapOffset)); 1153 __ lw(t0, FieldMemOperand(a1, HeapObject::kMapOffset));
1154 __ Branch(&update_each, eq, t0, Operand(a2)); 1154 __ Branch(&update_each, eq, t0, Operand(a2));
1155 1155
1156 // We might get here from TurboFan or Crankshaft when something in the
1157 // for-in loop body deopts and only now notice in fullcodegen, that we
1158 // can now longer use the enum cache, i.e. left fast mode. So better record
1159 // this information here, in case we later OSR back into this loop or
1160 // reoptimize the whole function w/o rerunning the loop with the slow
1161 // mode object in fullcodegen (which would result in a deopt loop).
1162 __ EmitLoadTypeFeedbackVector(a0);
1163 __ li(a2, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate())));
1164 __ sw(a2, FieldMemOperand(a0, FixedArray::OffsetOfElementAt(vector_index)));
1165
1156 // Convert the entry to a string or (smi) 0 if it isn't a property 1166 // Convert the entry to a string or (smi) 0 if it isn't a property
1157 // any more. If the property has been removed while iterating, we 1167 // any more. If the property has been removed while iterating, we
1158 // just skip it. 1168 // just skip it.
1159 __ Push(a1, a3); // Enumerable and current entry. 1169 __ Push(a1, a3); // Enumerable and current entry.
1160 __ CallRuntime(Runtime::kForInFilter); 1170 __ CallRuntime(Runtime::kForInFilter);
1161 PrepareForBailoutForId(stmt->FilterId(), TOS_REG); 1171 PrepareForBailoutForId(stmt->FilterId(), TOS_REG);
1162 __ mov(a3, result_register()); 1172 __ mov(a3, result_register());
1163 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); 1173 __ LoadRoot(at, Heap::kUndefinedValueRootIndex);
1164 __ Branch(loop_statement.continue_label(), eq, a3, Operand(at)); 1174 __ Branch(loop_statement.continue_label(), eq, a3, Operand(at));
1165 1175
(...skipping 3642 matching lines...) Expand 10 before | Expand all | Expand 10 after
4808 reinterpret_cast<uint32_t>( 4818 reinterpret_cast<uint32_t>(
4809 isolate->builtins()->OsrAfterStackCheck()->entry())); 4819 isolate->builtins()->OsrAfterStackCheck()->entry()));
4810 return OSR_AFTER_STACK_CHECK; 4820 return OSR_AFTER_STACK_CHECK;
4811 } 4821 }
4812 4822
4813 4823
4814 } // namespace internal 4824 } // namespace internal
4815 } // namespace v8 4825 } // namespace v8
4816 4826
4817 #endif // V8_TARGET_ARCH_MIPS 4827 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/full-codegen/ia32/full-codegen-ia32.cc ('k') | src/full-codegen/mips64/full-codegen-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698