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 2 more files have been updated (ed754d66) #370

Open github-actions[bot] opened 4 months ago

github-actions[bot] commented 4 months ago

Files

Changesets

Diffs

/js/src/frontend/CompilationStencil.h

--- 6f4e49448f1c68b2a749e5461b60a2a0d153eb42/js/src/frontend/CompilationStencil.h
+++ dffee1bbc0646b3bafcb39a8dfb85a273f43bdc1/js/src/frontend/CompilationStencil.h
@@ -166,39 +166,39 @@ class InputScope {
         [](const ScopeStencilRef& ref) { return ref.scope().hasEnvironment(); },
         [](const FakeStencilGlobalScope&) {
           // See Scope::hasEnvironment
           return true;
         });
   };
   inline InputScope enclosing() const;
   bool hasOnChain(ScopeKind kind) const {
-    return scope_.match(
-        [=](const Scope* ptr) { return ptr->hasOnChain(kind); },
-        [=](const ScopeStencilRef& ref) {
-          ScopeStencilRef it = ref;
-          while (true) {
-            const ScopeStencil& scope = it.scope();
-            if (scope.kind() == kind) {
-              return true;
-            }
-            if (scope.kind() == ScopeKind::Module &&
-                kind == ScopeKind::Global) {
-              return true;
-            }
-            if (!scope.hasEnclosing()) {
-              break;
-            }
-            new (&it) ScopeStencilRef{ref.context_, scope.enclosing()};
-          }
-          return false;
-        },
-        [=](const FakeStencilGlobalScope&) {
-          return kind == ScopeKind::Global;
-        });
+    return scope_.match([=](const Scope* ptr) { return ptr->hasOnChain(kind); },
+                        [=](const ScopeStencilRef& ref) {
+                          ScopeStencilRef it = ref;
+                          while (true) {
+                            const ScopeStencil& scope = it.scope();
+                            if (scope.kind() == kind) {
+                              return true;
+                            }
+                            if (scope.kind() == ScopeKind::Module &&
+                                kind == ScopeKind::Global) {
+                              return true;
+                            }
+                            if (!scope.hasEnclosing()) {
+                              break;
+                            }
+                            new (&it) ScopeStencilRef{ref.context_,
+                                                      scope.enclosing()};
+                          }
+                          return false;
+                        },
+                        [=](const FakeStencilGlobalScope&) {
+                          return kind == ScopeKind::Global;
+                        });
   }
   uint32_t environmentChainLength() const {
     return scope_.match(
         [](const Scope* ptr) { return ptr->environmentChainLength(); },
         [](const ScopeStencilRef& ref) {
           uint32_t length = 0;
           ScopeStencilRef it = ref;
           while (true) {

/js/src/frontend/Stencil.cpp

--- 62dc541aa94eb6143c9a1e5b0f873bb2f9ab7004/js/src/frontend/Stencil.cpp
+++ ed754d66855cc4c6706b0de9b6ee57e65b7e574e/js/src/frontend/Stencil.cpp
@@ -5615,8 +5615,27 @@ JS_PUBLIC_API size_t JS::SizeOfStencil(S
 }

 JS::InstantiationStorage::~InstantiationStorage() {
   if (gcOutput_) {
     js_delete(gcOutput_);
     gcOutput_ = nullptr;
   }
 }
+
+JS_PUBLIC_API JS::Stencil* JS::DuplicateStencil(JSContext* cx,
+                                                JS::Stencil* stencil) {
+  UniquePtr<ExtensibleCompilationStencil> extensibleStencil(
+      cx->new_<ExtensibleCompilationStencil>(stencil->source));
+  if (!extensibleStencil) {
+    return nullptr;
+  }
+
+  {
+    AutoReportFrontendContext fc(cx);
+    if (!extensibleStencil->cloneFrom(&fc, *stencil)) {
+      return nullptr;
+    }
+  }
+
+  JS::Stencil* dup = cx->new_<CompilationStencil>(std::move(extensibleStencil));
+  return dup;
+}

/js/src/vm/Opcodes.h

--- 4389394e65cf401d7175f8ee786c76c80cb153c3/js/src/vm/Opcodes.h
+++ b46a07d48e50c93bd53adb86f4bb9f95522eb226/js/src/vm/Opcodes.h
@@ -3403,20 +3403,20 @@
      * to the current lexical environment object.
      *
      * Implements: [AddDisposableResource ( disposeCapability, V, hint [ , method ] )][1], step 1, 3-4.
      *
      * [1] https://arai-a.github.io/ecma262-compare/?pr=3000&id=sec-adddisposableresource
      *
      *   Category: Variables and scopes
      *   Type: Entering and leaving environments
-     *   Operands:
+     *   Operands: UsingHint hint
      *   Stack: v => v
      */ \
-    IF_EXPLICIT_RESOURCE_MANAGEMENT(MACRO(AddDisposable, add_disposable, NULL, 1, 1, 1, JOF_BYTE)) \
+    IF_EXPLICIT_RESOURCE_MANAGEMENT(MACRO(AddDisposable, add_disposable, NULL, 2, 1, 1, JOF_UINT8)) \
     /*
      * Retrieve the disposable objects from the currenct lexical environment object
      * and dispose them.
      *
      * Implements: [DisposeResources ( disposeCapability, completion )][1], step 1-4
      *
      * [1] https://arai-a.github.io/ecma262-compare/?pr=3000&id=sec-disposeresources
      *