Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Side by Side Diff: runtime/vm/instructions_x64.cc

Issue 1439893002: - Annotate instructions that load objects from the ObjectPool or Thread. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/instructions_mips.cc ('k') | runtime/vm/json_stream.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/instructions.h" 10 #include "vm/instructions.h"
10 #include "vm/object.h" 11 #include "vm/object.h"
11 12
12 namespace dart { 13 namespace dart {
13 14
14 void ShortCallPattern::SetTargetAddress(uword target) const { 15 void ShortCallPattern::SetTargetAddress(uword target) const {
15 ASSERT(IsValid()); 16 ASSERT(IsValid());
16 *reinterpret_cast<uint32_t*>(start() + 1) = target - start() - kLengthInBytes; 17 *reinterpret_cast<uint32_t*>(start() + 1) = target - start() - kLengthInBytes;
17 CPU::FlushICache(start() + 1, kWordSize); 18 CPU::FlushICache(start() + 1, kWordSize);
18 } 19 }
19 20
20 21
22 bool DecodeLoadObjectFromPoolOrThread(uword pc,
23 const Code& code,
24 Object* obj) {
25 ASSERT(code.ContainsInstructionAt(pc));
26
27 uint8_t* bytes = reinterpret_cast<uint8_t*>(pc);
28 COMPILE_ASSERT(PP == R15);
29 if (((bytes[0] == 0x49) && (bytes[1] == 0x8b) && (bytes[2] == 0x9f)) ||
30 ((bytes[0] == 0x49) && (bytes[1] == 0x8b) && (bytes[2] == 0x87)) ||
31 ((bytes[0] == 0x4d) && (bytes[1] == 0x8b) && (bytes[2] == 0xa7)) ||
32 ((bytes[0] == 0x4d) && (bytes[1] == 0x8b) && (bytes[2] == 0x9f)) ||
33 ((bytes[0] == 0x4d) && (bytes[1] == 0x8b) && (bytes[2] == 0x97))) {
34 intptr_t index = IndexFromPPLoad(pc + 3);
35 const ObjectPool& pool = ObjectPool::Handle(code.object_pool());
36 if (pool.InfoAt(index) == ObjectPool::kTaggedObject) {
37 *obj = pool.ObjectAt(index);
38 return true;
39 }
40 }
41 COMPILE_ASSERT(THR == R14);
42 if (((bytes[0] == 0x49) && (bytes[1] == 0x8b) && (bytes[2] == 0x86)) ||
43 ((bytes[0] == 0x49) && (bytes[1] == 0x8b) && (bytes[2] == 0xb6)) ||
44 ((bytes[0] == 0x49) && (bytes[1] == 0x8b) && (bytes[2] == 0x96)) ||
45 ((bytes[0] == 0x49) && (bytes[1] == 0x8b) && (bytes[2] == 0x9e)) ||
46 ((bytes[0] == 0x4d) && (bytes[1] == 0x8b) && (bytes[2] == 0x9e)) ||
47 ((bytes[0] == 0x4d) && (bytes[1] == 0x8b) && (bytes[2] == 0xa6))) {
48 int32_t offset = *reinterpret_cast<int32_t*>(pc + 3);
49 return Thread::ObjectAtOffset(offset, obj);
50 }
51 if (((bytes[0] == 0x4d) && (bytes[1] == 0x8b) && (bytes[2] == 0x5e)) ||
52 ((bytes[0] == 0x4d) && (bytes[1] == 0x8b) && (bytes[2] == 0x6e))) {
53 uint8_t offset = *reinterpret_cast<uint8_t*>(pc + 3);
54 return Thread::ObjectAtOffset(offset, obj);
55 }
56
57 return false;
58 }
59
21 } // namespace dart 60 } // namespace dart
22 61
23 #endif // defined TARGET_ARCH_X64 62 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/instructions_mips.cc ('k') | runtime/vm/json_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698