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/cpu.h" | 8 #include "vm/cpu.h" |
9 #include "vm/constants_x64.h" | 9 #include "vm/constants_x64.h" |
10 #include "vm/instructions.h" | 10 #include "vm/instructions.h" |
11 #include "vm/object.h" | 11 #include "vm/object.h" |
12 | 12 |
13 namespace dart { | 13 namespace dart { |
14 | 14 |
| 15 void ShortCallPattern::SetTargetAddress(uword target) const { |
| 16 ASSERT(IsValid()); |
| 17 *reinterpret_cast<uint32_t*>(start() + 1) = target - start() - kLengthInBytes; |
| 18 CPU::FlushICache(start() + 1, kWordSize); |
| 19 } |
| 20 |
| 21 |
15 bool DecodeLoadObjectFromPoolOrThread(uword pc, | 22 bool DecodeLoadObjectFromPoolOrThread(uword pc, |
16 const Code& code, | 23 const Code& code, |
17 Object* obj) { | 24 Object* obj) { |
18 ASSERT(code.ContainsInstructionAt(pc)); | 25 ASSERT(code.ContainsInstructionAt(pc)); |
19 | 26 |
20 uint8_t* bytes = reinterpret_cast<uint8_t*>(pc); | 27 uint8_t* bytes = reinterpret_cast<uint8_t*>(pc); |
21 | 28 |
22 COMPILE_ASSERT(PP == R15); | 29 COMPILE_ASSERT(PP == R15); |
23 if ((bytes[0] == 0x49) || (bytes[0] == 0x4d)) { | 30 if ((bytes[0] == 0x49) || (bytes[0] == 0x4d)) { |
24 if ((bytes[1] == 0x8b) || (bytes[1] == 0x3b)) { // movq, cmpq | 31 if ((bytes[1] == 0x8b) || (bytes[1] == 0x3b)) { // movq, cmpq |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 uint8_t offset = *reinterpret_cast<uint8_t*>(pc + 3); | 66 uint8_t offset = *reinterpret_cast<uint8_t*>(pc + 3); |
60 return Thread::ObjectAtOffset(offset, obj); | 67 return Thread::ObjectAtOffset(offset, obj); |
61 } | 68 } |
62 | 69 |
63 return false; | 70 return false; |
64 } | 71 } |
65 | 72 |
66 } // namespace dart | 73 } // namespace dart |
67 | 74 |
68 #endif // defined TARGET_ARCH_X64 | 75 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |