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 990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1001 __ push(Immediate(Smi::FromInt(0))); // Initial index. | 1001 __ push(Immediate(Smi::FromInt(0))); // Initial index. |
1002 __ jmp(&loop); | 1002 __ jmp(&loop); |
1003 | 1003 |
1004 __ bind(&no_descriptors); | 1004 __ bind(&no_descriptors); |
1005 __ add(esp, Immediate(kPointerSize)); | 1005 __ add(esp, Immediate(kPointerSize)); |
1006 __ jmp(&exit); | 1006 __ jmp(&exit); |
1007 | 1007 |
1008 // We got a fixed array in register eax. Iterate through that. | 1008 // We got a fixed array in register eax. Iterate through that. |
1009 __ bind(&fixed_array); | 1009 __ bind(&fixed_array); |
1010 | 1010 |
1011 // No need for a write barrier, we are storing a Smi in the feedback vector. | |
1012 int const vector_index = SmiFromSlot(slot)->value(); | |
1013 __ EmitLoadTypeFeedbackVector(ebx); | |
1014 __ mov(FieldOperand(ebx, FixedArray::OffsetOfElementAt(vector_index)), | |
1015 Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate()))); | |
1016 __ push(Immediate(Smi::FromInt(1))); // Smi(1) indicates slow check | 1011 __ push(Immediate(Smi::FromInt(1))); // Smi(1) indicates slow check |
1017 __ push(eax); // Array | 1012 __ push(eax); // Array |
1018 __ mov(eax, FieldOperand(eax, FixedArray::kLengthOffset)); | 1013 __ mov(eax, FieldOperand(eax, FixedArray::kLengthOffset)); |
1019 __ push(eax); // Fixed array length (as smi). | 1014 __ push(eax); // Fixed array length (as smi). |
1020 PrepareForBailoutForId(stmt->PrepareId(), NO_REGISTERS); | 1015 PrepareForBailoutForId(stmt->PrepareId(), NO_REGISTERS); |
1021 __ push(Immediate(Smi::FromInt(0))); // Initial index. | 1016 __ push(Immediate(Smi::FromInt(0))); // Initial index. |
1022 | 1017 |
1023 // Generate code for doing the condition check. | 1018 // Generate code for doing the condition check. |
1024 __ bind(&loop); | 1019 __ bind(&loop); |
1025 SetExpressionAsStatementPosition(stmt->each()); | 1020 SetExpressionAsStatementPosition(stmt->each()); |
(...skipping 10 matching lines...) Expand all Loading... |
1036 // permanent slow case into register edx. | 1031 // permanent slow case into register edx. |
1037 __ mov(edx, Operand(esp, 3 * kPointerSize)); | 1032 __ mov(edx, Operand(esp, 3 * kPointerSize)); |
1038 | 1033 |
1039 // Check if the expected map still matches that of the enumerable. | 1034 // Check if the expected map still matches that of the enumerable. |
1040 // If not, we may have to filter the key. | 1035 // If not, we may have to filter the key. |
1041 Label update_each; | 1036 Label update_each; |
1042 __ mov(ecx, Operand(esp, 4 * kPointerSize)); | 1037 __ mov(ecx, Operand(esp, 4 * kPointerSize)); |
1043 __ cmp(edx, FieldOperand(ecx, HeapObject::kMapOffset)); | 1038 __ cmp(edx, FieldOperand(ecx, HeapObject::kMapOffset)); |
1044 __ j(equal, &update_each, Label::kNear); | 1039 __ j(equal, &update_each, Label::kNear); |
1045 | 1040 |
1046 // We might get here from TurboFan or Crankshaft when something in the | 1041 // We need to filter the key, record slow-path here. |
1047 // for-in loop body deopts and only now notice in fullcodegen, that we | 1042 int const vector_index = SmiFromSlot(slot)->value(); |
1048 // can now longer use the enum cache, i.e. left fast mode. So better record | |
1049 // this information here, in case we later OSR back into this loop or | |
1050 // reoptimize the whole function w/o rerunning the loop with the slow | |
1051 // mode object in fullcodegen (which would result in a deopt loop). | |
1052 __ EmitLoadTypeFeedbackVector(edx); | 1043 __ EmitLoadTypeFeedbackVector(edx); |
1053 __ mov(FieldOperand(edx, FixedArray::OffsetOfElementAt(vector_index)), | 1044 __ mov(FieldOperand(edx, FixedArray::OffsetOfElementAt(vector_index)), |
1054 Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate()))); | 1045 Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate()))); |
1055 | 1046 |
1056 // Convert the entry to a string or null if it isn't a property | 1047 // Convert the entry to a string or null if it isn't a property |
1057 // anymore. If the property has been removed while iterating, we | 1048 // anymore. If the property has been removed while iterating, we |
1058 // just skip it. | 1049 // just skip it. |
1059 __ push(ecx); // Enumerable. | 1050 __ push(ecx); // Enumerable. |
1060 __ push(ebx); // Current entry. | 1051 __ push(ebx); // Current entry. |
1061 __ CallRuntime(Runtime::kForInFilter); | 1052 __ CallRuntime(Runtime::kForInFilter); |
(...skipping 3031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4093 Assembler::target_address_at(call_target_address, | 4084 Assembler::target_address_at(call_target_address, |
4094 unoptimized_code)); | 4085 unoptimized_code)); |
4095 return OSR_AFTER_STACK_CHECK; | 4086 return OSR_AFTER_STACK_CHECK; |
4096 } | 4087 } |
4097 | 4088 |
4098 | 4089 |
4099 } // namespace internal | 4090 } // namespace internal |
4100 } // namespace v8 | 4091 } // namespace v8 |
4101 | 4092 |
4102 #endif // V8_TARGET_ARCH_IA32 | 4093 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |