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 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 address + Assembler::kCallTargetAddressOffset; | 833 address + Assembler::kCallTargetAddressOffset; |
834 | 834 |
835 // If the instruction following the call is not a andi at, rx, #yyy, nothing | 835 // If the instruction following the call is not a andi at, rx, #yyy, nothing |
836 // was inlined. | 836 // was inlined. |
837 Instr instr = Assembler::instr_at(andi_instruction_address); | 837 Instr instr = Assembler::instr_at(andi_instruction_address); |
838 return Assembler::IsAndImmediate(instr) && | 838 return Assembler::IsAndImmediate(instr) && |
839 Assembler::GetRt(instr) == static_cast<uint32_t>(zero_reg.code()); | 839 Assembler::GetRt(instr) == static_cast<uint32_t>(zero_reg.code()); |
840 } | 840 } |
841 | 841 |
842 | 842 |
843 void PatchInlinedSmiCode(Address address, InlinedSmiCheck check) { | 843 void PatchInlinedSmiCode(Isolate* isolate, Address address, |
| 844 InlinedSmiCheck check) { |
844 Address andi_instruction_address = | 845 Address andi_instruction_address = |
845 address + Assembler::kCallTargetAddressOffset; | 846 address + Assembler::kCallTargetAddressOffset; |
846 | 847 |
847 // If the instruction following the call is not a andi at, rx, #yyy, nothing | 848 // If the instruction following the call is not a andi at, rx, #yyy, nothing |
848 // was inlined. | 849 // was inlined. |
849 Instr instr = Assembler::instr_at(andi_instruction_address); | 850 Instr instr = Assembler::instr_at(andi_instruction_address); |
850 if (!(Assembler::IsAndImmediate(instr) && | 851 if (!(Assembler::IsAndImmediate(instr) && |
851 Assembler::GetRt(instr) == static_cast<uint32_t>(zero_reg.code()))) { | 852 Assembler::GetRt(instr) == static_cast<uint32_t>(zero_reg.code()))) { |
852 return; | 853 return; |
853 } | 854 } |
(...skipping 17 matching lines...) Expand all Loading... |
871 andi_instruction_address - delta * Instruction::kInstrSize; | 872 andi_instruction_address - delta * Instruction::kInstrSize; |
872 Instr instr_at_patch = Assembler::instr_at(patch_address); | 873 Instr instr_at_patch = Assembler::instr_at(patch_address); |
873 // This is patching a conditional "jump if not smi/jump if smi" site. | 874 // This is patching a conditional "jump if not smi/jump if smi" site. |
874 // Enabling by changing from | 875 // Enabling by changing from |
875 // andi at, rx, 0 | 876 // andi at, rx, 0 |
876 // Branch <target>, eq, at, Operand(zero_reg) | 877 // Branch <target>, eq, at, Operand(zero_reg) |
877 // to: | 878 // to: |
878 // andi at, rx, #kSmiTagMask | 879 // andi at, rx, #kSmiTagMask |
879 // Branch <target>, ne, at, Operand(zero_reg) | 880 // Branch <target>, ne, at, Operand(zero_reg) |
880 // and vice-versa to be disabled again. | 881 // and vice-versa to be disabled again. |
881 CodePatcher patcher(patch_address, 2); | 882 CodePatcher patcher(isolate, patch_address, 2); |
882 Register reg = Register::from_code(Assembler::GetRs(instr_at_patch)); | 883 Register reg = Register::from_code(Assembler::GetRs(instr_at_patch)); |
883 if (check == ENABLE_INLINED_SMI_CHECK) { | 884 if (check == ENABLE_INLINED_SMI_CHECK) { |
884 DCHECK(Assembler::IsAndImmediate(instr_at_patch)); | 885 DCHECK(Assembler::IsAndImmediate(instr_at_patch)); |
885 DCHECK_EQ(0u, Assembler::GetImmediate16(instr_at_patch)); | 886 DCHECK_EQ(0u, Assembler::GetImmediate16(instr_at_patch)); |
886 patcher.masm()->andi(at, reg, kSmiTagMask); | 887 patcher.masm()->andi(at, reg, kSmiTagMask); |
887 } else { | 888 } else { |
888 DCHECK_EQ(check, DISABLE_INLINED_SMI_CHECK); | 889 DCHECK_EQ(check, DISABLE_INLINED_SMI_CHECK); |
889 DCHECK(Assembler::IsAndImmediate(instr_at_patch)); | 890 DCHECK(Assembler::IsAndImmediate(instr_at_patch)); |
890 patcher.masm()->andi(at, reg, 0); | 891 patcher.masm()->andi(at, reg, 0); |
891 } | 892 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
925 break; | 926 break; |
926 default: | 927 default: |
927 UNIMPLEMENTED(); | 928 UNIMPLEMENTED(); |
928 } | 929 } |
929 patcher.ChangeBranchCondition(branch_instr, opcode); | 930 patcher.ChangeBranchCondition(branch_instr, opcode); |
930 } | 931 } |
931 } // namespace internal | 932 } // namespace internal |
932 } // namespace v8 | 933 } // namespace v8 |
933 | 934 |
934 #endif // V8_TARGET_ARCH_MIPS | 935 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |