Bug 1636916 part 2 - Add branchTestGCThing to the MacroAssembler. r=jonco
authorJan de Mooij <jdemooij@mozilla.com>
Mon, 11 May 2020 17:24:27 +0000
changeset 529280 b1daef8344369667663fcc349337da8b8642f439
parent 529279 faf97dd5d45415bb3bd09757b4ab1c885654981c
child 529281 dbeae97866271549a144aa5a21a4c6a22523bdb0
push id37406
push userdluca@mozilla.com
push dateTue, 12 May 2020 09:34:21 +0000
treeherdermozilla-central@1706d4d54ec6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonco
bugs1636916
milestone78.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1636916 part 2 - Add branchTestGCThing to the MacroAssembler. r=jonco Depends on D74647 Differential Revision: https://phabricator.services.mozilla.com/D74648
js/src/jit/MacroAssembler.h
js/src/jit/arm/MacroAssembler-arm-inl.h
js/src/jit/arm/MacroAssembler-arm.cpp
js/src/jit/arm/MacroAssembler-arm.h
js/src/jit/arm64/MacroAssembler-arm64-inl.h
js/src/jit/arm64/MacroAssembler-arm64.h
js/src/jit/x86-shared/MacroAssembler-x86-shared-inl.h
--- a/js/src/jit/MacroAssembler.h
+++ b/js/src/jit/MacroAssembler.h
@@ -1566,16 +1566,19 @@ class MacroAssembler : public MacroAssem
   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;
+  inline void branchTestGCThing(Condition cond, const ValueOperand& value,
+                                Label* label)
+      DEFINED_ON(arm, arm64, x86_shared);
 
   inline void branchTestPrimitive(Condition cond, const ValueOperand& value,
                                   Label* label)
       DEFINED_ON(arm, arm64, mips32, mips64, x86_shared);
 
   inline void branchTestMagic(Condition cond, const Address& address,
                               Label* label) PER_SHARED_ARCH;
   inline void branchTestMagic(Condition cond, const BaseIndex& address,
--- a/js/src/jit/arm/MacroAssembler-arm-inl.h
+++ b/js/src/jit/arm/MacroAssembler-arm-inl.h
@@ -1810,16 +1810,22 @@ void MacroAssembler::branchTestGCThing(C
   branchTestGCThingImpl(cond, address, label);
 }
 
 void MacroAssembler::branchTestGCThing(Condition cond, const BaseIndex& address,
                                        Label* label) {
   branchTestGCThingImpl(cond, address, label);
 }
 
+void MacroAssembler::branchTestGCThing(Condition cond,
+                                       const ValueOperand& value,
+                                       Label* label) {
+  branchTestGCThingImpl(cond, value, label);
+}
+
 template <typename T>
 void MacroAssembler::branchTestGCThingImpl(Condition cond, const T& t,
                                            Label* label) {
   Condition c = testGCThing(cond, t);
   ma_b(label, c);
 }
 
 void MacroAssembler::branchTestPrimitive(Condition cond, Register tag,
--- a/js/src/jit/arm/MacroAssembler-arm.cpp
+++ b/js/src/jit/arm/MacroAssembler-arm.cpp
@@ -2441,16 +2441,21 @@ Assembler::Condition MacroAssemblerARMCo
   return testMagic(cond, value.typeReg());
 }
 
 Assembler::Condition MacroAssemblerARMCompat::testPrimitive(
     Assembler::Condition cond, const ValueOperand& value) {
   return testPrimitive(cond, value.typeReg());
 }
 
+Assembler::Condition MacroAssemblerARMCompat::testGCThing(
+    Assembler::Condition cond, const ValueOperand& value) {
+  return testGCThing(cond, value.typeReg());
+}
+
 // Register-based tests.
 Assembler::Condition MacroAssemblerARMCompat::testInt32(
     Assembler::Condition cond, Register tag) {
   MOZ_ASSERT(cond == Equal || cond == NotEqual);
   ma_cmp(tag, ImmTag(JSVAL_TAG_INT32));
   return cond;
 }
 
@@ -2513,16 +2518,23 @@ Assembler::Condition MacroAssemblerARMCo
 Assembler::Condition MacroAssemblerARMCompat::testPrimitive(
     Assembler::Condition cond, Register tag) {
   MOZ_ASSERT(cond == Equal || cond == NotEqual);
   ma_cmp(tag, ImmTag(JS::detail::ValueUpperExclPrimitiveTag));
   return cond == Equal ? Below : AboveOrEqual;
 }
 
 Assembler::Condition MacroAssemblerARMCompat::testGCThing(
+    Assembler::Condition cond, Register tag) {
+  MOZ_ASSERT(cond == Equal || cond == NotEqual);
+  ma_cmp(tag, ImmTag(JS::detail::ValueLowerInclGCThingTag));
+  return cond == Equal ? AboveOrEqual : Below;
+}
+
+Assembler::Condition MacroAssemblerARMCompat::testGCThing(
     Assembler::Condition cond, const Address& address) {
   MOZ_ASSERT(cond == Equal || cond == NotEqual);
   ScratchRegisterScope scratch(asMasm());
   Register tag = extractTag(address, scratch);
   ma_cmp(tag, ImmTag(JS::detail::ValueLowerInclGCThingTag));
   return cond == Equal ? AboveOrEqual : Below;
 }
 
--- a/js/src/jit/arm/MacroAssembler-arm.h
+++ b/js/src/jit/arm/MacroAssembler-arm.h
@@ -769,30 +769,32 @@ class MacroAssemblerARMCompat : public M
   Condition testString(Condition cond, const ValueOperand& value);
   Condition testSymbol(Condition cond, const ValueOperand& value);
   Condition testBigInt(Condition cond, const ValueOperand& value);
   Condition testObject(Condition cond, const ValueOperand& value);
   Condition testNumber(Condition cond, const ValueOperand& value);
   Condition testMagic(Condition cond, const ValueOperand& value);
 
   Condition testPrimitive(Condition cond, const ValueOperand& value);
+  Condition testGCThing(Condition cond, const ValueOperand& value);
 
   // Register-based tests.
   Condition testInt32(Condition cond, Register tag);
   Condition testBoolean(Condition cond, Register tag);
   Condition testNull(Condition cond, Register tag);
   Condition testUndefined(Condition cond, Register tag);
   Condition testString(Condition cond, Register tag);
   Condition testSymbol(Condition cond, Register tag);
   Condition testBigInt(Condition cond, Register tag);
   Condition testObject(Condition cond, Register tag);
   Condition testDouble(Condition cond, Register tag);
   Condition testNumber(Condition cond, Register tag);
   Condition testMagic(Condition cond, Register tag);
   Condition testPrimitive(Condition cond, Register tag);
+  Condition testGCThing(Condition cond, Register tag);
 
   Condition testGCThing(Condition cond, const Address& address);
   Condition testMagic(Condition cond, const Address& address);
   Condition testInt32(Condition cond, const Address& address);
   Condition testDouble(Condition cond, const Address& address);
   Condition testBoolean(Condition cond, const Address& address);
   Condition testNull(Condition cond, const Address& address);
   Condition testUndefined(Condition cond, const Address& address);
--- a/js/src/jit/arm64/MacroAssembler-arm64-inl.h
+++ b/js/src/jit/arm64/MacroAssembler-arm64-inl.h
@@ -1524,16 +1524,22 @@ void MacroAssembler::branchTestGCThing(C
   branchTestGCThingImpl(cond, address, label);
 }
 
 void MacroAssembler::branchTestGCThing(Condition cond, const BaseIndex& address,
                                        Label* label) {
   branchTestGCThingImpl(cond, address, label);
 }
 
+void MacroAssembler::branchTestGCThing(Condition cond,
+                                       const ValueOperand& value,
+                                       Label* label) {
+  branchTestGCThingImpl(cond, value, label);
+}
+
 template <typename T>
 void MacroAssembler::branchTestGCThingImpl(Condition cond, const T& src,
                                            Label* label) {
   Condition c = testGCThing(cond, src);
   B(label, c);
 }
 
 void MacroAssembler::branchTestPrimitive(Condition cond, Register tag,
--- a/js/src/jit/arm64/MacroAssembler-arm64.h
+++ b/js/src/jit/arm64/MacroAssembler-arm64.h
@@ -1633,16 +1633,23 @@ class MacroAssemblerCompat : public vixl
   }
   Condition testMagic(Condition cond, const ValueOperand& value) {
     vixl::UseScratchRegisterScope temps(this);
     const Register scratch = temps.AcquireX().asUnsized();
     MOZ_ASSERT(value.valueReg() != scratch);
     splitSignExtTag(value, scratch);
     return testMagic(cond, scratch);
   }
+  Condition testGCThing(Condition cond, const ValueOperand& value) {
+    vixl::UseScratchRegisterScope temps(this);
+    const Register scratch = temps.AcquireX().asUnsized();
+    MOZ_ASSERT(value.valueReg() != scratch);
+    splitSignExtTag(value, scratch);
+    return testGCThing(cond, scratch);
+  }
   Condition testError(Condition cond, const ValueOperand& value) {
     return testMagic(cond, value);
   }
 
   // Address-based tests.
   Condition testGCThing(Condition cond, const Address& address) {
     vixl::UseScratchRegisterScope temps(this);
     const Register scratch = temps.AcquireX().asUnsized();
--- a/js/src/jit/x86-shared/MacroAssembler-x86-shared-inl.h
+++ b/js/src/jit/x86-shared/MacroAssembler-x86-shared-inl.h
@@ -903,16 +903,22 @@ void MacroAssembler::branchTestGCThing(C
   branchTestGCThingImpl(cond, address, label);
 }
 
 void MacroAssembler::branchTestGCThing(Condition cond, const BaseIndex& address,
                                        Label* label) {
   branchTestGCThingImpl(cond, address, label);
 }
 
+void MacroAssembler::branchTestGCThing(Condition cond,
+                                       const ValueOperand& value,
+                                       Label* label) {
+  branchTestGCThingImpl(cond, value, label);
+}
+
 template <typename T>
 void MacroAssembler::branchTestGCThingImpl(Condition cond, const T& t,
                                            Label* label) {
   cond = testGCThing(cond, t);
   j(cond, label);
 }
 
 void MacroAssembler::branchTestPrimitive(Condition cond, Register tag,