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

Side by Side Diff: src/mips/assembler-mips.cc

Issue 148503002: A64: Synchronize with r15545. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/messages.js ('k') | src/mips/builtins-mips.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 (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 17 matching lines...) Expand all
28 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 30
31 // The original source code covered by the above license above has been 31 // The original source code covered by the above license above has been
32 // modified significantly by Google Inc. 32 // modified significantly by Google Inc.
33 // Copyright 2012 the V8 project authors. All rights reserved. 33 // Copyright 2012 the V8 project authors. All rights reserved.
34 34
35 35
36 #include "v8.h" 36 #include "v8.h"
37 37
38 #if defined(V8_TARGET_ARCH_MIPS) 38 #if V8_TARGET_ARCH_MIPS
39 39
40 #include "mips/assembler-mips-inl.h" 40 #include "mips/assembler-mips-inl.h"
41 #include "serialize.h" 41 #include "serialize.h"
42 42
43 namespace v8 { 43 namespace v8 {
44 namespace internal { 44 namespace internal {
45 45
46 #ifdef DEBUG 46 #ifdef DEBUG
47 bool CpuFeatures::initialized_ = false; 47 bool CpuFeatures::initialized_ = false;
48 #endif 48 #endif
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 opcode == BGTZ || 494 opcode == BGTZ ||
495 opcode == BEQL || 495 opcode == BEQL ||
496 opcode == BNEL || 496 opcode == BNEL ||
497 opcode == BLEZL || 497 opcode == BLEZL ||
498 opcode == BGTZL || 498 opcode == BGTZL ||
499 (opcode == REGIMM && (rt_field == BLTZ || rt_field == BGEZ || 499 (opcode == REGIMM && (rt_field == BLTZ || rt_field == BGEZ ||
500 rt_field == BLTZAL || rt_field == BGEZAL)) || 500 rt_field == BLTZAL || rt_field == BGEZAL)) ||
501 (opcode == COP1 && rs_field == BC1); // Coprocessor branch. 501 (opcode == COP1 && rs_field == BC1); // Coprocessor branch.
502 } 502 }
503 503
504
504 bool Assembler::IsEmittedConstant(Instr instr) { 505 bool Assembler::IsEmittedConstant(Instr instr) {
505 uint32_t label_constant = GetLabelConst(instr); 506 uint32_t label_constant = GetLabelConst(instr);
506 return label_constant == 0; // Emitted label const in reg-exp engine. 507 return label_constant == 0; // Emitted label const in reg-exp engine.
507 } 508 }
508 509
510
509 bool Assembler::IsBeq(Instr instr) { 511 bool Assembler::IsBeq(Instr instr) {
510 return GetOpcodeField(instr) == BEQ; 512 return GetOpcodeField(instr) == BEQ;
511 } 513 }
512 514
513 515
514 bool Assembler::IsBne(Instr instr) { 516 bool Assembler::IsBne(Instr instr) {
515 return GetOpcodeField(instr) == BNE; 517 return GetOpcodeField(instr) == BNE;
516 } 518 }
517 519
518 520
(...skipping 13 matching lines...) Expand all
532 uint32_t opcode = GetOpcodeField(instr); 534 uint32_t opcode = GetOpcodeField(instr);
533 // Checks if the instruction is a jump. 535 // Checks if the instruction is a jump.
534 return opcode == J; 536 return opcode == J;
535 } 537 }
536 538
537 539
538 bool Assembler::IsJal(Instr instr) { 540 bool Assembler::IsJal(Instr instr) {
539 return GetOpcodeField(instr) == JAL; 541 return GetOpcodeField(instr) == JAL;
540 } 542 }
541 543
544
542 bool Assembler::IsJr(Instr instr) { 545 bool Assembler::IsJr(Instr instr) {
543 return GetOpcodeField(instr) == SPECIAL && GetFunctionField(instr) == JR; 546 return GetOpcodeField(instr) == SPECIAL && GetFunctionField(instr) == JR;
544 } 547 }
545 548
549
546 bool Assembler::IsJalr(Instr instr) { 550 bool Assembler::IsJalr(Instr instr) {
547 return GetOpcodeField(instr) == SPECIAL && GetFunctionField(instr) == JALR; 551 return GetOpcodeField(instr) == SPECIAL && GetFunctionField(instr) == JALR;
548 } 552 }
549 553
550 554
551 bool Assembler::IsLui(Instr instr) { 555 bool Assembler::IsLui(Instr instr) {
552 uint32_t opcode = GetOpcodeField(instr); 556 uint32_t opcode = GetOpcodeField(instr);
553 // Checks if the instruction is a load upper immediate. 557 // Checks if the instruction is a load upper immediate.
554 return opcode == LUI; 558 return opcode == LUI;
555 } 559 }
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 ASSERT(L->is_linked()); 822 ASSERT(L->is_linked());
819 int link = target_at(L->pos()); 823 int link = target_at(L->pos());
820 if (link == kEndOfChain) { 824 if (link == kEndOfChain) {
821 L->Unuse(); 825 L->Unuse();
822 } else { 826 } else {
823 ASSERT(link >= 0); 827 ASSERT(link >= 0);
824 L->link_to(link); 828 L->link_to(link);
825 } 829 }
826 } 830 }
827 831
832
828 bool Assembler::is_near(Label* L) { 833 bool Assembler::is_near(Label* L) {
829 if (L->is_bound()) { 834 if (L->is_bound()) {
830 return ((pc_offset() - L->pos()) < kMaxBranchOffset - 4 * kInstrSize); 835 return ((pc_offset() - L->pos()) < kMaxBranchOffset - 4 * kInstrSize);
831 } 836 }
832 return false; 837 return false;
833 } 838 }
834 839
840
835 // We have to use a temporary register for things that can be relocated even 841 // We have to use a temporary register for things that can be relocated even
836 // if they can be encoded in the MIPS's 16 bits of immediate-offset instruction 842 // if they can be encoded in the MIPS's 16 bits of immediate-offset instruction
837 // space. There is no guarantee that the relocated location can be similarly 843 // space. There is no guarantee that the relocated location can be similarly
838 // encoded. 844 // encoded.
839 bool Assembler::MustUseReg(RelocInfo::Mode rmode) { 845 bool Assembler::MustUseReg(RelocInfo::Mode rmode) {
840 return !RelocInfo::IsNone(rmode); 846 return !RelocInfo::IsNone(rmode);
841 } 847 }
842 848
843 void Assembler::GenInstrRegister(Opcode opcode, 849 void Assembler::GenInstrRegister(Opcode opcode,
844 Register rs, 850 Register rs,
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
1468 (code > kMaxStopCode || 1474 (code > kMaxStopCode ||
1469 code <= kMaxWatchpointCode))); 1475 code <= kMaxWatchpointCode)));
1470 Instr break_instr = SPECIAL | BREAK | (code << 6); 1476 Instr break_instr = SPECIAL | BREAK | (code << 6);
1471 emit(break_instr); 1477 emit(break_instr);
1472 } 1478 }
1473 1479
1474 1480
1475 void Assembler::stop(const char* msg, uint32_t code) { 1481 void Assembler::stop(const char* msg, uint32_t code) {
1476 ASSERT(code > kMaxWatchpointCode); 1482 ASSERT(code > kMaxWatchpointCode);
1477 ASSERT(code <= kMaxStopCode); 1483 ASSERT(code <= kMaxStopCode);
1478 #if defined(V8_HOST_ARCH_MIPS) 1484 #if V8_HOST_ARCH_MIPS
1479 break_(0x54321); 1485 break_(0x54321);
1480 #else // V8_HOST_ARCH_MIPS 1486 #else // V8_HOST_ARCH_MIPS
1481 BlockTrampolinePoolFor(2); 1487 BlockTrampolinePoolFor(2);
1482 // The Simulator will handle the stop instruction and get the message address. 1488 // The Simulator will handle the stop instruction and get the message address.
1483 // On MIPS stop() is just a special kind of break_(). 1489 // On MIPS stop() is just a special kind of break_().
1484 break_(code, true); 1490 break_(code, true);
1485 emit(reinterpret_cast<Instr>(msg)); 1491 emit(reinterpret_cast<Instr>(msg));
1486 #endif 1492 #endif
1487 } 1493 }
1488 1494
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
1662 1668
1663 void Assembler::ctc1(Register rt, FPUControlRegister fs) { 1669 void Assembler::ctc1(Register rt, FPUControlRegister fs) {
1664 GenInstrRegister(COP1, CTC1, rt, fs); 1670 GenInstrRegister(COP1, CTC1, rt, fs);
1665 } 1671 }
1666 1672
1667 1673
1668 void Assembler::cfc1(Register rt, FPUControlRegister fs) { 1674 void Assembler::cfc1(Register rt, FPUControlRegister fs) {
1669 GenInstrRegister(COP1, CFC1, rt, fs); 1675 GenInstrRegister(COP1, CFC1, rt, fs);
1670 } 1676 }
1671 1677
1678
1672 void Assembler::DoubleAsTwoUInt32(double d, uint32_t* lo, uint32_t* hi) { 1679 void Assembler::DoubleAsTwoUInt32(double d, uint32_t* lo, uint32_t* hi) {
1673 uint64_t i; 1680 uint64_t i;
1674 OS::MemCopy(&i, &d, 8); 1681 OS::MemCopy(&i, &d, 8);
1675 1682
1676 *lo = i & 0xffffffff; 1683 *lo = i & 0xffffffff;
1677 *hi = i >> 32; 1684 *hi = i >> 32;
1678 } 1685 }
1679 1686
1687
1680 // Arithmetic. 1688 // Arithmetic.
1681 1689
1682 void Assembler::add_d(FPURegister fd, FPURegister fs, FPURegister ft) { 1690 void Assembler::add_d(FPURegister fd, FPURegister fs, FPURegister ft) {
1683 GenInstrRegister(COP1, D, ft, fs, fd, ADD_D); 1691 GenInstrRegister(COP1, D, ft, fs, fd, ADD_D);
1684 } 1692 }
1685 1693
1686 1694
1687 void Assembler::sub_d(FPURegister fd, FPURegister fs, FPURegister ft) { 1695 void Assembler::sub_d(FPURegister fd, FPURegister fs, FPURegister ft) {
1688 GenInstrRegister(COP1, D, ft, fs, fd, SUB_D); 1696 GenInstrRegister(COP1, D, ft, fs, fd, SUB_D);
1689 } 1697 }
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
2250 // JR 'rs' reg is the 'rt' reg specified in the ORI instruction (instr2). 2258 // JR 'rs' reg is the 'rt' reg specified in the ORI instruction (instr2).
2251 uint32_t rs_field = GetRt(instr2) << kRsShift; 2259 uint32_t rs_field = GetRt(instr2) << kRsShift;
2252 *(p+2) = SPECIAL | rs_field | JR; 2260 *(p+2) = SPECIAL | rs_field | JR;
2253 } 2261 }
2254 patched_jump = true; 2262 patched_jump = true;
2255 } 2263 }
2256 2264
2257 CPU::FlushICache(pc, (patched_jump ? 3 : 2) * sizeof(int32_t)); 2265 CPU::FlushICache(pc, (patched_jump ? 3 : 2) * sizeof(int32_t));
2258 } 2266 }
2259 2267
2268
2260 void Assembler::JumpLabelToJumpRegister(Address pc) { 2269 void Assembler::JumpLabelToJumpRegister(Address pc) {
2261 // Address pc points to lui/ori instructions. 2270 // Address pc points to lui/ori instructions.
2262 // Jump to label may follow at pc + 2 * kInstrSize. 2271 // Jump to label may follow at pc + 2 * kInstrSize.
2263 uint32_t* p = reinterpret_cast<uint32_t*>(pc); 2272 uint32_t* p = reinterpret_cast<uint32_t*>(pc);
2264 #ifdef DEBUG 2273 #ifdef DEBUG
2265 Instr instr1 = instr_at(pc); 2274 Instr instr1 = instr_at(pc);
2266 #endif 2275 #endif
2267 Instr instr2 = instr_at(pc + 1 * kInstrSize); 2276 Instr instr2 = instr_at(pc + 1 * kInstrSize);
2268 Instr instr3 = instr_at(pc + 2 * kInstrSize); 2277 Instr instr3 = instr_at(pc + 2 * kInstrSize);
2269 bool patched = false; 2278 bool patched = false;
(...skipping 16 matching lines...) Expand all
2286 } 2295 }
2287 2296
2288 if (patched) { 2297 if (patched) {
2289 CPU::FlushICache(pc+2, sizeof(Address)); 2298 CPU::FlushICache(pc+2, sizeof(Address));
2290 } 2299 }
2291 } 2300 }
2292 2301
2293 } } // namespace v8::internal 2302 } } // namespace v8::internal
2294 2303
2295 #endif // V8_TARGET_ARCH_MIPS 2304 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/messages.js ('k') | src/mips/builtins-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698