| 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 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1066 | 1066 |
| 1067 // Generate code for doing the condition check. | 1067 // Generate code for doing the condition check. |
| 1068 __ Bind(&loop); | 1068 __ Bind(&loop); |
| 1069 SetExpressionAsStatementPosition(stmt->each()); | 1069 SetExpressionAsStatementPosition(stmt->each()); |
| 1070 | 1070 |
| 1071 // Load the current count to x0, load the length to x1. | 1071 // Load the current count to x0, load the length to x1. |
| 1072 __ PeekPair(x0, x1, 0); | 1072 __ PeekPair(x0, x1, 0); |
| 1073 __ Cmp(x0, x1); // Compare to the array length. | 1073 __ Cmp(x0, x1); // Compare to the array length. |
| 1074 __ B(hs, loop_statement.break_label()); | 1074 __ B(hs, loop_statement.break_label()); |
| 1075 | 1075 |
| 1076 // Get the current entry of the array into register r3. | 1076 // Get the current entry of the array into register x0. |
| 1077 __ Peek(x10, 2 * kXRegSize); | 1077 __ Peek(x10, 2 * kXRegSize); |
| 1078 __ Add(x10, x10, Operand::UntagSmiAndScale(x0, kPointerSizeLog2)); | 1078 __ Add(x10, x10, Operand::UntagSmiAndScale(x0, kPointerSizeLog2)); |
| 1079 __ Ldr(x3, MemOperand(x10, FixedArray::kHeaderSize - kHeapObjectTag)); | 1079 __ Ldr(x0, MemOperand(x10, FixedArray::kHeaderSize - kHeapObjectTag)); |
| 1080 | 1080 |
| 1081 // Get the expected map from the stack or a smi in the | 1081 // Get the expected map from the stack or a smi in the |
| 1082 // permanent slow case into register x10. | 1082 // permanent slow case into register x2. |
| 1083 __ Peek(x2, 3 * kXRegSize); | 1083 __ Peek(x2, 3 * kXRegSize); |
| 1084 | 1084 |
| 1085 // Check if the expected map still matches that of the enumerable. | 1085 // Check if the expected map still matches that of the enumerable. |
| 1086 // If not, we may have to filter the key. | 1086 // If not, we may have to filter the key. |
| 1087 Label update_each; | 1087 Label update_each; |
| 1088 __ Peek(x1, 4 * kXRegSize); | 1088 __ Peek(x1, 4 * kXRegSize); |
| 1089 __ Ldr(x11, FieldMemOperand(x1, HeapObject::kMapOffset)); | 1089 __ Ldr(x11, FieldMemOperand(x1, HeapObject::kMapOffset)); |
| 1090 __ Cmp(x11, x2); | 1090 __ Cmp(x11, x2); |
| 1091 __ B(eq, &update_each); | 1091 __ B(eq, &update_each); |
| 1092 | 1092 |
| 1093 // We need to filter the key, record slow-path here. | 1093 // We need to filter the key, record slow-path here. |
| 1094 int const vector_index = SmiFromSlot(slot)->value(); | 1094 int const vector_index = SmiFromSlot(slot)->value(); |
| 1095 __ EmitLoadTypeFeedbackVector(x0); | 1095 __ EmitLoadTypeFeedbackVector(x3); |
| 1096 __ Mov(x10, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate()))); | 1096 __ Mov(x10, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate()))); |
| 1097 __ Str(x10, FieldMemOperand(x0, FixedArray::OffsetOfElementAt(vector_index))); | 1097 __ Str(x10, FieldMemOperand(x3, FixedArray::OffsetOfElementAt(vector_index))); |
| 1098 | 1098 |
| 1099 // Convert the entry to a string or (smi) 0 if it isn't a property | 1099 // x0 contains the key. The receiver in x1 is the second argument to the |
| 1100 // any more. If the property has been removed while iterating, we | 1100 // ForInFilterStub. ForInFilter returns undefined if the receiver doesn't |
| 1101 // just skip it. | 1101 // have the key or returns the name-converted key. |
| 1102 __ Push(x1, x3); | 1102 ForInFilterStub filter_stub(isolate()); |
| 1103 __ CallRuntime(Runtime::kForInFilter); | 1103 __ CallStub(&filter_stub); |
| 1104 RestoreContext(); |
| 1104 PrepareForBailoutForId(stmt->FilterId(), BailoutState::TOS_REGISTER); | 1105 PrepareForBailoutForId(stmt->FilterId(), BailoutState::TOS_REGISTER); |
| 1105 __ Mov(x3, x0); | 1106 __ CompareRoot(result_register(), Heap::kUndefinedValueRootIndex); |
| 1106 __ JumpIfRoot(x0, Heap::kUndefinedValueRootIndex, | 1107 __ B(eq, loop_statement.continue_label()); |
| 1107 loop_statement.continue_label()); | |
| 1108 | 1108 |
| 1109 // Update the 'each' property or variable from the possibly filtered | 1109 // Update the 'each' property or variable from the possibly filtered |
| 1110 // entry in register x3. | 1110 // entry in register x0. |
| 1111 __ Bind(&update_each); | 1111 __ Bind(&update_each); |
| 1112 __ Mov(result_register(), x3); | |
| 1113 // Perform the assignment as if via '='. | 1112 // Perform the assignment as if via '='. |
| 1114 { EffectContext context(this); | 1113 { EffectContext context(this); |
| 1115 EmitAssignment(stmt->each(), stmt->EachFeedbackSlot()); | 1114 EmitAssignment(stmt->each(), stmt->EachFeedbackSlot()); |
| 1116 PrepareForBailoutForId(stmt->AssignmentId(), BailoutState::NO_REGISTERS); | 1115 PrepareForBailoutForId(stmt->AssignmentId(), BailoutState::NO_REGISTERS); |
| 1117 } | 1116 } |
| 1118 | 1117 |
| 1119 // Both Crankshaft and Turbofan expect BodyId to be right before stmt->body(). | 1118 // Both Crankshaft and Turbofan expect BodyId to be right before stmt->body(). |
| 1120 PrepareForBailoutForId(stmt->BodyId(), BailoutState::NO_REGISTERS); | 1119 PrepareForBailoutForId(stmt->BodyId(), BailoutState::NO_REGISTERS); |
| 1121 // Generate code for the body of the loop. | 1120 // Generate code for the body of the loop. |
| 1122 Visit(stmt->body()); | 1121 Visit(stmt->body()); |
| (...skipping 2730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3853 } | 3852 } |
| 3854 | 3853 |
| 3855 return INTERRUPT; | 3854 return INTERRUPT; |
| 3856 } | 3855 } |
| 3857 | 3856 |
| 3858 | 3857 |
| 3859 } // namespace internal | 3858 } // namespace internal |
| 3860 } // namespace v8 | 3859 } // namespace v8 |
| 3861 | 3860 |
| 3862 #endif // V8_TARGET_ARCH_ARM64 | 3861 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |