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

Side by Side Diff: src/compiler/arm64/code-generator-arm64.cc

Issue 892513003: [turbofan] Initial support for Switch. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix Wuschelstudio build. Created 5 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
« no previous file with comments | « src/compiler/arm/code-generator-arm.cc ('k') | src/compiler/code-generator.h » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 #include "src/compiler/code-generator.h" 5 #include "src/compiler/code-generator.h"
6 6
7 #include "src/arm64/macro-assembler-arm64.h" 7 #include "src/arm64/macro-assembler-arm64.h"
8 #include "src/compiler/code-generator-impl.h" 8 #include "src/compiler/code-generator-impl.h"
9 #include "src/compiler/gap-resolver.h" 9 #include "src/compiler/gap-resolver.h"
10 #include "src/compiler/node-matchers.h" 10 #include "src/compiler/node-matchers.h"
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 __ Assert(eq, kWrongFunctionContext); 350 __ Assert(eq, kWrongFunctionContext);
351 } 351 }
352 __ Ldr(x10, FieldMemOperand(func, JSFunction::kCodeEntryOffset)); 352 __ Ldr(x10, FieldMemOperand(func, JSFunction::kCodeEntryOffset));
353 __ Call(x10); 353 __ Call(x10);
354 AddSafepointAndDeopt(instr); 354 AddSafepointAndDeopt(instr);
355 break; 355 break;
356 } 356 }
357 case kArchJmp: 357 case kArchJmp:
358 AssembleArchJump(i.InputRpo(0)); 358 AssembleArchJump(i.InputRpo(0));
359 break; 359 break;
360 case kArchSwitch:
361 AssembleArchSwitch(instr);
362 break;
360 case kArchNop: 363 case kArchNop:
361 // don't emit code for nops. 364 // don't emit code for nops.
362 break; 365 break;
363 case kArchRet: 366 case kArchRet:
364 AssembleReturn(); 367 AssembleReturn();
365 break; 368 break;
366 case kArchStackPointer: 369 case kArchStackPointer:
367 __ mov(i.OutputRegister(), masm()->StackPointer()); 370 __ mov(i.OutputRegister(), masm()->StackPointer());
368 break; 371 break;
369 case kArchTruncateDoubleToI: 372 case kArchTruncateDoubleToI:
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 } 834 }
832 if (!branch->fallthru) __ B(flabel); // no fallthru to flabel. 835 if (!branch->fallthru) __ B(flabel); // no fallthru to flabel.
833 } 836 }
834 837
835 838
836 void CodeGenerator::AssembleArchJump(BasicBlock::RpoNumber target) { 839 void CodeGenerator::AssembleArchJump(BasicBlock::RpoNumber target) {
837 if (!IsNextInAssemblyOrder(target)) __ B(GetLabel(target)); 840 if (!IsNextInAssemblyOrder(target)) __ B(GetLabel(target));
838 } 841 }
839 842
840 843
844 void CodeGenerator::AssembleArchSwitch(Instruction* instr) {
845 Arm64OperandConverter i(this, instr);
846 UseScratchRegisterScope scope(masm());
847 Register reg = i.InputRegister(0);
848 Register tmp = scope.AcquireX();
849 Label table;
850 __ Adr(tmp, &table);
851 __ Add(tmp, tmp, Operand(reg, LSL, 2));
852 __ Br(tmp);
853 __ Bind(&table);
854 for (size_t index = 1; index < instr->InputCount(); ++index) {
855 __ B(GetLabel(i.InputRpo(index)));
856 }
857 }
858
859
841 // Assemble boolean materializations after this instruction. 860 // Assemble boolean materializations after this instruction.
842 void CodeGenerator::AssembleArchBoolean(Instruction* instr, 861 void CodeGenerator::AssembleArchBoolean(Instruction* instr,
843 FlagsCondition condition) { 862 FlagsCondition condition) {
844 Arm64OperandConverter i(this, instr); 863 Arm64OperandConverter i(this, instr);
845 864
846 // Materialize a full 64-bit 1 or 0 value. The result register is always the 865 // Materialize a full 64-bit 1 or 0 value. The result register is always the
847 // last output of the instruction. 866 // last output of the instruction.
848 DCHECK_NE(0u, instr->OutputCount()); 867 DCHECK_NE(0u, instr->OutputCount());
849 Register reg = i.OutputRegister(instr->OutputCount() - 1); 868 Register reg = i.OutputRegister(instr->OutputCount() - 1);
850 Condition cc = FlagsConditionToCondition(condition); 869 Condition cc = FlagsConditionToCondition(condition);
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 __ Ldr(src, dst); 1096 __ Ldr(src, dst);
1078 __ Str(temp, dst); 1097 __ Str(temp, dst);
1079 } 1098 }
1080 } else { 1099 } else {
1081 // No other combinations are possible. 1100 // No other combinations are possible.
1082 UNREACHABLE(); 1101 UNREACHABLE();
1083 } 1102 }
1084 } 1103 }
1085 1104
1086 1105
1106 void CodeGenerator::AssembleJumpTable(Label** targets, size_t target_count) {
1107 // On 64-bit ARM we emit the jump tables inline.
1108 UNREACHABLE();
1109 }
1110
1111
1087 void CodeGenerator::AddNopForSmiCodeInlining() { __ movz(xzr, 0); } 1112 void CodeGenerator::AddNopForSmiCodeInlining() { __ movz(xzr, 0); }
1088 1113
1089 1114
1090 void CodeGenerator::EnsureSpaceForLazyDeopt() { 1115 void CodeGenerator::EnsureSpaceForLazyDeopt() {
1091 int space_needed = Deoptimizer::patch_size(); 1116 int space_needed = Deoptimizer::patch_size();
1092 if (!info()->IsStub()) { 1117 if (!info()->IsStub()) {
1093 // Ensure that we have enough space after the previous lazy-bailout 1118 // Ensure that we have enough space after the previous lazy-bailout
1094 // instruction for patching the code here. 1119 // instruction for patching the code here.
1095 intptr_t current_pc = masm()->pc_offset(); 1120 intptr_t current_pc = masm()->pc_offset();
1096 1121
(...skipping 10 matching lines...) Expand all
1107 } 1132 }
1108 } 1133 }
1109 MarkLazyDeoptSite(); 1134 MarkLazyDeoptSite();
1110 } 1135 }
1111 1136
1112 #undef __ 1137 #undef __
1113 1138
1114 } // namespace compiler 1139 } // namespace compiler
1115 } // namespace internal 1140 } // namespace internal
1116 } // namespace v8 1141 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/arm/code-generator-arm.cc ('k') | src/compiler/code-generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698