Commit 9bb8b585 authored by svenpanne's avatar svenpanne Committed by Commit bot

Add an --omit-quit flag to d8 for Emscripten's sake.

Review URL: https://codereview.chromium.org/1101683002

Cr-Commit-Position: refs/heads/master@{#28004}
parent c715098e
......@@ -924,8 +924,13 @@ Handle<ObjectTemplate> Shell::CreateGlobalTemplate(Isolate* isolate) {
FunctionTemplate::New(isolate, ReadLine));
global_template->Set(String::NewFromUtf8(isolate, "load"),
FunctionTemplate::New(isolate, Load));
global_template->Set(String::NewFromUtf8(isolate, "quit"),
FunctionTemplate::New(isolate, Quit));
// Some Emscripten-generated code tries to call 'quit', which in turn would
// call C's exit(). This would lead to memory leaks, because there is no way
// we can terminate cleanly then, so we need a way to hide 'quit'.
if (!options.omit_quit) {
global_template->Set(String::NewFromUtf8(isolate, "quit"),
FunctionTemplate::New(isolate, Quit));
}
global_template->Set(String::NewFromUtf8(isolate, "version"),
FunctionTemplate::New(isolate, Version));
......@@ -1374,6 +1379,9 @@ bool Shell::SetOptions(int argc, char* argv[]) {
// TODO(jochen) See issue 3351
options.send_idle_notification = true;
argv[i] = NULL;
} else if (strcmp(argv[i], "--omit-quit") == 0) {
options.omit_quit = true;
argv[i] = NULL;
} else if (strcmp(argv[i], "-f") == 0) {
// Ignore any -f flags for compatibility with other stand-alone
// JavaScript engines.
......
......@@ -196,6 +196,7 @@ class ShellOptions {
last_run(true),
send_idle_notification(false),
invoke_weak_callbacks(false),
omit_quit(false),
stress_opt(false),
stress_deopt(false),
interactive_shell(false),
......@@ -222,6 +223,7 @@ class ShellOptions {
bool last_run;
bool send_idle_notification;
bool invoke_weak_callbacks;
bool omit_quit;
bool stress_opt;
bool stress_deopt;
bool interactive_shell;
......
......@@ -396,9 +396,6 @@
'big-array-literal': [SKIP],
'big-object-literal': [SKIP],
'regress/regress-crbug-178790': [SKIP],
# FIXME(svenpanne,titzer): Skipped until leak-free.
'asm/sqlite3/*': [SKIP],
}], # 'asan == True'
##############################################################################
......
......@@ -352,6 +352,7 @@ def ProcessOptions(options):
if options.asan:
options.extra_flags.append("--invoke-weak-callbacks")
options.extra_flags.append("--omit-quit")
if options.tsan:
VARIANTS = ["default"]
......
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