OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1163 } | 1163 } |
1164 #endif | 1164 #endif |
1165 push(eax); | 1165 push(eax); |
1166 push(Immediate(p0)); | 1166 push(Immediate(p0)); |
1167 push(Immediate(reinterpret_cast<intptr_t>(Smi::FromInt(p1 - p0)))); | 1167 push(Immediate(reinterpret_cast<intptr_t>(Smi::FromInt(p1 - p0)))); |
1168 CallRuntime(Runtime::kAbort, 2); | 1168 CallRuntime(Runtime::kAbort, 2); |
1169 // will not return here | 1169 // will not return here |
1170 } | 1170 } |
1171 | 1171 |
1172 | 1172 |
1173 #ifdef ENABLE_DEBUGGER_SUPPORT | |
1174 CodePatcher::CodePatcher(byte* address, int size) | 1173 CodePatcher::CodePatcher(byte* address, int size) |
1175 : address_(address), size_(size), masm_(address, size + Assembler::kGap) { | 1174 : address_(address), size_(size), masm_(address, size + Assembler::kGap) { |
1176 // Create a new macro assembler pointing to the address of the code to patch. | 1175 // Create a new macro assembler pointing to the address of the code to patch. |
1177 // The size is adjusted with kGap on order for the assembler to generate size | 1176 // The size is adjusted with kGap on order for the assembler to generate size |
1178 // bytes of instructions without failing with buffer size constraints. | 1177 // bytes of instructions without failing with buffer size constraints. |
1179 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 1178 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
1180 } | 1179 } |
1181 | 1180 |
1182 | 1181 |
1183 CodePatcher::~CodePatcher() { | 1182 CodePatcher::~CodePatcher() { |
1184 // Indicate that code has changed. | 1183 // Indicate that code has changed. |
1185 CPU::FlushICache(address_, size_); | 1184 CPU::FlushICache(address_, size_); |
1186 | 1185 |
1187 // Check that the code was patched as expected. | 1186 // Check that the code was patched as expected. |
1188 ASSERT(masm_.pc_ == address_ + size_); | 1187 ASSERT(masm_.pc_ == address_ + size_); |
1189 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 1188 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
1190 } | 1189 } |
1191 #endif // ENABLE_DEBUGGER_SUPPORT | |
1192 | 1190 |
1193 | 1191 |
1194 } } // namespace v8::internal | 1192 } } // namespace v8::internal |
OLD | NEW |