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