arai-a / smoosh-sync

Automation to make jsparagus and SpiderMonkey bytecode in sync
2 stars 0 forks source link

/js/src/vm/BytecodeUtil-inl.h and one more file have been updated (c6a27259) #329

Open github-actions[bot] opened 1 year ago

github-actions[bot] commented 1 year ago

Files

Changesets

Diffs

/js/src/vm/BytecodeUtil-inl.h

--- 2df411f957801f07a8089a04c907bda66c69ec13/js/src/vm/BytecodeUtil-inl.h
+++ c6a272593c07225b4f26ffcaabfee526d7ce186e/js/src/vm/BytecodeUtil-inl.h
@@ -14,41 +14,43 @@

 namespace js {

 static inline unsigned GetDefCount(jsbytecode* pc) {
   /*
    * Add an extra pushed value for Or/And opcodes, so that they are included
    * in the pushed array of stack values for type inference.
    */
-  switch (JSOp(*pc)) {
+  JSOp op = JSOp(*pc);
+  switch (op) {
     case JSOp::Or:
     case JSOp::And:
     case JSOp::Coalesce:
       return 1;
     case JSOp::Pick:
     case JSOp::Unpick:
       /*
        * Pick pops and pushes how deep it looks in the stack + 1
        * items. i.e. if the stack were |a b[2] c[1] d[0]|, pick 2
        * would pop b, c, and d to rearrange the stack to |a c[0]
        * d[1] b[2]|.
        */
       return pc[1] + 1;
     default:
-      return StackDefs(pc);
+      return StackDefs(op);
   }
 }

 static inline unsigned GetUseCount(jsbytecode* pc) {
-  if (JSOp(*pc) == JSOp::Pick || JSOp(*pc) == JSOp::Unpick) {
+  JSOp op = JSOp(*pc);
+  if (op == JSOp::Pick || op == JSOp::Unpick) {
     return pc[1] + 1;
   }

-  return StackUses(pc);
+  return StackUses(op, pc);
 }

 static inline JSOp ReverseCompareOp(JSOp op) {
   switch (op) {
     case JSOp::Gt:
       return JSOp::Lt;
     case JSOp::Ge:
       return JSOp::Le;

/js/src/vm/BytecodeUtil.h

--- ed8285b6542c7b833fa64b6900eb6faad4a64b1e/js/src/vm/BytecodeUtil.h
+++ c6a272593c07225b4f26ffcaabfee526d7ce186e/js/src/vm/BytecodeUtil.h
@@ -323,18 +323,20 @@ static inline bool BytecodeIsJumpTarget(
     case JSOp::LoopHead:
     case JSOp::AfterYield:
       return true;
     default:
       return false;
   }
 }

-MOZ_ALWAYS_INLINE unsigned StackUses(jsbytecode* pc) {
-  JSOp op = JSOp(*pc);
+// The JSOp argument is superflous, but we are using it to avoid a
+// store forwarding Bug on some Android phones; see Bug 1833315
+MOZ_ALWAYS_INLINE unsigned StackUses(JSOp op, jsbytecode* pc) {
+  MOZ_ASSERT(op == JSOp(*pc));
   int nuses = CodeSpec(op).nuses;
   if (nuses >= 0) {
     return nuses;
   }

   MOZ_ASSERT(nuses == -1);
   switch (op) {
     case JSOp::PopN:
@@ -348,18 +350,18 @@ MOZ_ALWAYS_INLINE unsigned StackUses(jsb
       MOZ_ASSERT(op == JSOp::Call || op == JSOp::CallContent ||
                  op == JSOp::CallIgnoresRv || op == JSOp::Eval ||
                  op == JSOp::CallIter || op == JSOp::CallContentIter ||
                  op == JSOp::StrictEval);
       return 2 + GET_ARGC(pc);
   }
 }

-MOZ_ALWAYS_INLINE unsigned StackDefs(jsbytecode* pc) {
-  int ndefs = CodeSpec(JSOp(*pc)).ndefs;
+MOZ_ALWAYS_INLINE unsigned StackDefs(JSOp op) {
+  int ndefs = CodeSpec(op).ndefs;
   MOZ_ASSERT(ndefs >= 0);
   return ndefs;
 }

 #if defined(DEBUG) || defined(JS_JITSPEW)
 /*
  * Given bytecode address pc in script's main program code, compute the operand
  * stack depth just before (JSOp) *pc executes.  If *pc is not reachable, return