Index: src/ia32/full-codegen-ia32.cc |
diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc |
index 9ba5f87603482a0b01094db8cd9e35e19aead69e..64400de81d1f1eeca8f8c950b53a5b60ab17c9b4 100644 |
--- a/src/ia32/full-codegen-ia32.cc |
+++ b/src/ia32/full-codegen-ia32.cc |
@@ -1091,19 +1091,28 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { |
// We got a map in register eax. Get the enumeration cache from it. |
+ Label no_descriptors; |
__ bind(&use_cache); |
+ |
+ __ EnumLength(edx, eax); |
+ __ cmp(edx, Immediate(Smi::FromInt(0))); |
+ __ j(equal, &no_descriptors); |
+ |
__ LoadInstanceDescriptors(eax, ecx); |
__ mov(ecx, FieldOperand(ecx, DescriptorArray::kEnumCacheOffset)); |
- __ mov(edx, FieldOperand(ecx, DescriptorArray::kEnumCacheBridgeCacheOffset)); |
+ __ mov(ecx, FieldOperand(ecx, DescriptorArray::kEnumCacheBridgeCacheOffset)); |
// Set up the four remaining stack slots. |
__ push(eax); // Map. |
- __ push(edx); // Enumeration cache. |
- __ mov(eax, FieldOperand(edx, FixedArray::kLengthOffset)); |
- __ push(eax); // Enumeration cache length (as smi). |
+ __ push(ecx); // Enumeration cache. |
+ __ push(edx); // Number of valid entries for the map in the enum cache. |
__ push(Immediate(Smi::FromInt(0))); // Initial index. |
__ jmp(&loop); |
+ __ bind(&no_descriptors); |
+ __ add(esp, Immediate(kPointerSize)); |
+ __ jmp(&exit); |
+ |
// We got a fixed array in register eax. Iterate through that. |
Label non_proxy; |
__ bind(&fixed_array); |