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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
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 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 __ push(ecx); // Enumeration cache. | 1019 __ push(ecx); // Enumeration cache. |
1020 __ push(edx); // Number of valid entries for the map in the enum cache. | 1020 __ push(edx); // Number of valid entries for the map in the enum cache. |
1021 __ push(Immediate(Smi::FromInt(0))); // Initial index. | 1021 __ push(Immediate(Smi::FromInt(0))); // Initial index. |
1022 __ jmp(&loop); | 1022 __ jmp(&loop); |
1023 | 1023 |
1024 __ bind(&no_descriptors); | 1024 __ bind(&no_descriptors); |
1025 __ add(esp, Immediate(kPointerSize)); | 1025 __ add(esp, Immediate(kPointerSize)); |
1026 __ jmp(&exit); | 1026 __ jmp(&exit); |
1027 | 1027 |
1028 // We got a fixed array in register eax. Iterate through that. | 1028 // We got a fixed array in register eax. Iterate through that. |
1029 Label non_proxy; | |
1030 __ bind(&fixed_array); | 1029 __ bind(&fixed_array); |
1031 | 1030 |
1032 // No need for a write barrier, we are storing a Smi in the feedback vector. | 1031 // No need for a write barrier, we are storing a Smi in the feedback vector. |
1033 __ EmitLoadTypeFeedbackVector(ebx); | 1032 __ EmitLoadTypeFeedbackVector(ebx); |
1034 int vector_index = SmiFromSlot(slot)->value(); | 1033 int vector_index = SmiFromSlot(slot)->value(); |
1035 __ mov(FieldOperand(ebx, FixedArray::OffsetOfElementAt(vector_index)), | 1034 __ mov(FieldOperand(ebx, FixedArray::OffsetOfElementAt(vector_index)), |
1036 Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate()))); | 1035 Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate()))); |
1037 | 1036 __ push(Immediate(Smi::FromInt(1))); // Smi(1) indicates slow check |
1038 __ mov(ebx, Immediate(Smi::FromInt(1))); // Smi indicates slow check | |
1039 __ mov(ecx, Operand(esp, 0 * kPointerSize)); // Get enumerated object | |
1040 STATIC_ASSERT(JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE); | |
1041 __ CmpObjectType(ecx, JS_PROXY_TYPE, ecx); | |
1042 __ j(above, &non_proxy); | |
1043 __ Move(ebx, Immediate(Smi::FromInt(0))); // Zero indicates proxy | |
1044 __ bind(&non_proxy); | |
1045 __ push(ebx); // Smi | |
1046 __ push(eax); // Array | 1037 __ push(eax); // Array |
1047 __ mov(eax, FieldOperand(eax, FixedArray::kLengthOffset)); | 1038 __ mov(eax, FieldOperand(eax, FixedArray::kLengthOffset)); |
1048 __ push(eax); // Fixed array length (as smi). | 1039 __ push(eax); // Fixed array length (as smi). |
1049 __ push(Immediate(Smi::FromInt(0))); // Initial index. | 1040 __ push(Immediate(Smi::FromInt(0))); // Initial index. |
1050 | 1041 |
1051 // Generate code for doing the condition check. | 1042 // Generate code for doing the condition check. |
1052 __ bind(&loop); | 1043 __ bind(&loop); |
1053 SetExpressionAsStatementPosition(stmt->each()); | 1044 SetExpressionAsStatementPosition(stmt->each()); |
1054 | 1045 |
1055 __ mov(eax, Operand(esp, 0 * kPointerSize)); // Get the current index. | 1046 __ mov(eax, Operand(esp, 0 * kPointerSize)); // Get the current index. |
1056 __ cmp(eax, Operand(esp, 1 * kPointerSize)); // Compare to the array length. | 1047 __ cmp(eax, Operand(esp, 1 * kPointerSize)); // Compare to the array length. |
1057 __ j(above_equal, loop_statement.break_label()); | 1048 __ j(above_equal, loop_statement.break_label()); |
1058 | 1049 |
1059 // Get the current entry of the array into register ebx. | 1050 // Get the current entry of the array into register ebx. |
1060 __ mov(ebx, Operand(esp, 2 * kPointerSize)); | 1051 __ mov(ebx, Operand(esp, 2 * kPointerSize)); |
1061 __ mov(ebx, FieldOperand(ebx, eax, times_2, FixedArray::kHeaderSize)); | 1052 __ mov(ebx, FieldOperand(ebx, eax, times_2, FixedArray::kHeaderSize)); |
1062 | 1053 |
1063 // Get the expected map from the stack or a smi in the | 1054 // Get the expected map from the stack or a smi in the |
1064 // permanent slow case into register edx. | 1055 // permanent slow case into register edx. |
1065 __ mov(edx, Operand(esp, 3 * kPointerSize)); | 1056 __ mov(edx, Operand(esp, 3 * kPointerSize)); |
1066 | 1057 |
1067 // Check if the expected map still matches that of the enumerable. | 1058 // Check if the expected map still matches that of the enumerable. |
1068 // If not, we may have to filter the key. | 1059 // If not, we may have to filter the key. |
1069 Label update_each; | 1060 Label update_each; |
1070 __ mov(ecx, Operand(esp, 4 * kPointerSize)); | 1061 __ mov(ecx, Operand(esp, 4 * kPointerSize)); |
1071 __ cmp(edx, FieldOperand(ecx, HeapObject::kMapOffset)); | 1062 __ cmp(edx, FieldOperand(ecx, HeapObject::kMapOffset)); |
1072 __ j(equal, &update_each, Label::kNear); | 1063 __ j(equal, &update_each, Label::kNear); |
1073 | 1064 |
1074 // For proxies, no filtering is done. | |
1075 // TODO(rossberg): What if only a prototype is a proxy? Not specified yet. | |
1076 DCHECK(Smi::FromInt(0) == 0); | |
1077 __ test(edx, edx); | |
1078 __ j(zero, &update_each); | |
1079 | |
1080 // Convert the entry to a string or null if it isn't a property | 1065 // Convert the entry to a string or null if it isn't a property |
1081 // anymore. If the property has been removed while iterating, we | 1066 // anymore. If the property has been removed while iterating, we |
1082 // just skip it. | 1067 // just skip it. |
1083 __ push(ecx); // Enumerable. | 1068 __ push(ecx); // Enumerable. |
1084 __ push(ebx); // Current entry. | 1069 __ push(ebx); // Current entry. |
1085 __ CallRuntime(Runtime::kForInFilter, 2); | 1070 __ CallRuntime(Runtime::kForInFilter, 2); |
1086 PrepareForBailoutForId(stmt->FilterId(), TOS_REG); | 1071 PrepareForBailoutForId(stmt->FilterId(), TOS_REG); |
1087 __ cmp(eax, isolate()->factory()->undefined_value()); | 1072 __ cmp(eax, isolate()->factory()->undefined_value()); |
1088 __ j(equal, loop_statement.continue_label()); | 1073 __ j(equal, loop_statement.continue_label()); |
1089 __ mov(ebx, eax); | 1074 __ mov(ebx, eax); |
(...skipping 3734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4824 Assembler::target_address_at(call_target_address, | 4809 Assembler::target_address_at(call_target_address, |
4825 unoptimized_code)); | 4810 unoptimized_code)); |
4826 return OSR_AFTER_STACK_CHECK; | 4811 return OSR_AFTER_STACK_CHECK; |
4827 } | 4812 } |
4828 | 4813 |
4829 | 4814 |
4830 } // namespace internal | 4815 } // namespace internal |
4831 } // namespace v8 | 4816 } // namespace v8 |
4832 | 4817 |
4833 #endif // V8_TARGET_ARCH_IA32 | 4818 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |