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

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

Issue 1749033002: [for-in] Record slow path feedback only when we hit %ForInFilter. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « src/full-codegen/ppc/full-codegen-ppc.cc ('k') | src/full-codegen/x87/full-codegen-x87.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_X64 5 #if V8_TARGET_ARCH_X64
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 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after
1022 __ Push(Smi::FromInt(0)); // Initial index. 1022 __ Push(Smi::FromInt(0)); // Initial index.
1023 __ jmp(&loop); 1023 __ jmp(&loop);
1024 1024
1025 __ bind(&no_descriptors); 1025 __ bind(&no_descriptors);
1026 __ addp(rsp, Immediate(kPointerSize)); 1026 __ addp(rsp, Immediate(kPointerSize));
1027 __ jmp(&exit); 1027 __ jmp(&exit);
1028 1028
1029 // We got a fixed array in register rax. Iterate through that. 1029 // We got a fixed array in register rax. Iterate through that.
1030 __ bind(&fixed_array); 1030 __ bind(&fixed_array);
1031 1031
1032 // No need for a write barrier, we are storing a Smi in the feedback vector.
1033 int const vector_index = SmiFromSlot(slot)->value();
1034 __ EmitLoadTypeFeedbackVector(rbx);
1035 __ Move(FieldOperand(rbx, FixedArray::OffsetOfElementAt(vector_index)),
1036 TypeFeedbackVector::MegamorphicSentinel(isolate()));
1037 __ movp(rcx, Operand(rsp, 0 * kPointerSize)); // Get enumerated object 1032 __ movp(rcx, Operand(rsp, 0 * kPointerSize)); // Get enumerated object
1038 __ Push(Smi::FromInt(1)); // Smi(1) indicates slow check 1033 __ Push(Smi::FromInt(1)); // Smi(1) indicates slow check
1039 __ Push(rax); // Array 1034 __ Push(rax); // Array
1040 __ movp(rax, FieldOperand(rax, FixedArray::kLengthOffset)); 1035 __ movp(rax, FieldOperand(rax, FixedArray::kLengthOffset));
1041 __ Push(rax); // Fixed array length (as smi). 1036 __ Push(rax); // Fixed array length (as smi).
1042 PrepareForBailoutForId(stmt->PrepareId(), NO_REGISTERS); 1037 PrepareForBailoutForId(stmt->PrepareId(), NO_REGISTERS);
1043 __ Push(Smi::FromInt(0)); // Initial index. 1038 __ Push(Smi::FromInt(0)); // Initial index.
1044 1039
1045 // Generate code for doing the condition check. 1040 // Generate code for doing the condition check.
1046 __ bind(&loop); 1041 __ bind(&loop);
(...skipping 15 matching lines...) Expand all
1062 // permanent slow case into register rdx. 1057 // permanent slow case into register rdx.
1063 __ movp(rdx, Operand(rsp, 3 * kPointerSize)); 1058 __ movp(rdx, Operand(rsp, 3 * kPointerSize));
1064 1059
1065 // Check if the expected map still matches that of the enumerable. 1060 // Check if the expected map still matches that of the enumerable.
1066 // If not, we may have to filter the key. 1061 // If not, we may have to filter the key.
1067 Label update_each; 1062 Label update_each;
1068 __ movp(rcx, Operand(rsp, 4 * kPointerSize)); 1063 __ movp(rcx, Operand(rsp, 4 * kPointerSize));
1069 __ cmpp(rdx, FieldOperand(rcx, HeapObject::kMapOffset)); 1064 __ cmpp(rdx, FieldOperand(rcx, HeapObject::kMapOffset));
1070 __ j(equal, &update_each, Label::kNear); 1065 __ j(equal, &update_each, Label::kNear);
1071 1066
1072 // We might get here from TurboFan or Crankshaft when something in the 1067 // We need to filter the key, record slow-path here.
1073 // for-in loop body deopts and only now notice in fullcodegen, that we 1068 int const vector_index = SmiFromSlot(slot)->value();
1074 // can now longer use the enum cache, i.e. left fast mode. So better record
1075 // this information here, in case we later OSR back into this loop or
1076 // reoptimize the whole function w/o rerunning the loop with the slow
1077 // mode object in fullcodegen (which would result in a deopt loop).
1078 __ EmitLoadTypeFeedbackVector(rdx); 1069 __ EmitLoadTypeFeedbackVector(rdx);
1079 __ Move(FieldOperand(rdx, FixedArray::OffsetOfElementAt(vector_index)), 1070 __ Move(FieldOperand(rdx, FixedArray::OffsetOfElementAt(vector_index)),
1080 TypeFeedbackVector::MegamorphicSentinel(isolate())); 1071 TypeFeedbackVector::MegamorphicSentinel(isolate()));
1081 1072
1082 // Convert the entry to a string or null if it isn't a property 1073 // Convert the entry to a string or null if it isn't a property
1083 // anymore. If the property has been removed while iterating, we 1074 // anymore. If the property has been removed while iterating, we
1084 // just skip it. 1075 // just skip it.
1085 __ Push(rcx); // Enumerable. 1076 __ Push(rcx); // Enumerable.
1086 __ Push(rbx); // Current entry. 1077 __ Push(rbx); // Current entry.
1087 __ CallRuntime(Runtime::kForInFilter); 1078 __ CallRuntime(Runtime::kForInFilter);
(...skipping 2991 matching lines...) Expand 10 before | Expand all | Expand 10 after
4079 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 4070 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
4080 Assembler::target_address_at(call_target_address, 4071 Assembler::target_address_at(call_target_address,
4081 unoptimized_code)); 4072 unoptimized_code));
4082 return OSR_AFTER_STACK_CHECK; 4073 return OSR_AFTER_STACK_CHECK;
4083 } 4074 }
4084 4075
4085 } // namespace internal 4076 } // namespace internal
4086 } // namespace v8 4077 } // namespace v8
4087 4078
4088 #endif // V8_TARGET_ARCH_X64 4079 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/full-codegen/ppc/full-codegen-ppc.cc ('k') | src/full-codegen/x87/full-codegen-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698