| 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 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1041 __ Push(rcx); // Enumeration cache. | 1041 __ Push(rcx); // Enumeration cache. |
| 1042 __ Push(rdx); // Number of valid entries for the map in the enum cache. | 1042 __ Push(rdx); // Number of valid entries for the map in the enum cache. |
| 1043 __ Push(Smi::FromInt(0)); // Initial index. | 1043 __ Push(Smi::FromInt(0)); // Initial index. |
| 1044 __ jmp(&loop); | 1044 __ jmp(&loop); |
| 1045 | 1045 |
| 1046 __ bind(&no_descriptors); | 1046 __ bind(&no_descriptors); |
| 1047 __ addp(rsp, Immediate(kPointerSize)); | 1047 __ addp(rsp, Immediate(kPointerSize)); |
| 1048 __ jmp(&exit); | 1048 __ jmp(&exit); |
| 1049 | 1049 |
| 1050 // We got a fixed array in register rax. Iterate through that. | 1050 // We got a fixed array in register rax. Iterate through that. |
| 1051 Label non_proxy; | |
| 1052 __ bind(&fixed_array); | 1051 __ bind(&fixed_array); |
| 1053 | 1052 |
| 1054 // No need for a write barrier, we are storing a Smi in the feedback vector. | 1053 // No need for a write barrier, we are storing a Smi in the feedback vector. |
| 1055 __ EmitLoadTypeFeedbackVector(rbx); | 1054 __ EmitLoadTypeFeedbackVector(rbx); |
| 1056 int vector_index = SmiFromSlot(slot)->value(); | 1055 int vector_index = SmiFromSlot(slot)->value(); |
| 1057 __ Move(FieldOperand(rbx, FixedArray::OffsetOfElementAt(vector_index)), | 1056 __ Move(FieldOperand(rbx, FixedArray::OffsetOfElementAt(vector_index)), |
| 1058 TypeFeedbackVector::MegamorphicSentinel(isolate())); | 1057 TypeFeedbackVector::MegamorphicSentinel(isolate())); |
| 1059 __ Move(rbx, Smi::FromInt(1)); // Smi indicates slow check | |
| 1060 __ movp(rcx, Operand(rsp, 0 * kPointerSize)); // Get enumerated object | 1058 __ movp(rcx, Operand(rsp, 0 * kPointerSize)); // Get enumerated object |
| 1061 STATIC_ASSERT(JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE); | 1059 __ Push(Smi::FromInt(1)); // Smi(1) indicates slow check |
| 1062 __ CmpObjectType(rcx, JS_PROXY_TYPE, rcx); | |
| 1063 __ j(above, &non_proxy); | |
| 1064 __ Move(rbx, Smi::FromInt(0)); // Zero indicates proxy | |
| 1065 __ bind(&non_proxy); | |
| 1066 __ Push(rbx); // Smi | |
| 1067 __ Push(rax); // Array | 1060 __ Push(rax); // Array |
| 1068 __ movp(rax, FieldOperand(rax, FixedArray::kLengthOffset)); | 1061 __ movp(rax, FieldOperand(rax, FixedArray::kLengthOffset)); |
| 1069 __ Push(rax); // Fixed array length (as smi). | 1062 __ Push(rax); // Fixed array length (as smi). |
| 1070 __ Push(Smi::FromInt(0)); // Initial index. | 1063 __ Push(Smi::FromInt(0)); // Initial index. |
| 1071 | 1064 |
| 1072 // Generate code for doing the condition check. | 1065 // Generate code for doing the condition check. |
| 1073 __ bind(&loop); | 1066 __ bind(&loop); |
| 1074 SetExpressionAsStatementPosition(stmt->each()); | 1067 SetExpressionAsStatementPosition(stmt->each()); |
| 1075 | 1068 |
| 1076 __ movp(rax, Operand(rsp, 0 * kPointerSize)); // Get the current index. | 1069 __ movp(rax, Operand(rsp, 0 * kPointerSize)); // Get the current index. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1089 // permanent slow case into register rdx. | 1082 // permanent slow case into register rdx. |
| 1090 __ movp(rdx, Operand(rsp, 3 * kPointerSize)); | 1083 __ movp(rdx, Operand(rsp, 3 * kPointerSize)); |
| 1091 | 1084 |
| 1092 // Check if the expected map still matches that of the enumerable. | 1085 // Check if the expected map still matches that of the enumerable. |
| 1093 // If not, we may have to filter the key. | 1086 // If not, we may have to filter the key. |
| 1094 Label update_each; | 1087 Label update_each; |
| 1095 __ movp(rcx, Operand(rsp, 4 * kPointerSize)); | 1088 __ movp(rcx, Operand(rsp, 4 * kPointerSize)); |
| 1096 __ cmpp(rdx, FieldOperand(rcx, HeapObject::kMapOffset)); | 1089 __ cmpp(rdx, FieldOperand(rcx, HeapObject::kMapOffset)); |
| 1097 __ j(equal, &update_each, Label::kNear); | 1090 __ j(equal, &update_each, Label::kNear); |
| 1098 | 1091 |
| 1099 // For proxies, no filtering is done. | |
| 1100 // TODO(rossberg): What if only a prototype is a proxy? Not specified yet. | |
| 1101 __ Cmp(rdx, Smi::FromInt(0)); | |
| 1102 __ j(equal, &update_each, Label::kNear); | |
| 1103 | |
| 1104 // Convert the entry to a string or null if it isn't a property | 1092 // Convert the entry to a string or null if it isn't a property |
| 1105 // anymore. If the property has been removed while iterating, we | 1093 // anymore. If the property has been removed while iterating, we |
| 1106 // just skip it. | 1094 // just skip it. |
| 1107 __ Push(rcx); // Enumerable. | 1095 __ Push(rcx); // Enumerable. |
| 1108 __ Push(rbx); // Current entry. | 1096 __ Push(rbx); // Current entry. |
| 1109 __ CallRuntime(Runtime::kForInFilter, 2); | 1097 __ CallRuntime(Runtime::kForInFilter, 2); |
| 1110 PrepareForBailoutForId(stmt->FilterId(), TOS_REG); | 1098 PrepareForBailoutForId(stmt->FilterId(), TOS_REG); |
| 1111 __ CompareRoot(rax, Heap::kUndefinedValueRootIndex); | 1099 __ CompareRoot(rax, Heap::kUndefinedValueRootIndex); |
| 1112 __ j(equal, loop_statement.continue_label()); | 1100 __ j(equal, loop_statement.continue_label()); |
| 1113 __ movp(rbx, rax); | 1101 __ movp(rbx, rax); |
| (...skipping 3717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4831 Assembler::target_address_at(call_target_address, | 4819 Assembler::target_address_at(call_target_address, |
| 4832 unoptimized_code)); | 4820 unoptimized_code)); |
| 4833 return OSR_AFTER_STACK_CHECK; | 4821 return OSR_AFTER_STACK_CHECK; |
| 4834 } | 4822 } |
| 4835 | 4823 |
| 4836 | 4824 |
| 4837 } // namespace internal | 4825 } // namespace internal |
| 4838 } // namespace v8 | 4826 } // namespace v8 |
| 4839 | 4827 |
| 4840 #endif // V8_TARGET_ARCH_X64 | 4828 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |