From 9a87fb6fae8cc7641a0efbde105a39fd3a7bc60b Mon Sep 17 00:00:00 2001 From: Jeff Walden Date: Fri, 28 Apr 2017 19:35:52 -0700 Subject: [PATCH] Bug 1359980 - Followup hazard fix. (Maybe the varargs threw off the hazard analysis, where the suppress-GC operation occurred *inside* a varargs function? *shrug*) r=bustage --- js/src/irregexp/RegExpParser.cpp | 20 +++++++++----------- js/src/irregexp/RegExpParser.h | 4 ++-- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/js/src/irregexp/RegExpParser.cpp b/js/src/irregexp/RegExpParser.cpp index c7b9555c3a09..3178af7fbc8d 100644 --- a/js/src/irregexp/RegExpParser.cpp +++ b/js/src/irregexp/RegExpParser.cpp @@ -252,10 +252,8 @@ RegExpParser::RegExpParser(frontend::TokenStream& ts, LifoAlloc* alloc, template void -RegExpParser::SyntaxError(unsigned errorNumber, va_list args) +RegExpParser::SyntaxError(unsigned errorNumber, ...) { - gc::AutoSuppressGC suppressGC(ts.context()); - ErrorMetadata err; ts.fillExcludingContext(&err, ts.currentToken().pos.begin); @@ -297,20 +295,20 @@ RegExpParser::SyntaxError(unsigned errorNumber, va_list args) err.lineLength = windowLength; err.tokenOffset = offset - (windowStart - start_); + va_list args; + va_start(args, errorNumber); + ReportCompileError(ts.context(), Move(err), nullptr, JSREPORT_ERROR, errorNumber, args); + + va_end(args); } template RegExpTree* -RegExpParser::ReportError(unsigned errorNumber, ...) +RegExpParser::ReportError(unsigned errorNumber, const char* param /* = nullptr */) { - va_list args; - va_start(args, errorNumber); - - SyntaxError(errorNumber, args); - - va_end(args); - + gc::AutoSuppressGC suppressGC(ts.context()); + SyntaxError(errorNumber, param); return nullptr; } diff --git a/js/src/irregexp/RegExpParser.h b/js/src/irregexp/RegExpParser.h index 406d6b1c4f57..26706bda4489 100644 --- a/js/src/irregexp/RegExpParser.h +++ b/js/src/irregexp/RegExpParser.h @@ -215,10 +215,10 @@ class RegExpParser bool ParseClassAtom(char16_t* char_class, widechar *value); private: - void SyntaxError(unsigned errorNumber, va_list args); + void SyntaxError(unsigned errorNumber, ...); public: - RegExpTree* ReportError(unsigned errorNumber, ...); + RegExpTree* ReportError(unsigned errorNumber, const char* param = nullptr); void Advance(); void Advance(int dist) {