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 1910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1921 if (bdslot == PROTECT) | 1921 if (bdslot == PROTECT) |
1922 nop(); | 1922 nop(); |
1923 } | 1923 } |
1924 | 1924 |
1925 | 1925 |
1926 void MacroAssembler::BranchShort(Label* L, Condition cond, Register rs, | 1926 void MacroAssembler::BranchShort(Label* L, Condition cond, Register rs, |
1927 const Operand& rt, | 1927 const Operand& rt, |
1928 BranchDelaySlot bdslot) { | 1928 BranchDelaySlot bdslot) { |
1929 BRANCH_ARGS_CHECK(cond, rs, rt); | 1929 BRANCH_ARGS_CHECK(cond, rs, rt); |
1930 | 1930 |
1931 int32_t offset; | 1931 int32_t offset = 0; |
1932 Register r2 = no_reg; | 1932 Register r2 = no_reg; |
1933 Register scratch = at; | 1933 Register scratch = at; |
1934 if (rt.is_reg()) { | 1934 if (rt.is_reg()) { |
1935 BlockTrampolinePoolScope block_trampoline_pool(this); | 1935 BlockTrampolinePoolScope block_trampoline_pool(this); |
1936 r2 = rt.rm_; | 1936 r2 = rt.rm_; |
1937 // Be careful to always use shifted_branch_offset only just before the | 1937 // Be careful to always use shifted_branch_offset only just before the |
1938 // branch instruction, as the location will be remember for patching the | 1938 // branch instruction, as the location will be remember for patching the |
1939 // target. | 1939 // target. |
1940 switch (cond) { | 1940 switch (cond) { |
1941 case cc_always: | 1941 case cc_always: |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2354 if (bdslot == PROTECT) | 2354 if (bdslot == PROTECT) |
2355 nop(); | 2355 nop(); |
2356 } | 2356 } |
2357 | 2357 |
2358 | 2358 |
2359 void MacroAssembler::BranchAndLinkShort(Label* L, Condition cond, Register rs, | 2359 void MacroAssembler::BranchAndLinkShort(Label* L, Condition cond, Register rs, |
2360 const Operand& rt, | 2360 const Operand& rt, |
2361 BranchDelaySlot bdslot) { | 2361 BranchDelaySlot bdslot) { |
2362 BRANCH_ARGS_CHECK(cond, rs, rt); | 2362 BRANCH_ARGS_CHECK(cond, rs, rt); |
2363 | 2363 |
2364 int32_t offset; | 2364 int32_t offset = 0; |
2365 Register r2 = no_reg; | 2365 Register r2 = no_reg; |
2366 Register scratch = at; | 2366 Register scratch = at; |
2367 if (rt.is_reg()) { | 2367 if (rt.is_reg()) { |
2368 r2 = rt.rm_; | 2368 r2 = rt.rm_; |
2369 } else if (cond != cc_always) { | 2369 } else if (cond != cc_always) { |
2370 r2 = scratch; | 2370 r2 = scratch; |
2371 li(r2, rt); | 2371 li(r2, rt); |
2372 } | 2372 } |
2373 | 2373 |
2374 { | 2374 { |
(...skipping 3132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5507 if (r1.is(r4)) return true; | 5507 if (r1.is(r4)) return true; |
5508 if (r2.is(r3)) return true; | 5508 if (r2.is(r3)) return true; |
5509 if (r2.is(r4)) return true; | 5509 if (r2.is(r4)) return true; |
5510 if (r3.is(r4)) return true; | 5510 if (r3.is(r4)) return true; |
5511 return false; | 5511 return false; |
5512 } | 5512 } |
5513 | 5513 |
5514 | 5514 |
5515 CodePatcher::CodePatcher(byte* address, int instructions) | 5515 CodePatcher::CodePatcher(byte* address, int instructions) |
5516 : address_(address), | 5516 : address_(address), |
5517 instructions_(instructions), | |
5518 size_(instructions * Assembler::kInstrSize), | 5517 size_(instructions * Assembler::kInstrSize), |
5519 masm_(NULL, address, size_ + Assembler::kGap) { | 5518 masm_(NULL, address, size_ + Assembler::kGap) { |
5520 // Create a new macro assembler pointing to the address of the code to patch. | 5519 // Create a new macro assembler pointing to the address of the code to patch. |
5521 // The size is adjusted with kGap on order for the assembler to generate size | 5520 // The size is adjusted with kGap on order for the assembler to generate size |
5522 // bytes of instructions without failing with buffer size constraints. | 5521 // bytes of instructions without failing with buffer size constraints. |
5523 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 5522 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
5524 } | 5523 } |
5525 | 5524 |
5526 | 5525 |
5527 CodePatcher::~CodePatcher() { | 5526 CodePatcher::~CodePatcher() { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5562 opcode == BGTZL); | 5561 opcode == BGTZL); |
5563 opcode = (cond == eq) ? BEQ : BNE; | 5562 opcode = (cond == eq) ? BEQ : BNE; |
5564 instr = (instr & ~kOpcodeMask) | opcode; | 5563 instr = (instr & ~kOpcodeMask) | opcode; |
5565 masm_.emit(instr); | 5564 masm_.emit(instr); |
5566 } | 5565 } |
5567 | 5566 |
5568 | 5567 |
5569 } } // namespace v8::internal | 5568 } } // namespace v8::internal |
5570 | 5569 |
5571 #endif // V8_TARGET_ARCH_MIPS | 5570 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |