Bug 1622562 - Remove flags parameter from ReportCompileError. r=arai
authorTom Schuster <evilpies@gmail.com>
Sun, 15 Mar 2020 00:04:58 +0000
changeset 518820 00683827be1afd7193afc84f64f8b45523c3a2ae
parent 518819 66f97d1cf94abf84e2fafddfbf440d4dfd8fba35
child 518821 0f2f823b599293166b82ceecd15b452de8b48382
push id37217
push userccoroiu@mozilla.com
push dateSun, 15 Mar 2020 21:37:59 +0000
treeherdermozilla-central@f9fc9427476e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersarai
bugs1622562
milestone76.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 1622562 - Remove flags parameter from ReportCompileError. r=arai Differential Revision: https://phabricator.services.mozilla.com/D66880
js/src/frontend/ErrorReporter.h
js/src/frontend/Frontend2.cpp
js/src/frontend/TokenStream.cpp
js/src/irregexp/RegExpParser.cpp
js/src/vm/ErrorReporting.cpp
js/src/vm/ErrorReporting.h
js/src/wasm/AsmJS.cpp
--- a/js/src/frontend/ErrorReporter.h
+++ b/js/src/frontend/ErrorReporter.h
@@ -140,18 +140,17 @@ class ErrorReportMixin : public StrictMo
                           const ErrorOffset& offset, unsigned errorNumber,
                           va_list* args) {
     ErrorMetadata metadata;
     if (!computeErrorMetadata(&metadata, offset)) {
       return;
     }
 
     ReportCompileErrorLatin1(getContext(), std::move(metadata),
-                             std::move(notes), JSREPORT_ERROR, errorNumber,
-                             args);
+                             std::move(notes), errorNumber, args);
   }
 
   // ==== warning ====
   //
   // Reports a warning.
   //
   // Returns true if the warning is reported.
   // Returns false if the warning is treated as an error, or an error occurs
@@ -332,18 +331,17 @@ class ErrorReportMixin : public StrictMo
     }
 
     ErrorMetadata metadata;
     if (!computeErrorMetadata(&metadata, offset)) {
       return false;
     }
 
     ReportCompileErrorLatin1(getContext(), std::move(metadata),
-                             std::move(notes), JSREPORT_ERROR, errorNumber,
-                             args);
+                             std::move(notes), errorNumber, args);
     return false;
   }
 
   // Reports a warning, or an error if the warning is treated as an error.
   MOZ_MUST_USE bool compileWarning(ErrorMetadata&& metadata,
                                    UniquePtr<JSErrorNotes> notes,
                                    unsigned errorNumber, va_list* args) {
     return ReportCompileWarning(getContext(), std::move(metadata),
--- a/js/src/frontend/Frontend2.cpp
+++ b/js/src/frontend/Frontend2.cpp
@@ -168,17 +168,17 @@ class AutoFreeSmooshParseResult {
   }
 };
 
 void ReportSmooshCompileError(JSContext* cx, ErrorMetadata&& metadata,
                               int errorNumber, ...) {
   va_list args;
   va_start(args, errorNumber);
   ReportCompileErrorUTF8(cx, std::move(metadata), /* notes = */ nullptr,
-                         JSREPORT_ERROR, errorNumber, &args);
+                         errorNumber, &args);
   va_end(args);
 }
 
 /* static */
 JSScript* Smoosh::compileGlobalScript(CompilationInfo& compilationInfo,
                                       JS::SourceText<Utf8Unit>& srcBuf,
                                       bool* unimplemented) {
   // FIXME: check info members and return with *unimplemented = true
--- a/js/src/frontend/TokenStream.cpp
+++ b/js/src/frontend/TokenStream.cpp
@@ -625,18 +625,17 @@ void TokenStreamAnyChars::reportErrorNoO
   va_end(args);
 }
 
 void TokenStreamAnyChars::reportErrorNoOffsetVA(unsigned errorNumber,
                                                 va_list* args) {
   ErrorMetadata metadata;
   computeErrorMetadataNoOffset(&metadata);
 
-  ReportCompileErrorLatin1(cx, std::move(metadata), nullptr, JSREPORT_ERROR,
-                           errorNumber, args);
+  ReportCompileErrorLatin1(cx, std::move(metadata), nullptr, errorNumber, args);
 }
 
 // Use the fastest available getc.
 #if defined(HAVE_GETC_UNLOCKED)
 #  define fast_getc getc_unlocked
 #elif defined(HAVE__GETC_NOLOCK)
 #  define fast_getc _getc_nolock
 #else
@@ -1043,17 +1042,17 @@ MOZ_COLD void TokenStreamChars<Utf8Unit,
 
     if (!notes->addNoteASCII(anyChars.cx, anyChars.getFilename(), 0, line,
                              column, GetErrorMessage, nullptr,
                              JSMSG_BAD_CODE_UNITS, badUnitsStr)) {
       break;
     }
 
     ReportCompileErrorLatin1(anyChars.cx, std::move(err), std::move(notes),
-                             JSREPORT_ERROR, errorNumber, &args);
+                             errorNumber, &args);
   } while (false);
 
   va_end(args);
 }
 
 template <class AnyCharsAccess>
 MOZ_COLD void TokenStreamChars<Utf8Unit, AnyCharsAccess>::badLeadUnit(
     Utf8Unit lead) {
--- a/js/src/irregexp/RegExpParser.cpp
+++ b/js/src/irregexp/RegExpParser.cpp
@@ -331,17 +331,17 @@ RegExpParser<CharT>::SyntaxError(unsigne
 
     err.lineLength = windowLength;
     err.tokenOffset = offset - (windowStart - start_);
 
     va_list args;
     va_start(args, errorNumber);
 
     ReportCompileErrorLatin1(ts.context(), std::move(err), nullptr,
-                             JSREPORT_ERROR, errorNumber, &args);
+                             errorNumber, &args);
 
     va_end(args);
 }
 
 template <typename CharT>
 RegExpTree*
 RegExpParser<CharT>::ReportError(unsigned errorNumber, const char* param /* = nullptr */)
 {
--- a/js/src/vm/ErrorReporting.cpp
+++ b/js/src/vm/ErrorReporting.cpp
@@ -91,30 +91,29 @@ bool js::ReportCompileWarning(JSContext*
     err->throwError(cx);
   }
 
   return true;
 }
 
 static void ReportCompileErrorImpl(JSContext* cx, js::ErrorMetadata&& metadata,
                                    js::UniquePtr<JSErrorNotes> notes,
-                                   unsigned flags, unsigned errorNumber,
-                                   va_list* args,
+                                   unsigned errorNumber, va_list* args,
                                    js::ErrorArgumentsType argumentsType) {
   // On the main thread, report the error immediately. When compiling off
   // thread, save the error so that the thread finishing the parse can report
   // it later.
   js::CompileError tempErr;
   js::CompileError* err = &tempErr;
   if (cx->isHelperThreadContext() && !cx->addPendingCompileError(&err)) {
     return;
   }
 
   err->notes = std::move(notes);
-  err->flags = flags;
+  err->flags = JSREPORT_ERROR;
   err->errorNumber = errorNumber;
 
   err->filename = metadata.filename;
   err->lineno = metadata.lineNumber;
   err->column = metadata.columnNumber;
   err->isMuted = metadata.isMuted;
 
   if (UniqueTwoByteChars lineOfContext = std::move(metadata.lineOfContext)) {
@@ -128,27 +127,27 @@ static void ReportCompileErrorImpl(JSCon
   }
 
   if (!cx->isHelperThreadContext()) {
     err->throwError(cx);
   }
 }
 
 void js::ReportCompileErrorLatin1(JSContext* cx, ErrorMetadata&& metadata,
-                                  UniquePtr<JSErrorNotes> notes, unsigned flags,
+                                  UniquePtr<JSErrorNotes> notes,
                                   unsigned errorNumber, va_list* args) {
-  ReportCompileErrorImpl(cx, std::move(metadata), std::move(notes), flags,
-                         errorNumber, args, ArgumentsAreLatin1);
+  ReportCompileErrorImpl(cx, std::move(metadata), std::move(notes), errorNumber,
+                         args, ArgumentsAreLatin1);
 }
 
 void js::ReportCompileErrorUTF8(JSContext* cx, ErrorMetadata&& metadata,
-                                UniquePtr<JSErrorNotes> notes, unsigned flags,
+                                UniquePtr<JSErrorNotes> notes,
                                 unsigned errorNumber, va_list* args) {
-  ReportCompileErrorImpl(cx, std::move(metadata), std::move(notes), flags,
-                         errorNumber, args, ArgumentsAreUTF8);
+  ReportCompileErrorImpl(cx, std::move(metadata), std::move(notes), errorNumber,
+                         args, ArgumentsAreUTF8);
 }
 
 void js::ReportErrorToGlobal(JSContext* cx, Handle<GlobalObject*> global,
                              HandleValue error) {
   MOZ_ASSERT(!cx->isExceptionPending());
 #ifdef DEBUG
   // No assertSameCompartment version that doesn't take JSContext...
   if (error.isObject()) {
--- a/js/src/vm/ErrorReporting.h
+++ b/js/src/vm/ErrorReporting.h
@@ -80,23 +80,21 @@ class MOZ_STACK_CLASS ReportExceptionClo
 extern void CallWarningReporter(JSContext* cx, JSErrorReport* report);
 
 /**
  * Report a compile error during script processing prior to execution of the
  * script.
  */
 extern void ReportCompileErrorLatin1(JSContext* cx, ErrorMetadata&& metadata,
                                      UniquePtr<JSErrorNotes> notes,
-                                     unsigned flags, unsigned errorNumber,
-                                     va_list* args);
+                                     unsigned errorNumber, va_list* args);
 
 extern void ReportCompileErrorUTF8(JSContext* cx, ErrorMetadata&& metadata,
                                    UniquePtr<JSErrorNotes> notes,
-                                   unsigned flags, unsigned errorNumber,
-                                   va_list* args);
+                                   unsigned errorNumber, va_list* args);
 
 /**
  * Report a compile warning during script processing prior to execution of the
  * script.  Returns true if the warning was successfully reported, false if an
  * error occurred.
  */
 extern MOZ_MUST_USE bool ReportCompileWarning(JSContext* cx,
                                               ErrorMetadata&& metadata,
--- a/js/src/wasm/AsmJS.cpp
+++ b/js/src/wasm/AsmJS.cpp
@@ -1909,18 +1909,17 @@ class MOZ_STACK_CLASS JS_HAZ_ROOTED Modu
     va_list args;
     va_start(args, offset);
 
     auto& ts = tokenStream();
     ErrorMetadata metadata;
     if (ts.computeErrorMetadata(&metadata, AsVariant(offset))) {
       if (ts.anyCharsAccess().options().throwOnAsmJSValidationFailureOption) {
         ReportCompileErrorLatin1(cx_, std::move(metadata), nullptr,
-                                 JSREPORT_ERROR, JSMSG_USE_ASM_TYPE_FAIL,
-                                 &args);
+                                 JSMSG_USE_ASM_TYPE_FAIL, &args);
       } else {
         // asm.js type failure is indicated by calling one of the fail*
         // functions below.  These functions always return false to
         // halt asm.js parsing.  Whether normal parsing is attempted as
         // fallback, depends whether an exception is also set.
         //
         // If warning succeeds, no exception is set.  If warning fails,
         // an exception is set and execution will halt.  Thus it's safe