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 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1296 // If the instruction following the call is not a test al, nothing | 1296 // If the instruction following the call is not a test al, nothing |
1297 // was inlined. | 1297 // was inlined. |
1298 if (*test_instruction_address != Assembler::kTestAlByte) { | 1298 if (*test_instruction_address != Assembler::kTestAlByte) { |
1299 ASSERT(*test_instruction_address == Assembler::kNopByte); | 1299 ASSERT(*test_instruction_address == Assembler::kNopByte); |
1300 return; | 1300 return; |
1301 } | 1301 } |
1302 | 1302 |
1303 Address delta_address = test_instruction_address + 1; | 1303 Address delta_address = test_instruction_address + 1; |
1304 // The delta to the start of the map check instruction and the | 1304 // The delta to the start of the map check instruction and the |
1305 // condition code uses at the patched jump. | 1305 // condition code uses at the patched jump. |
1306 int8_t delta = *reinterpret_cast<int8_t*>(delta_address); | 1306 uint8_t delta = *reinterpret_cast<uint8_t*>(delta_address); |
1307 if (FLAG_trace_ic) { | 1307 if (FLAG_trace_ic) { |
1308 PrintF("[ patching ic at %p, test=%p, delta=%d\n", | 1308 PrintF("[ patching ic at %p, test=%p, delta=%d\n", |
1309 address, test_instruction_address, delta); | 1309 address, test_instruction_address, delta); |
1310 } | 1310 } |
1311 | 1311 |
1312 // Patch with a short conditional jump. Enabling means switching from a short | 1312 // Patch with a short conditional jump. Enabling means switching from a short |
1313 // jump-if-carry/not-carry to jump-if-zero/not-zero, whereas disabling is the | 1313 // jump-if-carry/not-carry to jump-if-zero/not-zero, whereas disabling is the |
1314 // reverse operation of that. | 1314 // reverse operation of that. |
1315 Address jmp_address = test_instruction_address - delta; | 1315 Address jmp_address = test_instruction_address - delta; |
1316 ASSERT((check == ENABLE_INLINED_SMI_CHECK) | 1316 ASSERT((check == ENABLE_INLINED_SMI_CHECK) |
1317 ? (*jmp_address == Assembler::kJncShortOpcode || | 1317 ? (*jmp_address == Assembler::kJncShortOpcode || |
1318 *jmp_address == Assembler::kJcShortOpcode) | 1318 *jmp_address == Assembler::kJcShortOpcode) |
1319 : (*jmp_address == Assembler::kJnzShortOpcode || | 1319 : (*jmp_address == Assembler::kJnzShortOpcode || |
1320 *jmp_address == Assembler::kJzShortOpcode)); | 1320 *jmp_address == Assembler::kJzShortOpcode)); |
1321 Condition cc = (check == ENABLE_INLINED_SMI_CHECK) | 1321 Condition cc = (check == ENABLE_INLINED_SMI_CHECK) |
1322 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) | 1322 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) |
1323 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); | 1323 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); |
1324 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 1324 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
1325 } | 1325 } |
1326 | 1326 |
1327 | 1327 |
1328 } } // namespace v8::internal | 1328 } } // namespace v8::internal |
1329 | 1329 |
1330 #endif // V8_TARGET_ARCH_X64 | 1330 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |