OLD | NEW |
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_X64 | 5 #if V8_TARGET_ARCH_X64 |
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 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1061 __ jmp(&loop); | 1061 __ jmp(&loop); |
1062 | 1062 |
1063 __ bind(&no_descriptors); | 1063 __ bind(&no_descriptors); |
1064 __ addp(rsp, Immediate(kPointerSize)); | 1064 __ addp(rsp, Immediate(kPointerSize)); |
1065 __ jmp(&exit); | 1065 __ jmp(&exit); |
1066 | 1066 |
1067 // We got a fixed array in register rax. Iterate through that. | 1067 // We got a fixed array in register rax. Iterate through that. |
1068 __ bind(&fixed_array); | 1068 __ bind(&fixed_array); |
1069 | 1069 |
1070 // No need for a write barrier, we are storing a Smi in the feedback vector. | 1070 // No need for a write barrier, we are storing a Smi in the feedback vector. |
| 1071 int const vector_index = SmiFromSlot(slot)->value(); |
1071 __ EmitLoadTypeFeedbackVector(rbx); | 1072 __ EmitLoadTypeFeedbackVector(rbx); |
1072 int vector_index = SmiFromSlot(slot)->value(); | |
1073 __ Move(FieldOperand(rbx, FixedArray::OffsetOfElementAt(vector_index)), | 1073 __ Move(FieldOperand(rbx, FixedArray::OffsetOfElementAt(vector_index)), |
1074 TypeFeedbackVector::MegamorphicSentinel(isolate())); | 1074 TypeFeedbackVector::MegamorphicSentinel(isolate())); |
1075 __ movp(rcx, Operand(rsp, 0 * kPointerSize)); // Get enumerated object | 1075 __ movp(rcx, Operand(rsp, 0 * kPointerSize)); // Get enumerated object |
1076 __ Push(Smi::FromInt(1)); // Smi(1) indicates slow check | 1076 __ Push(Smi::FromInt(1)); // Smi(1) indicates slow check |
1077 __ Push(rax); // Array | 1077 __ Push(rax); // Array |
1078 __ movp(rax, FieldOperand(rax, FixedArray::kLengthOffset)); | 1078 __ movp(rax, FieldOperand(rax, FixedArray::kLengthOffset)); |
1079 __ Push(rax); // Fixed array length (as smi). | 1079 __ Push(rax); // Fixed array length (as smi). |
1080 PrepareForBailoutForId(stmt->PrepareId(), NO_REGISTERS); | 1080 PrepareForBailoutForId(stmt->PrepareId(), NO_REGISTERS); |
1081 __ Push(Smi::FromInt(0)); // Initial index. | 1081 __ Push(Smi::FromInt(0)); // Initial index. |
1082 | 1082 |
(...skipping 17 matching lines...) Expand all Loading... |
1100 // permanent slow case into register rdx. | 1100 // permanent slow case into register rdx. |
1101 __ movp(rdx, Operand(rsp, 3 * kPointerSize)); | 1101 __ movp(rdx, Operand(rsp, 3 * kPointerSize)); |
1102 | 1102 |
1103 // Check if the expected map still matches that of the enumerable. | 1103 // Check if the expected map still matches that of the enumerable. |
1104 // If not, we may have to filter the key. | 1104 // If not, we may have to filter the key. |
1105 Label update_each; | 1105 Label update_each; |
1106 __ movp(rcx, Operand(rsp, 4 * kPointerSize)); | 1106 __ movp(rcx, Operand(rsp, 4 * kPointerSize)); |
1107 __ cmpp(rdx, FieldOperand(rcx, HeapObject::kMapOffset)); | 1107 __ cmpp(rdx, FieldOperand(rcx, HeapObject::kMapOffset)); |
1108 __ j(equal, &update_each, Label::kNear); | 1108 __ j(equal, &update_each, Label::kNear); |
1109 | 1109 |
| 1110 // We might get here from TurboFan or Crankshaft when something in the |
| 1111 // for-in loop body deopts and only now notice in fullcodegen, that we |
| 1112 // can now longer use the enum cache, i.e. left fast mode. So better record |
| 1113 // this information here, in case we later OSR back into this loop or |
| 1114 // reoptimize the whole function w/o rerunning the loop with the slow |
| 1115 // mode object in fullcodegen (which would result in a deopt loop). |
| 1116 __ EmitLoadTypeFeedbackVector(rdx); |
| 1117 __ Move(FieldOperand(rdx, FixedArray::OffsetOfElementAt(vector_index)), |
| 1118 TypeFeedbackVector::MegamorphicSentinel(isolate())); |
| 1119 |
1110 // Convert the entry to a string or null if it isn't a property | 1120 // Convert the entry to a string or null if it isn't a property |
1111 // anymore. If the property has been removed while iterating, we | 1121 // anymore. If the property has been removed while iterating, we |
1112 // just skip it. | 1122 // just skip it. |
1113 __ Push(rcx); // Enumerable. | 1123 __ Push(rcx); // Enumerable. |
1114 __ Push(rbx); // Current entry. | 1124 __ Push(rbx); // Current entry. |
1115 __ CallRuntime(Runtime::kForInFilter); | 1125 __ CallRuntime(Runtime::kForInFilter); |
1116 PrepareForBailoutForId(stmt->FilterId(), TOS_REG); | 1126 PrepareForBailoutForId(stmt->FilterId(), TOS_REG); |
1117 __ CompareRoot(rax, Heap::kUndefinedValueRootIndex); | 1127 __ CompareRoot(rax, Heap::kUndefinedValueRootIndex); |
1118 __ j(equal, loop_statement.continue_label()); | 1128 __ j(equal, loop_statement.continue_label()); |
1119 __ movp(rbx, rax); | 1129 __ movp(rbx, rax); |
(...skipping 3605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4725 Assembler::target_address_at(call_target_address, | 4735 Assembler::target_address_at(call_target_address, |
4726 unoptimized_code)); | 4736 unoptimized_code)); |
4727 return OSR_AFTER_STACK_CHECK; | 4737 return OSR_AFTER_STACK_CHECK; |
4728 } | 4738 } |
4729 | 4739 |
4730 | 4740 |
4731 } // namespace internal | 4741 } // namespace internal |
4732 } // namespace v8 | 4742 } // namespace v8 |
4733 | 4743 |
4734 #endif // V8_TARGET_ARCH_X64 | 4744 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |