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

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

Issue 932683002: MIPS64: [turbofan] Initial support for Switch. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « no previous file | 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 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 #include "src/compiler/code-generator-impl.h" 6 #include "src/compiler/code-generator-impl.h"
7 #include "src/compiler/gap-resolver.h" 7 #include "src/compiler/gap-resolver.h"
8 #include "src/compiler/node-matchers.h" 8 #include "src/compiler/node-matchers.h"
9 #include "src/mips/macro-assembler-mips.h" 9 #include "src/mips/macro-assembler-mips.h"
10 #include "src/scopes.h" 10 #include "src/scopes.h"
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 } 421 }
422 422
423 __ ld(at, FieldMemOperand(func, JSFunction::kCodeEntryOffset)); 423 __ ld(at, FieldMemOperand(func, JSFunction::kCodeEntryOffset));
424 __ Call(at); 424 __ Call(at);
425 AddSafepointAndDeopt(instr); 425 AddSafepointAndDeopt(instr);
426 break; 426 break;
427 } 427 }
428 case kArchJmp: 428 case kArchJmp:
429 AssembleArchJump(i.InputRpo(0)); 429 AssembleArchJump(i.InputRpo(0));
430 break; 430 break;
431 case kArchSwitch:
432 AssembleArchSwitch(instr);
433 break;
431 case kArchNop: 434 case kArchNop:
432 // don't emit code for nops. 435 // don't emit code for nops.
433 break; 436 break;
434 case kArchRet: 437 case kArchRet:
435 AssembleReturn(); 438 AssembleReturn();
436 break; 439 break;
437 case kArchStackPointer: 440 case kArchStackPointer:
438 __ mov(i.OutputRegister(), sp); 441 __ mov(i.OutputRegister(), sp);
439 break; 442 break;
440 case kArchTruncateDoubleToI: 443 case kArchTruncateDoubleToI:
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 UNIMPLEMENTED(); 912 UNIMPLEMENTED();
910 } 913 }
911 } 914 }
912 915
913 916
914 void CodeGenerator::AssembleArchJump(BasicBlock::RpoNumber target) { 917 void CodeGenerator::AssembleArchJump(BasicBlock::RpoNumber target) {
915 if (!IsNextInAssemblyOrder(target)) __ Branch(GetLabel(target)); 918 if (!IsNextInAssemblyOrder(target)) __ Branch(GetLabel(target));
916 } 919 }
917 920
918 921
922 void CodeGenerator::AssembleArchSwitch(Instruction* instr) {
923 MipsOperandConverter i(this, instr);
924 int const kNumLabels = static_cast<int>(instr->InputCount() - 1);
925 v8::internal::Assembler::BlockTrampolinePoolScope block_trampoline_pool(
926 masm());
927 Label here;
928
929 // Ensure that dd-ed labels goes to 8 byte aligned addresses.
930 if ((masm()->pc_offset() & 7) == 0) {
931 __ nop();
932 }
933 __ bal(&here);
934 __ nop(); // Branch delay slot nop.
935 __ bind(&here);
936 __ dsll(at, i.InputRegister(0), 3);
937 __ daddu(at, at, ra);
938 __ ld(at, MemOperand(at, 5 * v8::internal::Assembler::kInstrSize));
939 __ jr(at);
940 __ nop(); // Branch delay slot nop.
941
942 for (int index = 0; index < kNumLabels; ++index) {
943 __ dd(GetLabel(i.InputRpo(index + 1)));
944 }
945 }
946
947
919 // Assembles boolean materializations after an instruction. 948 // Assembles boolean materializations after an instruction.
920 void CodeGenerator::AssembleArchBoolean(Instruction* instr, 949 void CodeGenerator::AssembleArchBoolean(Instruction* instr,
921 FlagsCondition condition) { 950 FlagsCondition condition) {
922 MipsOperandConverter i(this, instr); 951 MipsOperandConverter i(this, instr);
923 Label done; 952 Label done;
924 953
925 // Materialize a full 32-bit 1 or 0 value. The result register is always the 954 // Materialize a full 32-bit 1 or 0 value. The result register is always the
926 // last output of the instruction. 955 // last output of the instruction.
927 Label false_value; 956 Label false_value;
928 DCHECK_NE(0u, instr->OutputCount()); 957 DCHECK_NE(0u, instr->OutputCount());
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
1276 __ lw(temp_0, src1); 1305 __ lw(temp_0, src1);
1277 __ sw(temp_0, dst1); 1306 __ sw(temp_0, dst1);
1278 __ sdc1(temp_1, src0); 1307 __ sdc1(temp_1, src0);
1279 } else { 1308 } else {
1280 // No other combinations are possible. 1309 // No other combinations are possible.
1281 UNREACHABLE(); 1310 UNREACHABLE();
1282 } 1311 }
1283 } 1312 }
1284 1313
1285 1314
1315 void CodeGenerator::AssembleJumpTable(Label** targets, size_t target_count) {
1316 // On 64-bit MIPS we emit the jump tables inline.
1317 UNREACHABLE();
1318 }
1319
1320
1286 void CodeGenerator::AddNopForSmiCodeInlining() { 1321 void CodeGenerator::AddNopForSmiCodeInlining() {
1287 // Unused on 32-bit ARM. Still exists on 64-bit arm. 1322 // Unused on 32-bit ARM. Still exists on 64-bit arm.
1288 // TODO(plind): Unclear when this is called now. Understand, fix if needed. 1323 // TODO(plind): Unclear when this is called now. Understand, fix if needed.
1289 __ nop(); // Maybe PROPERTY_ACCESS_INLINED? 1324 __ nop(); // Maybe PROPERTY_ACCESS_INLINED?
1290 } 1325 }
1291 1326
1292 1327
1293 void CodeGenerator::EnsureSpaceForLazyDeopt() { 1328 void CodeGenerator::EnsureSpaceForLazyDeopt() {
1294 int space_needed = Deoptimizer::patch_size(); 1329 int space_needed = Deoptimizer::patch_size();
1295 if (!info()->IsStub()) { 1330 if (!info()->IsStub()) {
(...skipping 13 matching lines...) Expand all
1309 } 1344 }
1310 } 1345 }
1311 MarkLazyDeoptSite(); 1346 MarkLazyDeoptSite();
1312 } 1347 }
1313 1348
1314 #undef __ 1349 #undef __
1315 1350
1316 } // namespace compiler 1351 } // namespace compiler
1317 } // namespace internal 1352 } // namespace internal
1318 } // namespace v8 1353 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698