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

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

Issue 8758012: Port object tests to x64. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/assembler_x64_test.cc » ('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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/heap.h" 9 #include "vm/heap.h"
10 #include "vm/memory_region.h" 10 #include "vm/memory_region.h"
(...skipping 25 matching lines...) Expand all
36 36
37 void Assembler::call(Label* label) { 37 void Assembler::call(Label* label) {
38 AssemblerBuffer::EnsureCapacity ensured(&buffer_); 38 AssemblerBuffer::EnsureCapacity ensured(&buffer_);
39 static const int kSize = 5; 39 static const int kSize = 5;
40 EmitUint8(0xE8); 40 EmitUint8(0xE8);
41 EmitLabel(label, kSize); 41 EmitLabel(label, kSize);
42 } 42 }
43 43
44 44
45 void Assembler::call(const ExternalLabel* label) { 45 void Assembler::call(const ExternalLabel* label) {
46 movq(R11, Immediate(label->address())); 46 movq(TMP, Immediate(label->address()));
47 call(R11); 47 call(TMP);
48 } 48 }
49 49
50 50
51 void Assembler::pushq(Register reg) { 51 void Assembler::pushq(Register reg) {
52 AssemblerBuffer::EnsureCapacity ensured(&buffer_); 52 AssemblerBuffer::EnsureCapacity ensured(&buffer_);
53 EmitRegisterREX(reg, REX_NONE); 53 EmitRegisterREX(reg, REX_NONE);
54 EmitUint8(0x50 | (reg & 7)); 54 EmitUint8(0x50 | (reg & 7));
55 } 55 }
56 56
57 57
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 EmitUint8(0xEB); 1068 EmitUint8(0xEB);
1069 EmitNearLabelLink(label); 1069 EmitNearLabelLink(label);
1070 } else { 1070 } else {
1071 EmitUint8(0xE9); 1071 EmitUint8(0xE9);
1072 EmitLabelLink(label); 1072 EmitLabelLink(label);
1073 } 1073 }
1074 } 1074 }
1075 1075
1076 1076
1077 void Assembler::jmp(const ExternalLabel* label) { 1077 void Assembler::jmp(const ExternalLabel* label) {
1078 movq(R11, Immediate(label->address())); 1078 movq(TMP, Immediate(label->address()));
1079 jmp(R11); 1079 jmp(TMP);
1080 } 1080 }
1081 1081
1082 1082
1083 void Assembler::lock() { 1083 void Assembler::lock() {
1084 AssemblerBuffer::EnsureCapacity ensured(&buffer_); 1084 AssemblerBuffer::EnsureCapacity ensured(&buffer_);
1085 EmitUint8(0xF0); 1085 EmitUint8(0xF0);
1086 } 1086 }
1087 1087
1088 1088
1089 void Assembler::cmpxchgl(const Address& address, Register reg) { 1089 void Assembler::cmpxchgl(const Address& address, Register reg) {
(...skipping 27 matching lines...) Expand all
1117 if (value == 1) { 1117 if (value == 1) {
1118 decq(reg); 1118 decq(reg);
1119 } else if (value != 0) { 1119 } else if (value != 0) {
1120 subq(reg, Immediate(value)); 1120 subq(reg, Immediate(value));
1121 } 1121 }
1122 } 1122 }
1123 } 1123 }
1124 1124
1125 1125
1126 void Assembler::LoadObject(Register dst, const Object& object) { 1126 void Assembler::LoadObject(Register dst, const Object& object) {
1127 UNIMPLEMENTED();
1128 ASSERT(object.IsZoneHandle()); 1127 ASSERT(object.IsZoneHandle());
1129 AssemblerBuffer::EnsureCapacity ensured(&buffer_); 1128 AssemblerBuffer::EnsureCapacity ensured(&buffer_);
1130 EmitUint8(0xB8 + dst); 1129 EmitRegisterREX(dst, REX_W);
1130 EmitUint8(0xB8 | (dst & 7));
1131 buffer_.EmitObject(object); 1131 buffer_.EmitObject(object);
1132 } 1132 }
1133 1133
1134 1134
1135 void Assembler::PushObject(const Object& object) { 1135 void Assembler::PushObject(const Object& object) {
1136 UNIMPLEMENTED(); 1136 LoadObject(TMP, object);
1137 ASSERT(object.IsZoneHandle()); 1137 pushq(TMP);
1138 AssemblerBuffer::EnsureCapacity ensured(&buffer_);
1139 EmitUint8(0x68);
1140 buffer_.EmitObject(object);
1141 } 1138 }
1142 1139
1143 1140
1144 void Assembler::CompareObject(Register reg, const Object& object) { 1141 void Assembler::CompareObject(Register reg, const Object& object) {
1145 UNIMPLEMENTED(); 1142 ASSERT(reg != TMP);
1146 ASSERT(object.IsZoneHandle()); 1143 LoadObject(TMP, object);
1147 AssemblerBuffer::EnsureCapacity ensured(&buffer_); 1144 cmpq(reg, TMP);
1148 if (reg == RAX) {
1149 EmitUint8(0x05 + (7 << 3));
1150 buffer_.EmitObject(object);
1151 } else {
1152 EmitUint8(0x81);
1153 EmitOperand(7, Operand(reg));
1154 buffer_.EmitObject(object);
1155 }
1156 } 1145 }
1157 1146
1158 1147
1159 void Assembler::Stop(const char* message) { 1148 void Assembler::Stop(const char* message) {
1160 // Emit the lower half and the higher half of the message address as immediate 1149 // Emit the lower half and the higher half of the message address as immediate
1161 // operands in the test rax instructions, followed by the int3 instruction. 1150 // operands in the test rax instructions, followed by the int3 instruction.
1162 // Execution can be resumed with the 'cont' command in gdb. 1151 // Execution can be resumed with the 'cont' command in gdb.
1163 int64_t message_address = reinterpret_cast<int64_t>(message); 1152 int64_t message_address = reinterpret_cast<int64_t>(message);
1164 testl(RAX, Immediate(Utils::Low32Bits(message_address))); 1153 testl(RAX, Immediate(Utils::Low32Bits(message_address)));
1165 testl(RAX, Immediate(Utils::High32Bits(message_address))); 1154 testl(RAX, Immediate(Utils::High32Bits(message_address)));
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1303 } else { 1292 } else {
1304 EmitRegisterREX(operand, REX_NONE); 1293 EmitRegisterREX(operand, REX_NONE);
1305 } 1294 }
1306 EmitUint8(0xD3); 1295 EmitUint8(0xD3);
1307 EmitOperand(rm, Operand(operand)); 1296 EmitOperand(rm, Operand(operand));
1308 } 1297 }
1309 1298
1310 } // namespace dart 1299 } // namespace dart
1311 1300
1312 #endif // defined TARGET_ARCH_X64 1301 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/assembler_x64_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698