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

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

Issue 154733002: Fix disassembler crash with profiler (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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/code_generator.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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 case 0xB1: return "cmpxchg"; 244 case 0xB1: return "cmpxchg";
245 case 0x50: return "movmskps"; 245 case 0x50: return "movmskps";
246 case 0x51: return "sqrtps"; 246 case 0x51: return "sqrtps";
247 case 0x52: return "rqstps"; 247 case 0x52: return "rqstps";
248 case 0x53: return "rcpps"; 248 case 0x53: return "rcpps";
249 case 0x54: return "andps"; 249 case 0x54: return "andps";
250 case 0x56: return "orps"; 250 case 0x56: return "orps";
251 case 0x57: return "xorps"; 251 case 0x57: return "xorps";
252 case 0x58: return "addps"; 252 case 0x58: return "addps";
253 case 0x59: return "mulps"; 253 case 0x59: return "mulps";
254 case 0x5A: return "cvtps2pd";
254 case 0x5C: return "subps"; 255 case 0x5C: return "subps";
255 case 0x5D: return "minps"; 256 case 0x5D: return "minps";
256 case 0x5E: return "divps"; 257 case 0x5E: return "divps";
257 case 0x5F: return "maxps"; 258 case 0x5F: return "maxps";
258 case 0x28: return "movaps"; 259 case 0x28: return "movaps";
259 case 0x10: return "movups"; 260 case 0x10: return "movups";
260 case 0x11: return "movups"; 261 case 0x11: return "movups";
261 default: return NULL; 262 default: return NULL;
262 } 263 }
263 } 264 }
264 265
266 static const char* PackedDoubleMnemonic(uint8_t data) {
267 const char* mnemonic = NULL;
268 if (data == 0xFE) mnemonic = "paddd ";
269 if (data == 0xFA) mnemonic = "psubd ";
270 if (data == 0x2F) mnemonic = "comisd ";
271 if (data == 0x58) mnemonic = "addpd ";
272 if (data == 0x5C) mnemonic = "subpd ";
273 if (data == 0x59) mnemonic = "mulpd ";
274 if (data == 0x5E) mnemonic = "divpd ";
275 if (data == 0x5D) mnemonic = "minpd ";
276 if (data == 0x5F) mnemonic = "maxpd ";
277 if (data == 0x51) mnemonic = "sqrtpd ";
278 if (data == 0x5A) mnemonic = "cvtpd2ps ";
279 ASSERT(mnemonic != NULL);
280 return mnemonic;
281 }
282
265 283
266 static bool IsTwoXmmRegInstruction(uint8_t f0byte) { 284 static bool IsTwoXmmRegInstruction(uint8_t f0byte) {
267 return f0byte == 0x28 || f0byte == 0x11 || f0byte == 0x12 || 285 return f0byte == 0x28 || f0byte == 0x11 || f0byte == 0x12 ||
268 f0byte == 0x14 || f0byte == 0x15 || f0byte == 0x16 || 286 f0byte == 0x14 || f0byte == 0x15 || f0byte == 0x16 ||
269 f0byte == 0x51 || f0byte == 0x52 || f0byte == 0x53 || 287 f0byte == 0x51 || f0byte == 0x52 || f0byte == 0x53 ||
270 f0byte == 0x54 || f0byte == 0x56 || f0byte == 0x58 || 288 f0byte == 0x54 || f0byte == 0x56 || f0byte == 0x58 ||
271 f0byte == 0x59 || f0byte == 0x5C || f0byte == 0x5D || 289 f0byte == 0x59 || f0byte == 0x5C || f0byte == 0x5D ||
272 f0byte == 0x5E || f0byte == 0x5F; 290 f0byte == 0x5E || f0byte == 0x5F || f0byte == 0x5A;
273 } 291 }
274 292
275 293
276 // The implementation of x86 decoding based on the above tables. 294 // The implementation of x86 decoding based on the above tables.
277 class X86Decoder : public ValueObject { 295 class X86Decoder : public ValueObject {
278 public: 296 public:
279 X86Decoder(char* buffer, intptr_t buffer_size) 297 X86Decoder(char* buffer, intptr_t buffer_size)
280 : buffer_(buffer), 298 : buffer_(buffer),
281 buffer_size_(buffer_size), 299 buffer_size_(buffer_size),
282 buffer_pos_(0) { 300 buffer_pos_(0) {
(...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after
1595 PrintXmmRegister(rm); 1613 PrintXmmRegister(rm);
1596 data += 2; 1614 data += 2;
1597 } else if (*data == 0x15) { 1615 } else if (*data == 0x15) {
1598 int mod, regop, rm; 1616 int mod, regop, rm;
1599 GetModRm(*(data+1), &mod, &regop, &rm); 1617 GetModRm(*(data+1), &mod, &regop, &rm);
1600 Print("unpckhpd "); 1618 Print("unpckhpd ");
1601 PrintXmmRegister(regop); 1619 PrintXmmRegister(regop);
1602 Print(","); 1620 Print(",");
1603 PrintXmmRegister(rm); 1621 PrintXmmRegister(rm);
1604 data += 2; 1622 data += 2;
1605 } else if ((*data == 0xFE) || (*data == 0xFA) || (*data == 0x2F)) { 1623 } else if ((*data == 0xFE) || (*data == 0xFA) || (*data == 0x2F) ||
1606 const char* mnemonic = NULL; 1624 (*data == 0x58) || (*data == 0x5C) || (*data == 0x59) ||
1607 if (*data == 0xFE) mnemonic = "paddd "; 1625 (*data == 0x5E) || (*data == 0x5D) || (*data == 0x5F) ||
1608 if (*data == 0xFA) mnemonic = "psubd "; 1626 (*data == 0x51) || (*data == 0x5A)) {
1609 if (*data == 0x2F) mnemonic = "comisd "; 1627 const char* mnemonic = PackedDoubleMnemonic(*data);
1610 int mod, regop, rm; 1628 int mod, regop, rm;
1611 GetModRm(*(data+1), &mod, &regop, &rm); 1629 GetModRm(*(data+1), &mod, &regop, &rm);
1612 Print(mnemonic); 1630 Print(mnemonic);
1613 PrintXmmRegister(regop); 1631 PrintXmmRegister(regop);
1614 Print(","); 1632 Print(",");
1615 PrintXmmRegister(rm); 1633 PrintXmmRegister(rm);
1616 data += 2; 1634 data += 2;
1617 } else { 1635 } else {
1618 UNIMPLEMENTED(); 1636 UNIMPLEMENTED();
1619 } 1637 }
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
1823 pc); 1841 pc);
1824 pc += instruction_length; 1842 pc += instruction_length;
1825 } 1843 }
1826 1844
1827 return; 1845 return;
1828 } 1846 }
1829 1847
1830 } // namespace dart 1848 } // namespace dart
1831 1849
1832 #endif // defined TARGET_ARCH_IA32 1850 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/code_generator.cc ('k') | runtime/vm/disassembler_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698