diff --git a/Cargo.toml b/Cargo.toml index 3ee96b675649..c63c81e3409d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ members = [ "js/src/rust", "js/src/wasm/cranelift", "js/rust", - "js/src/frontend/binsource", # Code generator. + "js/src/frontend/binast", # Code generator. "testing/geckodriver", "toolkit/crashreporter/rust", "toolkit/library/gtest/rust", diff --git a/js/src/frontend/BinSource-macros.h b/js/src/frontend/BinAST-macros.h similarity index 95% rename from js/src/frontend/BinSource-macros.h rename to js/src/frontend/BinAST-macros.h index a3a2b31b8459..ab5ef9cad630 100644 --- a/js/src/frontend/BinSource-macros.h +++ b/js/src/frontend/BinAST-macros.h @@ -4,8 +4,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef frontend_BinSource_macros_h -#define frontend_BinSource_macros_h +#ifndef frontend_BinAST_macros_h +#define frontend_BinAST_macros_h #include "vm/JSContext.h" @@ -59,4 +59,4 @@ if (_##VAR.isErr()) return ::mozilla::Err(_##VAR.unwrapErr()); \ auto VAR = _##VAR.unwrap(); -#endif // frontend_BinSource_macros_h +#endif // frontend_BinAST_macros_h diff --git a/js/src/frontend/BinSource.webidl_ b/js/src/frontend/BinAST.webidl_ similarity index 100% rename from js/src/frontend/BinSource.webidl_ rename to js/src/frontend/BinAST.webidl_ diff --git a/js/src/frontend/BinSource.yaml b/js/src/frontend/BinAST.yaml similarity index 99% rename from js/src/frontend/BinSource.yaml rename to js/src/frontend/BinAST.yaml index 059404cd4e59..84bf07c67f14 100644 --- a/js/src/frontend/BinSource.yaml +++ b/js/src/frontend/BinAST.yaml @@ -27,7 +27,7 @@ cpp: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // To generate this file, see the documentation in - // js/src/frontend/binsource/README.md. + // js/src/frontend/binast/README.md. #include "frontend/BinASTParser.h" @@ -38,7 +38,7 @@ cpp: #include "mozilla/PodOperations.h" #include "mozilla/Vector.h" - #include "frontend/BinSource-macros.h" + #include "frontend/BinAST-macros.h" #include "frontend/BinTokenReaderMultipart.h" #include "frontend/FullParseHandler.h" #include "frontend/ParseNode.h" @@ -80,7 +80,7 @@ hpp: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // To generate this file, see the documentation in - // js/src/frontend/binsource/README.md. + // js/src/frontend/binast/README.md. #ifndef frontend_BinASTParser_h #define frontend_BinASTParser_h @@ -209,7 +209,7 @@ hpp: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // To generate this file, see the documentation in - // js/src/frontend/binsource/README.md. + // js/src/frontend/binast/README.md. #ifndef frontend_BinASTEnum_h #define frontend_BinASTEnum_h @@ -287,7 +287,7 @@ hpp: // To generate this file, see the documentation in - // js/src/frontend/binsource/README.md. + // js/src/frontend/binast/README.md. #ifndef frontend_BinToken_h #define frontend_BinToken_h @@ -921,7 +921,7 @@ EagerFunctionExpression: // Push a new ParseContext. It will be used to parse `scope`, the arguments, // the function. - BinParseContext funpc(cx_, this, funbox, /* newDirectives = */ nullptr); + BinASTParseContext funpc(cx_, this, funbox, /* newDirectives = */ nullptr); BINJS_TRY(funpc.init()); pc_->functionScope().useAsVarScope(pc_); MOZ_ASSERT(pc_->isFunctionBox()); diff --git a/js/src/frontend/BinASTEnum.h b/js/src/frontend/BinASTEnum.h index b3bff35a165e..38a61f168338 100644 --- a/js/src/frontend/BinASTEnum.h +++ b/js/src/frontend/BinASTEnum.h @@ -7,7 +7,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // To generate this file, see the documentation in -// js/src/frontend/binsource/README.md. +// js/src/frontend/binast/README.md. #ifndef frontend_BinASTEnum_h #define frontend_BinASTEnum_h diff --git a/js/src/frontend/BinASTParser.cpp b/js/src/frontend/BinASTParser.cpp index 59301221523c..d44850fa2de2 100644 --- a/js/src/frontend/BinASTParser.cpp +++ b/js/src/frontend/BinASTParser.cpp @@ -7,7 +7,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // To generate this file, see the documentation in -// js/src/frontend/binsource/README.md. +// js/src/frontend/binast/README.md. #include "frontend/BinASTParser.h" @@ -18,7 +18,7 @@ #include "mozilla/PodOperations.h" #include "mozilla/Vector.h" -#include "frontend/BinSource-macros.h" +#include "frontend/BinAST-macros.h" #include "frontend/BinTokenReaderMultipart.h" #include "frontend/FullParseHandler.h" #include "frontend/ParseNode.h" @@ -2497,7 +2497,7 @@ BinASTParser::parseInterfaceEagerFunctionDeclaration( // Push a new ParseContext. It will be used to parse `scope`, the arguments, // the function. - BinParseContext funpc(cx_, this, funbox, /* newDirectives = */ nullptr); + BinASTParseContext funpc(cx_, this, funbox, /* newDirectives = */ nullptr); BINJS_TRY(funpc.init()); pc_->functionScope().useAsVarScope(pc_); MOZ_ASSERT(pc_->isFunctionBox()); @@ -2560,7 +2560,7 @@ JS::Result BinASTParser::parseInterfaceEagerFunctionExpression( // Push a new ParseContext. It will be used to parse `scope`, the arguments, // the function. - BinParseContext funpc(cx_, this, funbox, /* newDirectives = */ nullptr); + BinASTParseContext funpc(cx_, this, funbox, /* newDirectives = */ nullptr); BINJS_TRY(funpc.init()); pc_->functionScope().useAsVarScope(pc_); MOZ_ASSERT(pc_->isFunctionBox()); @@ -2615,7 +2615,7 @@ JS::Result BinASTParser::parseInterfaceEagerGetter( // Push a new ParseContext. It will be used to parse `scope`, the arguments, // the function. - BinParseContext funpc(cx_, this, funbox, /* newDirectives = */ nullptr); + BinASTParseContext funpc(cx_, this, funbox, /* newDirectives = */ nullptr); BINJS_TRY(funpc.init()); pc_->functionScope().useAsVarScope(pc_); MOZ_ASSERT(pc_->isFunctionBox()); @@ -2681,7 +2681,7 @@ JS::Result BinASTParser::parseInterfaceEagerMethod( // Push a new ParseContext. It will be used to parse `scope`, the arguments, // the function. - BinParseContext funpc(cx_, this, funbox, /* newDirectives = */ nullptr); + BinASTParseContext funpc(cx_, this, funbox, /* newDirectives = */ nullptr); BINJS_TRY(funpc.init()); pc_->functionScope().useAsVarScope(pc_); MOZ_ASSERT(pc_->isFunctionBox()); @@ -2740,7 +2740,7 @@ JS::Result BinASTParser::parseInterfaceEagerSetter( // Push a new ParseContext. It will be used to parse `scope`, the arguments, // the function. - BinParseContext funpc(cx_, this, funbox, /* newDirectives = */ nullptr); + BinASTParseContext funpc(cx_, this, funbox, /* newDirectives = */ nullptr); BINJS_TRY(funpc.init()); pc_->functionScope().useAsVarScope(pc_); MOZ_ASSERT(pc_->isFunctionBox()); diff --git a/js/src/frontend/BinASTParser.h b/js/src/frontend/BinASTParser.h index 04675a37eab6..b061520befa3 100644 --- a/js/src/frontend/BinASTParser.h +++ b/js/src/frontend/BinASTParser.h @@ -7,7 +7,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // To generate this file, see the documentation in -// js/src/frontend/binsource/README.md. +// js/src/frontend/binast/README.md. #ifndef frontend_BinASTParser_h #define frontend_BinASTParser_h diff --git a/js/src/frontend/BinASTParserPerTokenizer.cpp b/js/src/frontend/BinASTParserPerTokenizer.cpp index b7267299d68b..95102a069e07 100644 --- a/js/src/frontend/BinASTParserPerTokenizer.cpp +++ b/js/src/frontend/BinASTParserPerTokenizer.cpp @@ -14,8 +14,8 @@ #include "mozilla/ScopeExit.h" #include "mozilla/Vector.h" +#include "frontend/BinAST-macros.h" #include "frontend/BinASTParser.h" -#include "frontend/BinSource-macros.h" #include "frontend/BinTokenReaderMultipart.h" #include "frontend/FullParseHandler.h" #include "frontend/ParseNode.h" @@ -118,7 +118,8 @@ JS::Result BinASTParserPerTokenizer::parseAux( tokenizer_.emplace(cx_, this, start, length); - BinParseContext globalpc(cx_, this, globalsc, /* newDirectives = */ nullptr); + BinASTParseContext globalpc(cx_, this, globalsc, + /* newDirectives = */ nullptr); if (!globalpc.init()) { return cx_->alreadyReportedError(); } @@ -179,7 +180,7 @@ JS::Result BinASTParserPerTokenizer::parseLazyFunction( // Push a new ParseContext. It will be used to parse `scope`, the arguments, // the function. - BinParseContext funpc(cx_, this, funbox, /* newDirectives = */ nullptr); + BinASTParseContext funpc(cx_, this, funbox, /* newDirectives = */ nullptr); BINJS_TRY(funpc.init()); pc_->functionScope().useAsVarScope(pc_); MOZ_ASSERT(pc_->isFunctionBox()); diff --git a/js/src/frontend/BinASTParserPerTokenizer.h b/js/src/frontend/BinASTParserPerTokenizer.h index cd98e304aa1c..35ce42691207 100644 --- a/js/src/frontend/BinASTParserPerTokenizer.h +++ b/js/src/frontend/BinASTParserPerTokenizer.h @@ -284,7 +284,7 @@ class BinASTParserPerTokenizer : public BinASTParserBase, mozilla::Maybe tokenizer_; VariableDeclarationKind variableDeclarationKind_; - friend class BinParseContext; + friend class BinASTParseContext; friend class AutoVariableDeclarationKind; // Helper class: Restore field `variableDeclarationKind` upon leaving a scope. @@ -314,11 +314,11 @@ class BinASTParserPerTokenizer : public BinASTParserBase, inline const FinalParser* asFinalParser() const; }; -class BinParseContext : public ParseContext { +class BinASTParseContext : public ParseContext { public: template - BinParseContext(JSContext* cx, BinASTParserPerTokenizer* parser, - SharedContext* sc, Directives* newDirectives) + BinASTParseContext(JSContext* cx, BinASTParserPerTokenizer* parser, + SharedContext* sc, Directives* newDirectives) : ParseContext(cx, parser->pc_, sc, *parser, parser->usedNames_, newDirectives, /* isFull = */ true) {} }; diff --git a/js/src/frontend/BinSourceRuntimeSupport.cpp b/js/src/frontend/BinASTRuntimeSupport.cpp similarity index 96% rename from js/src/frontend/BinSourceRuntimeSupport.cpp rename to js/src/frontend/BinASTRuntimeSupport.cpp index a615377171d9..e0a499ca8618 100644 --- a/js/src/frontend/BinSourceRuntimeSupport.cpp +++ b/js/src/frontend/BinASTRuntimeSupport.cpp @@ -4,7 +4,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "frontend/BinSourceRuntimeSupport.h" +#include "frontend/BinASTRuntimeSupport.h" #include "gc/Tracer.h" #include "js/Vector.h" diff --git a/js/src/frontend/BinSourceRuntimeSupport.h b/js/src/frontend/BinASTRuntimeSupport.h similarity index 97% rename from js/src/frontend/BinSourceRuntimeSupport.h rename to js/src/frontend/BinASTRuntimeSupport.h index d37638fbd2cb..af7f3663ff50 100644 --- a/js/src/frontend/BinSourceRuntimeSupport.h +++ b/js/src/frontend/BinASTRuntimeSupport.h @@ -4,8 +4,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef frontend_BinSourceSupport_h -#define frontend_BinSourceSupport_h +#ifndef frontend_BinASTSupport_h +#define frontend_BinASTSupport_h #include "mozilla/HashFunctions.h" @@ -155,4 +155,4 @@ typedef UniquePtr -#include "frontend/BinSourceRuntimeSupport.h" +#include "frontend/BinASTRuntimeSupport.h" #include "frontend/TokenStream.h" #include "js/Result.h" #include "vm/JSContext.h" diff --git a/js/src/frontend/BinToken.h b/js/src/frontend/BinToken.h index dd5b0ba75880..bb9160e91679 100644 --- a/js/src/frontend/BinToken.h +++ b/js/src/frontend/BinToken.h @@ -7,7 +7,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // To generate this file, see the documentation in -// js/src/frontend/binsource/README.md. +// js/src/frontend/binast/README.md. #ifndef frontend_BinToken_h #define frontend_BinToken_h diff --git a/js/src/frontend/BinTokenReaderBase.cpp b/js/src/frontend/BinTokenReaderBase.cpp index 2376a89ff8ca..008b8c1545e9 100644 --- a/js/src/frontend/BinTokenReaderBase.cpp +++ b/js/src/frontend/BinTokenReaderBase.cpp @@ -6,7 +6,7 @@ #include "frontend/BinTokenReaderBase.h" -#include "frontend/BinSource-macros.h" +#include "frontend/BinAST-macros.h" #include "js/Result.h" namespace js { diff --git a/js/src/frontend/BinTokenReaderMultipart.cpp b/js/src/frontend/BinTokenReaderMultipart.cpp index 13b82a015c55..98ccc94011ed 100644 --- a/js/src/frontend/BinTokenReaderMultipart.cpp +++ b/js/src/frontend/BinTokenReaderMultipart.cpp @@ -14,8 +14,8 @@ #include -#include "frontend/BinSource-macros.h" -#include "frontend/BinSourceRuntimeSupport.h" +#include "frontend/BinAST-macros.h" +#include "frontend/BinASTRuntimeSupport.h" #include "frontend/BytecodeCompiler.h" // IsIdentifier #include "js/Result.h" diff --git a/js/src/frontend/BinTokenReaderMultipart.h b/js/src/frontend/BinTokenReaderMultipart.h index da3c67d1f97f..ba1903404e8a 100644 --- a/js/src/frontend/BinTokenReaderMultipart.h +++ b/js/src/frontend/BinTokenReaderMultipart.h @@ -9,7 +9,7 @@ #include "mozilla/Maybe.h" -#include "frontend/BinSourceRuntimeSupport.h" +#include "frontend/BinASTRuntimeSupport.h" #include "frontend/BinToken.h" #include "frontend/BinTokenReaderBase.h" diff --git a/js/src/frontend/BytecodeCompiler.h b/js/src/frontend/BytecodeCompiler.h index b19948a53eb0..7eaa266b9ae7 100644 --- a/js/src/frontend/BytecodeCompiler.h +++ b/js/src/frontend/BytecodeCompiler.h @@ -60,7 +60,7 @@ * ParseContext.h: class ParseContext: Extremely complex class that serves a lot * of purposes, but it's a single class - essentially no derived classes - so * it's a little easier to comprehend all at once. (SourceParseContext and - * BinParseContext do derive from ParseContext, but they do nothing except + * BinASTParseContext do derive from ParseContext, but they do nothing except * adjust the constructor's arguments). * Note it uses a thing called Nestable, which implements a stack of objects: * you can push (and pop) instances to a stack (linked list) as you parse diff --git a/js/src/frontend/binsource/Cargo.toml b/js/src/frontend/binast/Cargo.toml similarity index 93% rename from js/src/frontend/binsource/Cargo.toml rename to js/src/frontend/binast/Cargo.toml index 9b2b0ba51c42..ae46d12ca9a0 100644 --- a/js/src/frontend/binsource/Cargo.toml +++ b/js/src/frontend/binast/Cargo.toml @@ -14,5 +14,5 @@ yaml-rust = "^0.4.2" webidl = "^0.8" [[bin]] -name = "binsource" +name = "binast" path = "src/main.rs" diff --git a/js/src/frontend/binast/README.md b/js/src/frontend/binast/README.md new file mode 100644 index 000000000000..68a712a37819 --- /dev/null +++ b/js/src/frontend/binast/README.md @@ -0,0 +1,16 @@ +A parser generator used to generate the following files: + +- js/src/frontend/BinASTParser.h +- js/src/frontend/BinASTParser.cpp +- js/src/frontent/BinToken.h + +from the following files: + +- js/src/frontend/BinAST.webidl_ (specifications of BinAST) +- js/src/frontend/BinAST.yaml (parser generator driver) + +To use it: +```sh +$ cd $(topsrcdir)/js/src/frontend/binast +% ./build.sh +``` diff --git a/js/src/frontend/binsource/build.sh b/js/src/frontend/binast/build.sh similarity index 94% rename from js/src/frontend/binsource/build.sh rename to js/src/frontend/binast/build.sh index bb6f57b342cf..42cf1a345be3 100755 --- a/js/src/frontend/binsource/build.sh +++ b/js/src/frontend/binast/build.sh @@ -1,8 +1,8 @@ #!/bin/sh cargo run -- \ - ../BinSource.webidl_ \ - ../BinSource.yaml \ + ../BinAST.webidl_ \ + ../BinAST.yaml \ --out-class ../BinASTParser-tmp.h \ --out-impl ../BinASTParser-tmp.cpp \ --out-enum ../BinASTEnum-tmp.h \ diff --git a/js/src/frontend/binsource/moz.build b/js/src/frontend/binast/moz.build similarity index 88% rename from js/src/frontend/binsource/moz.build rename to js/src/frontend/binast/moz.build index ab07b96d07f9..a3e8a14877ed 100644 --- a/js/src/frontend/binsource/moz.build +++ b/js/src/frontend/binast/moz.build @@ -4,4 +4,4 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -HOST_RUST_PROGRAMS += ['binsource'] +HOST_RUST_PROGRAMS += ['binast'] diff --git a/js/src/frontend/binsource/src/main.rs b/js/src/frontend/binast/src/main.rs similarity index 100% rename from js/src/frontend/binsource/src/main.rs rename to js/src/frontend/binast/src/main.rs diff --git a/js/src/frontend/binsource/src/refgraph.rs b/js/src/frontend/binast/src/refgraph.rs similarity index 100% rename from js/src/frontend/binsource/src/refgraph.rs rename to js/src/frontend/binast/src/refgraph.rs diff --git a/js/src/frontend/binsource/README.md b/js/src/frontend/binsource/README.md deleted file mode 100644 index d4c86d10b285..000000000000 --- a/js/src/frontend/binsource/README.md +++ /dev/null @@ -1,16 +0,0 @@ -A parser generator used to generate the following files: - -- js/src/frontend/BinSource-auto.h -- js/src/frontend/BinSource-auto.cpp -- js/src/frontent/BinToken.h - -from the following files: - -- js/src/frontend/BinSource.webidl_ (specifications of BinAST) -- js/src/frontend/BinSource.yaml (parser generator driver) - -To use it: -```sh -$ cd $(topsrcdir)/js/src/frontend/binsource -% ./build.sh -``` diff --git a/js/src/frontend/moz.build b/js/src/frontend/moz.build index 0f5168c3eb9b..ff924cbb7639 100644 --- a/js/src/frontend/moz.build +++ b/js/src/frontend/moz.build @@ -72,14 +72,14 @@ if CONFIG['JS_BUILD_BINAST']: 'BinASTParser.cpp', 'BinASTParserBase.cpp', 'BinASTParserPerTokenizer.cpp', - 'BinSourceRuntimeSupport.cpp', + 'BinASTRuntimeSupport.cpp', 'BinToken.cpp', 'BinTokenReaderBase.cpp', 'BinTokenReaderMultipart.cpp', ] DIRS += [ - 'binsource' + 'binast' ] # Instrument BinAST files for fuzzing as we have a fuzzing target for BinAST. diff --git a/js/src/vm/JSScript.h b/js/src/vm/JSScript.h index ba693282d432..1b3affed2a97 100644 --- a/js/src/vm/JSScript.h +++ b/js/src/vm/JSScript.h @@ -25,7 +25,7 @@ #include "jstypes.h" -#include "frontend/BinSourceRuntimeSupport.h" +#include "frontend/BinASTRuntimeSupport.h" #include "frontend/NameAnalysisTypes.h" #include "gc/Barrier.h" #include "gc/Rooting.h" diff --git a/js/src/vm/Runtime.h b/js/src/vm/Runtime.h index 9d19803d2d76..cc4e3f75f853 100644 --- a/js/src/vm/Runtime.h +++ b/js/src/vm/Runtime.h @@ -24,7 +24,7 @@ #include "builtin/AtomicsObject.h" #include "builtin/intl/SharedIntlData.h" #include "builtin/Promise.h" -#include "frontend/BinSourceRuntimeSupport.h" +#include "frontend/BinASTRuntimeSupport.h" #include "frontend/NameCollections.h" #include "gc/GCRuntime.h" #include "gc/Tracer.h"