OLD | NEW |
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 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1065 __ Push(x0, x2, x1, xzr); | 1065 __ Push(x0, x2, x1, xzr); |
1066 __ B(&loop); | 1066 __ B(&loop); |
1067 | 1067 |
1068 __ Bind(&no_descriptors); | 1068 __ Bind(&no_descriptors); |
1069 __ Drop(1); | 1069 __ Drop(1); |
1070 __ B(&exit); | 1070 __ B(&exit); |
1071 | 1071 |
1072 // We got a fixed array in register x0. Iterate through that. | 1072 // We got a fixed array in register x0. Iterate through that. |
1073 __ Bind(&fixed_array); | 1073 __ Bind(&fixed_array); |
1074 | 1074 |
1075 int const vector_index = SmiFromSlot(slot)->value(); | |
1076 __ EmitLoadTypeFeedbackVector(x1); | |
1077 __ Mov(x10, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate()))); | |
1078 __ Str(x10, FieldMemOperand(x1, FixedArray::OffsetOfElementAt(vector_index))); | |
1079 __ Mov(x1, Smi::FromInt(1)); // Smi(1) indicates slow check. | 1075 __ Mov(x1, Smi::FromInt(1)); // Smi(1) indicates slow check. |
1080 __ Ldr(x2, FieldMemOperand(x0, FixedArray::kLengthOffset)); | 1076 __ Ldr(x2, FieldMemOperand(x0, FixedArray::kLengthOffset)); |
1081 __ Push(x1, x0, x2); // Smi and array, fixed array length (as smi). | 1077 __ Push(x1, x0, x2); // Smi and array, fixed array length (as smi). |
1082 PrepareForBailoutForId(stmt->PrepareId(), NO_REGISTERS); | 1078 PrepareForBailoutForId(stmt->PrepareId(), NO_REGISTERS); |
1083 __ Push(xzr); // Initial index. | 1079 __ Push(xzr); // Initial index. |
1084 | 1080 |
1085 // Generate code for doing the condition check. | 1081 // Generate code for doing the condition check. |
1086 __ Bind(&loop); | 1082 __ Bind(&loop); |
1087 SetExpressionAsStatementPosition(stmt->each()); | 1083 SetExpressionAsStatementPosition(stmt->each()); |
1088 | 1084 |
(...skipping 12 matching lines...) Expand all Loading... |
1101 __ Peek(x2, 3 * kXRegSize); | 1097 __ Peek(x2, 3 * kXRegSize); |
1102 | 1098 |
1103 // Check if the expected map still matches that of the enumerable. | 1099 // Check if the expected map still matches that of the enumerable. |
1104 // If not, we may have to filter the key. | 1100 // If not, we may have to filter the key. |
1105 Label update_each; | 1101 Label update_each; |
1106 __ Peek(x1, 4 * kXRegSize); | 1102 __ Peek(x1, 4 * kXRegSize); |
1107 __ Ldr(x11, FieldMemOperand(x1, HeapObject::kMapOffset)); | 1103 __ Ldr(x11, FieldMemOperand(x1, HeapObject::kMapOffset)); |
1108 __ Cmp(x11, x2); | 1104 __ Cmp(x11, x2); |
1109 __ B(eq, &update_each); | 1105 __ B(eq, &update_each); |
1110 | 1106 |
1111 // We might get here from TurboFan or Crankshaft when something in the | 1107 // We need to filter the key, record slow-path here. |
1112 // for-in loop body deopts and only now notice in fullcodegen, that we | 1108 int const vector_index = SmiFromSlot(slot)->value(); |
1113 // can now longer use the enum cache, i.e. left fast mode. So better record | |
1114 // this information here, in case we later OSR back into this loop or | |
1115 // reoptimize the whole function w/o rerunning the loop with the slow | |
1116 // mode object in fullcodegen (which would result in a deopt loop). | |
1117 __ EmitLoadTypeFeedbackVector(x0); | 1109 __ EmitLoadTypeFeedbackVector(x0); |
1118 __ Mov(x10, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate()))); | 1110 __ Mov(x10, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate()))); |
1119 __ Str(x10, FieldMemOperand(x0, FixedArray::OffsetOfElementAt(vector_index))); | 1111 __ Str(x10, FieldMemOperand(x0, FixedArray::OffsetOfElementAt(vector_index))); |
1120 | 1112 |
1121 // Convert the entry to a string or (smi) 0 if it isn't a property | 1113 // Convert the entry to a string or (smi) 0 if it isn't a property |
1122 // any more. If the property has been removed while iterating, we | 1114 // any more. If the property has been removed while iterating, we |
1123 // just skip it. | 1115 // just skip it. |
1124 __ Push(x1, x3); | 1116 __ Push(x1, x3); |
1125 __ CallRuntime(Runtime::kForInFilter); | 1117 __ CallRuntime(Runtime::kForInFilter); |
1126 PrepareForBailoutForId(stmt->FilterId(), TOS_REG); | 1118 PrepareForBailoutForId(stmt->FilterId(), TOS_REG); |
(...skipping 3137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4264 } | 4256 } |
4265 | 4257 |
4266 return INTERRUPT; | 4258 return INTERRUPT; |
4267 } | 4259 } |
4268 | 4260 |
4269 | 4261 |
4270 } // namespace internal | 4262 } // namespace internal |
4271 } // namespace v8 | 4263 } // namespace v8 |
4272 | 4264 |
4273 #endif // V8_TARGET_ARCH_ARM64 | 4265 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |