| 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_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
| 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 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 address + Assembler::kCallTargetAddressOffset; | 830 address + Assembler::kCallTargetAddressOffset; |
| 831 | 831 |
| 832 // If the instruction following the call is not a andi at, rx, #yyy, nothing | 832 // If the instruction following the call is not a andi at, rx, #yyy, nothing |
| 833 // was inlined. | 833 // was inlined. |
| 834 Instr instr = Assembler::instr_at(andi_instruction_address); | 834 Instr instr = Assembler::instr_at(andi_instruction_address); |
| 835 return Assembler::IsAndImmediate(instr) && | 835 return Assembler::IsAndImmediate(instr) && |
| 836 Assembler::GetRt(instr) == static_cast<uint32_t>(zero_reg.code()); | 836 Assembler::GetRt(instr) == static_cast<uint32_t>(zero_reg.code()); |
| 837 } | 837 } |
| 838 | 838 |
| 839 | 839 |
| 840 void PatchInlinedSmiCode(Address address, InlinedSmiCheck check) { | 840 void PatchInlinedSmiCode(Isolate* isolate, Address address, |
| 841 InlinedSmiCheck check) { |
| 841 Address andi_instruction_address = | 842 Address andi_instruction_address = |
| 842 address + Assembler::kCallTargetAddressOffset; | 843 address + Assembler::kCallTargetAddressOffset; |
| 843 | 844 |
| 844 // If the instruction following the call is not a andi at, rx, #yyy, nothing | 845 // If the instruction following the call is not a andi at, rx, #yyy, nothing |
| 845 // was inlined. | 846 // was inlined. |
| 846 Instr instr = Assembler::instr_at(andi_instruction_address); | 847 Instr instr = Assembler::instr_at(andi_instruction_address); |
| 847 if (!(Assembler::IsAndImmediate(instr) && | 848 if (!(Assembler::IsAndImmediate(instr) && |
| 848 Assembler::GetRt(instr) == static_cast<uint32_t>(zero_reg.code()))) { | 849 Assembler::GetRt(instr) == static_cast<uint32_t>(zero_reg.code()))) { |
| 849 return; | 850 return; |
| 850 } | 851 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 870 Instr branch_instr = | 871 Instr branch_instr = |
| 871 Assembler::instr_at(patch_address + Instruction::kInstrSize); | 872 Assembler::instr_at(patch_address + Instruction::kInstrSize); |
| 872 // This is patching a conditional "jump if not smi/jump if smi" site. | 873 // This is patching a conditional "jump if not smi/jump if smi" site. |
| 873 // Enabling by changing from | 874 // Enabling by changing from |
| 874 // andi at, rx, 0 | 875 // andi at, rx, 0 |
| 875 // Branch <target>, eq, at, Operand(zero_reg) | 876 // Branch <target>, eq, at, Operand(zero_reg) |
| 876 // to: | 877 // to: |
| 877 // andi at, rx, #kSmiTagMask | 878 // andi at, rx, #kSmiTagMask |
| 878 // Branch <target>, ne, at, Operand(zero_reg) | 879 // Branch <target>, ne, at, Operand(zero_reg) |
| 879 // and vice-versa to be disabled again. | 880 // and vice-versa to be disabled again. |
| 880 CodePatcher patcher(patch_address, 2); | 881 CodePatcher patcher(isolate, patch_address, 2); |
| 881 Register reg = Register::from_code(Assembler::GetRs(instr_at_patch)); | 882 Register reg = Register::from_code(Assembler::GetRs(instr_at_patch)); |
| 882 if (check == ENABLE_INLINED_SMI_CHECK) { | 883 if (check == ENABLE_INLINED_SMI_CHECK) { |
| 883 DCHECK(Assembler::IsAndImmediate(instr_at_patch)); | 884 DCHECK(Assembler::IsAndImmediate(instr_at_patch)); |
| 884 DCHECK_EQ(0u, Assembler::GetImmediate16(instr_at_patch)); | 885 DCHECK_EQ(0u, Assembler::GetImmediate16(instr_at_patch)); |
| 885 patcher.masm()->andi(at, reg, kSmiTagMask); | 886 patcher.masm()->andi(at, reg, kSmiTagMask); |
| 886 } else { | 887 } else { |
| 887 DCHECK_EQ(check, DISABLE_INLINED_SMI_CHECK); | 888 DCHECK_EQ(check, DISABLE_INLINED_SMI_CHECK); |
| 888 DCHECK(Assembler::IsAndImmediate(instr_at_patch)); | 889 DCHECK(Assembler::IsAndImmediate(instr_at_patch)); |
| 889 patcher.masm()->andi(at, reg, 0); | 890 patcher.masm()->andi(at, reg, 0); |
| 890 } | 891 } |
| 891 DCHECK(Assembler::IsBranch(branch_instr)); | 892 DCHECK(Assembler::IsBranch(branch_instr)); |
| 892 if (Assembler::IsBeq(branch_instr)) { | 893 if (Assembler::IsBeq(branch_instr)) { |
| 893 patcher.ChangeBranchCondition(ne); | 894 patcher.ChangeBranchCondition(ne); |
| 894 } else { | 895 } else { |
| 895 DCHECK(Assembler::IsBne(branch_instr)); | 896 DCHECK(Assembler::IsBne(branch_instr)); |
| 896 patcher.ChangeBranchCondition(eq); | 897 patcher.ChangeBranchCondition(eq); |
| 897 } | 898 } |
| 898 } | 899 } |
| 899 } // namespace internal | 900 } // namespace internal |
| 900 } // namespace v8 | 901 } // namespace v8 |
| 901 | 902 |
| 902 #endif // V8_TARGET_ARCH_MIPS64 | 903 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |