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_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
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 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
874 | 874 |
875 if (FLAG_trace_ic) { | 875 if (FLAG_trace_ic) { |
876 PrintF("[ patching ic at %p, andi=%p, delta=%d\n", address, | 876 PrintF("[ patching ic at %p, andi=%p, delta=%d\n", address, |
877 andi_instruction_address, delta); | 877 andi_instruction_address, delta); |
878 } | 878 } |
879 | 879 |
880 Address patch_address = | 880 Address patch_address = |
881 andi_instruction_address - delta * Instruction::kInstrSize; | 881 andi_instruction_address - delta * Instruction::kInstrSize; |
882 Instr instr_at_patch = Assembler::instr_at(patch_address); | 882 Instr instr_at_patch = Assembler::instr_at(patch_address); |
883 Instr branch_instr = | 883 Instr branch_instr = |
884 Assembler::instr_at(patch_address + Instruction::kInstrSize); | 884 Assembler::instr_at(patch_address + Instruction::kInstrSize); |
paul.l...
2015/10/15 01:51:24
Add ' USE(branch_instr);' here or somewhere. After
balazs.kilvady
2015/10/30 21:11:14
Done.
| |
885 // This is patching a conditional "jump if not smi/jump if smi" site. | 885 // This is patching a conditional "jump if not smi/jump if smi" site. |
886 // Enabling by changing from | 886 // Enabling by changing from |
887 // andi at, rx, 0 | 887 // andi at, rx, 0 |
888 // Branch <target>, eq, at, Operand(zero_reg) | 888 // Branch <target>, eq, at, Operand(zero_reg) |
889 // to: | 889 // to: |
890 // andi at, rx, #kSmiTagMask | 890 // andi at, rx, #kSmiTagMask |
891 // Branch <target>, ne, at, Operand(zero_reg) | 891 // Branch <target>, ne, at, Operand(zero_reg) |
892 // and vice-versa to be disabled again. | 892 // and vice-versa to be disabled again. |
893 CodePatcher patcher(patch_address, 2); | 893 CodePatcher patcher(patch_address, 2); |
894 Register reg = Register::from_code(Assembler::GetRs(instr_at_patch)); | 894 Register reg = Register::from_code(Assembler::GetRs(instr_at_patch)); |
895 if (check == ENABLE_INLINED_SMI_CHECK) { | 895 if (check == ENABLE_INLINED_SMI_CHECK) { |
896 DCHECK(Assembler::IsAndImmediate(instr_at_patch)); | 896 DCHECK(Assembler::IsAndImmediate(instr_at_patch)); |
897 DCHECK_EQ(0u, Assembler::GetImmediate16(instr_at_patch)); | 897 DCHECK_EQ(0u, Assembler::GetImmediate16(instr_at_patch)); |
898 patcher.masm()->andi(at, reg, kSmiTagMask); | 898 patcher.masm()->andi(at, reg, kSmiTagMask); |
899 } else { | 899 } else { |
900 DCHECK_EQ(check, DISABLE_INLINED_SMI_CHECK); | 900 DCHECK_EQ(check, DISABLE_INLINED_SMI_CHECK); |
901 DCHECK(Assembler::IsAndImmediate(instr_at_patch)); | 901 DCHECK(Assembler::IsAndImmediate(instr_at_patch)); |
902 patcher.masm()->andi(at, reg, 0); | 902 patcher.masm()->andi(at, reg, 0); |
903 } | 903 } |
904 DCHECK(Assembler::IsBranch(branch_instr)); | 904 DCHECK(Assembler::IsBranch(branch_instr)); |
905 if (Assembler::IsBeq(branch_instr)) { | 905 patcher.ChangeBranchCondition(); |
paul.l...
2015/10/15 01:51:24
I kind of like the old way, where you check if (eq
balazs.kilvady
2015/10/30 21:11:14
Done.
| |
906 patcher.ChangeBranchCondition(ne); | |
907 } else { | |
908 DCHECK(Assembler::IsBne(branch_instr)); | |
909 patcher.ChangeBranchCondition(eq); | |
910 } | |
911 } | 906 } |
912 } // namespace internal | 907 } // namespace internal |
913 } // namespace v8 | 908 } // namespace v8 |
914 | 909 |
915 #endif // V8_TARGET_ARCH_MIPS | 910 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |