Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(630)

Unified Diff: test/cctest/interpreter/generate-bytecode-expectations.cc

Issue 2393453003: [interpreter] Add some bytecode tests for modules. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/cctest/interpreter/generate-bytecode-expectations.cc
diff --git a/test/cctest/interpreter/generate-bytecode-expectations.cc b/test/cctest/interpreter/generate-bytecode-expectations.cc
index ed1c692050ce3c0f792e2dae4c7dc25a912aa548..1adfc6a89966a50b755516dcd832645ddc73e193 100644
--- a/test/cctest/interpreter/generate-bytecode-expectations.cc
+++ b/test/cctest/interpreter/generate-bytecode-expectations.cc
@@ -40,6 +40,7 @@ class ProgramOptions final {
read_from_stdin_(false),
rebaseline_(false),
wrap_(true),
+ module_(false),
top_level_(false),
do_expressions_(false),
verbose_(false) {}
@@ -57,6 +58,7 @@ class ProgramOptions final {
}
bool rebaseline() const { return rebaseline_; }
bool wrap() const { return wrap_; }
+ bool module() const { return module_; }
bool top_level() const { return top_level_; }
bool do_expressions() const { return do_expressions_; }
bool verbose() const { return verbose_; }
@@ -72,6 +74,7 @@ class ProgramOptions final {
bool read_from_stdin_;
bool rebaseline_;
bool wrap_;
+ bool module_;
bool top_level_;
bool do_expressions_;
bool verbose_;
@@ -157,6 +160,8 @@ ProgramOptions ProgramOptions::FromCommandLine(int argc, char** argv) {
options.rebaseline_ = true;
} else if (strcmp(argv[i], "--no-wrap") == 0) {
options.wrap_ = false;
+ } else if (strcmp(argv[i], "--module") == 0) {
+ options.module_ = true;
} else if (strcmp(argv[i], "--top-level") == 0) {
options.top_level_ = true;
} else if (strcmp(argv[i], "--do-expressions") == 0) {
@@ -235,6 +240,12 @@ bool ProgramOptions::Validate() const {
return false;
}
+ if (module_ && (!top_level_ || wrap_)) {
+ REPORT_ERROR(
+ "The flag --module currently requires --top-level and --no-wrap.");
+ return false;
+ }
+
return true;
}
@@ -247,7 +258,9 @@ void ProgramOptions::UpdateFromHeader(std::istream& stream) {
}
while (std::getline(stream, line)) {
- if (line.compare(0, 6, "wrap: ") == 0) {
+ if (line.compare(0, 8, "module: ") == 0) {
+ module_ = ParseBoolean(line.c_str() + 8);
+ } else if (line.compare(0, 6, "wrap: ") == 0) {
wrap_ = ParseBoolean(line.c_str() + 6);
} else if (line.compare(0, 20, "test function name: ") == 0) {
test_function_name_ = line.c_str() + 20;
@@ -274,6 +287,7 @@ void ProgramOptions::PrintHeader(std::ostream& stream) const { // NOLINT
stream << "\ntest function name: " << test_function_name_;
}
+ if (module_) stream << "\nmodule: yes";
if (top_level_) stream << "\ntop level: yes";
if (do_expressions_) stream << "\ndo expressions: yes";
@@ -373,6 +387,7 @@ void GenerateExpectationsFile(std::ostream& stream, // NOLINT
BytecodeExpectationsPrinter printer(platform.isolate());
printer.set_wrap(options.wrap());
+ printer.set_module(options.module());
printer.set_top_level(options.top_level());
if (!options.test_function_name().empty()) {
printer.set_test_function_name(options.test_function_name());
@@ -426,6 +441,7 @@ void PrintUsage(const char* exec_path) {
" --stdin Read from standard input instead of file.\n"
" --rebaseline Rebaseline input snippet file.\n"
" --no-wrap Do not wrap the snippet in a function.\n"
+ " --module Compile as JavaScript module.\n"
" --test-function-name=foo "
"Specify the name of the test function.\n"
" --top-level Process top level code, not the top-level function.\n"
« no previous file with comments | « test/cctest/interpreter/bytecode_expectations/Modules.golden ('k') | test/cctest/interpreter/test-bytecode-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698