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/instructions.h" | 8 #include "vm/instructions.h" |
9 #include "vm/instructions_x64.h" | 9 #include "vm/instructions_x64.h" |
10 | 10 |
11 #include "vm/cpu.h" | 11 #include "vm/cpu.h" |
12 #include "vm/constants_x64.h" | 12 #include "vm/constants_x64.h" |
13 #include "vm/object.h" | 13 #include "vm/object.h" |
14 | 14 |
15 namespace dart { | 15 namespace dart { |
16 | 16 |
17 bool DecodeLoadObjectFromPoolOrThread(uword pc, | 17 bool DecodeLoadObjectFromPoolOrThread(uword pc, const Code& code, Object* obj) { |
18 const Code& code, | |
19 Object* obj) { | |
20 ASSERT(code.ContainsInstructionAt(pc)); | 18 ASSERT(code.ContainsInstructionAt(pc)); |
21 | 19 |
22 uint8_t* bytes = reinterpret_cast<uint8_t*>(pc); | 20 uint8_t* bytes = reinterpret_cast<uint8_t*>(pc); |
23 | 21 |
24 COMPILE_ASSERT(PP == R15); | 22 COMPILE_ASSERT(PP == R15); |
25 if ((bytes[0] == 0x49) || (bytes[0] == 0x4d)) { | 23 if ((bytes[0] == 0x49) || (bytes[0] == 0x4d)) { |
26 if ((bytes[1] == 0x8b) || (bytes[1] == 0x3b)) { // movq, cmpq | 24 if ((bytes[1] == 0x8b) || (bytes[1] == 0x3b)) { // movq, cmpq |
27 if ((bytes[2] & 0xc7) == (0x80 | (PP & 7))) { // [r15+disp32] | 25 if ((bytes[2] & 0xc7) == (0x80 | (PP & 7))) { // [r15+disp32] |
28 intptr_t index = IndexFromPPLoad(pc + 3); | 26 intptr_t index = IndexFromPPLoad(pc + 3); |
29 const ObjectPool& pool = ObjectPool::Handle(code.object_pool()); | 27 const ObjectPool& pool = ObjectPool::Handle(code.object_pool()); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 uint8_t offset = *reinterpret_cast<uint8_t*>(pc + 3); | 59 uint8_t offset = *reinterpret_cast<uint8_t*>(pc + 3); |
62 return Thread::ObjectAtOffset(offset, obj); | 60 return Thread::ObjectAtOffset(offset, obj); |
63 } | 61 } |
64 | 62 |
65 return false; | 63 return false; |
66 } | 64 } |
67 | 65 |
68 } // namespace dart | 66 } // namespace dart |
69 | 67 |
70 #endif // defined TARGET_ARCH_X64 | 68 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |