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 3720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3731 | 3731 |
3732 return n_of_valid_regs != n_of_non_aliasing_regs; | 3732 return n_of_valid_regs != n_of_non_aliasing_regs; |
3733 } | 3733 } |
3734 #endif | 3734 #endif |
3735 | 3735 |
3736 | 3736 |
3737 CodePatcher::CodePatcher(byte* address, int instructions) | 3737 CodePatcher::CodePatcher(byte* address, int instructions) |
3738 : address_(address), | 3738 : address_(address), |
3739 instructions_(instructions), | 3739 instructions_(instructions), |
3740 size_(instructions * Assembler::kInstrSize), | 3740 size_(instructions * Assembler::kInstrSize), |
3741 masm_(Isolate::Current(), address, size_ + Assembler::kGap) { | 3741 masm_(NULL, address, size_ + Assembler::kGap) { |
3742 // Create a new macro assembler pointing to the address of the code to patch. | 3742 // Create a new macro assembler pointing to the address of the code to patch. |
3743 // The size is adjusted with kGap on order for the assembler to generate size | 3743 // The size is adjusted with kGap on order for the assembler to generate size |
3744 // bytes of instructions without failing with buffer size constraints. | 3744 // bytes of instructions without failing with buffer size constraints. |
3745 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 3745 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
3746 } | 3746 } |
3747 | 3747 |
3748 | 3748 |
3749 CodePatcher::~CodePatcher() { | 3749 CodePatcher::~CodePatcher() { |
3750 // Indicate that code has changed. | 3750 // Indicate that code has changed. |
3751 CPU::FlushICache(address_, size_); | 3751 CPU::FlushICache(address_, size_); |
(...skipping 17 matching lines...) Expand all Loading... |
3769 void CodePatcher::EmitCondition(Condition cond) { | 3769 void CodePatcher::EmitCondition(Condition cond) { |
3770 Instr instr = Assembler::instr_at(masm_.pc_); | 3770 Instr instr = Assembler::instr_at(masm_.pc_); |
3771 instr = (instr & ~kCondMask) | cond; | 3771 instr = (instr & ~kCondMask) | cond; |
3772 masm_.emit(instr); | 3772 masm_.emit(instr); |
3773 } | 3773 } |
3774 | 3774 |
3775 | 3775 |
3776 } } // namespace v8::internal | 3776 } } // namespace v8::internal |
3777 | 3777 |
3778 #endif // V8_TARGET_ARCH_ARM | 3778 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |