Skip to content

Commit

Permalink
Bug 1505343 - Part 1: Rename binsource => binast. r=Yoric
Browse files Browse the repository at this point in the history
Differential Revision: https://phabricator.services.mozilla.com/D23097

--HG--
rename : js/src/frontend/BinSource-macros.h => js/src/frontend/BinAST-macros.h
rename : js/src/frontend/BinSource.webidl_ => js/src/frontend/BinAST.webidl_
rename : js/src/frontend/BinSource.yaml => js/src/frontend/BinAST.yaml
rename : js/src/frontend/BinSourceRuntimeSupport.cpp => js/src/frontend/BinASTRuntimeSupport.cpp
rename : js/src/frontend/BinSourceRuntimeSupport.h => js/src/frontend/BinASTRuntimeSupport.h
rename : js/src/frontend/binsource/Cargo.toml => js/src/frontend/binast/Cargo.toml
rename : js/src/frontend/binsource/README.md => js/src/frontend/binast/README.md
rename : js/src/frontend/binsource/build.sh => js/src/frontend/binast/build.sh
rename : js/src/frontend/binsource/moz.build => js/src/frontend/binast/moz.build
rename : js/src/frontend/binsource/src/main.rs => js/src/frontend/binast/src/main.rs
rename : js/src/frontend/binsource/src/refgraph.rs => js/src/frontend/binast/src/refgraph.rs
extra : moz-landing-system : lando
  • Loading branch information
arai-a committed Mar 13, 2019
1 parent 2c65d72 commit df37d83
Show file tree
Hide file tree
Showing 27 changed files with 62 additions and 61 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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
File renamed without changes.
12 changes: 6 additions & 6 deletions js/src/frontend/BinSource.yaml → js/src/frontend/BinAST.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion js/src/frontend/BinASTEnum.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions js/src/frontend/BinASTParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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"
Expand Down Expand Up @@ -2497,7 +2497,7 @@ BinASTParser<Tok>::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());
Expand Down Expand Up @@ -2560,7 +2560,7 @@ JS::Result<ParseNode*> BinASTParser<Tok>::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());
Expand Down Expand Up @@ -2615,7 +2615,7 @@ JS::Result<ParseNode*> BinASTParser<Tok>::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());
Expand Down Expand Up @@ -2681,7 +2681,7 @@ JS::Result<ParseNode*> BinASTParser<Tok>::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());
Expand Down Expand Up @@ -2740,7 +2740,7 @@ JS::Result<ParseNode*> BinASTParser<Tok>::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());
Expand Down
2 changes: 1 addition & 1 deletion js/src/frontend/BinASTParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions js/src/frontend/BinASTParserPerTokenizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -118,7 +118,8 @@ JS::Result<ParseNode*> BinASTParserPerTokenizer<Tok>::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();
}
Expand Down Expand Up @@ -179,7 +180,7 @@ JS::Result<FunctionNode*> BinASTParserPerTokenizer<Tok>::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());
Expand Down
8 changes: 4 additions & 4 deletions js/src/frontend/BinASTParserPerTokenizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ class BinASTParserPerTokenizer : public BinASTParserBase,
mozilla::Maybe<Tokenizer> tokenizer_;
VariableDeclarationKind variableDeclarationKind_;

friend class BinParseContext;
friend class BinASTParseContext;
friend class AutoVariableDeclarationKind;

// Helper class: Restore field `variableDeclarationKind` upon leaving a scope.
Expand Down Expand Up @@ -314,11 +314,11 @@ class BinASTParserPerTokenizer : public BinASTParserBase,
inline const FinalParser* asFinalParser() const;
};

class BinParseContext : public ParseContext {
class BinASTParseContext : public ParseContext {
public:
template <typename Tok>
BinParseContext(JSContext* cx, BinASTParserPerTokenizer<Tok>* parser,
SharedContext* sc, Directives* newDirectives)
BinASTParseContext(JSContext* cx, BinASTParserPerTokenizer<Tok>* parser,
SharedContext* sc, Directives* newDirectives)
: ParseContext(cx, parser->pc_, sc, *parser, parser->usedNames_,
newDirectives, /* isFull = */ true) {}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -155,4 +155,4 @@ typedef UniquePtr<frontend::BinASTSourceMetadata,

} // namespace js

#endif // frontend_BinSourceSupport_h
#endif // frontend_BinASTSupport_h
2 changes: 1 addition & 1 deletion js/src/frontend/BinToken.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include <sys/types.h>

#include "frontend/BinSourceRuntimeSupport.h"
#include "frontend/BinASTRuntimeSupport.h"
#include "frontend/TokenStream.h"
#include "js/Result.h"
#include "vm/JSContext.h"
Expand Down
2 changes: 1 addition & 1 deletion js/src/frontend/BinToken.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion js/src/frontend/BinTokenReaderBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include "frontend/BinTokenReaderBase.h"

#include "frontend/BinSource-macros.h"
#include "frontend/BinAST-macros.h"
#include "js/Result.h"

namespace js {
Expand Down
4 changes: 2 additions & 2 deletions js/src/frontend/BinTokenReaderMultipart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

#include <utility>

#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"
Expand Down
2 changes: 1 addition & 1 deletion js/src/frontend/BinTokenReaderMultipart.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "mozilla/Maybe.h"

#include "frontend/BinSourceRuntimeSupport.h"
#include "frontend/BinASTRuntimeSupport.h"
#include "frontend/BinToken.h"
#include "frontend/BinTokenReaderBase.h"

Expand Down
2 changes: 1 addition & 1 deletion js/src/frontend/BytecodeCompiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ yaml-rust = "^0.4.2"
webidl = "^0.8"

[[bin]]
name = "binsource"
name = "binast"
path = "src/main.rs"
16 changes: 16 additions & 0 deletions js/src/frontend/binast/README.md
Original file line number Diff line number Diff line change
@@ -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
```
Original file line number Diff line number Diff line change
@@ -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 \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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']
File renamed without changes.
File renamed without changes.
16 changes: 0 additions & 16 deletions js/src/frontend/binsource/README.md

This file was deleted.

4 changes: 2 additions & 2 deletions js/src/frontend/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion js/src/vm/JSScript.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion js/src/vm/Runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit df37d83

Please sign in to comment.