Index: runtime/vm/instructions_x64.cc |
diff --git a/runtime/vm/instructions_x64.cc b/runtime/vm/instructions_x64.cc |
index 3fa610aa9b04015ecd6b772f38fbffe5b7998b04..33ded5b449055fe8042784fb0a9a6a721de83f68 100644 |
--- a/runtime/vm/instructions_x64.cc |
+++ b/runtime/vm/instructions_x64.cc |
@@ -25,35 +25,46 @@ bool DecodeLoadObjectFromPoolOrThread(uword pc, |
ASSERT(code.ContainsInstructionAt(pc)); |
uint8_t* bytes = reinterpret_cast<uint8_t*>(pc); |
+ |
COMPILE_ASSERT(PP == R15); |
- if (((bytes[0] == 0x49) && (bytes[1] == 0x8b) && (bytes[2] == 0x9f)) || |
- ((bytes[0] == 0x49) && (bytes[1] == 0x8b) && (bytes[2] == 0x87)) || |
- ((bytes[0] == 0x4d) && (bytes[1] == 0x8b) && (bytes[2] == 0xa7)) || |
- ((bytes[0] == 0x4d) && (bytes[1] == 0x8b) && (bytes[2] == 0x9f)) || |
- ((bytes[0] == 0x4d) && (bytes[1] == 0x8b) && (bytes[2] == 0x97))) { |
- intptr_t index = IndexFromPPLoad(pc + 3); |
- const ObjectPool& pool = ObjectPool::Handle(code.object_pool()); |
- if (pool.InfoAt(index) == ObjectPool::kTaggedObject) { |
- *obj = pool.ObjectAt(index); |
- return true; |
+ if ((bytes[0] == 0x49) || (bytes[0] == 0x4d)) { |
+ if ((bytes[1] == 0x8b) || (bytes[1] == 0x3b)) { // movq, cmpq |
+ if ((bytes[2] & 0xc7) == (0x80 | (PP & 7))) { // [R15+disp32] |
+ intptr_t index = IndexFromPPLoad(pc + 3); |
+ const ObjectPool& pool = ObjectPool::Handle(code.object_pool()); |
+ if (pool.InfoAt(index) == ObjectPool::kTaggedObject) { |
+ *obj = pool.ObjectAt(index); |
+ return true; |
+ } |
+ } |
+ if ((bytes[2] & 0xc7) == (0x40 | (PP & 7))) { // [R15+disp8] |
+ intptr_t index = IndexFromPPLoadDisp8(pc + 3); |
+ const ObjectPool& pool = ObjectPool::Handle(code.object_pool()); |
+ if (pool.InfoAt(index) == ObjectPool::kTaggedObject) { |
+ *obj = pool.ObjectAt(index); |
+ return true; |
+ } |
+ } |
} |
} |
+ |
COMPILE_ASSERT(THR == R14); |
- if (((bytes[0] == 0x49) && (bytes[1] == 0x8b) && (bytes[2] == 0x86)) || |
- ((bytes[0] == 0x49) && (bytes[1] == 0x8b) && (bytes[2] == 0xb6)) || |
- ((bytes[0] == 0x49) && (bytes[1] == 0x8b) && (bytes[2] == 0x96)) || |
- ((bytes[0] == 0x49) && (bytes[1] == 0x8b) && (bytes[2] == 0x9e)) || |
- ((bytes[0] == 0x4d) && (bytes[1] == 0x8b) && (bytes[2] == 0x9e)) || |
- ((bytes[0] == 0x4d) && (bytes[1] == 0x8b) && (bytes[2] == 0xa6))) { |
- int32_t offset = *reinterpret_cast<int32_t*>(pc + 3); |
- return Thread::ObjectAtOffset(offset, obj); |
+ if ((bytes[0] == 0x49) || (bytes[0] == 0x4d)) { |
+ if ((bytes[1] == 0x8b) || (bytes[1] == 0x3b)) { // movq, cmpq |
+ if ((bytes[2] & 0xc7) == (0x40 | (R14 & 7))) { |
Florian Schneider
2016/04/15 16:57:49
s/R14/THR/g for consistency with PP above.
Maybe
sra1
2016/04/15 17:55:00
Done.
|
+ // [r14+disp8] |
Florian Schneider
2016/04/15 16:57:49
Move to prev line.
sra1
2016/04/15 17:55:00
Done.
|
+ uint8_t offset = *reinterpret_cast<uint8_t*>(pc + 3); |
+ return Thread::ObjectAtOffset(offset, obj); |
+ } |
+ if ((bytes[2] & 0307) == (0x80 | (R14 & 7))) { |
Florian Schneider
2016/04/15 16:57:49
Please don't use octal literals...
if ((bytes[2]
sra1
2016/04/15 17:55:00
Done. I missed that one. (mod r/m fields correspon
sra1
2016/04/15 17:55:00
Done.
|
+ // [r14+disp32] |
+ int32_t offset = *reinterpret_cast<int32_t*>(pc + 3); |
+ return Thread::ObjectAtOffset(offset, obj); |
+ } |
+ } |
} |
- if (((bytes[0] == 0x41) && (bytes[1] == 0xff) && (bytes[2] == 0x76)) || |
- ((bytes[0] == 0x49) && (bytes[1] == 0x3b) && (bytes[2] == 0x66)) || |
- ((bytes[0] == 0x49) && (bytes[1] == 0x8b) && (bytes[2] == 0x46)) || |
- ((bytes[0] == 0x4d) && (bytes[1] == 0x8b) && (bytes[2] == 0x5e)) || |
- ((bytes[0] == 0x4d) && (bytes[1] == 0x8b) && (bytes[2] == 0x66)) || |
- ((bytes[0] == 0x4d) && (bytes[1] == 0x8b) && (bytes[2] == 0x6e))) { |
+ if (((bytes[0] == 0x41) && (bytes[1] == 0xff) && (bytes[2] == 0x76))) { |
+ // push [r14+disp8] |
uint8_t offset = *reinterpret_cast<uint8_t*>(pc + 3); |
return Thread::ObjectAtOffset(offset, obj); |
} |