Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: src/full-codegen/ia32/full-codegen-ia32.cc

Issue 1638303008: [for-in] Ensure that we learn from deopts within for-in loop bodies. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after
1040 __ jmp(&loop); 1040 __ jmp(&loop);
1041 1041
1042 __ bind(&no_descriptors); 1042 __ bind(&no_descriptors);
1043 __ add(esp, Immediate(kPointerSize)); 1043 __ add(esp, Immediate(kPointerSize));
1044 __ jmp(&exit); 1044 __ jmp(&exit);
1045 1045
1046 // We got a fixed array in register eax. Iterate through that. 1046 // We got a fixed array in register eax. Iterate through that.
1047 __ bind(&fixed_array); 1047 __ bind(&fixed_array);
1048 1048
1049 // No need for a write barrier, we are storing a Smi in the feedback vector. 1049 // No need for a write barrier, we are storing a Smi in the feedback vector.
1050 int const vector_index = SmiFromSlot(slot)->value();
1050 __ EmitLoadTypeFeedbackVector(ebx); 1051 __ EmitLoadTypeFeedbackVector(ebx);
1051 int vector_index = SmiFromSlot(slot)->value();
1052 __ mov(FieldOperand(ebx, FixedArray::OffsetOfElementAt(vector_index)), 1052 __ mov(FieldOperand(ebx, FixedArray::OffsetOfElementAt(vector_index)),
1053 Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate()))); 1053 Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate())));
1054 __ push(Immediate(Smi::FromInt(1))); // Smi(1) indicates slow check 1054 __ push(Immediate(Smi::FromInt(1))); // Smi(1) indicates slow check
1055 __ push(eax); // Array 1055 __ push(eax); // Array
1056 __ mov(eax, FieldOperand(eax, FixedArray::kLengthOffset)); 1056 __ mov(eax, FieldOperand(eax, FixedArray::kLengthOffset));
1057 __ push(eax); // Fixed array length (as smi). 1057 __ push(eax); // Fixed array length (as smi).
1058 PrepareForBailoutForId(stmt->PrepareId(), NO_REGISTERS); 1058 PrepareForBailoutForId(stmt->PrepareId(), NO_REGISTERS);
1059 __ push(Immediate(Smi::FromInt(0))); // Initial index. 1059 __ push(Immediate(Smi::FromInt(0))); // Initial index.
1060 1060
1061 // Generate code for doing the condition check. 1061 // Generate code for doing the condition check.
(...skipping 12 matching lines...) Expand all
1074 // permanent slow case into register edx. 1074 // permanent slow case into register edx.
1075 __ mov(edx, Operand(esp, 3 * kPointerSize)); 1075 __ mov(edx, Operand(esp, 3 * kPointerSize));
1076 1076
1077 // Check if the expected map still matches that of the enumerable. 1077 // Check if the expected map still matches that of the enumerable.
1078 // If not, we may have to filter the key. 1078 // If not, we may have to filter the key.
1079 Label update_each; 1079 Label update_each;
1080 __ mov(ecx, Operand(esp, 4 * kPointerSize)); 1080 __ mov(ecx, Operand(esp, 4 * kPointerSize));
1081 __ cmp(edx, FieldOperand(ecx, HeapObject::kMapOffset)); 1081 __ cmp(edx, FieldOperand(ecx, HeapObject::kMapOffset));
1082 __ j(equal, &update_each, Label::kNear); 1082 __ j(equal, &update_each, Label::kNear);
1083 1083
1084 // We might get here from TurboFan or Crankshaft when something in the
1085 // for-in loop body deopts and only now notice in fullcodegen, that we
1086 // can now longer use the enum cache, i.e. left fast mode. So better record
1087 // this information here, in case we later OSR back into this loop or
1088 // reoptimize the whole function w/o rerunning the loop with the slow
1089 // mode object in fullcodegen (which would result in a deopt loop).
1090 __ EmitLoadTypeFeedbackVector(edx);
1091 __ mov(FieldOperand(edx, FixedArray::OffsetOfElementAt(vector_index)),
1092 Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate())));
1093
1084 // Convert the entry to a string or null if it isn't a property 1094 // Convert the entry to a string or null if it isn't a property
1085 // anymore. If the property has been removed while iterating, we 1095 // anymore. If the property has been removed while iterating, we
1086 // just skip it. 1096 // just skip it.
1087 __ push(ecx); // Enumerable. 1097 __ push(ecx); // Enumerable.
1088 __ push(ebx); // Current entry. 1098 __ push(ebx); // Current entry.
1089 __ CallRuntime(Runtime::kForInFilter); 1099 __ CallRuntime(Runtime::kForInFilter);
1090 PrepareForBailoutForId(stmt->FilterId(), TOS_REG); 1100 PrepareForBailoutForId(stmt->FilterId(), TOS_REG);
1091 __ cmp(eax, isolate()->factory()->undefined_value()); 1101 __ cmp(eax, isolate()->factory()->undefined_value());
1092 __ j(equal, loop_statement.continue_label()); 1102 __ j(equal, loop_statement.continue_label());
1093 __ mov(ebx, eax); 1103 __ mov(ebx, eax);
(...skipping 3628 matching lines...) Expand 10 before | Expand all | Expand 10 after
4722 Assembler::target_address_at(call_target_address, 4732 Assembler::target_address_at(call_target_address,
4723 unoptimized_code)); 4733 unoptimized_code));
4724 return OSR_AFTER_STACK_CHECK; 4734 return OSR_AFTER_STACK_CHECK;
4725 } 4735 }
4726 4736
4727 4737
4728 } // namespace internal 4738 } // namespace internal
4729 } // namespace v8 4739 } // namespace v8
4730 4740
4731 #endif // V8_TARGET_ARCH_IA32 4741 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/full-codegen/arm64/full-codegen-arm64.cc ('k') | src/full-codegen/mips/full-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698