Index: runtime/vm/instructions_x64.cc |
diff --git a/runtime/vm/instructions_x64.cc b/runtime/vm/instructions_x64.cc |
index dc691a4359893994a939ae6409da42a088e6ffc4..2dc98bc55d8bc29a9738692c552972a9d5094741 100644 |
--- a/runtime/vm/instructions_x64.cc |
+++ b/runtime/vm/instructions_x64.cc |
@@ -6,6 +6,7 @@ |
#if defined(TARGET_ARCH_X64) |
#include "vm/cpu.h" |
+#include "vm/constants_x64.h" |
#include "vm/instructions.h" |
#include "vm/object.h" |
@@ -18,6 +19,44 @@ void ShortCallPattern::SetTargetAddress(uword target) const { |
} |
+bool DecodeLoadObjectFromPoolOrThread(uword pc, |
+ const Code& code, |
+ Object* obj) { |
+ 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; |
+ } |
+ } |
+ 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] == 0x4d) && (bytes[1] == 0x8b) && (bytes[2] == 0x5e)) || |
+ ((bytes[0] == 0x4d) && (bytes[1] == 0x8b) && (bytes[2] == 0x6e))) { |
+ uint8_t offset = *reinterpret_cast<uint8_t*>(pc + 3); |
+ return Thread::ObjectAtOffset(offset, obj); |
+ } |
+ |
+ return false; |
+} |
+ |
} // namespace dart |
#endif // defined TARGET_ARCH_X64 |