From dc44c3b83cc68ad8b8ed773f8da2d7e657129b92 Mon Sep 17 00:00:00 2001 From: Tooru Fujisawa Date: Thu, 3 Mar 2016 08:03:44 +0900 Subject: [PATCH] Bug 1245112 - Part 31: Move MacroAssembler::branchTestGCThing into generic macro assembler. r=jandem --- js/src/jit/MacroAssembler.h | 6 ++++++ js/src/jit/arm/MacroAssembler-arm-inl.h | 20 +++++++++++++++++++ js/src/jit/arm/MacroAssembler-arm.h | 5 ----- js/src/jit/arm64/MacroAssembler-arm64-inl.h | 20 +++++++++++++++++++ js/src/jit/arm64/MacroAssembler-arm64.h | 5 ----- .../MacroAssembler-mips-shared-inl.h | 19 ++++++++++++++++++ js/src/jit/mips32/MacroAssembler-mips32.cpp | 17 ---------------- js/src/jit/mips32/MacroAssembler-mips32.h | 3 --- js/src/jit/mips64/MacroAssembler-mips64.cpp | 17 ---------------- js/src/jit/mips64/MacroAssembler-mips64.h | 3 --- js/src/jit/none/MacroAssembler-none.h | 1 - js/src/jit/x64/MacroAssembler-x64.h | 5 ----- .../MacroAssembler-x86-shared-inl.h | 20 +++++++++++++++++++ js/src/jit/x86/MacroAssembler-x86.h | 5 ----- 14 files changed, 85 insertions(+), 61 deletions(-) diff --git a/js/src/jit/MacroAssembler.h b/js/src/jit/MacroAssembler.h index abecef1709b..df4463418d7 100644 --- a/js/src/jit/MacroAssembler.h +++ b/js/src/jit/MacroAssembler.h @@ -980,6 +980,9 @@ class MacroAssembler : public MacroAssemblerSpecific inline void branchTestObject(Condition cond, const ValueOperand& value, Label* label) DEFINED_ON(arm, arm64, mips32, mips64, x86_shared); + inline void branchTestGCThing(Condition cond, const Address& address, Label* label) PER_SHARED_ARCH; + inline void branchTestGCThing(Condition cond, const BaseIndex& address, Label* label) PER_SHARED_ARCH; + // Checks if given Value is evaluated to true or false in a condition. // The type of the value should match the type of the method. inline void branchTestInt32Truthy(bool truthy, const ValueOperand& value, Label* label) @@ -1019,6 +1022,9 @@ class MacroAssembler : public MacroAssemblerSpecific template inline void branchTestObjectImpl(Condition cond, const T& t, Label* label) DEFINED_ON(arm, arm64, x86_shared); + template + inline void branchTestGCThingImpl(Condition cond, const T& t, Label* label) + DEFINED_ON(arm, arm64, x86_shared); //}}} check_macroassembler_style public: diff --git a/js/src/jit/arm/MacroAssembler-arm-inl.h b/js/src/jit/arm/MacroAssembler-arm-inl.h index b3a7591e84e..177354b185c 100644 --- a/js/src/jit/arm/MacroAssembler-arm-inl.h +++ b/js/src/jit/arm/MacroAssembler-arm-inl.h @@ -1091,6 +1091,26 @@ MacroAssembler::branchTestObjectImpl(Condition cond, const T& t, Label* label) ma_b(label, c); } +void +MacroAssembler::branchTestGCThing(Condition cond, const Address& address, Label* label) +{ + branchTestGCThingImpl(cond, address, label); +} + +void +MacroAssembler::branchTestGCThing(Condition cond, const BaseIndex& address, Label* label) +{ + branchTestGCThingImpl(cond, address, label); +} + +template +void +MacroAssembler::branchTestGCThingImpl(Condition cond, const T& t, Label* label) +{ + Condition c = testGCThing(cond, t); + ma_b(label, c); +} + //}}} check_macroassembler_style // =============================================================== diff --git a/js/src/jit/arm/MacroAssembler-arm.h b/js/src/jit/arm/MacroAssembler-arm.h index e8ac190a1a5..91dda3becef 100644 --- a/js/src/jit/arm/MacroAssembler-arm.h +++ b/js/src/jit/arm/MacroAssembler-arm.h @@ -684,11 +684,6 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM Condition testMagic(Condition cond, const BaseIndex& src); Condition testGCThing(Condition cond, const BaseIndex& src); - template - void branchTestGCThing(Condition cond, const T& t, Label* label) { - Condition c = testGCThing(cond, t); - ma_b(label, c); - } template void branchTestPrimitive(Condition cond, const T& t, Label* label) { Condition c = testPrimitive(cond, t); diff --git a/js/src/jit/arm64/MacroAssembler-arm64-inl.h b/js/src/jit/arm64/MacroAssembler-arm64-inl.h index 2c84379352b..dab3601b10c 100644 --- a/js/src/jit/arm64/MacroAssembler-arm64-inl.h +++ b/js/src/jit/arm64/MacroAssembler-arm64-inl.h @@ -1190,6 +1190,26 @@ MacroAssembler::branchTestObjectImpl(Condition cond, const T& t, Label* label) B(label, c); } +void +MacroAssembler::branchTestGCThing(Condition cond, const Address& address, Label* label) +{ + branchTestGCThingImpl(cond, address, label); +} + +void +MacroAssembler::branchTestGCThing(Condition cond, const BaseIndex& address, Label* label) +{ + branchTestGCThingImpl(cond, address, label); +} + +template +void +MacroAssembler::branchTestGCThingImpl(Condition cond, const T& src, Label* label) +{ + Condition c = testGCThing(cond, src); + B(label, c); +} + //}}} check_macroassembler_style // =============================================================== diff --git a/js/src/jit/arm64/MacroAssembler-arm64.h b/js/src/jit/arm64/MacroAssembler-arm64.h index 79e1f8b120d..4ac9755cc4c 100644 --- a/js/src/jit/arm64/MacroAssembler-arm64.h +++ b/js/src/jit/arm64/MacroAssembler-arm64.h @@ -1328,11 +1328,6 @@ class MacroAssemblerCompat : public vixl::MacroAssembler return jumpWithPatch(label, Always, documentation); } - template - void branchTestGCThing(Condition cond, const T& src, Label* label) { - Condition c = testGCThing(cond, src); - B(label, c); - } template void branchTestPrimitive(Condition cond, const T& t, Label* label) { Condition c = testPrimitive(cond, t); diff --git a/js/src/jit/mips-shared/MacroAssembler-mips-shared-inl.h b/js/src/jit/mips-shared/MacroAssembler-mips-shared-inl.h index 9abde7aee40..3b68b1207c8 100644 --- a/js/src/jit/mips-shared/MacroAssembler-mips-shared-inl.h +++ b/js/src/jit/mips-shared/MacroAssembler-mips-shared-inl.h @@ -686,6 +686,25 @@ MacroAssembler::branchTestObject(Condition cond, const BaseIndex& address, Label branchTestObject(cond, scratch2, label); } +void +MacroAssembler::branchTestGCThing(Condition cond, const Address& address, Label* label) +{ + MOZ_ASSERT(cond == Equal || cond == NotEqual); + SecondScratchRegisterScope scratch2(*this); + extractTag(address, scratch2); + ma_b(scratch2, ImmTag(JSVAL_LOWER_INCL_TAG_OF_GCTHING_SET), label, + (cond == Equal) ? AboveOrEqual : Below); +} +void +MacroAssembler::branchTestGCThing(Condition cond, const BaseIndex& address, Label* label) +{ + MOZ_ASSERT(cond == Equal || cond == NotEqual); + SecondScratchRegisterScope scratch2(*this); + extractTag(address, scratch2); + ma_b(scratch2, ImmTag(JSVAL_LOWER_INCL_TAG_OF_GCTHING_SET), label, + (cond == Equal) ? AboveOrEqual : Below); +} + //}}} check_macroassembler_style // =============================================================== diff --git a/js/src/jit/mips32/MacroAssembler-mips32.cpp b/js/src/jit/mips32/MacroAssembler-mips32.cpp index ff1d1169aaa..c001458acdf 100644 --- a/js/src/jit/mips32/MacroAssembler-mips32.cpp +++ b/js/src/jit/mips32/MacroAssembler-mips32.cpp @@ -1095,23 +1095,6 @@ MacroAssemblerMIPSCompat::ToType(Operand base) return Operand(Register::FromCode(base.base()), base.disp() + TAG_OFFSET); } -void -MacroAssemblerMIPSCompat::branchTestGCThing(Condition cond, const Address& address, Label* label) -{ - MOZ_ASSERT(cond == Equal || cond == NotEqual); - extractTag(address, SecondScratchReg); - ma_b(SecondScratchReg, ImmTag(JSVAL_LOWER_INCL_TAG_OF_GCTHING_SET), label, - (cond == Equal) ? AboveOrEqual : Below); -} -void -MacroAssemblerMIPSCompat::branchTestGCThing(Condition cond, const BaseIndex& src, Label* label) -{ - MOZ_ASSERT(cond == Equal || cond == NotEqual); - extractTag(src, SecondScratchReg); - ma_b(SecondScratchReg, ImmTag(JSVAL_LOWER_INCL_TAG_OF_GCTHING_SET), label, - (cond == Equal) ? AboveOrEqual : Below); -} - void MacroAssemblerMIPSCompat::branchTestPrimitive(Condition cond, const ValueOperand& value, Label* label) diff --git a/js/src/jit/mips32/MacroAssembler-mips32.h b/js/src/jit/mips32/MacroAssembler-mips32.h index 6e132bad43c..c11d94ed83a 100644 --- a/js/src/jit/mips32/MacroAssembler-mips32.h +++ b/js/src/jit/mips32/MacroAssembler-mips32.h @@ -309,9 +309,6 @@ class MacroAssemblerMIPSCompat : public MacroAssemblerMIPS return value.typeReg(); } - void branchTestGCThing(Condition cond, const Address& address, Label* label); - void branchTestGCThing(Condition cond, const BaseIndex& src, Label* label); - void branchTestPrimitive(Condition cond, const ValueOperand& value, Label* label); void branchTestPrimitive(Condition cond, Register tag, Label* label); diff --git a/js/src/jit/mips64/MacroAssembler-mips64.cpp b/js/src/jit/mips64/MacroAssembler-mips64.cpp index 60cc6e95077..b36d7108ca4 100644 --- a/js/src/jit/mips64/MacroAssembler-mips64.cpp +++ b/js/src/jit/mips64/MacroAssembler-mips64.cpp @@ -1222,23 +1222,6 @@ MacroAssembler::clampDoubleToUint8(FloatRegister input, Register output) bind(&done); } -void -MacroAssemblerMIPS64Compat::branchTestGCThing(Condition cond, const Address& address, Label* label) -{ - MOZ_ASSERT(cond == Equal || cond == NotEqual); - extractTag(address, SecondScratchReg); - ma_b(SecondScratchReg, ImmTag(JSVAL_LOWER_INCL_TAG_OF_GCTHING_SET), label, - (cond == Equal) ? AboveOrEqual : Below); -} -void -MacroAssemblerMIPS64Compat::branchTestGCThing(Condition cond, const BaseIndex& src, Label* label) -{ - MOZ_ASSERT(cond == Equal || cond == NotEqual); - extractTag(src, SecondScratchReg); - ma_b(SecondScratchReg, ImmTag(JSVAL_LOWER_INCL_TAG_OF_GCTHING_SET), label, - (cond == Equal) ? AboveOrEqual : Below); -} - void MacroAssemblerMIPS64Compat::branchTestPrimitive(Condition cond, const ValueOperand& value, Label* label) diff --git a/js/src/jit/mips64/MacroAssembler-mips64.h b/js/src/jit/mips64/MacroAssembler-mips64.h index 1cf63d2c813..d9fc0515ecb 100644 --- a/js/src/jit/mips64/MacroAssembler-mips64.h +++ b/js/src/jit/mips64/MacroAssembler-mips64.h @@ -337,9 +337,6 @@ class MacroAssemblerMIPS64Compat : public MacroAssemblerMIPS64 return SecondScratchReg; } - void branchTestGCThing(Condition cond, const Address& address, Label* label); - void branchTestGCThing(Condition cond, const BaseIndex& src, Label* label); - void branchTestPrimitive(Condition cond, const ValueOperand& value, Label* label); void branchTestPrimitive(Condition cond, Register tag, Label* label); diff --git a/js/src/jit/none/MacroAssembler-none.h b/js/src/jit/none/MacroAssembler-none.h index 5504a558252..a35407c2524 100644 --- a/js/src/jit/none/MacroAssembler-none.h +++ b/js/src/jit/none/MacroAssembler-none.h @@ -345,7 +345,6 @@ class MacroAssemblerNone : public Assembler Register splitTagForTest(ValueOperand) { MOZ_CRASH(); } - template void branchTestGCThing(Condition, T, Label*) { MOZ_CRASH(); } template void branchTestPrimitive(Condition, T, Label*) { MOZ_CRASH(); } template void branchTestMagic(Condition, T, L) { MOZ_CRASH(); } template void branchTestMagicValue(Condition, T, JSWhyMagic, Label*) { MOZ_CRASH(); } diff --git a/js/src/jit/x64/MacroAssembler-x64.h b/js/src/jit/x64/MacroAssembler-x64.h index f81acb48d62..22ab3948351 100644 --- a/js/src/jit/x64/MacroAssembler-x64.h +++ b/js/src/jit/x64/MacroAssembler-x64.h @@ -683,11 +683,6 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared cmp32(reg, tag); } - template - void branchTestGCThing(Condition cond, const T& src, Label* label) { - cond = testGCThing(cond, src); - j(cond, label); - } template void branchTestPrimitive(Condition cond, const T& t, Label* label) { cond = testPrimitive(cond, t); diff --git a/js/src/jit/x86-shared/MacroAssembler-x86-shared-inl.h b/js/src/jit/x86-shared/MacroAssembler-x86-shared-inl.h index f0bb71a2551..a9528c28a93 100644 --- a/js/src/jit/x86-shared/MacroAssembler-x86-shared-inl.h +++ b/js/src/jit/x86-shared/MacroAssembler-x86-shared-inl.h @@ -713,6 +713,26 @@ MacroAssembler::branchTestObjectImpl(Condition cond, const T& t, Label* label) j(cond, label); } +void +MacroAssembler::branchTestGCThing(Condition cond, const Address& address, Label* label) +{ + branchTestGCThingImpl(cond, address, label); +} + +void +MacroAssembler::branchTestGCThing(Condition cond, const BaseIndex& address, Label* label) +{ + branchTestGCThingImpl(cond, address, label); +} + +template +void +MacroAssembler::branchTestGCThingImpl(Condition cond, const T& t, Label* label) +{ + cond = testGCThing(cond, t); + j(cond, label); +} + //}}} check_macroassembler_style // =============================================================== diff --git a/js/src/jit/x86/MacroAssembler-x86.h b/js/src/jit/x86/MacroAssembler-x86.h index 7c1039235d4..0a7f8340028 100644 --- a/js/src/jit/x86/MacroAssembler-x86.h +++ b/js/src/jit/x86/MacroAssembler-x86.h @@ -660,11 +660,6 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared // Type testing instructions can take a tag in a register or a // ValueOperand. template - void branchTestGCThing(Condition cond, const T& t, Label* label) { - cond = testGCThing(cond, t); - j(cond, label); - } - template void branchTestPrimitive(Condition cond, const T& t, Label* label) { cond = testPrimitive(cond, t); j(cond, label);