| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
| 6 | 6 |
| 7 #include "src/codegen.h" | 7 #include "src/codegen.h" |
| 8 #include "src/ic/ic.h" | 8 #include "src/ic/ic.h" |
| 9 #include "src/ic/ic-compiler.h" | 9 #include "src/ic/ic-compiler.h" |
| 10 #include "src/ic/stub-cache.h" | 10 #include "src/ic/stub-cache.h" |
| (...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 if (*test_instruction_address != Assembler::kTestAlByte) { | 822 if (*test_instruction_address != Assembler::kTestAlByte) { |
| 823 DCHECK(*test_instruction_address == Assembler::kNopByte); | 823 DCHECK(*test_instruction_address == Assembler::kNopByte); |
| 824 return; | 824 return; |
| 825 } | 825 } |
| 826 | 826 |
| 827 Address delta_address = test_instruction_address + 1; | 827 Address delta_address = test_instruction_address + 1; |
| 828 // The delta to the start of the map check instruction and the | 828 // The delta to the start of the map check instruction and the |
| 829 // condition code uses at the patched jump. | 829 // condition code uses at the patched jump. |
| 830 uint8_t delta = *reinterpret_cast<uint8_t*>(delta_address); | 830 uint8_t delta = *reinterpret_cast<uint8_t*>(delta_address); |
| 831 if (FLAG_trace_ic) { | 831 if (FLAG_trace_ic) { |
| 832 PrintF("[ patching ic at %p, test=%p, delta=%d\n", address, | 832 PrintF("[ patching ic at %p, test=%p, delta=%d\n", |
| 833 test_instruction_address, delta); | 833 static_cast<void*>(address), |
| 834 static_cast<void*>(test_instruction_address), delta); |
| 834 } | 835 } |
| 835 | 836 |
| 836 // Patch with a short conditional jump. Enabling means switching from a short | 837 // Patch with a short conditional jump. Enabling means switching from a short |
| 837 // jump-if-carry/not-carry to jump-if-zero/not-zero, whereas disabling is the | 838 // jump-if-carry/not-carry to jump-if-zero/not-zero, whereas disabling is the |
| 838 // reverse operation of that. | 839 // reverse operation of that. |
| 839 Address jmp_address = test_instruction_address - delta; | 840 Address jmp_address = test_instruction_address - delta; |
| 840 DCHECK((check == ENABLE_INLINED_SMI_CHECK) | 841 DCHECK((check == ENABLE_INLINED_SMI_CHECK) |
| 841 ? (*jmp_address == Assembler::kJncShortOpcode || | 842 ? (*jmp_address == Assembler::kJncShortOpcode || |
| 842 *jmp_address == Assembler::kJcShortOpcode) | 843 *jmp_address == Assembler::kJcShortOpcode) |
| 843 : (*jmp_address == Assembler::kJnzShortOpcode || | 844 : (*jmp_address == Assembler::kJnzShortOpcode || |
| 844 *jmp_address == Assembler::kJzShortOpcode)); | 845 *jmp_address == Assembler::kJzShortOpcode)); |
| 845 Condition cc = | 846 Condition cc = |
| 846 (check == ENABLE_INLINED_SMI_CHECK) | 847 (check == ENABLE_INLINED_SMI_CHECK) |
| 847 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) | 848 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) |
| 848 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); | 849 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); |
| 849 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 850 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
| 850 } | 851 } |
| 851 } // namespace internal | 852 } // namespace internal |
| 852 } // namespace v8 | 853 } // namespace v8 |
| 853 | 854 |
| 854 #endif // V8_TARGET_ARCH_X64 | 855 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |