OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1275 // If the instruction following the call is not a test al, nothing | 1275 // If the instruction following the call is not a test al, nothing |
1276 // was inlined. | 1276 // was inlined. |
1277 if (*test_instruction_address != Assembler::kTestAlByte) { | 1277 if (*test_instruction_address != Assembler::kTestAlByte) { |
1278 ASSERT(*test_instruction_address == Assembler::kNopByte); | 1278 ASSERT(*test_instruction_address == Assembler::kNopByte); |
1279 return; | 1279 return; |
1280 } | 1280 } |
1281 | 1281 |
1282 Address delta_address = test_instruction_address + 1; | 1282 Address delta_address = test_instruction_address + 1; |
1283 // The delta to the start of the map check instruction and the | 1283 // The delta to the start of the map check instruction and the |
1284 // condition code uses at the patched jump. | 1284 // condition code uses at the patched jump. |
1285 int8_t delta = *reinterpret_cast<int8_t*>(delta_address); | 1285 uint8_t delta = *reinterpret_cast<uint8_t*>(delta_address); |
1286 if (FLAG_trace_ic) { | 1286 if (FLAG_trace_ic) { |
1287 PrintF("[ patching ic at %p, test=%p, delta=%d\n", | 1287 PrintF("[ patching ic at %p, test=%p, delta=%d\n", |
1288 address, test_instruction_address, delta); | 1288 address, test_instruction_address, delta); |
1289 } | 1289 } |
1290 | 1290 |
1291 // Patch with a short conditional jump. Enabling means switching from a short | 1291 // Patch with a short conditional jump. Enabling means switching from a short |
1292 // jump-if-carry/not-carry to jump-if-zero/not-zero, whereas disabling is the | 1292 // jump-if-carry/not-carry to jump-if-zero/not-zero, whereas disabling is the |
1293 // reverse operation of that. | 1293 // reverse operation of that. |
1294 Address jmp_address = test_instruction_address - delta; | 1294 Address jmp_address = test_instruction_address - delta; |
1295 ASSERT((check == ENABLE_INLINED_SMI_CHECK) | 1295 ASSERT((check == ENABLE_INLINED_SMI_CHECK) |
1296 ? (*jmp_address == Assembler::kJncShortOpcode || | 1296 ? (*jmp_address == Assembler::kJncShortOpcode || |
1297 *jmp_address == Assembler::kJcShortOpcode) | 1297 *jmp_address == Assembler::kJcShortOpcode) |
1298 : (*jmp_address == Assembler::kJnzShortOpcode || | 1298 : (*jmp_address == Assembler::kJnzShortOpcode || |
1299 *jmp_address == Assembler::kJzShortOpcode)); | 1299 *jmp_address == Assembler::kJzShortOpcode)); |
1300 Condition cc = (check == ENABLE_INLINED_SMI_CHECK) | 1300 Condition cc = (check == ENABLE_INLINED_SMI_CHECK) |
1301 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) | 1301 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) |
1302 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); | 1302 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); |
1303 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 1303 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
1304 } | 1304 } |
1305 | 1305 |
1306 | 1306 |
1307 } } // namespace v8::internal | 1307 } } // namespace v8::internal |
1308 | 1308 |
1309 #endif // V8_TARGET_ARCH_IA32 | 1309 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |