Commit f644fa40 authored by Toon Verwaest's avatar Toon Verwaest Committed by Commit Bot

[d8] Add parser experimentation flags

--parse-only only invokes the parser but does not compile / run the scripts
--max-lazy ignores eager compilation hints from IIFE.

Change-Id: Icd156cab16d796b9f676b95bb1542ad07c67546d
Reviewed-on: https://chromium-review.googlesource.com/c/1460939
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59469}
parent 93d92cfb
......@@ -36,10 +36,14 @@
#include "src/objects-inl.h"
#include "src/objects.h"
#include "src/ostreams.h"
#include "src/parsing/parse-info.h"
#include "src/parsing/parsing.h"
#include "src/parsing/scanner-character-streams.h"
#include "src/snapshot/natives.h"
#include "src/trap-handler/trap-handler.h"
#include "src/utils.h"
#include "src/v8.h"
#include "src/vm-state-inl.h"
#include "src/wasm/wasm-engine.h"
#if !defined(_WIN32) && !defined(_WIN64)
......@@ -464,6 +468,27 @@ bool Shell::ExecuteString(Isolate* isolate, Local<String> source,
Local<Value> name, PrintResult print_result,
ReportExceptions report_exceptions,
ProcessMessageQueue process_message_queue) {
if (i::FLAG_parse_only) {
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
i::VMState<PARSER> state(i_isolate);
i::Handle<i::String> str = Utils::OpenHandle(*(source));
// Set up ParseInfo.
i::ParseInfo parse_info(i_isolate);
parse_info.set_toplevel();
parse_info.set_allow_lazy_parsing();
parse_info.set_language_mode(
i::construct_language_mode(i::FLAG_use_strict));
parse_info.set_script(
parse_info.CreateScript(i_isolate, str, options.compile_options));
if (!i::parsing::ParseProgram(&parse_info, i_isolate)) {
fprintf(stderr, "Failed parsing\n");
return false;
}
return true;
}
HandleScope handle_scope(isolate);
TryCatch try_catch(isolate);
try_catch.SetVerbose(true);
......
......@@ -901,6 +901,8 @@ DEFINE_BOOL(trace, false, "trace function calls")
// codegen.cc
DEFINE_BOOL(lazy, true, "use lazy compilation")
DEFINE_BOOL(max_lazy, false, "ignore eager compilation hints")
DEFINE_IMPLICATION(max_lazy, lazy)
DEFINE_BOOL(trace_opt, false, "trace lazy optimization")
DEFINE_BOOL(trace_opt_verbose, false, "extra verbose compilation tracing")
DEFINE_IMPLICATION(trace_opt_verbose, trace_opt)
......@@ -1016,7 +1018,7 @@ DEFINE_IMPLICATION(trace_maps, log_code)
// parser.cc
DEFINE_BOOL(allow_natives_syntax, false, "allow natives syntax")
DEFINE_BOOL(preparse, false, "only preparse the input")
DEFINE_BOOL(parse_only, false, "only parse the sources")
// simulator-arm.cc, simulator-arm64.cc and simulator-mips.cc
DEFINE_BOOL(trace_sim, false, "Trace simulator execution")
......
......@@ -400,7 +400,7 @@ class ParserBase {
}
void set_next_function_is_likely_called() {
next_function_is_likely_called_ = true;
next_function_is_likely_called_ = !FLAG_max_lazy;
}
void RecordFunctionOrEvalCall() { contains_function_or_eval_ = true; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment