| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
| 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 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 823 Address info_address = Assembler::return_address_from_call_start(address); | 823 Address info_address = Assembler::return_address_from_call_start(address); |
| 824 | 824 |
| 825 InstructionSequence* patch_info = InstructionSequence::At(info_address); | 825 InstructionSequence* patch_info = InstructionSequence::At(info_address); |
| 826 return patch_info->IsInlineData(); | 826 return patch_info->IsInlineData(); |
| 827 } | 827 } |
| 828 | 828 |
| 829 | 829 |
| 830 // Activate a SMI fast-path by patching the instructions generated by | 830 // Activate a SMI fast-path by patching the instructions generated by |
| 831 // JumpPatchSite::EmitJumpIf(Not)Smi(), using the information encoded by | 831 // JumpPatchSite::EmitJumpIf(Not)Smi(), using the information encoded by |
| 832 // JumpPatchSite::EmitPatchInfo(). | 832 // JumpPatchSite::EmitPatchInfo(). |
| 833 void PatchInlinedSmiCode(Address address, InlinedSmiCheck check) { | 833 void PatchInlinedSmiCode(Isolate* isolate, Address address, |
| 834 InlinedSmiCheck check) { |
| 834 // The patch information is encoded in the instruction stream using | 835 // The patch information is encoded in the instruction stream using |
| 835 // instructions which have no side effects, so we can safely execute them. | 836 // instructions which have no side effects, so we can safely execute them. |
| 836 // The patch information is encoded directly after the call to the helper | 837 // The patch information is encoded directly after the call to the helper |
| 837 // function which is requesting this patch operation. | 838 // function which is requesting this patch operation. |
| 838 Address info_address = Assembler::return_address_from_call_start(address); | 839 Address info_address = Assembler::return_address_from_call_start(address); |
| 839 InlineSmiCheckInfo info(info_address); | 840 InlineSmiCheckInfo info(info_address); |
| 840 | 841 |
| 841 // Check and decode the patch information instruction. | 842 // Check and decode the patch information instruction. |
| 842 if (!info.HasSmiCheck()) { | 843 if (!info.HasSmiCheck()) { |
| 843 return; | 844 return; |
| 844 } | 845 } |
| 845 | 846 |
| 846 if (FLAG_trace_ic) { | 847 if (FLAG_trace_ic) { |
| 847 PrintF("[ Patching ic at %p, marker=%p, SMI check=%p\n", address, | 848 PrintF("[ Patching ic at %p, marker=%p, SMI check=%p\n", address, |
| 848 info_address, reinterpret_cast<void*>(info.SmiCheck())); | 849 info_address, reinterpret_cast<void*>(info.SmiCheck())); |
| 849 } | 850 } |
| 850 | 851 |
| 851 // Patch and activate code generated by JumpPatchSite::EmitJumpIfNotSmi() | 852 // Patch and activate code generated by JumpPatchSite::EmitJumpIfNotSmi() |
| 852 // and JumpPatchSite::EmitJumpIfSmi(). | 853 // and JumpPatchSite::EmitJumpIfSmi(). |
| 853 // Changing | 854 // Changing |
| 854 // tb(n)z xzr, #0, <target> | 855 // tb(n)z xzr, #0, <target> |
| 855 // to | 856 // to |
| 856 // tb(!n)z test_reg, #0, <target> | 857 // tb(!n)z test_reg, #0, <target> |
| 857 Instruction* to_patch = info.SmiCheck(); | 858 Instruction* to_patch = info.SmiCheck(); |
| 858 PatchingAssembler patcher(to_patch, 1); | 859 PatchingAssembler patcher(isolate, to_patch, 1); |
| 859 DCHECK(to_patch->IsTestBranch()); | 860 DCHECK(to_patch->IsTestBranch()); |
| 860 DCHECK(to_patch->ImmTestBranchBit5() == 0); | 861 DCHECK(to_patch->ImmTestBranchBit5() == 0); |
| 861 DCHECK(to_patch->ImmTestBranchBit40() == 0); | 862 DCHECK(to_patch->ImmTestBranchBit40() == 0); |
| 862 | 863 |
| 863 STATIC_ASSERT(kSmiTag == 0); | 864 STATIC_ASSERT(kSmiTag == 0); |
| 864 STATIC_ASSERT(kSmiTagMask == 1); | 865 STATIC_ASSERT(kSmiTagMask == 1); |
| 865 | 866 |
| 866 int branch_imm = to_patch->ImmTestBranch(); | 867 int branch_imm = to_patch->ImmTestBranch(); |
| 867 Register smi_reg; | 868 Register smi_reg; |
| 868 if (check == ENABLE_INLINED_SMI_CHECK) { | 869 if (check == ENABLE_INLINED_SMI_CHECK) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 880 } else { | 881 } else { |
| 881 DCHECK(to_patch->Mask(TestBranchMask) == TBNZ); | 882 DCHECK(to_patch->Mask(TestBranchMask) == TBNZ); |
| 882 // This is JumpIfSmi(smi_reg, branch_imm). | 883 // This is JumpIfSmi(smi_reg, branch_imm). |
| 883 patcher.tbz(smi_reg, 0, branch_imm); | 884 patcher.tbz(smi_reg, 0, branch_imm); |
| 884 } | 885 } |
| 885 } | 886 } |
| 886 } // namespace internal | 887 } // namespace internal |
| 887 } // namespace v8 | 888 } // namespace v8 |
| 888 | 889 |
| 889 #endif // V8_TARGET_ARCH_ARM64 | 890 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |