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