arai-a / smoosh-sync

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

/js/src/frontend/CompilationStencil.h and one more file have been updated (7284cca9) #290

Closed github-actions[bot] closed 1 year ago

github-actions[bot] commented 2 years ago

Files

Changesets

Diffs

/js/src/frontend/CompilationStencil.h

--- 62177878bdfbb1a5332a8f16ec2d80caca12d841/js/src/frontend/CompilationStencil.h
+++ 7284cca9b5383e03ea15e36f2a899c854169a9cd/js/src/frontend/CompilationStencil.h
@@ -1175,17 +1175,18 @@ struct CompilationStencil {
   [[nodiscard]] bool delazifySelfHostedFunction(JSContext* cx,
                                                 CompilationAtomCache& atomCache,
                                                 ScriptIndexRange range,
                                                 HandleFunction fun);

   [[nodiscard]] bool serializeStencils(JSContext* cx, CompilationInput& input,
                                        JS::TranscodeBuffer& buf,
                                        bool* succeededOut = nullptr) const;
-  [[nodiscard]] bool deserializeStencils(JSContext* cx, CompilationInput& input,
+  [[nodiscard]] bool deserializeStencils(JSContext* cx, ErrorContext* ec,
+                                         CompilationInput& input,
                                          const JS::TranscodeRange& range,
                                          bool* succeededOut = nullptr);

   // To avoid any misuses, make sure this is neither copyable or assignable.
   CompilationStencil(const CompilationStencil&) = delete;
   CompilationStencil(CompilationStencil&&) = delete;
   CompilationStencil& operator=(const CompilationStencil&) = delete;
   CompilationStencil& operator=(CompilationStencil&&) = delete;

/js/src/frontend/Stencil.cpp

--- 62177878bdfbb1a5332a8f16ec2d80caca12d841/js/src/frontend/Stencil.cpp
+++ 7284cca9b5383e03ea15e36f2a899c854169a9cd/js/src/frontend/Stencil.cpp
@@ -2710,17 +2710,18 @@ bool CompilationStencil::prepareForInsta

 bool CompilationStencil::serializeStencils(JSContext* cx,
                                            CompilationInput& input,
                                            JS::TranscodeBuffer& buf,
                                            bool* succeededOut) const {
   if (succeededOut) {
     *succeededOut = false;
   }
-  XDRStencilEncoder encoder(cx, buf);
+  MainThreadErrorContext ec(cx);
+  XDRStencilEncoder encoder(cx, &ec, buf);

   XDRResult res = encoder.codeStencil(*this);
   if (res.isErr()) {
     if (JS::IsTranscodeFailureResult(res.unwrapErr())) {
       buf.clear();
       return true;
     }
     MOZ_ASSERT(res.unwrapErr() == JS::TranscodeResult::Throw);
@@ -2729,25 +2730,25 @@ bool CompilationStencil::serializeStenci
   }

   if (succeededOut) {
     *succeededOut = true;
   }
   return true;
 }

-bool CompilationStencil::deserializeStencils(JSContext* cx,
+bool CompilationStencil::deserializeStencils(JSContext* cx, ErrorContext* ec,
                                              CompilationInput& input,
                                              const JS::TranscodeRange& range,
                                              bool* succeededOut) {
   if (succeededOut) {
     *succeededOut = false;
   }
   MOZ_ASSERT(parserAtomData.empty());
-  XDRStencilDecoder decoder(cx, range);
+  XDRStencilDecoder decoder(cx, ec, range);
   JS::DecodeOptions options(input.options);

   XDRResult res = decoder.codeStencil(options, *this);
   if (res.isErr()) {
     if (JS::IsTranscodeFailureResult(res.unwrapErr())) {
       return true;
     }
     MOZ_ASSERT(res.unwrapErr() == JS::TranscodeResult::Throw);
@@ -5330,17 +5331,18 @@ JS_PUBLIC_API JSObject* JS::InstantiateM
     return nullptr;
   }

   return storage->gcOutput_->module;
 }

 JS::TranscodeResult JS::EncodeStencil(JSContext* cx, JS::Stencil* stencil,
                                       TranscodeBuffer& buffer) {
-  XDRStencilEncoder encoder(cx, buffer);
+  MainThreadErrorContext ec(cx);
+  XDRStencilEncoder encoder(cx, &ec, buffer);
   XDRResult res = encoder.codeStencil(*stencil);
   if (res.isErr()) {
     return res.unwrapErr();
   }
   return TranscodeResult::Ok;
 }

 JS::TranscodeResult JS::DecodeStencil(JSContext* cx,
@@ -5350,17 +5352,18 @@ JS::TranscodeResult JS::DecodeStencil(JS
   RefPtr<ScriptSource> source = cx->new_<ScriptSource>();
   if (!source) {
     return TranscodeResult::Throw;
   }
   RefPtr<JS::Stencil> stencil(cx->new_<CompilationStencil>(source));
   if (!stencil) {
     return TranscodeResult::Throw;
   }
-  XDRStencilDecoder decoder(cx, range);
+  MainThreadErrorContext ec(cx);
+  XDRStencilDecoder decoder(cx, &ec, range);
   XDRResult res = decoder.codeStencil(options, *stencil);
   if (res.isErr()) {
     return res.unwrapErr();
   }
   *stencilOut = stencil.forget().take();
   return TranscodeResult::Ok;
 }