Commit b32ee7b0 authored by Yang Guo's avatar Yang Guo Committed by Commit Bot

[d8] pass --no-arguments to omit top-level arguments

TBR=petermarshall@chromium.org

Bug: v8:8385
Change-Id: Iba13004e0fd03a82cb65ed497d4bd2b4d006b424
Reviewed-on: https://chromium-review.googlesource.com/c/1307417Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Commit-Queue: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57155}
parent 5cce694d
...@@ -1938,11 +1938,10 @@ Local<Context> Shell::CreateEvaluationContext(Isolate* isolate) { ...@@ -1938,11 +1938,10 @@ Local<Context> Shell::CreateEvaluationContext(Isolate* isolate) {
Local<Context> context = Context::New(isolate, nullptr, global_template); Local<Context> context = Context::New(isolate, nullptr, global_template);
DCHECK(!context.IsEmpty()); DCHECK(!context.IsEmpty());
InitializeModuleEmbedderData(context); InitializeModuleEmbedderData(context);
Context::Scope scope(context); if (options.include_arguments) {
Context::Scope scope(context);
const std::vector<const char*>& args = options.arguments; const std::vector<const char*>& args = options.arguments;
int size = static_cast<int>(args.size()); int size = static_cast<int>(args.size());
if (size > 0) {
Local<Array> array = Array::New(isolate, size); Local<Array> array = Array::New(isolate, size);
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
Local<String> arg = Local<String> arg =
...@@ -2766,8 +2765,10 @@ bool Shell::SetOptions(int argc, char* argv[]) { ...@@ -2766,8 +2765,10 @@ bool Shell::SetOptions(int argc, char* argv[]) {
argv[j] = nullptr; argv[j] = nullptr;
} }
break; break;
} } else if (strcmp(argv[i], "--no-arguments") == 0) {
if (strcmp(argv[i], "--stress-opt") == 0) { options.include_arguments = false;
argv[i] = nullptr;
} else if (strcmp(argv[i], "--stress-opt") == 0) {
options.stress_opt = true; options.stress_opt = true;
argv[i] = nullptr; argv[i] = nullptr;
} else if (strcmp(argv[i], "--nostress-opt") == 0 || } else if (strcmp(argv[i], "--nostress-opt") == 0 ||
......
...@@ -387,6 +387,7 @@ class ShellOptions { ...@@ -387,6 +387,7 @@ class ShellOptions {
bool quiet_load = false; bool quiet_load = false;
int thread_pool_size = 0; int thread_pool_size = 0;
std::vector<const char*> arguments; std::vector<const char*> arguments;
bool include_arguments = true;
}; };
class Shell : public i::AllStatic { class Shell : public i::AllStatic {
......
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
assertEquals(undefined, Object.getOwnPropertyDescriptor(this, "arguments"));
...@@ -185,7 +185,8 @@ class TestCase(testcase.D8TestCase): ...@@ -185,7 +185,8 @@ class TestCase(testcase.D8TestCase):
if "detachArrayBuffer.js" in self.test_record.get("includes", []) if "detachArrayBuffer.js" in self.test_record.get("includes", [])
else []) + else []) +
[flag for (feature, flag) in FEATURE_FLAGS.items() [flag for (feature, flag) in FEATURE_FLAGS.items()
if feature in self.test_record.get("features", [])] if feature in self.test_record.get("features", [])] +
["--no-arguments"] # disable top-level arguments in d8
) )
def _get_includes(self): def _get_includes(self):
......
...@@ -55,7 +55,7 @@ var entriesProviders = { ...@@ -55,7 +55,7 @@ var entriesProviders = {
'mac': MacCppEntriesProvider 'mac': MacCppEntriesProvider
}; };
var params = processArguments(arguments || []); var params = processArguments(arguments);
var sourceMap = null; var sourceMap = null;
if (params.sourceMap) { if (params.sourceMap) {
initSourceMapSupport(); initSourceMapSupport();
......
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