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

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

Issue 1512143005: [WIP] Proxy fix for for-in. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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/compiler/js-typed-lowering.cc ('k') | no next file » | 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 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 __ Push(rcx); // Enumeration cache. 1041 __ Push(rcx); // Enumeration cache.
1042 __ Push(rdx); // Number of valid entries for the map in the enum cache. 1042 __ Push(rdx); // Number of valid entries for the map in the enum cache.
1043 __ Push(Smi::FromInt(0)); // Initial index. 1043 __ Push(Smi::FromInt(0)); // Initial index.
1044 __ jmp(&loop); 1044 __ jmp(&loop);
1045 1045
1046 __ bind(&no_descriptors); 1046 __ bind(&no_descriptors);
1047 __ addp(rsp, Immediate(kPointerSize)); 1047 __ addp(rsp, Immediate(kPointerSize));
1048 __ jmp(&exit); 1048 __ jmp(&exit);
1049 1049
1050 // We got a fixed array in register rax. Iterate through that. 1050 // We got a fixed array in register rax. Iterate through that.
1051 Label non_proxy;
1052 __ bind(&fixed_array); 1051 __ bind(&fixed_array);
1053 1052
1054 // No need for a write barrier, we are storing a Smi in the feedback vector. 1053 // No need for a write barrier, we are storing a Smi in the feedback vector.
1055 __ EmitLoadTypeFeedbackVector(rbx); 1054 __ EmitLoadTypeFeedbackVector(rbx);
1056 int vector_index = SmiFromSlot(slot)->value(); 1055 int vector_index = SmiFromSlot(slot)->value();
1057 __ Move(FieldOperand(rbx, FixedArray::OffsetOfElementAt(vector_index)), 1056 __ Move(FieldOperand(rbx, FixedArray::OffsetOfElementAt(vector_index)),
1058 TypeFeedbackVector::MegamorphicSentinel(isolate())); 1057 TypeFeedbackVector::MegamorphicSentinel(isolate()));
1059 __ Move(rbx, Smi::FromInt(1)); // Smi indicates slow check 1058 __ Move(rbx, Smi::FromInt(0)); // Smi indicates slow check
1060 __ movp(rcx, Operand(rsp, 0 * kPointerSize)); // Get enumerated object 1059 __ movp(rcx, Operand(rsp, 0 * kPointerSize)); // Get enumerated object
1061 STATIC_ASSERT(JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
1062 __ CmpObjectType(rcx, JS_PROXY_TYPE, rcx);
1063 __ j(above, &non_proxy);
1064 __ Move(rbx, Smi::FromInt(0)); // Zero indicates proxy
1065 __ bind(&non_proxy);
1066 __ Push(rbx); // Smi 1060 __ Push(rbx); // Smi
1067 __ Push(rax); // Array 1061 __ Push(rax); // Array
1068 __ movp(rax, FieldOperand(rax, FixedArray::kLengthOffset)); 1062 __ movp(rax, FieldOperand(rax, FixedArray::kLengthOffset));
1069 __ Push(rax); // Fixed array length (as smi). 1063 __ Push(rax); // Fixed array length (as smi).
1070 __ Push(Smi::FromInt(0)); // Initial index. 1064 __ Push(Smi::FromInt(0)); // Initial index.
1071 1065
1072 // Generate code for doing the condition check. 1066 // Generate code for doing the condition check.
1073 __ bind(&loop); 1067 __ bind(&loop);
1074 SetExpressionAsStatementPosition(stmt->each()); 1068 SetExpressionAsStatementPosition(stmt->each());
1075 1069
(...skipping 13 matching lines...) Expand all
1089 // permanent slow case into register rdx. 1083 // permanent slow case into register rdx.
1090 __ movp(rdx, Operand(rsp, 3 * kPointerSize)); 1084 __ movp(rdx, Operand(rsp, 3 * kPointerSize));
1091 1085
1092 // Check if the expected map still matches that of the enumerable. 1086 // Check if the expected map still matches that of the enumerable.
1093 // If not, we may have to filter the key. 1087 // If not, we may have to filter the key.
1094 Label update_each; 1088 Label update_each;
1095 __ movp(rcx, Operand(rsp, 4 * kPointerSize)); 1089 __ movp(rcx, Operand(rsp, 4 * kPointerSize));
1096 __ cmpp(rdx, FieldOperand(rcx, HeapObject::kMapOffset)); 1090 __ cmpp(rdx, FieldOperand(rcx, HeapObject::kMapOffset));
1097 __ j(equal, &update_each, Label::kNear); 1091 __ j(equal, &update_each, Label::kNear);
1098 1092
1099 // For proxies, no filtering is done.
1100 // TODO(rossberg): What if only a prototype is a proxy? Not specified yet.
1101 __ Cmp(rdx, Smi::FromInt(0));
1102 __ j(equal, &update_each, Label::kNear);
1103
1104 // Convert the entry to a string or null if it isn't a property 1093 // Convert the entry to a string or null if it isn't a property
1105 // anymore. If the property has been removed while iterating, we 1094 // anymore. If the property has been removed while iterating, we
1106 // just skip it. 1095 // just skip it.
1107 __ Push(rcx); // Enumerable. 1096 __ Push(rcx); // Enumerable.
1108 __ Push(rbx); // Current entry. 1097 __ Push(rbx); // Current entry.
1109 __ CallRuntime(Runtime::kForInFilter, 2); 1098 __ CallRuntime(Runtime::kForInFilter, 2);
1110 PrepareForBailoutForId(stmt->FilterId(), TOS_REG); 1099 PrepareForBailoutForId(stmt->FilterId(), TOS_REG);
1111 __ CompareRoot(rax, Heap::kUndefinedValueRootIndex); 1100 __ CompareRoot(rax, Heap::kUndefinedValueRootIndex);
1112 __ j(equal, loop_statement.continue_label()); 1101 __ j(equal, loop_statement.continue_label());
1113 __ movp(rbx, rax); 1102 __ movp(rbx, rax);
(...skipping 3717 matching lines...) Expand 10 before | Expand all | Expand 10 after
4831 Assembler::target_address_at(call_target_address, 4820 Assembler::target_address_at(call_target_address,
4832 unoptimized_code)); 4821 unoptimized_code));
4833 return OSR_AFTER_STACK_CHECK; 4822 return OSR_AFTER_STACK_CHECK;
4834 } 4823 }
4835 4824
4836 4825
4837 } // namespace internal 4826 } // namespace internal
4838 } // namespace v8 4827 } // namespace v8
4839 4828
4840 #endif // V8_TARGET_ARCH_X64 4829 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/compiler/js-typed-lowering.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698