| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/code_patcher.h" | 9 #include "vm/code_patcher.h" |
| 10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 return call.target(); | 166 return call.target(); |
| 167 } | 167 } |
| 168 | 168 |
| 169 | 169 |
| 170 intptr_t CodePatcher::InstanceCallSizeInBytes() { | 170 intptr_t CodePatcher::InstanceCallSizeInBytes() { |
| 171 return DartCallPattern::kCallPatternSize; | 171 return DartCallPattern::kCallPatternSize; |
| 172 } | 172 } |
| 173 | 173 |
| 174 | 174 |
| 175 void CodePatcher::InsertCallAt(uword start, uword target) { | 175 void CodePatcher::InsertCallAt(uword start, uword target) { |
| 176 // The inserted call should not overlap the lazy deopt jump code. |
| 177 ASSERT(start + ShortCallPattern::InstructionLength() <= target); |
| 176 *reinterpret_cast<uint8_t*>(start) = 0xE8; | 178 *reinterpret_cast<uint8_t*>(start) = 0xE8; |
| 177 ShortCallPattern call(start); | 179 ShortCallPattern call(start); |
| 178 call.SetTargetAddress(target); | 180 call.SetTargetAddress(target); |
| 179 CPU::FlushICache(start, ShortCallPattern::InstructionLength()); | 181 CPU::FlushICache(start, ShortCallPattern::InstructionLength()); |
| 180 } | 182 } |
| 181 | 183 |
| 182 | 184 |
| 183 } // namespace dart | 185 } // namespace dart |
| 184 | 186 |
| 185 #endif // defined TARGET_ARCH_X64 | 187 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |