Bug 1546778 - Improve commenting in visitObjectGroupDispatch r=jandem DONTBUILD
authorMatthew Gaudet <mgaudet@mozilla.com>
Fri, 26 Apr 2019 12:48:09 +0000
changeset 471476 bead97221072097029cf26069459a9fb5e1a0d49
parent 471475 91925dfb453226613fdbbcad3222e990396b4bdc
child 471477 71d3155b4fa79dd6230aa1ab885617e1d2bc2fb3
push id35920
push useraiakab@mozilla.com
push dateFri, 26 Apr 2019 22:02:33 +0000
treeherdermozilla-central@b13f2b24ae62 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1546778
milestone68.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 1546778 - Improve commenting in visitObjectGroupDispatch r=jandem DONTBUILD Differential Revision: https://phabricator.services.mozilla.com/D28722
js/src/jit/CodeGenerator.cpp
--- a/js/src/jit/CodeGenerator.cpp
+++ b/js/src/jit/CodeGenerator.cpp
@@ -1453,60 +1453,70 @@ void CodeGenerator::visitObjectGroupDisp
   MacroAssembler::BranchGCPtr lastBranch;
   LBlock* lastBlock = nullptr;
   InlinePropertyTable* propTable = mir->propTable();
   for (size_t i = 0; i < mir->numCases(); i++) {
     JSFunction* func = mir->getCase(i);
     LBlock* target = skipTrivialBlocks(mir->getCaseBlock(i))->lir();
 
     DebugOnly<bool> found = false;
+    // Find the function in the prop table.
     for (size_t j = 0; j < propTable->numEntries(); j++) {
       if (propTable->getFunction(j) != func) {
         continue;
       }
 
+      // Emit the previous prop's jump.
       if (lastBranch.isInitialized()) {
         lastBranch.emit(masm);
       }
 
+      // Setup jump for next iteration.
       ObjectGroup* group = propTable->getObjectGroup(j);
       lastBranch = MacroAssembler::BranchGCPtr(
           Assembler::Equal, temp, ImmGCPtr(group), target->label());
       lastBlock = target;
       found = true;
     }
     MOZ_ASSERT(found);
   }
 
+  // At this point the final case branch hasn't been emitted.
+
   // Jump to fallback block if we have an unknown ObjectGroup. If there's no
   // fallback block, we should have handled all cases.
-
   if (!mir->hasFallback()) {
     MOZ_ASSERT(lastBranch.isInitialized());
 
     Label ok;
+    // Change the target of the branch to OK.
     lastBranch.relink(&ok);
     lastBranch.emit(masm);
     masm.assumeUnreachable("Unexpected ObjectGroup");
     masm.bind(&ok);
 
+    // If we don't naturally fall through to the target,
+    // then jump to the target.
     if (!isNextBlock(lastBlock)) {
       masm.jump(lastBlock->label());
     }
     return;
   }
 
   LBlock* fallback = skipTrivialBlocks(mir->getFallback())->lir();
+  // This should only happen if we have zero cases. We're done then.
   if (!lastBranch.isInitialized()) {
     if (!isNextBlock(fallback)) {
       masm.jump(fallback->label());
     }
     return;
   }
 
+  // If we don't match the last object group and we have a fallback,
+  // we should jump to it.
   lastBranch.invertCondition();
   lastBranch.relink(fallback->label());
   lastBranch.emit(masm);
 
   if (!isNextBlock(lastBlock)) {
     masm.jump(lastBlock->label());
   }
 }