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