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

Side by Side Diff: src/ia32/disasm-ia32.cc

Issue 8776033: Support multi-byte nop instructions as recommended by (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
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 | « src/ia32/deoptimizer-ia32.cc ('k') | src/ia32/lithium-codegen-ia32.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 } 980 }
981 } 981 }
982 break; 982 break;
983 983
984 case 0x81: // fall through 984 case 0x81: // fall through
985 case 0x83: // 0x81 with sign extension bit set 985 case 0x83: // 0x81 with sign extension bit set
986 data += PrintImmediateOp(data); 986 data += PrintImmediateOp(data);
987 break; 987 break;
988 988
989 case 0x0F: 989 case 0x0F:
990 { byte f0byte = *(data+1); 990 { byte f0byte = data[1];
991 const char* f0mnem = F0Mnem(f0byte); 991 const char* f0mnem = F0Mnem(f0byte);
992 if (f0byte == 0x18) { 992 if (f0byte == 0x18) {
993 int mod, regop, rm; 993 int mod, regop, rm;
994 get_modrm(*data, &mod, &regop, &rm); 994 get_modrm(*data, &mod, &regop, &rm);
995 const char* suffix[] = {"nta", "1", "2", "3"}; 995 const char* suffix[] = {"nta", "1", "2", "3"};
996 AppendToBuffer("%s%s ", f0mnem, suffix[regop & 0x03]); 996 AppendToBuffer("%s%s ", f0mnem, suffix[regop & 0x03]);
997 data += PrintRightOperand(data); 997 data += PrintRightOperand(data);
998 } else if (f0byte == 0x1F && data[2] == 0) {
999 AppendToBuffer("nop"); // 3 byte nop.
1000 data += 3;
1001 } else if (f0byte == 0x1F && data[2] == 0x40 && data[3] == 0) {
1002 AppendToBuffer("nop"); // 4 byte nop.
1003 data += 4;
1004 } else if (f0byte == 0x1F && data[2] == 0x44 && data[3] == 0 &&
1005 data[4] == 0) {
1006 AppendToBuffer("nop"); // 5 byte nop.
1007 data += 5;
1008 } else if (f0byte == 0x1F && data[2] == 0x80 && data[3] == 0 &&
1009 data[4] == 0 && data[5] == 0 && data[6] == 0) {
1010 AppendToBuffer("nop"); // 7 byte nop.
1011 data += 7;
1012 } else if (f0byte == 0x1F && data[2] == 0x84 && data[3] == 0 &&
1013 data[4] == 0 && data[5] == 0 && data[6] == 0 &&
1014 data[7] == 0) {
1015 AppendToBuffer("nop"); // 8 byte nop.
1016 data += 8;
998 } else if (f0byte == 0xA2 || f0byte == 0x31) { 1017 } else if (f0byte == 0xA2 || f0byte == 0x31) {
999 AppendToBuffer("%s", f0mnem); 1018 AppendToBuffer("%s", f0mnem);
1000 data += 2; 1019 data += 2;
1001 } else if (f0byte == 0x28) { 1020 } else if (f0byte == 0x28) {
1002 data += 2; 1021 data += 2;
1003 int mod, regop, rm; 1022 int mod, regop, rm;
1004 get_modrm(*data, &mod, &regop, &rm); 1023 get_modrm(*data, &mod, &regop, &rm);
1005 AppendToBuffer("movaps %s,%s", 1024 AppendToBuffer("movaps %s,%s",
1006 NameOfXMMRegister(regop), 1025 NameOfXMMRegister(regop),
1007 NameOfXMMRegister(rm)); 1026 NameOfXMMRegister(rm));
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 AppendToBuffer(",%s", NameOfByteCPURegister(regop)); 1142 AppendToBuffer(",%s", NameOfByteCPURegister(regop));
1124 } else { 1143 } else {
1125 AppendToBuffer("%s ", "mov"); 1144 AppendToBuffer("%s ", "mov");
1126 data += PrintRightOperand(data); 1145 data += PrintRightOperand(data);
1127 AppendToBuffer(",%s", NameOfCPURegister(regop)); 1146 AppendToBuffer(",%s", NameOfCPURegister(regop));
1128 } 1147 }
1129 } 1148 }
1130 break; 1149 break;
1131 1150
1132 case 0x66: // prefix 1151 case 0x66: // prefix
1133 data++; 1152 while (*data == 0x66) data++;
1134 if (*data == 0x8B) { 1153 if (*data == 0xf && data[1] == 0x1f) {
1154 AppendToBuffer("nop"); // 0x66 prefix
1155 } else if (*data == 0x90) {
1156 AppendToBuffer("nop"); // 0x66 prefix
1157 } else if (*data == 0x8B) {
1135 data++; 1158 data++;
1136 data += PrintOperands("mov_w", REG_OPER_OP_ORDER, data); 1159 data += PrintOperands("mov_w", REG_OPER_OP_ORDER, data);
1137 } else if (*data == 0x89) { 1160 } else if (*data == 0x89) {
1138 data++; 1161 data++;
1139 int mod, regop, rm; 1162 int mod, regop, rm;
1140 get_modrm(*data, &mod, &regop, &rm); 1163 get_modrm(*data, &mod, &regop, &rm);
1141 AppendToBuffer("mov_w "); 1164 AppendToBuffer("mov_w ");
1142 data += PrintRightOperand(data); 1165 data += PrintRightOperand(data);
1143 AppendToBuffer(",%s", NameOfCPURegister(regop)); 1166 AppendToBuffer(",%s", NameOfCPURegister(regop));
1144 } else if (*data == 0x0F) { 1167 } else if (*data == 0x0F) {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 } else if (*data == 0x70) { 1274 } else if (*data == 0x70) {
1252 data++; 1275 data++;
1253 int mod, regop, rm; 1276 int mod, regop, rm;
1254 get_modrm(*data, &mod, &regop, &rm); 1277 get_modrm(*data, &mod, &regop, &rm);
1255 int8_t imm8 = static_cast<int8_t>(data[1]); 1278 int8_t imm8 = static_cast<int8_t>(data[1]);
1256 AppendToBuffer("pshufd %s,%s,%d", 1279 AppendToBuffer("pshufd %s,%s,%d",
1257 NameOfXMMRegister(regop), 1280 NameOfXMMRegister(regop),
1258 NameOfXMMRegister(rm), 1281 NameOfXMMRegister(rm),
1259 static_cast<int>(imm8)); 1282 static_cast<int>(imm8));
1260 data += 2; 1283 data += 2;
1284 } else if (*data == 0x90) {
1285 data++;
1286 AppendToBuffer("nop"); // 2 byte nop.
1261 } else if (*data == 0xF3) { 1287 } else if (*data == 0xF3) {
1262 data++; 1288 data++;
1263 int mod, regop, rm; 1289 int mod, regop, rm;
1264 get_modrm(*data, &mod, &regop, &rm); 1290 get_modrm(*data, &mod, &regop, &rm);
1265 AppendToBuffer("psllq %s,%s", 1291 AppendToBuffer("psllq %s,%s",
1266 NameOfXMMRegister(regop), 1292 NameOfXMMRegister(regop),
1267 NameOfXMMRegister(rm)); 1293 NameOfXMMRegister(rm));
1268 data++; 1294 data++;
1269 } else if (*data == 0x73) { 1295 } else if (*data == 0x73) {
1270 data++; 1296 data++;
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
1649 fprintf(f, " "); 1675 fprintf(f, " ");
1650 } 1676 }
1651 fprintf(f, " %s\n", buffer.start()); 1677 fprintf(f, " %s\n", buffer.start());
1652 } 1678 }
1653 } 1679 }
1654 1680
1655 1681
1656 } // namespace disasm 1682 } // namespace disasm
1657 1683
1658 #endif // V8_TARGET_ARCH_IA32 1684 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/deoptimizer-ia32.cc ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698