| 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_ARM | 5 #if V8_TARGET_ARCH_ARM |
| 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 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 836 Address cmp_instruction_address = | 836 Address cmp_instruction_address = |
| 837 Assembler::return_address_from_call_start(address); | 837 Assembler::return_address_from_call_start(address); |
| 838 | 838 |
| 839 // If the instruction following the call is not a cmp rx, #yyy, nothing | 839 // If the instruction following the call is not a cmp rx, #yyy, nothing |
| 840 // was inlined. | 840 // was inlined. |
| 841 Instr instr = Assembler::instr_at(cmp_instruction_address); | 841 Instr instr = Assembler::instr_at(cmp_instruction_address); |
| 842 return Assembler::IsCmpImmediate(instr); | 842 return Assembler::IsCmpImmediate(instr); |
| 843 } | 843 } |
| 844 | 844 |
| 845 | 845 |
| 846 void PatchInlinedSmiCode(Address address, InlinedSmiCheck check) { | 846 void PatchInlinedSmiCode(Isolate* isolate, Address address, |
| 847 InlinedSmiCheck check) { |
| 847 Address cmp_instruction_address = | 848 Address cmp_instruction_address = |
| 848 Assembler::return_address_from_call_start(address); | 849 Assembler::return_address_from_call_start(address); |
| 849 | 850 |
| 850 // If the instruction following the call is not a cmp rx, #yyy, nothing | 851 // If the instruction following the call is not a cmp rx, #yyy, nothing |
| 851 // was inlined. | 852 // was inlined. |
| 852 Instr instr = Assembler::instr_at(cmp_instruction_address); | 853 Instr instr = Assembler::instr_at(cmp_instruction_address); |
| 853 if (!Assembler::IsCmpImmediate(instr)) { | 854 if (!Assembler::IsCmpImmediate(instr)) { |
| 854 return; | 855 return; |
| 855 } | 856 } |
| 856 | 857 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 875 Instr branch_instr = | 876 Instr branch_instr = |
| 876 Assembler::instr_at(patch_address + Instruction::kInstrSize); | 877 Assembler::instr_at(patch_address + Instruction::kInstrSize); |
| 877 // This is patching a conditional "jump if not smi/jump if smi" site. | 878 // This is patching a conditional "jump if not smi/jump if smi" site. |
| 878 // Enabling by changing from | 879 // Enabling by changing from |
| 879 // cmp rx, rx | 880 // cmp rx, rx |
| 880 // b eq/ne, <target> | 881 // b eq/ne, <target> |
| 881 // to | 882 // to |
| 882 // tst rx, #kSmiTagMask | 883 // tst rx, #kSmiTagMask |
| 883 // b ne/eq, <target> | 884 // b ne/eq, <target> |
| 884 // and vice-versa to be disabled again. | 885 // and vice-versa to be disabled again. |
| 885 CodePatcher patcher(patch_address, 2); | 886 CodePatcher patcher(isolate, patch_address, 2); |
| 886 Register reg = Assembler::GetRn(instr_at_patch); | 887 Register reg = Assembler::GetRn(instr_at_patch); |
| 887 if (check == ENABLE_INLINED_SMI_CHECK) { | 888 if (check == ENABLE_INLINED_SMI_CHECK) { |
| 888 DCHECK(Assembler::IsCmpRegister(instr_at_patch)); | 889 DCHECK(Assembler::IsCmpRegister(instr_at_patch)); |
| 889 DCHECK_EQ(Assembler::GetRn(instr_at_patch).code(), | 890 DCHECK_EQ(Assembler::GetRn(instr_at_patch).code(), |
| 890 Assembler::GetRm(instr_at_patch).code()); | 891 Assembler::GetRm(instr_at_patch).code()); |
| 891 patcher.masm()->tst(reg, Operand(kSmiTagMask)); | 892 patcher.masm()->tst(reg, Operand(kSmiTagMask)); |
| 892 } else { | 893 } else { |
| 893 DCHECK(check == DISABLE_INLINED_SMI_CHECK); | 894 DCHECK(check == DISABLE_INLINED_SMI_CHECK); |
| 894 DCHECK(Assembler::IsTstImmediate(instr_at_patch)); | 895 DCHECK(Assembler::IsTstImmediate(instr_at_patch)); |
| 895 patcher.masm()->cmp(reg, reg); | 896 patcher.masm()->cmp(reg, reg); |
| 896 } | 897 } |
| 897 DCHECK(Assembler::IsBranch(branch_instr)); | 898 DCHECK(Assembler::IsBranch(branch_instr)); |
| 898 if (Assembler::GetCondition(branch_instr) == eq) { | 899 if (Assembler::GetCondition(branch_instr) == eq) { |
| 899 patcher.EmitCondition(ne); | 900 patcher.EmitCondition(ne); |
| 900 } else { | 901 } else { |
| 901 DCHECK(Assembler::GetCondition(branch_instr) == ne); | 902 DCHECK(Assembler::GetCondition(branch_instr) == ne); |
| 902 patcher.EmitCondition(eq); | 903 patcher.EmitCondition(eq); |
| 903 } | 904 } |
| 904 } | 905 } |
| 905 } // namespace internal | 906 } // namespace internal |
| 906 } // namespace v8 | 907 } // namespace v8 |
| 907 | 908 |
| 908 #endif // V8_TARGET_ARCH_ARM | 909 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |