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 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1399 and_(object, Immediate(~kHeapObjectTagMask)); | 1399 and_(object, Immediate(~kHeapObjectTagMask)); |
1400 movq(kScratchRegister, new_space_allocation_top); | 1400 movq(kScratchRegister, new_space_allocation_top); |
1401 #ifdef DEBUG | 1401 #ifdef DEBUG |
1402 cmpq(object, Operand(kScratchRegister, 0)); | 1402 cmpq(object, Operand(kScratchRegister, 0)); |
1403 Check(below, "Undo allocation of non allocated memory"); | 1403 Check(below, "Undo allocation of non allocated memory"); |
1404 #endif | 1404 #endif |
1405 movq(Operand(kScratchRegister, 0), object); | 1405 movq(Operand(kScratchRegister, 0), object); |
1406 } | 1406 } |
1407 | 1407 |
1408 | 1408 |
| 1409 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 1410 CodePatcher::CodePatcher(byte* address, int size) |
| 1411 : address_(address), size_(size), masm_(address, size + Assembler::kGap) { |
| 1412 // Create a new macro assembler pointing to the address of the code to patch. |
| 1413 // The size is adjusted with kGap on order for the assembler to generate size |
| 1414 // bytes of instructions without failing with buffer size constraints. |
| 1415 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
| 1416 } |
| 1417 |
| 1418 |
| 1419 CodePatcher::~CodePatcher() { |
| 1420 // Indicate that code has changed. |
| 1421 CPU::FlushICache(address_, size_); |
| 1422 |
| 1423 // Check that the code was patched as expected. |
| 1424 ASSERT(masm_.pc_ == address_ + size_); |
| 1425 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
| 1426 } |
| 1427 #endif // ENABLE_DEBUGGER_SUPPORT |
| 1428 |
| 1429 |
1409 } } // namespace v8::internal | 1430 } } // namespace v8::internal |
OLD | NEW |