Index: src/ia32/full-codegen-ia32.cc |
diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc |
index 75253c07a462c60b461e7d0d32498fc667870762..217a81e6f9dfb11bcc8e1db847dca75327959b5b 100644 |
--- a/src/ia32/full-codegen-ia32.cc |
+++ b/src/ia32/full-codegen-ia32.cc |
@@ -1089,18 +1089,29 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { |
// We got a map in register eax. Get the enumeration cache from it. |
__ bind(&use_cache); |
+ |
+ Label no_descriptors; |
Michael Starzinger
2012/08/06 15:06:22
Move this up above the __ bind() but below the com
Toon Verwaest
2012/08/07 10:49:47
Done.
|
+ |
+ __ EnumLength(edx, eax); |
+ __ cmp(edx, Immediate(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. |
+ __ SmiTag(edx); |
+ __ 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); |