Bug 1381423 - Generate slightly better code for visitCallGeneric and RangePopFront. r=jandem
☠☠ backed out by ac2934d4263e ☠ ☠
authorAndré Bargull <andre.bargull@gmail.com>
Mon, 17 Jul 2017 02:23:10 -0700
changeset 418294 aeb1787900b83269847d4ab7ec56008f5d4cfb34
parent 418293 35beba17c5500c9f0344d40ad90481dc16bc0ac4
child 418295 07dd7b5ed0e80f7a97f12a855a2f21dd6f2545c4
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1381423
milestone56.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 1381423 - Generate slightly better code for visitCallGeneric and RangePopFront. r=jandem
js/src/jit/CodeGenerator.cpp
--- a/js/src/jit/CodeGenerator.cpp
+++ b/js/src/jit/CodeGenerator.cpp
@@ -4166,18 +4166,17 @@ CodeGenerator::visitCallGeneric(LCallGen
     MOZ_ASSERT(!call->hasSingleTarget());
 
     // Generate an ArgumentsRectifier.
     JitCode* argumentsRectifier = gen->jitRuntime()->getArgumentsRectifier();
 
     masm.checkStackAlignment();
 
     // Guard that calleereg is actually a function object.
-    masm.loadObjClass(calleereg, nargsreg);
-    masm.branchPtr(Assembler::NotEqual, nargsreg, ImmPtr(&JSFunction::class_), &invoke);
+    masm.branchTestObjClass(Assembler::NotEqual, calleereg, nargsreg, &JSFunction::class_, &invoke);
 
     // Guard that calleereg is an interpreted function with a JSScript.
     // If we are constructing, also ensure the callee is a constructor.
     if (call->mir()->isConstructing()) {
         masm.branchIfNotInterpretedConstructor(calleereg, nargsreg, &invoke);
     } else {
         masm.branchIfFunctionHasNoScript(calleereg, &invoke);
         masm.branchFunctionKind(Assembler::Equal, JSFunction::ClassConstructor, calleereg, objreg, &invoke);
@@ -6579,32 +6578,29 @@ static void
 RangePopFront(MacroAssembler& masm, Register range, Register front, Register dataLength,
               Register temp)
 {
     Register i = temp;
 
     masm.add32(Imm32(1), Address(range, OrderedHashTable::Range::offsetOfCount()));
 
     masm.load32(Address(range, OrderedHashTable::Range::offsetOfI()), i);
-    masm.add32(Imm32(1), i);
 
     Label done, seek;
     masm.bind(&seek);
+    masm.add32(Imm32(1), i);
     masm.branch32(Assembler::AboveOrEqual, i, dataLength, &done);
 
     // We can add sizeof(Data) to |front| to select the next element, because
     // |front| and |range.ht.data[i]| point to the same location.
     MOZ_ASSERT(OrderedHashTable::offsetOfImplDataElement() == 0, "offsetof(Data, element) is 0");
     masm.addPtr(Imm32(OrderedHashTable::sizeofImplData()), front);
 
-    masm.branchTestMagic(Assembler::NotEqual, Address(front, OrderedHashTable::offsetOfEntryKey()),
-                         JS_HASH_KEY_EMPTY, &done);
-
-    masm.add32(Imm32(1), i);
-    masm.jump(&seek);
+    masm.branchTestMagic(Assembler::Equal, Address(front, OrderedHashTable::offsetOfEntryKey()),
+                         JS_HASH_KEY_EMPTY, &seek);
 
     masm.bind(&done);
     masm.store32(i, Address(range, OrderedHashTable::Range::offsetOfI()));
 }
 
 template <class OrderedHashTable>
 static inline void
 RangeDestruct(MacroAssembler& masm, Register range, Register temp0, Register temp1)