diff --git a/src/d8.cc b/src/d8.cc index c199a7b10d..4f7b6309e1 100644 --- a/src/d8.cc +++ b/src/d8.cc @@ -1938,11 +1938,10 @@ Local Shell::CreateEvaluationContext(Isolate* isolate) { Local context = Context::New(isolate, nullptr, global_template); DCHECK(!context.IsEmpty()); InitializeModuleEmbedderData(context); - Context::Scope scope(context); - - const std::vector& args = options.arguments; - int size = static_cast(args.size()); - if (size > 0) { + if (options.include_arguments) { + Context::Scope scope(context); + const std::vector& args = options.arguments; + int size = static_cast(args.size()); Local array = Array::New(isolate, size); for (int i = 0; i < size; i++) { Local 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 || diff --git a/src/d8.h b/src/d8.h index e843d0a716..fbe3b50d54 100644 --- a/src/d8.h +++ b/src/d8.h @@ -387,6 +387,7 @@ class ShellOptions { bool quiet_load = false; int thread_pool_size = 0; std::vector arguments; + bool include_arguments = true; }; class Shell : public i::AllStatic { diff --git a/test/mjsunit/d8/d8-no-arguments.js b/test/mjsunit/d8/d8-no-arguments.js deleted file mode 100644 index 9427de72ab..0000000000 --- a/test/mjsunit/d8/d8-no-arguments.js +++ /dev/null @@ -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")); diff --git a/test/test262/testcfg.py b/test/test262/testcfg.py index 5c74cb734f..89f3874c10 100644 --- a/test/test262/testcfg.py +++ b/test/test262/testcfg.py @@ -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): diff --git a/tools/tickprocessor-driver.js b/tools/tickprocessor-driver.js index 7117b26df3..58844c127e 100644 --- a/tools/tickprocessor-driver.js +++ b/tools/tickprocessor-driver.js @@ -55,7 +55,7 @@ var entriesProviders = { 'mac': MacCppEntriesProvider }; -var params = processArguments(arguments || []); +var params = processArguments(arguments); var sourceMap = null; if (params.sourceMap) { initSourceMapSupport();