arai-a / smoosh-sync

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

/js/src/vm/Opcodes.h and one more file have been updated (ed8285b6) #325

Open github-actions[bot] opened 1 year ago

github-actions[bot] commented 1 year ago

Files

Changesets

Diffs

/js/src/vm/BytecodeUtil.h

--- d85e933ffd605cf38d796294b929a0241ab55d62/js/src/vm/BytecodeUtil.h
+++ ed8285b6542c7b833fa64b6900eb6faad4a64b1e/js/src/vm/BytecodeUtil.h
@@ -526,16 +526,20 @@ inline bool IsConstructOp(JSOp op) {
 inline bool IsConstructPC(const jsbytecode* pc) {
   return IsConstructOp(JSOp(*pc));
 }

 inline bool IsSpreadOp(JSOp op) { return CodeSpec(op).format & JOF_SPREAD; }

 inline bool IsSpreadPC(const jsbytecode* pc) { return IsSpreadOp(JSOp(*pc)); }

+inline bool OpUsesEnvironmentChain(JSOp op) {
+  return CodeSpec(op).format & JOF_USES_ENV;
+}
+
 static inline int32_t GetBytecodeInteger(jsbytecode* pc) {
   switch (JSOp(*pc)) {
     case JSOp::Zero:
       return 0;
     case JSOp::One:
       return 1;
     case JSOp::Uint16:
       return GET_UINT16(pc);

/js/src/vm/Opcodes.h

--- ab307229ef848175e11c66db534ffb40d5f213c5/js/src/vm/Opcodes.h
+++ 64b2487b96b949b3c6a787dfd17210f9998fb42e/js/src/vm/Opcodes.h
@@ -1660,17 +1660,17 @@
      * [1]: https://tc39.es/ecma262/#sec-function-definitions-runtime-semantics-instantiatefunctionobject
      * [2]: https://tc39.es/ecma262/#sec-function-definitions-runtime-semantics-evaluation
      *
      *   Category: Functions
      *   Type: Creating functions
      *   Operands: uint32_t funcIndex
      *   Stack: => fn
      */ \
-    MACRO(Lambda, lambda, NULL, 5, 0, 1, JOF_OBJECT) \
+    MACRO(Lambda, lambda, NULL, 5, 0, 1, JOF_OBJECT|JOF_USES_ENV) \
     /*
      * Set the name of a function.
      *
      * `fun` must be a function object. `name` must be a string, Int32 value,
      * or symbol (like the result of `JSOp::ToId`).
      *
      * Implements: [SetFunctionName][1], used e.g. to name methods with
      * computed property names.
@@ -1723,17 +1723,17 @@
      *
      * [1]: https://tc39.es/ecma262/#sec-runtime-semantics-classdefinitionevaluation
      *
      *   Category: Functions
      *   Type: Creating constructors
      *   Operands: uint32_t funcIndex
      *   Stack: proto => obj
      */ \
-    MACRO(FunWithProto, fun_with_proto, NULL, 5, 1, 1, JOF_OBJECT) \
+    MACRO(FunWithProto, fun_with_proto, NULL, 5, 1, 1, JOF_OBJECT|JOF_USES_ENV) \
     /*
      * Pushes the current global's %BuiltinObject%.
      *
      * `kind` must be a valid `BuiltinObjectKind` (and must not be
      * `BuiltinObjectKind::None`).
      *
      *   Category: Objects
      *   Type: Built-in objects
@@ -1886,17 +1886,17 @@
      * [1]: https://tc39.es/ecma262/#sec-evaluatecall
      * [2]: https://bugzilla.mozilla.org/show_bug.cgi?id=1166408
      *
      *   Category: Functions
      *   Type: Calls
      *   Operands: uint32_t nameIndex
      *   Stack: => this
      */ \
-    MACRO(ImplicitThis, implicit_this, "", 5, 0, 1, JOF_ATOM) \
+    MACRO(ImplicitThis, implicit_this, "", 5, 0, 1, JOF_ATOM|JOF_USES_ENV) \
     /*
      * Push the call site object for a tagged template call.
      *
      * `script->getObject(objectIndex)` is the call site object.
      *
      * The call site object will already have the `.raw` property defined on it
      * and will be frozen.
      *
@@ -2000,17 +2000,17 @@
      * object for the current frame (that is, this instruction must execute at
      * most once per generator or async call).
      *
      *   Category: Functions
      *   Type: Generators and async functions
      *   Operands:
      *   Stack: => gen
      */ \
-    MACRO(Generator, generator, NULL, 1, 0, 1, JOF_BYTE) \
+    MACRO(Generator, generator, NULL, 1, 0, 1, JOF_BYTE|JOF_USES_ENV) \
     /*
      * Suspend the current generator and return to the caller.
      *
      * When a generator is called, its script starts running, like any other JS
      * function, because [FunctionDeclarationInstantation][1] and other
      * [generator object setup][2] are implemented mostly in bytecode. However,
      * the *FunctionBody* of the generator is not supposed to start running
      * until the first `.next()` call, so after setup the script suspends
@@ -2778,17 +2778,17 @@
      * contains a binding for that name. If no such binding exists, push the
      * global lexical environment.
      *
      *   Category: Variables and scopes
      *   Type: Looking up bindings
      *   Operands: uint32_t nameIndex
      *   Stack: => env
      */ \
-    MACRO(BindName, bind_name, NULL, 5, 0, 1, JOF_ATOM|JOF_NAME|JOF_IC) \
+    MACRO(BindName, bind_name, NULL, 5, 0, 1, JOF_ATOM|JOF_NAME|JOF_IC|JOF_USES_ENV) \
     /*
      * Find a binding on the environment chain and push its value.
      *
      * If the binding is an uninitialized lexical, throw a ReferenceError. If
      * no such binding exists, throw a ReferenceError unless the next
      * instruction is `JSOp::Typeof`, in which case push `undefined`.
      *
      * Implements: [ResolveBinding][1] followed by [GetValue][2]
@@ -2800,17 +2800,17 @@
      * [1]: https://tc39.es/ecma262/#sec-resolvebinding
      * [2]: https://tc39.es/ecma262/#sec-getvalue
      *
      *   Category: Variables and scopes
      *   Type: Getting binding values
      *   Operands: uint32_t nameIndex
      *   Stack: => val
      */ \
-    MACRO(GetName, get_name, NULL, 5, 0, 1, JOF_ATOM|JOF_NAME|JOF_IC) \
+    MACRO(GetName, get_name, NULL, 5, 0, 1, JOF_ATOM|JOF_NAME|JOF_IC|JOF_USES_ENV) \
     /*
      * Find a global binding and push its value.
      *
      * This searches the global lexical environment and, failing that, the
      * global object. (Unlike most declarative environments, the global lexical
      * environment can gain more bindings after compilation, possibly shadowing
      * global object properties.)
      *
@@ -2906,17 +2906,17 @@
      *
      * [1]: https://searchfox.org/mozilla-central/search?q=symbol:T_js%3A%3AEnvironmentCoordinate
      *
      *   Category: Variables and scopes
      *   Type: Getting binding values
      *   Operands: uint8_t hops, uint24_t slot
      *   Stack: => aliasedVar
      */ \
-    MACRO(GetAliasedVar, get_aliased_var, NULL, 5, 0, 1, JOF_ENVCOORD|JOF_NAME) \
+    MACRO(GetAliasedVar, get_aliased_var, NULL, 5, 0, 1, JOF_ENVCOORD|JOF_NAME|JOF_USES_ENV) \
     /*
      * Push the value of an aliased binding, which may have to bypass a DebugEnvironmentProxy
      * on the environment chain.
      *
      *   Category: Variables and scopes
      *   Type: Getting binding values
      *   Operands: uint8_t hops, uint24_t slot
      *   Stack: => aliasedVar
@@ -3023,32 +3023,32 @@
      *
      * [1]: https://tc39.es/ecma262/#sec-putvalue
      *
      *   Category: Variables and scopes
      *   Type: Setting binding values
      *   Operands: uint32_t nameIndex
      *   Stack: env, val => val
      */ \
-    MACRO(SetName, set_name, NULL, 5, 2, 1, JOF_ATOM|JOF_NAME|JOF_PROPSET|JOF_CHECKSLOPPY|JOF_IC) \
+    MACRO(SetName, set_name, NULL, 5, 2, 1, JOF_ATOM|JOF_NAME|JOF_PROPSET|JOF_CHECKSLOPPY|JOF_IC|JOF_USES_ENV) \
     /*
      * Like `JSOp::SetName`, but throw a TypeError if there is no binding for
      * the specified name in `env`, or if the binding is immutable (a `const`
      * or read-only property).
      *
      * Implements: [PutValue][1] steps 5 and 7 for strict mode code.
      *
      * [1]: https://tc39.es/ecma262/#sec-putvalue
      *
      *   Category: Variables and scopes
      *   Type: Setting binding values
      *   Operands: uint32_t nameIndex
      *   Stack: env, val => val
      */ \
-    MACRO(StrictSetName, strict_set_name, NULL, 5, 2, 1, JOF_ATOM|JOF_NAME|JOF_PROPSET|JOF_CHECKSTRICT|JOF_IC) \
+    MACRO(StrictSetName, strict_set_name, NULL, 5, 2, 1, JOF_ATOM|JOF_NAME|JOF_PROPSET|JOF_CHECKSTRICT|JOF_IC|JOF_USES_ENV) \
     /*
      * Like `JSOp::SetName`, but for assigning to globals. `env` must be an
      * environment pushed by `JSOp::BindGName`.
      *
      *   Category: Variables and scopes
      *   Type: Setting binding values
      *   Operands: uint32_t nameIndex
      *   Stack: env, val => val
@@ -3092,17 +3092,17 @@
      *
      * [1]: https://tc39.es/ecma262/#sec-declarative-environment-records-setmutablebinding-n-v-s
      *
      *   Category: Variables and scopes
      *   Type: Setting binding values
      *   Operands: uint8_t hops, uint24_t slot
      *   Stack: val => val
      */ \
-    MACRO(SetAliasedVar, set_aliased_var, NULL, 5, 1, 1, JOF_ENVCOORD|JOF_NAME|JOF_PROPSET) \
+    MACRO(SetAliasedVar, set_aliased_var, NULL, 5, 1, 1, JOF_ENVCOORD|JOF_NAME|JOF_PROPSET|JOF_USES_ENV) \
     /*
      * Assign to an intrinsic.
      *
      * Nonstandard. Intrinsics are used in lieu of global bindings in self-
      * hosted code. The value is actually stored in the intrinsics holder
      * object, `GlobalObject::getIntrinsicsHolder`. (Self-hosted code doesn't
      * have many global `var`s, but it has many `function`s.)
      *
@@ -3150,28 +3150,28 @@
      *
      * [1]: https://tc39.es/ecma262/#sec-block-runtime-semantics-evaluation
      *
      *   Category: Variables and scopes
      *   Type: Entering and leaving environments
      *   Operands: uint32_t lexicalScopeIndex
      *   Stack: =>
      */ \
-    MACRO(PushLexicalEnv, push_lexical_env, NULL, 5, 0, 0, JOF_SCOPE) \
+    MACRO(PushLexicalEnv, push_lexical_env, NULL, 5, 0, 0, JOF_SCOPE|JOF_USES_ENV) \
     /*
      * Pop a lexical or class-body environment from the environment chain.
      *
      * See `JSOp::PushLexicalEnv` for the fine print.
      *
      *   Category: Variables and scopes
      *   Type: Entering and leaving environments
      *   Operands:
      *   Stack: =>
      */ \
-    MACRO(PopLexicalEnv, pop_lexical_env, NULL, 1, 0, 0, JOF_BYTE) \
+    MACRO(PopLexicalEnv, pop_lexical_env, NULL, 1, 0, 0, JOF_BYTE|JOF_USES_ENV) \
     /*
      * No-op instruction that indicates leaving an optimized lexical scope.
      *
      * If all bindings in a lexical scope are optimized into stack slots, then
      * the runtime environment objects for that scope are optimized away. No
      * `JSOp::{Push,Pop}LexicalEnv` instructions are emitted. However, the
      * debugger still needs to be notified when control exits a scope; that's
      * what this instruction does.
@@ -3257,17 +3257,17 @@
      * [1]: https://tc39.es/ecma262/#sec-performeval
      * [2]: https://tc39.es/ecma262/#sec-functiondeclarationinstantiation
      *
      *   Category: Variables and scopes
      *   Type: Entering and leaving environments
      *   Operands: uint32_t scopeIndex
      *   Stack: =>
      */ \
-    MACRO(PushVarEnv, push_var_env, NULL, 5, 0, 0, JOF_SCOPE) \
+    MACRO(PushVarEnv, push_var_env, NULL, 5, 0, 0, JOF_SCOPE|JOF_USES_ENV) \
     /*
      * Push a `WithEnvironmentObject` wrapping ToObject(`val`) to the
      * environment chain.
      *
      * Implements: [Evaluation of `with` statements][1], steps 2-6.
      *
      * Operations that may need to consult a WithEnvironment can't be correctly
      * implemented using optimized instructions like `JSOp::GetLocal`. A script
@@ -3312,17 +3312,17 @@
      *
      * [1]: https://tc39.es/ecma262/#sec-web-compat-functiondeclarationinstantiation
      *
      *   Category: Variables and scopes
      *   Type: Creating and deleting bindings
      *   Operands:
      *   Stack: => env
      */ \
-    MACRO(BindVar, bind_var, NULL, 1, 0, 1, JOF_BYTE) \
+    MACRO(BindVar, bind_var, NULL, 1, 0, 1, JOF_BYTE|JOF_USES_ENV) \
     /*
      * Check for conflicting bindings and then initialize them in global or
      * sloppy eval scripts. This is required for global scripts with any
      * top-level bindings, or any sloppy-eval scripts with any non-lexical
      * top-level bindings.
      *
      * Implements: [GlobalDeclarationInstantiation][1] and
      *             [EvalDeclarationInstantiation][2] (except step 12).
@@ -3334,17 +3334,17 @@
      * [1]: https://tc39.es/ecma262/#sec-globaldeclarationinstantiation
      * [2]: https://tc39.es/ecma262/#sec-evaldeclarationinstantiation
      *
      *   Category: Variables and scopes
      *   Type: Creating and deleting bindings
      *   Operands: uint32_t lastFun
      *   Stack: =>
      */ \
-    MACRO(GlobalOrEvalDeclInstantiation, global_or_eval_decl_instantiation, NULL, 5, 0, 0, JOF_GCTHING) \
+    MACRO(GlobalOrEvalDeclInstantiation, global_or_eval_decl_instantiation, NULL, 5, 0, 0, JOF_GCTHING|JOF_USES_ENV) \
     /*
      * Look up a variable on the environment chain and delete it. Push `true`
      * on success (if a binding was deleted, or if no such binding existed in
      * the first place), `false` otherwise (most kinds of bindings can't be
      * deleted).
      *
      * Implements: [`delete` *Identifier*][1], which [is a SyntaxError][2] in
      * strict mode code.
@@ -3352,17 +3352,17 @@
      *    [1]: https://tc39.es/ecma262/#sec-delete-operator-runtime-semantics-evaluation
      *    [2]: https://tc39.es/ecma262/#sec-delete-operator-static-semantics-early-errors
      *
      *   Category: Variables and scopes
      *   Type: Creating and deleting bindings
      *   Operands: uint32_t nameIndex
      *   Stack: => succeeded
      */ \
-    MACRO(DelName, del_name, NULL, 5, 0, 1, JOF_ATOM|JOF_NAME|JOF_CHECKSLOPPY) \
+    MACRO(DelName, del_name, NULL, 5, 0, 1, JOF_ATOM|JOF_NAME|JOF_CHECKSLOPPY|JOF_USES_ENV) \
     /*
      * Create and push the `arguments` object for the current function activation.
      *
      * When it exists, `arguments` is stored in an ordinary local variable.
      * `JSOp::Arguments` is used in function preludes, to populate that variable
      * before the function body runs, *not* each time `arguments` appears in a
      * function.
      *
@@ -3373,17 +3373,17 @@
      * The current script must be a function script. This instruction must
      * execute at most once per function activation.
      *
      *   Category: Variables and scopes
      *   Type: Function environment setup
      *   Operands:
      *   Stack: => arguments
      */ \
-    MACRO(Arguments, arguments, NULL, 1, 0, 1, JOF_BYTE) \
+    MACRO(Arguments, arguments, NULL, 1, 0, 1, JOF_BYTE|JOF_USES_ENV) \
     /*
      * Create and push the rest parameter array for current function call.
      *
      * This must appear only in a script for a function that has a rest
      * parameter.
      *
      *   Category: Variables and scopes
      *   Type: Function environment setup