[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/1307417
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57155}
This commit is contained in:
Yang Guo 2018-10-31 07:37:33 +01:00 committed by Commit Bot
parent 5cce694d60
commit b32ee7b0f2
5 changed files with 12 additions and 14 deletions

View File

@ -1938,11 +1938,10 @@ Local<Context> Shell::CreateEvaluationContext(Isolate* isolate) {
Local<Context> context = Context::New(isolate, nullptr, global_template);
DCHECK(!context.IsEmpty());
InitializeModuleEmbedderData(context);
if (options.include_arguments) {
Context::Scope scope(context);
const std::vector<const char*>& args = options.arguments;
int size = static_cast<int>(args.size());
if (size > 0) {
Local<Array> array = Array::New(isolate, size);
for (int i = 0; i < size; i++) {
Local<String> arg =
@ -2766,8 +2765,10 @@ bool Shell::SetOptions(int argc, char* argv[]) {
argv[j] = nullptr;
}
break;
}
if (strcmp(argv[i], "--stress-opt") == 0) {
} else if (strcmp(argv[i], "--no-arguments") == 0) {
options.include_arguments = false;
argv[i] = nullptr;
} else if (strcmp(argv[i], "--stress-opt") == 0) {
options.stress_opt = true;
argv[i] = nullptr;
} else if (strcmp(argv[i], "--nostress-opt") == 0 ||

View File

@ -387,6 +387,7 @@ class ShellOptions {
bool quiet_load = false;
int thread_pool_size = 0;
std::vector<const char*> arguments;
bool include_arguments = true;
};
class Shell : public i::AllStatic {

View File

@ -1,5 +0,0 @@
// 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"));

View File

@ -185,7 +185,8 @@ class TestCase(testcase.D8TestCase):
if "detachArrayBuffer.js" in self.test_record.get("includes", [])
else []) +
[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):

View File

@ -55,7 +55,7 @@ var entriesProviders = {
'mac': MacCppEntriesProvider
};
var params = processArguments(arguments || []);
var params = processArguments(arguments);
var sourceMap = null;
if (params.sourceMap) {
initSourceMapSupport();