OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 5 #if V8_TARGET_ARCH_PPC |
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 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
846 // If the instruction following the call is not a cmp rx, #yyy, nothing | 846 // If the instruction following the call is not a cmp rx, #yyy, nothing |
847 // was inlined. | 847 // was inlined. |
848 Instr instr = Assembler::instr_at(cmp_instruction_address); | 848 Instr instr = Assembler::instr_at(cmp_instruction_address); |
849 return Assembler::IsCmpImmediate(instr); | 849 return Assembler::IsCmpImmediate(instr); |
850 } | 850 } |
851 | 851 |
852 | 852 |
853 // | 853 // |
854 // This code is paired with the JumpPatchSite class in full-codegen-ppc.cc | 854 // This code is paired with the JumpPatchSite class in full-codegen-ppc.cc |
855 // | 855 // |
856 void PatchInlinedSmiCode(Address address, InlinedSmiCheck check) { | 856 void PatchInlinedSmiCode(Isolate* isolate, Address address, |
| 857 InlinedSmiCheck check) { |
857 Address cmp_instruction_address = | 858 Address cmp_instruction_address = |
858 Assembler::return_address_from_call_start(address); | 859 Assembler::return_address_from_call_start(address); |
859 | 860 |
860 // If the instruction following the call is not a cmp rx, #yyy, nothing | 861 // If the instruction following the call is not a cmp rx, #yyy, nothing |
861 // was inlined. | 862 // was inlined. |
862 Instr instr = Assembler::instr_at(cmp_instruction_address); | 863 Instr instr = Assembler::instr_at(cmp_instruction_address); |
863 if (!Assembler::IsCmpImmediate(instr)) { | 864 if (!Assembler::IsCmpImmediate(instr)) { |
864 return; | 865 return; |
865 } | 866 } |
866 | 867 |
(...skipping 17 matching lines...) Expand all Loading... |
884 Instr instr_at_patch = Assembler::instr_at(patch_address); | 885 Instr instr_at_patch = Assembler::instr_at(patch_address); |
885 Instr branch_instr = | 886 Instr branch_instr = |
886 Assembler::instr_at(patch_address + Instruction::kInstrSize); | 887 Assembler::instr_at(patch_address + Instruction::kInstrSize); |
887 // This is patching a conditional "jump if not smi/jump if smi" site. | 888 // This is patching a conditional "jump if not smi/jump if smi" site. |
888 // Enabling by changing from | 889 // Enabling by changing from |
889 // cmp cr0, rx, rx | 890 // cmp cr0, rx, rx |
890 // to | 891 // to |
891 // rlwinm(r0, value, 0, 31, 31, SetRC); | 892 // rlwinm(r0, value, 0, 31, 31, SetRC); |
892 // bc(label, BT/BF, 2) | 893 // bc(label, BT/BF, 2) |
893 // and vice-versa to be disabled again. | 894 // and vice-versa to be disabled again. |
894 CodePatcher patcher(patch_address, 2); | 895 CodePatcher patcher(isolate, patch_address, 2); |
895 Register reg = Assembler::GetRA(instr_at_patch); | 896 Register reg = Assembler::GetRA(instr_at_patch); |
896 if (check == ENABLE_INLINED_SMI_CHECK) { | 897 if (check == ENABLE_INLINED_SMI_CHECK) { |
897 DCHECK(Assembler::IsCmpRegister(instr_at_patch)); | 898 DCHECK(Assembler::IsCmpRegister(instr_at_patch)); |
898 DCHECK_EQ(Assembler::GetRA(instr_at_patch).code(), | 899 DCHECK_EQ(Assembler::GetRA(instr_at_patch).code(), |
899 Assembler::GetRB(instr_at_patch).code()); | 900 Assembler::GetRB(instr_at_patch).code()); |
900 patcher.masm()->TestIfSmi(reg, r0); | 901 patcher.masm()->TestIfSmi(reg, r0); |
901 } else { | 902 } else { |
902 DCHECK(check == DISABLE_INLINED_SMI_CHECK); | 903 DCHECK(check == DISABLE_INLINED_SMI_CHECK); |
903 DCHECK(Assembler::IsAndi(instr_at_patch)); | 904 DCHECK(Assembler::IsAndi(instr_at_patch)); |
904 patcher.masm()->cmp(reg, reg, cr0); | 905 patcher.masm()->cmp(reg, reg, cr0); |
905 } | 906 } |
906 DCHECK(Assembler::IsBranch(branch_instr)); | 907 DCHECK(Assembler::IsBranch(branch_instr)); |
907 | 908 |
908 // Invert the logic of the branch | 909 // Invert the logic of the branch |
909 if (Assembler::GetCondition(branch_instr) == eq) { | 910 if (Assembler::GetCondition(branch_instr) == eq) { |
910 patcher.EmitCondition(ne); | 911 patcher.EmitCondition(ne); |
911 } else { | 912 } else { |
912 DCHECK(Assembler::GetCondition(branch_instr) == ne); | 913 DCHECK(Assembler::GetCondition(branch_instr) == ne); |
913 patcher.EmitCondition(eq); | 914 patcher.EmitCondition(eq); |
914 } | 915 } |
915 } | 916 } |
916 } // namespace internal | 917 } // namespace internal |
917 } // namespace v8 | 918 } // namespace v8 |
918 | 919 |
919 #endif // V8_TARGET_ARCH_PPC | 920 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |