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

Side by Side Diff: src/full-codegen/arm64/full-codegen-arm64.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 | « src/full-codegen/arm/full-codegen-arm.cc ('k') | src/full-codegen/ia32/full-codegen-ia32.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_ARM64 5 #if V8_TARGET_ARCH_ARM64
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 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 __ Push(x0, x2, x1, xzr); 1107 __ Push(x0, x2, x1, xzr);
1108 __ B(&loop); 1108 __ B(&loop);
1109 1109
1110 __ Bind(&no_descriptors); 1110 __ Bind(&no_descriptors);
1111 __ Drop(1); 1111 __ Drop(1);
1112 __ B(&exit); 1112 __ B(&exit);
1113 1113
1114 // We got a fixed array in register x0. Iterate through that. 1114 // We got a fixed array in register x0. Iterate through that.
1115 __ Bind(&fixed_array); 1115 __ Bind(&fixed_array);
1116 1116
1117 int const vector_index = SmiFromSlot(slot)->value();
1117 __ EmitLoadTypeFeedbackVector(x1); 1118 __ EmitLoadTypeFeedbackVector(x1);
1118 __ Mov(x10, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate()))); 1119 __ Mov(x10, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate())));
1119 int vector_index = SmiFromSlot(slot)->value();
1120 __ Str(x10, FieldMemOperand(x1, FixedArray::OffsetOfElementAt(vector_index))); 1120 __ Str(x10, FieldMemOperand(x1, FixedArray::OffsetOfElementAt(vector_index)));
1121 __ Mov(x1, Smi::FromInt(1)); // Smi(1) indicates slow check. 1121 __ Mov(x1, Smi::FromInt(1)); // Smi(1) indicates slow check.
1122 __ Ldr(x2, FieldMemOperand(x0, FixedArray::kLengthOffset)); 1122 __ Ldr(x2, FieldMemOperand(x0, FixedArray::kLengthOffset));
1123 __ Push(x1, x0, x2); // Smi and array, fixed array length (as smi). 1123 __ Push(x1, x0, x2); // Smi and array, fixed array length (as smi).
1124 PrepareForBailoutForId(stmt->PrepareId(), NO_REGISTERS); 1124 PrepareForBailoutForId(stmt->PrepareId(), NO_REGISTERS);
1125 __ Push(xzr); // Initial index. 1125 __ Push(xzr); // Initial index.
1126 1126
1127 // Generate code for doing the condition check. 1127 // Generate code for doing the condition check.
1128 __ Bind(&loop); 1128 __ Bind(&loop);
1129 SetExpressionAsStatementPosition(stmt->each()); 1129 SetExpressionAsStatementPosition(stmt->each());
(...skipping 13 matching lines...) Expand all
1143 __ Peek(x2, 3 * kXRegSize); 1143 __ Peek(x2, 3 * kXRegSize);
1144 1144
1145 // Check if the expected map still matches that of the enumerable. 1145 // Check if the expected map still matches that of the enumerable.
1146 // If not, we may have to filter the key. 1146 // If not, we may have to filter the key.
1147 Label update_each; 1147 Label update_each;
1148 __ Peek(x1, 4 * kXRegSize); 1148 __ Peek(x1, 4 * kXRegSize);
1149 __ Ldr(x11, FieldMemOperand(x1, HeapObject::kMapOffset)); 1149 __ Ldr(x11, FieldMemOperand(x1, HeapObject::kMapOffset));
1150 __ Cmp(x11, x2); 1150 __ Cmp(x11, x2);
1151 __ B(eq, &update_each); 1151 __ B(eq, &update_each);
1152 1152
1153 // We might get here from TurboFan or Crankshaft when something in the
1154 // for-in loop body deopts and only now notice in fullcodegen, that we
1155 // can now longer use the enum cache, i.e. left fast mode. So better record
1156 // this information here, in case we later OSR back into this loop or
1157 // reoptimize the whole function w/o rerunning the loop with the slow
1158 // mode object in fullcodegen (which would result in a deopt loop).
1159 __ EmitLoadTypeFeedbackVector(x0);
1160 __ Mov(x10, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate())));
1161 __ Str(x10, FieldMemOperand(x0, FixedArray::OffsetOfElementAt(vector_index)));
1162
1153 // Convert the entry to a string or (smi) 0 if it isn't a property 1163 // Convert the entry to a string or (smi) 0 if it isn't a property
1154 // any more. If the property has been removed while iterating, we 1164 // any more. If the property has been removed while iterating, we
1155 // just skip it. 1165 // just skip it.
1156 __ Push(x1, x3); 1166 __ Push(x1, x3);
1157 __ CallRuntime(Runtime::kForInFilter); 1167 __ CallRuntime(Runtime::kForInFilter);
1158 PrepareForBailoutForId(stmt->FilterId(), TOS_REG); 1168 PrepareForBailoutForId(stmt->FilterId(), TOS_REG);
1159 __ Mov(x3, x0); 1169 __ Mov(x3, x0);
1160 __ JumpIfRoot(x0, Heap::kUndefinedValueRootIndex, 1170 __ JumpIfRoot(x0, Heap::kUndefinedValueRootIndex,
1161 loop_statement.continue_label()); 1171 loop_statement.continue_label());
1162 1172
(...skipping 3678 matching lines...) Expand 10 before | Expand all | Expand 10 after
4841 } 4851 }
4842 4852
4843 return INTERRUPT; 4853 return INTERRUPT;
4844 } 4854 }
4845 4855
4846 4856
4847 } // namespace internal 4857 } // namespace internal
4848 } // namespace v8 4858 } // namespace v8
4849 4859
4850 #endif // V8_TARGET_ARCH_ARM64 4860 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/full-codegen/arm/full-codegen-arm.cc ('k') | src/full-codegen/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698