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

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

Issue 1749033002: [for-in] Record slow path feedback only when we hit %ForInFilter. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after
1065 __ Push(v0, a2, a1, a0); 1065 __ Push(v0, a2, a1, a0);
1066 __ jmp(&loop); 1066 __ jmp(&loop);
1067 1067
1068 __ bind(&no_descriptors); 1068 __ bind(&no_descriptors);
1069 __ Drop(1); 1069 __ Drop(1);
1070 __ jmp(&exit); 1070 __ jmp(&exit);
1071 1071
1072 // We got a fixed array in register v0. Iterate through that. 1072 // We got a fixed array in register v0. Iterate through that.
1073 __ bind(&fixed_array); 1073 __ bind(&fixed_array);
1074 1074
1075 int const vector_index = SmiFromSlot(slot)->value();
1076 __ EmitLoadTypeFeedbackVector(a1);
1077 __ li(a2, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate())));
1078 __ sw(a2, FieldMemOperand(a1, FixedArray::OffsetOfElementAt(vector_index)));
1079
1080 __ li(a1, Operand(Smi::FromInt(1))); // Smi(1) indicates slow check 1075 __ li(a1, Operand(Smi::FromInt(1))); // Smi(1) indicates slow check
1081 __ Push(a1, v0); // Smi and array 1076 __ Push(a1, v0); // Smi and array
1082 __ lw(a1, FieldMemOperand(v0, FixedArray::kLengthOffset)); 1077 __ lw(a1, FieldMemOperand(v0, FixedArray::kLengthOffset));
1083 __ Push(a1); // Fixed array length (as smi). 1078 __ Push(a1); // Fixed array length (as smi).
1084 PrepareForBailoutForId(stmt->PrepareId(), NO_REGISTERS); 1079 PrepareForBailoutForId(stmt->PrepareId(), NO_REGISTERS);
1085 __ li(a0, Operand(Smi::FromInt(0))); 1080 __ li(a0, Operand(Smi::FromInt(0)));
1086 __ Push(a0); // Initial index. 1081 __ Push(a0); // Initial index.
1087 1082
1088 // Generate code for doing the condition check. 1083 // Generate code for doing the condition check.
1089 __ bind(&loop); 1084 __ bind(&loop);
(...skipping 14 matching lines...) Expand all
1104 // permanent slow case into register a2. 1099 // permanent slow case into register a2.
1105 __ lw(a2, MemOperand(sp, 3 * kPointerSize)); 1100 __ lw(a2, MemOperand(sp, 3 * kPointerSize));
1106 1101
1107 // Check if the expected map still matches that of the enumerable. 1102 // Check if the expected map still matches that of the enumerable.
1108 // If not, we may have to filter the key. 1103 // If not, we may have to filter the key.
1109 Label update_each; 1104 Label update_each;
1110 __ lw(a1, MemOperand(sp, 4 * kPointerSize)); 1105 __ lw(a1, MemOperand(sp, 4 * kPointerSize));
1111 __ lw(t0, FieldMemOperand(a1, HeapObject::kMapOffset)); 1106 __ lw(t0, FieldMemOperand(a1, HeapObject::kMapOffset));
1112 __ Branch(&update_each, eq, t0, Operand(a2)); 1107 __ Branch(&update_each, eq, t0, Operand(a2));
1113 1108
1114 // We might get here from TurboFan or Crankshaft when something in the 1109 // We need to filter the key, record slow-path here.
1115 // for-in loop body deopts and only now notice in fullcodegen, that we 1110 int const vector_index = SmiFromSlot(slot)->value();
1116 // can now longer use the enum cache, i.e. left fast mode. So better record
1117 // this information here, in case we later OSR back into this loop or
1118 // reoptimize the whole function w/o rerunning the loop with the slow
1119 // mode object in fullcodegen (which would result in a deopt loop).
1120 __ EmitLoadTypeFeedbackVector(a0); 1111 __ EmitLoadTypeFeedbackVector(a0);
1121 __ li(a2, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate()))); 1112 __ li(a2, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate())));
1122 __ sw(a2, FieldMemOperand(a0, FixedArray::OffsetOfElementAt(vector_index))); 1113 __ sw(a2, FieldMemOperand(a0, FixedArray::OffsetOfElementAt(vector_index)));
1123 1114
1124 // Convert the entry to a string or (smi) 0 if it isn't a property 1115 // Convert the entry to a string or (smi) 0 if it isn't a property
1125 // any more. If the property has been removed while iterating, we 1116 // any more. If the property has been removed while iterating, we
1126 // just skip it. 1117 // just skip it.
1127 __ Push(a1, a3); // Enumerable and current entry. 1118 __ Push(a1, a3); // Enumerable and current entry.
1128 __ CallRuntime(Runtime::kForInFilter); 1119 __ CallRuntime(Runtime::kForInFilter);
1129 PrepareForBailoutForId(stmt->FilterId(), TOS_REG); 1120 PrepareForBailoutForId(stmt->FilterId(), TOS_REG);
(...skipping 3086 matching lines...) Expand 10 before | Expand all | Expand 10 after
4216 reinterpret_cast<uint32_t>( 4207 reinterpret_cast<uint32_t>(
4217 isolate->builtins()->OsrAfterStackCheck()->entry())); 4208 isolate->builtins()->OsrAfterStackCheck()->entry()));
4218 return OSR_AFTER_STACK_CHECK; 4209 return OSR_AFTER_STACK_CHECK;
4219 } 4210 }
4220 4211
4221 4212
4222 } // namespace internal 4213 } // namespace internal
4223 } // namespace v8 4214 } // namespace v8
4224 4215
4225 #endif // V8_TARGET_ARCH_MIPS 4216 #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