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/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/debug/debug.h" | 10 #include "src/debug/debug.h" |
(...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1129 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); | 1129 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); |
1130 // TODO(all): similar check was done already. Can we avoid it here? | 1130 // TODO(all): similar check was done already. Can we avoid it here? |
1131 __ CompareObjectType(x10, x11, x12, LAST_JS_PROXY_TYPE); | 1131 __ CompareObjectType(x10, x11, x12, LAST_JS_PROXY_TYPE); |
1132 DCHECK(Smi::FromInt(0) == 0); | 1132 DCHECK(Smi::FromInt(0) == 0); |
1133 __ CzeroX(x1, le); // Zero indicates proxy. | 1133 __ CzeroX(x1, le); // Zero indicates proxy. |
1134 __ Ldr(x2, FieldMemOperand(x0, FixedArray::kLengthOffset)); | 1134 __ Ldr(x2, FieldMemOperand(x0, FixedArray::kLengthOffset)); |
1135 // Smi and array, fixed array length (as smi) and initial index. | 1135 // Smi and array, fixed array length (as smi) and initial index. |
1136 __ Push(x1, x0, x2, xzr); | 1136 __ Push(x1, x0, x2, xzr); |
1137 | 1137 |
1138 // Generate code for doing the condition check. | 1138 // Generate code for doing the condition check. |
1139 PrepareForBailoutForId(stmt->BodyId(), NO_REGISTERS); | |
1140 __ Bind(&loop); | 1139 __ Bind(&loop); |
1141 SetExpressionAsStatementPosition(stmt->each()); | 1140 SetExpressionAsStatementPosition(stmt->each()); |
1142 | 1141 |
1143 // Load the current count to x0, load the length to x1. | 1142 // Load the current count to x0, load the length to x1. |
1144 __ PeekPair(x0, x1, 0); | 1143 __ PeekPair(x0, x1, 0); |
1145 __ Cmp(x0, x1); // Compare to the array length. | 1144 __ Cmp(x0, x1); // Compare to the array length. |
1146 __ B(hs, loop_statement.break_label()); | 1145 __ B(hs, loop_statement.break_label()); |
1147 | 1146 |
1148 // Get the current entry of the array into register r3. | 1147 // Get the current entry of the array into register r3. |
1149 __ Peek(x10, 2 * kXRegSize); | 1148 __ Peek(x10, 2 * kXRegSize); |
(...skipping 30 matching lines...) Expand all Loading... |
1180 // Update the 'each' property or variable from the possibly filtered | 1179 // Update the 'each' property or variable from the possibly filtered |
1181 // entry in register x3. | 1180 // entry in register x3. |
1182 __ Bind(&update_each); | 1181 __ Bind(&update_each); |
1183 __ Mov(result_register(), x3); | 1182 __ Mov(result_register(), x3); |
1184 // Perform the assignment as if via '='. | 1183 // Perform the assignment as if via '='. |
1185 { EffectContext context(this); | 1184 { EffectContext context(this); |
1186 EmitAssignment(stmt->each(), stmt->EachFeedbackSlot()); | 1185 EmitAssignment(stmt->each(), stmt->EachFeedbackSlot()); |
1187 PrepareForBailoutForId(stmt->AssignmentId(), NO_REGISTERS); | 1186 PrepareForBailoutForId(stmt->AssignmentId(), NO_REGISTERS); |
1188 } | 1187 } |
1189 | 1188 |
| 1189 // Both Crankshaft and Turbofan expect BodyId to be right before stmt->body(). |
| 1190 PrepareForBailoutForId(stmt->BodyId(), NO_REGISTERS); |
1190 // Generate code for the body of the loop. | 1191 // Generate code for the body of the loop. |
1191 Visit(stmt->body()); | 1192 Visit(stmt->body()); |
1192 | 1193 |
1193 // Generate code for going to the next element by incrementing | 1194 // Generate code for going to the next element by incrementing |
1194 // the index (smi) stored on top of the stack. | 1195 // the index (smi) stored on top of the stack. |
1195 __ Bind(loop_statement.continue_label()); | 1196 __ Bind(loop_statement.continue_label()); |
1196 // TODO(all): We could use a callee saved register to avoid popping. | 1197 // TODO(all): We could use a callee saved register to avoid popping. |
1197 __ Pop(x0); | 1198 __ Pop(x0); |
1198 __ Add(x0, x0, Smi::FromInt(1)); | 1199 __ Add(x0, x0, Smi::FromInt(1)); |
1199 __ Push(x0); | 1200 __ Push(x0); |
(...skipping 3978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5178 } | 5179 } |
5179 | 5180 |
5180 return INTERRUPT; | 5181 return INTERRUPT; |
5181 } | 5182 } |
5182 | 5183 |
5183 | 5184 |
5184 } // namespace internal | 5185 } // namespace internal |
5185 } // namespace v8 | 5186 } // namespace v8 |
5186 | 5187 |
5187 #endif // V8_TARGET_ARCH_ARM64 | 5188 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |