| 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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
| 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 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 829 if (*test_instruction_address != Assembler::kTestAlByte) { | 829 if (*test_instruction_address != Assembler::kTestAlByte) { |
| 830 DCHECK(*test_instruction_address == Assembler::kNopByte); | 830 DCHECK(*test_instruction_address == Assembler::kNopByte); |
| 831 return; | 831 return; |
| 832 } | 832 } |
| 833 | 833 |
| 834 Address delta_address = test_instruction_address + 1; | 834 Address delta_address = test_instruction_address + 1; |
| 835 // The delta to the start of the map check instruction and the | 835 // The delta to the start of the map check instruction and the |
| 836 // condition code uses at the patched jump. | 836 // condition code uses at the patched jump. |
| 837 uint8_t delta = *reinterpret_cast<uint8_t*>(delta_address); | 837 uint8_t delta = *reinterpret_cast<uint8_t*>(delta_address); |
| 838 if (FLAG_trace_ic) { | 838 if (FLAG_trace_ic) { |
| 839 PrintF("[ patching ic at %p, test=%p, delta=%d\n", address, | 839 PrintF("[ patching ic at %p, test=%p, delta=%d\n", |
| 840 test_instruction_address, delta); | 840 static_cast<void*>(address), |
| 841 static_cast<void*>(test_instruction_address), delta); |
| 841 } | 842 } |
| 842 | 843 |
| 843 // Patch with a short conditional jump. Enabling means switching from a short | 844 // Patch with a short conditional jump. Enabling means switching from a short |
| 844 // jump-if-carry/not-carry to jump-if-zero/not-zero, whereas disabling is the | 845 // jump-if-carry/not-carry to jump-if-zero/not-zero, whereas disabling is the |
| 845 // reverse operation of that. | 846 // reverse operation of that. |
| 846 Address jmp_address = test_instruction_address - delta; | 847 Address jmp_address = test_instruction_address - delta; |
| 847 DCHECK((check == ENABLE_INLINED_SMI_CHECK) | 848 DCHECK((check == ENABLE_INLINED_SMI_CHECK) |
| 848 ? (*jmp_address == Assembler::kJncShortOpcode || | 849 ? (*jmp_address == Assembler::kJncShortOpcode || |
| 849 *jmp_address == Assembler::kJcShortOpcode) | 850 *jmp_address == Assembler::kJcShortOpcode) |
| 850 : (*jmp_address == Assembler::kJnzShortOpcode || | 851 : (*jmp_address == Assembler::kJnzShortOpcode || |
| 851 *jmp_address == Assembler::kJzShortOpcode)); | 852 *jmp_address == Assembler::kJzShortOpcode)); |
| 852 Condition cc = | 853 Condition cc = |
| 853 (check == ENABLE_INLINED_SMI_CHECK) | 854 (check == ENABLE_INLINED_SMI_CHECK) |
| 854 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) | 855 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) |
| 855 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); | 856 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); |
| 856 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 857 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
| 857 } | 858 } |
| 858 } // namespace internal | 859 } // namespace internal |
| 859 } // namespace v8 | 860 } // namespace v8 |
| 860 | 861 |
| 861 #endif // V8_TARGET_ARCH_IA32 | 862 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |