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

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

Issue 1192103004: VM: New calling convention for generated code. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 months 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
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/instructions.h" 9 #include "vm/instructions.h"
10 #include "vm/object.h" 10 #include "vm/object.h"
(...skipping 18 matching lines...) Expand all
29 for (int i = 0; i < num_bytes; i++) { 29 for (int i = 0; i < num_bytes; i++) {
30 // Skip comparison for data[i] < 0. 30 // Skip comparison for data[i] < 0.
31 if ((data[i] >= 0) && (byte_array[i] != (0xFF & data[i]))) { 31 if ((data[i] >= 0) && (byte_array[i] != (0xFF & data[i]))) {
32 return false; 32 return false;
33 } 33 }
34 } 34 }
35 return true; 35 return true;
36 } 36 }
37 37
38 38
39 uword JumpPattern::TargetAddress() const { 39 RawCode* JumpPattern::TargetCode() const {
40 ASSERT(IsValid()); 40 ASSERT(IsValid());
41 int index = InstructionPattern::IndexFromPPLoad(start() + 3); 41 int index = InstructionPattern::IndexFromPPLoad(start() + 3);
42 return object_pool_.RawValueAt(index); 42 Code& code = Code::Handle();
43 code ^= object_pool_.ObjectAt(index);
44 return code.raw();
43 } 45 }
44 46
45 47
46 void JumpPattern::SetTargetAddress(uword target) const { 48 void JumpPattern::SetTargetCode(const Code& target) const {
47 ASSERT(IsValid()); 49 ASSERT(IsValid());
48 int index = InstructionPattern::IndexFromPPLoad(start() + 3); 50 int index = InstructionPattern::IndexFromPPLoad(start() + 3);
49 object_pool_.SetRawValueAt(index, target); 51 object_pool_.SetObjectAt(index, target);
50 // No need to flush the instruction cache, since the code is not modified. 52 // No need to flush the instruction cache, since the code is not modified.
51 } 53 }
52 54
53 55
54 const int* JumpPattern::pattern() const { 56 const int* JumpPattern::pattern() const {
55 // 07: 41 ff a7 imm32 jmpq [reg + off] 57 // 0: 4d 8b a5 imm32 movq CR, [PP + offs]
58 // 7: 4d 8b 5c 24 07 movq TMP, [CR + insns_offs]
59 // 12: 49 83 c3 1f addq TMP, entry_offs
60 // 16: 41 ff e3 jmp TMP
61 // 19:
56 static const int kJumpPattern[kLengthInBytes] = 62 static const int kJumpPattern[kLengthInBytes] =
57 {0x41, 0xFF, -1, -1, -1, -1, -1}; 63 {0x4d, 0x8b, -1, -1, -1, -1, -1,
64 0x4d, 0x8b, 0x5c, 0x24, 0x07,
65 0x49, 0x83, 0xc3, 0x1f,
66 0x41, 0xff, 0xe3};
58 return kJumpPattern; 67 return kJumpPattern;
59 } 68 }
60 69
61 70
62 void ShortCallPattern::SetTargetAddress(uword target) const { 71 void ShortCallPattern::SetTargetAddress(uword target) const {
63 ASSERT(IsValid()); 72 ASSERT(IsValid());
64 *reinterpret_cast<uint32_t*>(start() + 1) = target - start() - kLengthInBytes; 73 *reinterpret_cast<uint32_t*>(start() + 1) = target - start() - kLengthInBytes;
65 CPU::FlushICache(start() + 1, kWordSize); 74 CPU::FlushICache(start() + 1, kWordSize);
66 } 75 }
67 76
(...skipping 18 matching lines...) Expand all
86 95
87 96
88 const int* SetFramePointerPattern::pattern() const { 97 const int* SetFramePointerPattern::pattern() const {
89 static const int kFramePointerPattern[kLengthInBytes] = { 0x48, 0x89, 0xe5 }; 98 static const int kFramePointerPattern[kLengthInBytes] = { 0x48, 0x89, 0xe5 };
90 return kFramePointerPattern; 99 return kFramePointerPattern;
91 } 100 }
92 101
93 } // namespace dart 102 } // namespace dart
94 103
95 #endif // defined TARGET_ARCH_X64 104 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698