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

Side by Side Diff: src/full-codegen/arm/full-codegen-arm.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
« no previous file with comments | « no previous file | src/full-codegen/arm64/full-codegen-arm64.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_ARM 5 #if V8_TARGET_ARCH_ARM
6 6
7 #include "src/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1111 __ Push(r2, r1, r0); 1111 __ Push(r2, r1, r0);
1112 __ jmp(&loop); 1112 __ jmp(&loop);
1113 1113
1114 __ bind(&no_descriptors); 1114 __ bind(&no_descriptors);
1115 __ Drop(1); 1115 __ Drop(1);
1116 __ jmp(&exit); 1116 __ jmp(&exit);
1117 1117
1118 // We got a fixed array in register r0. Iterate through that. 1118 // We got a fixed array in register r0. Iterate through that.
1119 __ bind(&fixed_array); 1119 __ bind(&fixed_array);
1120 1120
1121 int const vector_index = SmiFromSlot(slot)->value();
1121 __ EmitLoadTypeFeedbackVector(r1); 1122 __ EmitLoadTypeFeedbackVector(r1);
1122 __ mov(r2, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate()))); 1123 __ mov(r2, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate())));
1123 int vector_index = SmiFromSlot(slot)->value();
1124 __ str(r2, FieldMemOperand(r1, FixedArray::OffsetOfElementAt(vector_index))); 1124 __ str(r2, FieldMemOperand(r1, FixedArray::OffsetOfElementAt(vector_index)));
1125 __ mov(r1, Operand(Smi::FromInt(1))); // Smi(1) indicates slow check 1125 __ mov(r1, Operand(Smi::FromInt(1))); // Smi(1) indicates slow check
1126 __ Push(r1, r0); // Smi and array 1126 __ Push(r1, r0); // Smi and array
1127 __ ldr(r1, FieldMemOperand(r0, FixedArray::kLengthOffset)); 1127 __ ldr(r1, FieldMemOperand(r0, FixedArray::kLengthOffset));
1128 __ Push(r1); // Fixed array length (as smi). 1128 __ Push(r1); // Fixed array length (as smi).
1129 PrepareForBailoutForId(stmt->PrepareId(), NO_REGISTERS); 1129 PrepareForBailoutForId(stmt->PrepareId(), NO_REGISTERS);
1130 __ mov(r0, Operand(Smi::FromInt(0))); 1130 __ mov(r0, Operand(Smi::FromInt(0)));
1131 __ Push(r0); // Initial index. 1131 __ Push(r0); // Initial index.
1132 1132
1133 // Generate code for doing the condition check. 1133 // Generate code for doing the condition check.
(...skipping 15 matching lines...) Expand all
1149 __ ldr(r2, MemOperand(sp, 3 * kPointerSize)); 1149 __ ldr(r2, MemOperand(sp, 3 * kPointerSize));
1150 1150
1151 // Check if the expected map still matches that of the enumerable. 1151 // Check if the expected map still matches that of the enumerable.
1152 // If not, we may have to filter the key. 1152 // If not, we may have to filter the key.
1153 Label update_each; 1153 Label update_each;
1154 __ ldr(r1, MemOperand(sp, 4 * kPointerSize)); 1154 __ ldr(r1, MemOperand(sp, 4 * kPointerSize));
1155 __ ldr(r4, FieldMemOperand(r1, HeapObject::kMapOffset)); 1155 __ ldr(r4, FieldMemOperand(r1, HeapObject::kMapOffset));
1156 __ cmp(r4, Operand(r2)); 1156 __ cmp(r4, Operand(r2));
1157 __ b(eq, &update_each); 1157 __ b(eq, &update_each);
1158 1158
1159 // We might get here from TurboFan or Crankshaft when something in the
1160 // for-in loop body deopts and only now notice in fullcodegen, that we
1161 // can now longer use the enum cache, i.e. left fast mode. So better record
1162 // this information here, in case we later OSR back into this loop or
1163 // reoptimize the whole function w/o rerunning the loop with the slow
1164 // mode object in fullcodegen (which would result in a deopt loop).
1165 __ EmitLoadTypeFeedbackVector(r0);
1166 __ mov(r2, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate())));
1167 __ str(r2, FieldMemOperand(r0, FixedArray::OffsetOfElementAt(vector_index)));
1168
1159 // Convert the entry to a string or (smi) 0 if it isn't a property 1169 // Convert the entry to a string or (smi) 0 if it isn't a property
1160 // any more. If the property has been removed while iterating, we 1170 // any more. If the property has been removed while iterating, we
1161 // just skip it. 1171 // just skip it.
1162 __ push(r1); // Enumerable. 1172 __ push(r1); // Enumerable.
1163 __ push(r3); // Current entry. 1173 __ push(r3); // Current entry.
1164 __ CallRuntime(Runtime::kForInFilter); 1174 __ CallRuntime(Runtime::kForInFilter);
1165 PrepareForBailoutForId(stmt->FilterId(), TOS_REG); 1175 PrepareForBailoutForId(stmt->FilterId(), TOS_REG);
1166 __ mov(r3, Operand(r0)); 1176 __ mov(r3, Operand(r0));
1167 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); 1177 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
1168 __ cmp(r0, ip); 1178 __ cmp(r0, ip);
(...skipping 3689 matching lines...) Expand 10 before | Expand all | Expand 10 after
4858 DCHECK(interrupt_address == 4868 DCHECK(interrupt_address ==
4859 isolate->builtins()->OsrAfterStackCheck()->entry()); 4869 isolate->builtins()->OsrAfterStackCheck()->entry());
4860 return OSR_AFTER_STACK_CHECK; 4870 return OSR_AFTER_STACK_CHECK;
4861 } 4871 }
4862 4872
4863 4873
4864 } // namespace internal 4874 } // namespace internal
4865 } // namespace v8 4875 } // namespace v8
4866 4876
4867 #endif // V8_TARGET_ARCH_ARM 4877 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/full-codegen/arm64/full-codegen-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698