OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 2069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2080 and_(object, Immediate(~kHeapObjectTagMask)); | 2080 and_(object, Immediate(~kHeapObjectTagMask)); |
2081 movq(kScratchRegister, new_space_allocation_top); | 2081 movq(kScratchRegister, new_space_allocation_top); |
2082 #ifdef DEBUG | 2082 #ifdef DEBUG |
2083 cmpq(object, Operand(kScratchRegister, 0)); | 2083 cmpq(object, Operand(kScratchRegister, 0)); |
2084 Check(below, "Undo allocation of non allocated memory"); | 2084 Check(below, "Undo allocation of non allocated memory"); |
2085 #endif | 2085 #endif |
2086 movq(Operand(kScratchRegister, 0), object); | 2086 movq(Operand(kScratchRegister, 0), object); |
2087 } | 2087 } |
2088 | 2088 |
2089 | 2089 |
2090 #ifdef ENABLE_DEBUGGER_SUPPORT | |
2091 CodePatcher::CodePatcher(byte* address, int size) | 2090 CodePatcher::CodePatcher(byte* address, int size) |
2092 : address_(address), size_(size), masm_(address, size + Assembler::kGap) { | 2091 : address_(address), size_(size), masm_(address, size + Assembler::kGap) { |
2093 // Create a new macro assembler pointing to the address of the code to patch. | 2092 // Create a new macro assembler pointing to the address of the code to patch. |
2094 // The size is adjusted with kGap on order for the assembler to generate size | 2093 // The size is adjusted with kGap on order for the assembler to generate size |
2095 // bytes of instructions without failing with buffer size constraints. | 2094 // bytes of instructions without failing with buffer size constraints. |
2096 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 2095 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
2097 } | 2096 } |
2098 | 2097 |
2099 | 2098 |
2100 CodePatcher::~CodePatcher() { | 2099 CodePatcher::~CodePatcher() { |
2101 // Indicate that code has changed. | 2100 // Indicate that code has changed. |
2102 CPU::FlushICache(address_, size_); | 2101 CPU::FlushICache(address_, size_); |
2103 | 2102 |
2104 // Check that the code was patched as expected. | 2103 // Check that the code was patched as expected. |
2105 ASSERT(masm_.pc_ == address_ + size_); | 2104 ASSERT(masm_.pc_ == address_ + size_); |
2106 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 2105 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
2107 } | 2106 } |
2108 #endif // ENABLE_DEBUGGER_SUPPORT | |
2109 | 2107 |
2110 | 2108 |
2111 } } // namespace v8::internal | 2109 } } // namespace v8::internal |
OLD | NEW |