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

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

Issue 2151773002: Avoid jumping to the runtime for ForInFilter (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: remove double label Created 4 years, 5 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/crankshaft/hydrogen.cc ('k') | src/full-codegen/arm64/full-codegen-arm64.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_ARM 5 #if V8_TARGET_ARCH_ARM
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 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 1075
1076 // Generate code for doing the condition check. 1076 // Generate code for doing the condition check.
1077 __ bind(&loop); 1077 __ bind(&loop);
1078 SetExpressionAsStatementPosition(stmt->each()); 1078 SetExpressionAsStatementPosition(stmt->each());
1079 1079
1080 // Load the current count to r0, load the length to r1. 1080 // Load the current count to r0, load the length to r1.
1081 __ Ldrd(r0, r1, MemOperand(sp, 0 * kPointerSize)); 1081 __ Ldrd(r0, r1, MemOperand(sp, 0 * kPointerSize));
1082 __ cmp(r0, r1); // Compare to the array length. 1082 __ cmp(r0, r1); // Compare to the array length.
1083 __ b(hs, loop_statement.break_label()); 1083 __ b(hs, loop_statement.break_label());
1084 1084
1085 // Get the current entry of the array into register r3. 1085 // Get the current entry of the array into register r0.
1086 __ ldr(r2, MemOperand(sp, 2 * kPointerSize)); 1086 __ ldr(r2, MemOperand(sp, 2 * kPointerSize));
1087 __ add(r2, r2, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 1087 __ add(r2, r2, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
1088 __ ldr(r3, MemOperand::PointerAddressFromSmiKey(r2, r0)); 1088 __ ldr(r0, MemOperand::PointerAddressFromSmiKey(r2, r0));
1089 1089
1090 // Get the expected map from the stack or a smi in the 1090 // Get the expected map from the stack or a smi in the
1091 // permanent slow case into register r2. 1091 // permanent slow case into register r2.
1092 __ ldr(r2, MemOperand(sp, 3 * kPointerSize)); 1092 __ ldr(r2, MemOperand(sp, 3 * kPointerSize));
1093 1093
1094 // Check if the expected map still matches that of the enumerable. 1094 // Check if the expected map still matches that of the enumerable.
1095 // If not, we may have to filter the key. 1095 // If not, we may have to filter the key.
1096 Label update_each; 1096 Label update_each;
1097 __ ldr(r1, MemOperand(sp, 4 * kPointerSize)); 1097 __ ldr(r1, MemOperand(sp, 4 * kPointerSize));
1098 __ ldr(r4, FieldMemOperand(r1, HeapObject::kMapOffset)); 1098 __ ldr(r4, FieldMemOperand(r1, HeapObject::kMapOffset));
1099 __ cmp(r4, Operand(r2)); 1099 __ cmp(r4, Operand(r2));
1100 __ b(eq, &update_each); 1100 __ b(eq, &update_each);
1101 1101
1102 // We need to filter the key, record slow-path here. 1102 // We need to filter the key, record slow-path here.
1103 int const vector_index = SmiFromSlot(slot)->value(); 1103 int const vector_index = SmiFromSlot(slot)->value();
1104 __ EmitLoadTypeFeedbackVector(r0); 1104 __ EmitLoadTypeFeedbackVector(r3);
1105 __ mov(r2, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate()))); 1105 __ mov(r2, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate())));
1106 __ str(r2, FieldMemOperand(r0, FixedArray::OffsetOfElementAt(vector_index))); 1106 __ str(r2, FieldMemOperand(r3, FixedArray::OffsetOfElementAt(vector_index)));
1107 1107
1108 // Convert the entry to a string or (smi) 0 if it isn't a property 1108 // r0 contains the key. The receiver in r1 is the second argument to the
1109 // any more. If the property has been removed while iterating, we 1109 // ForInFilterStub. ForInFilter returns undefined if the receiver doesn't
1110 // just skip it. 1110 // have the key or returns the name-converted key.
1111 __ push(r1); // Enumerable. 1111 ForInFilterStub filter_stub(isolate());
1112 __ push(r3); // Current entry. 1112 __ CallStub(&filter_stub);
1113 __ CallRuntime(Runtime::kForInFilter); 1113 RestoreContext();
1114 PrepareForBailoutForId(stmt->FilterId(), BailoutState::TOS_REGISTER); 1114 PrepareForBailoutForId(stmt->FilterId(), BailoutState::TOS_REGISTER);
1115 __ mov(r3, Operand(r0)); 1115 __ CompareRoot(result_register(), Heap::kUndefinedValueRootIndex);
1116 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
1117 __ cmp(r0, ip);
1118 __ b(eq, loop_statement.continue_label()); 1116 __ b(eq, loop_statement.continue_label());
1119 1117
1120 // Update the 'each' property or variable from the possibly filtered 1118 // Update the 'each' property or variable from the possibly filtered
1121 // entry in register r3. 1119 // entry in register r0.
1122 __ bind(&update_each); 1120 __ bind(&update_each);
1123 __ mov(result_register(), r3); 1121
1124 // Perform the assignment as if via '='. 1122 // Perform the assignment as if via '='.
1125 { EffectContext context(this); 1123 { EffectContext context(this);
1126 EmitAssignment(stmt->each(), stmt->EachFeedbackSlot()); 1124 EmitAssignment(stmt->each(), stmt->EachFeedbackSlot());
1127 PrepareForBailoutForId(stmt->AssignmentId(), BailoutState::NO_REGISTERS); 1125 PrepareForBailoutForId(stmt->AssignmentId(), BailoutState::NO_REGISTERS);
1128 } 1126 }
1129 1127
1130 // Both Crankshaft and Turbofan expect BodyId to be right before stmt->body(). 1128 // Both Crankshaft and Turbofan expect BodyId to be right before stmt->body().
1131 PrepareForBailoutForId(stmt->BodyId(), BailoutState::NO_REGISTERS); 1129 PrepareForBailoutForId(stmt->BodyId(), BailoutState::NO_REGISTERS);
1132 // Generate code for the body of the loop. 1130 // Generate code for the body of the loop.
1133 Visit(stmt->body()); 1131 Visit(stmt->body());
(...skipping 2712 matching lines...) Expand 10 before | Expand all | Expand 10 after
3846 DCHECK(interrupt_address == 3844 DCHECK(interrupt_address ==
3847 isolate->builtins()->OnStackReplacement()->entry()); 3845 isolate->builtins()->OnStackReplacement()->entry());
3848 return ON_STACK_REPLACEMENT; 3846 return ON_STACK_REPLACEMENT;
3849 } 3847 }
3850 3848
3851 3849
3852 } // namespace internal 3850 } // namespace internal
3853 } // namespace v8 3851 } // namespace v8
3854 3852
3855 #endif // V8_TARGET_ARCH_ARM 3853 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/crankshaft/hydrogen.cc ('k') | src/full-codegen/arm64/full-codegen-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698