| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1914 if (bdslot == PROTECT) | 1914 if (bdslot == PROTECT) |
| 1915 nop(); | 1915 nop(); |
| 1916 } | 1916 } |
| 1917 | 1917 |
| 1918 | 1918 |
| 1919 void MacroAssembler::BranchShort(Label* L, Condition cond, Register rs, | 1919 void MacroAssembler::BranchShort(Label* L, Condition cond, Register rs, |
| 1920 const Operand& rt, | 1920 const Operand& rt, |
| 1921 BranchDelaySlot bdslot) { | 1921 BranchDelaySlot bdslot) { |
| 1922 BRANCH_ARGS_CHECK(cond, rs, rt); | 1922 BRANCH_ARGS_CHECK(cond, rs, rt); |
| 1923 | 1923 |
| 1924 int32_t offset; | 1924 int32_t offset = 0; |
| 1925 Register r2 = no_reg; | 1925 Register r2 = no_reg; |
| 1926 Register scratch = at; | 1926 Register scratch = at; |
| 1927 if (rt.is_reg()) { | 1927 if (rt.is_reg()) { |
| 1928 r2 = rt.rm_; | 1928 r2 = rt.rm_; |
| 1929 // Be careful to always use shifted_branch_offset only just before the | 1929 // Be careful to always use shifted_branch_offset only just before the |
| 1930 // branch instruction, as the location will be remember for patching the | 1930 // branch instruction, as the location will be remember for patching the |
| 1931 // target. | 1931 // target. |
| 1932 switch (cond) { | 1932 switch (cond) { |
| 1933 case cc_always: | 1933 case cc_always: |
| 1934 offset = shifted_branch_offset(L, false); | 1934 offset = shifted_branch_offset(L, false); |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2342 if (bdslot == PROTECT) | 2342 if (bdslot == PROTECT) |
| 2343 nop(); | 2343 nop(); |
| 2344 } | 2344 } |
| 2345 | 2345 |
| 2346 | 2346 |
| 2347 void MacroAssembler::BranchAndLinkShort(Label* L, Condition cond, Register rs, | 2347 void MacroAssembler::BranchAndLinkShort(Label* L, Condition cond, Register rs, |
| 2348 const Operand& rt, | 2348 const Operand& rt, |
| 2349 BranchDelaySlot bdslot) { | 2349 BranchDelaySlot bdslot) { |
| 2350 BRANCH_ARGS_CHECK(cond, rs, rt); | 2350 BRANCH_ARGS_CHECK(cond, rs, rt); |
| 2351 | 2351 |
| 2352 int32_t offset; | 2352 int32_t offset = 0; |
| 2353 Register r2 = no_reg; | 2353 Register r2 = no_reg; |
| 2354 Register scratch = at; | 2354 Register scratch = at; |
| 2355 if (rt.is_reg()) { | 2355 if (rt.is_reg()) { |
| 2356 r2 = rt.rm_; | 2356 r2 = rt.rm_; |
| 2357 } else if (cond != cc_always) { | 2357 } else if (cond != cc_always) { |
| 2358 r2 = scratch; | 2358 r2 = scratch; |
| 2359 li(r2, rt); | 2359 li(r2, rt); |
| 2360 } | 2360 } |
| 2361 | 2361 |
| 2362 switch (cond) { | 2362 switch (cond) { |
| (...skipping 3113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5476 if (r1.is(r4)) return true; | 5476 if (r1.is(r4)) return true; |
| 5477 if (r2.is(r3)) return true; | 5477 if (r2.is(r3)) return true; |
| 5478 if (r2.is(r4)) return true; | 5478 if (r2.is(r4)) return true; |
| 5479 if (r3.is(r4)) return true; | 5479 if (r3.is(r4)) return true; |
| 5480 return false; | 5480 return false; |
| 5481 } | 5481 } |
| 5482 | 5482 |
| 5483 | 5483 |
| 5484 CodePatcher::CodePatcher(byte* address, int instructions) | 5484 CodePatcher::CodePatcher(byte* address, int instructions) |
| 5485 : address_(address), | 5485 : address_(address), |
| 5486 instructions_(instructions), | |
| 5487 size_(instructions * Assembler::kInstrSize), | 5486 size_(instructions * Assembler::kInstrSize), |
| 5488 masm_(NULL, address, size_ + Assembler::kGap) { | 5487 masm_(NULL, address, size_ + Assembler::kGap) { |
| 5489 // Create a new macro assembler pointing to the address of the code to patch. | 5488 // Create a new macro assembler pointing to the address of the code to patch. |
| 5490 // The size is adjusted with kGap on order for the assembler to generate size | 5489 // The size is adjusted with kGap on order for the assembler to generate size |
| 5491 // bytes of instructions without failing with buffer size constraints. | 5490 // bytes of instructions without failing with buffer size constraints. |
| 5492 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 5491 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
| 5493 } | 5492 } |
| 5494 | 5493 |
| 5495 | 5494 |
| 5496 CodePatcher::~CodePatcher() { | 5495 CodePatcher::~CodePatcher() { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5531 opcode == BGTZL); | 5530 opcode == BGTZL); |
| 5532 opcode = (cond == eq) ? BEQ : BNE; | 5531 opcode = (cond == eq) ? BEQ : BNE; |
| 5533 instr = (instr & ~kOpcodeMask) | opcode; | 5532 instr = (instr & ~kOpcodeMask) | opcode; |
| 5534 masm_.emit(instr); | 5533 masm_.emit(instr); |
| 5535 } | 5534 } |
| 5536 | 5535 |
| 5537 | 5536 |
| 5538 } } // namespace v8::internal | 5537 } } // namespace v8::internal |
| 5539 | 5538 |
| 5540 #endif // V8_TARGET_ARCH_MIPS | 5539 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |