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

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

Issue 12207117: SSE Assembler and Disassembler support (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Review fixes Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/assembler_x64_test.cc ('k') | runtime/vm/disassembler_x64.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) 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/disassembler.h" 5 #include "vm/disassembler.h"
6 6
7 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. 7 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
8 #if defined(TARGET_ARCH_IA32) 8 #if defined(TARGET_ARCH_IA32)
9 #include "platform/utils.h" 9 #include "platform/utils.h"
10 #include "vm/allocation.h" 10 #include "vm/allocation.h"
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 case 0x31: return "rdtsc"; 230 case 0x31: return "rdtsc";
231 case 0xBE: return "movsx_b"; 231 case 0xBE: return "movsx_b";
232 case 0xBF: return "movsx_w"; 232 case 0xBF: return "movsx_w";
233 case 0xB6: return "movzx_b"; 233 case 0xB6: return "movzx_b";
234 case 0xB7: return "movzx_w"; 234 case 0xB7: return "movzx_w";
235 case 0xAF: return "imul"; 235 case 0xAF: return "imul";
236 case 0xA5: return "shld"; 236 case 0xA5: return "shld";
237 case 0xAD: return "shrd"; 237 case 0xAD: return "shrd";
238 case 0xAB: return "bts"; 238 case 0xAB: return "bts";
239 case 0xB1: return "cmpxchg"; 239 case 0xB1: return "cmpxchg";
240 case 0x50: return "movmskps";
241 case 0x51: return "sqrtps";
242 case 0x52: return "rqstps";
243 case 0x53: return "rcpps";
244 case 0x54: return "andps";
245 case 0x56: return "orps";
240 case 0x57: return "xorps"; 246 case 0x57: return "xorps";
247 case 0x58: return "addps";
248 case 0x59: return "mulps";
249 case 0x5C: return "subps";
250 case 0x5D: return "minps";
251 case 0x5E: return "divps";
252 case 0x5F: return "maxps";
241 case 0x28: return "movaps"; 253 case 0x28: return "movaps";
254 case 0x10: return "movups";
255 case 0x11: return "movups";
242 default: return NULL; 256 default: return NULL;
243 } 257 }
244 } 258 }
245 259
246 260
247 // The implementation of x86 decoding based on the above tables. 261 // The implementation of x86 decoding based on the above tables.
248 class X86Decoder : public ValueObject { 262 class X86Decoder : public ValueObject {
249 public: 263 public:
250 X86Decoder(char* buffer, intptr_t buffer_size) 264 X86Decoder(char* buffer, intptr_t buffer_size)
251 : buffer_(buffer), 265 : buffer_(buffer),
(...skipping 27 matching lines...) Expand all
279 const char* GetBranchPrefix(uint8_t** data); 293 const char* GetBranchPrefix(uint8_t** data);
280 294
281 bool DecodeInstructionType(const InstructionDesc& idesc, 295 bool DecodeInstructionType(const InstructionDesc& idesc,
282 const char* branch_hint, 296 const char* branch_hint,
283 uint8_t** data); 297 uint8_t** data);
284 298
285 // Printing of common values. 299 // Printing of common values.
286 void PrintCPURegister(int reg); 300 void PrintCPURegister(int reg);
287 void PrintCPUByteRegister(int reg); 301 void PrintCPUByteRegister(int reg);
288 void PrintXmmRegister(int reg); 302 void PrintXmmRegister(int reg);
303 void PrintXmmComparison(int comparison);
289 void PrintAddress(uword addr); 304 void PrintAddress(uword addr);
290 305
291 typedef void (X86Decoder::*RegisterNamePrinter)(int reg); 306 typedef void (X86Decoder::*RegisterNamePrinter)(int reg);
292 307
293 int PrintRightOperandHelper(uint8_t* modrmp, 308 int PrintRightOperandHelper(uint8_t* modrmp,
294 RegisterNamePrinter register_printer); 309 RegisterNamePrinter register_printer);
295 int PrintRightOperand(uint8_t* modrmp); 310 int PrintRightOperand(uint8_t* modrmp);
296 int PrintRightXmmOperand(uint8_t* modrmp); 311 int PrintRightXmmOperand(uint8_t* modrmp);
297 int PrintRightByteOperand(uint8_t* modrmp); 312 int PrintRightByteOperand(uint8_t* modrmp);
298 int PrintOperands(const char* mnem, OperandOrder op_order, uint8_t* data); 313 int PrintOperands(const char* mnem, OperandOrder op_order, uint8_t* data);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 UNIMPLEMENTED(); 403 UNIMPLEMENTED();
389 } 404 }
390 405
391 406
392 void X86Decoder::PrintXmmRegister(int reg) { 407 void X86Decoder::PrintXmmRegister(int reg) {
393 ASSERT(0 <= reg); 408 ASSERT(0 <= reg);
394 ASSERT(reg < kMaxXmmRegisters); 409 ASSERT(reg < kMaxXmmRegisters);
395 Print(xmm_regs[reg]); 410 Print(xmm_regs[reg]);
396 } 411 }
397 412
413 void X86Decoder::PrintXmmComparison(int comparison) {
414 ASSERT(0 <= comparison);
415 ASSERT(comparison < 8);
416 static const char* comparisons[8] = {
417 "eq", "lt", "le", "unordered", "not eq", "not lt", "not le", "ordered"
418 };
419 Print(comparisons[comparison]);
420 }
421
398 422
399 static const char* ObjectToCStringNoGC(const Object& obj) { 423 static const char* ObjectToCStringNoGC(const Object& obj) {
400 if (obj.IsSmi() || 424 if (obj.IsSmi() ||
401 obj.IsMint() || 425 obj.IsMint() ||
402 obj.IsDouble() || 426 obj.IsDouble() ||
403 obj.IsString() || 427 obj.IsString() ||
404 obj.IsNull() || 428 obj.IsNull() ||
405 obj.IsBool() || 429 obj.IsBool() ||
406 obj.IsClass() || 430 obj.IsClass() ||
407 obj.IsFunction() || 431 obj.IsFunction() ||
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after
1330 } 1354 }
1331 } else if (f0byte == 0x28) { 1355 } else if (f0byte == 0x28) {
1332 // movaps 1356 // movaps
1333 Print(f0mnem); 1357 Print(f0mnem);
1334 int mod, regop, rm; 1358 int mod, regop, rm;
1335 GetModRm(*data, &mod, &regop, &rm); 1359 GetModRm(*data, &mod, &regop, &rm);
1336 Print(" "); 1360 Print(" ");
1337 PrintXmmRegister(regop); 1361 PrintXmmRegister(regop);
1338 Print(","); 1362 Print(",");
1339 data += PrintRightXmmOperand(data); 1363 data += PrintRightXmmOperand(data);
1364 } else if (f0byte == 0x11) {
1365 Print("movups ");
1366 int mod, regop, rm;
1367 GetModRm(*data, &mod, &regop, &rm);
1368 data += PrintRightXmmOperand(data);
1369 Print(",");
1370 PrintXmmRegister(regop);
1371 } else if (f0byte == 0x10) {
1372 int mod, regop, rm;
1373 GetModRm(*data, &mod, &regop, &rm);
1374 Print("movups ");
1375 PrintXmmRegister(regop);
1376 Print(",");
1377 data += PrintRightOperand(data);
1378 } else if (f0byte == 0x51 || f0byte == 0x52 || f0byte == 0x53 ||
1379 f0byte == 0x54 || f0byte == 0x56 || f0byte == 0x58 ||
1380 f0byte == 0x59 || f0byte == 0x5C || f0byte == 0x5D ||
1381 f0byte == 0x5E || f0byte == 0x5F) {
1382 int mod, regop, rm;
1383 GetModRm(*data, &mod, &regop, &rm);
1384 Print(f0mnem);
1385 Print(" ");
1386 PrintXmmRegister(regop);
1387 Print(",");
1388 data += PrintRightXmmOperand(data);
1389 } else if (f0byte == 0x50) {
1390 Print("movmskpd ");
1391 int mod, regop, rm;
1392 GetModRm(*data, &mod, &regop, &rm);
1393 PrintCPURegister(regop);
1394 Print(",");
1395 data += PrintRightXmmOperand(data);
1396 } else if (f0byte == 0xC2 || f0byte == 0xC6) {
1397 if (f0byte == 0xC2)
1398 Print("cmpps ");
1399 else
1400 Print("shufps ");
1401 int mod, regop, rm;
1402 GetModRm(*data, &mod, &regop, &rm);
1403 Print(" ");
1404 PrintXmmRegister(regop);
1405 Print(",");
1406 data += PrintRightXmmOperand(data);
1407 int comparison = *data;
1408 Print(" [");
1409 PrintHex(comparison);
1410 Print("]");
1411 data++;
1340 } else { 1412 } else {
1341 UNIMPLEMENTED(); 1413 UNIMPLEMENTED();
1342 } 1414 }
1343 } 1415 }
1344 } 1416 }
1345 break; 1417 break;
1346 1418
1347 case 0x8F: 1419 case 0x8F:
1348 { data++; 1420 { data++;
1349 int mod, regop, rm; 1421 int mod, regop, rm;
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
1720 human_buffer, 1792 human_buffer,
1721 sizeof(human_buffer), 1793 sizeof(human_buffer),
1722 pc); 1794 pc);
1723 pc += instruction_length; 1795 pc += instruction_length;
1724 } 1796 }
1725 } 1797 }
1726 1798
1727 } // namespace dart 1799 } // namespace dart
1728 1800
1729 #endif // defined TARGET_ARCH_IA32 1801 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/assembler_x64_test.cc ('k') | runtime/vm/disassembler_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698