From d3ef8f4b9579417d84b65f6dac4c51676a264639 Mon Sep 17 00:00:00 2001 From: neis Date: Mon, 28 Sep 2015 04:16:55 -0700 Subject: [PATCH] [es6] Ship rest parameters. R=rossberg BUG= Review URL: https://codereview.chromium.org/1371963002 Cr-Commit-Position: refs/heads/master@{#30970} --- src/bootstrapper.cc | 4 ++-- src/flag-definitions.h | 4 ++-- src/parser.cc | 4 ++-- src/preparser.h | 9 +++++---- test/cctest/test-parsing.cc | 2 +- test/js-perf-test/JSTests.json | 2 +- test/mjsunit/harmony/spread-call-new-class.js | 2 +- test/mjsunit/harmony/spread-call-new.js | 2 +- test/mjsunit/harmony/spread-call-super-property.js | 2 +- test/mjsunit/harmony/spread-call.js | 2 +- test/mjsunit/harmony/super.js | 2 +- test/mjsunit/strong/function-arity.js | 2 +- 12 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc index 4bcebaa8d6..778c7bd5b5 100644 --- a/src/bootstrapper.cc +++ b/src/bootstrapper.cc @@ -1861,7 +1861,7 @@ EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_sloppy_function) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_sloppy_let) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_rest_parameters) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_default_parameters) -EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_spreadcalls) +EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_spread_calls) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_destructuring) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_object_observe) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_spread_arrays) @@ -2565,7 +2565,7 @@ bool Genesis::InstallExperimentalNatives() { static const char* harmony_default_parameters_natives[] = {nullptr}; static const char* harmony_reflect_natives[] = {"native harmony-reflect.js", nullptr}; - static const char* harmony_spreadcalls_natives[] = { + static const char* harmony_spread_calls_natives[] = { "native harmony-spread.js", nullptr}; static const char* harmony_destructuring_natives[] = {nullptr}; static const char* harmony_object_observe_natives[] = { diff --git a/src/flag-definitions.h b/src/flag-definitions.h index 8578820450..2c2a0fa420 100644 --- a/src/flag-definitions.h +++ b/src/flag-definitions.h @@ -204,7 +204,6 @@ DEFINE_BOOL(legacy_const, true, "legacy semantics for const in sloppy mode") #define HARMONY_STAGED(V) \ V(harmony_tostring, "harmony toString") \ V(harmony_concat_spreadable, "harmony isConcatSpreadable") \ - V(harmony_rest_parameters, "harmony rest parameters") \ V(harmony_sloppy, "harmony features in sloppy mode") \ V(harmony_sloppy_function, "harmony sloppy function block scoping") \ V(harmony_sloppy_let, "harmony let in sloppy mode") @@ -215,7 +214,8 @@ DEFINE_BOOL(legacy_const, true, "legacy semantics for const in sloppy mode") V(harmony_array_includes, "harmony Array.prototype.includes") \ V(harmony_new_target, "harmony new.target") \ V(harmony_object_observe, "harmony Object.observe") \ - V(harmony_spreadcalls, "harmony spread-calls") \ + V(harmony_rest_parameters, "harmony rest parameters") \ + V(harmony_spread_calls, "harmony spread-calls") \ V(harmony_spread_arrays, "harmony spread in array literals") // Once a shipping feature has proved stable in the wild, it will be dropped diff --git a/src/parser.cc b/src/parser.cc index e3ce0f0172..e2b99ec73b 100644 --- a/src/parser.cc +++ b/src/parser.cc @@ -919,7 +919,7 @@ Parser::Parser(ParseInfo* info) set_allow_harmony_sloppy_let(FLAG_harmony_sloppy_let); set_allow_harmony_rest_parameters(FLAG_harmony_rest_parameters); set_allow_harmony_default_parameters(FLAG_harmony_default_parameters); - set_allow_harmony_spreadcalls(FLAG_harmony_spreadcalls); + set_allow_harmony_spread_calls(FLAG_harmony_spread_calls); set_allow_harmony_destructuring(FLAG_harmony_destructuring); set_allow_harmony_spread_arrays(FLAG_harmony_spread_arrays); set_allow_harmony_new_target(FLAG_harmony_new_target); @@ -4737,7 +4737,7 @@ PreParser::PreParseResult Parser::ParseLazyFunctionBodyWithPreParser( SET_ALLOW(harmony_sloppy_let); SET_ALLOW(harmony_rest_parameters); SET_ALLOW(harmony_default_parameters); - SET_ALLOW(harmony_spreadcalls); + SET_ALLOW(harmony_spread_calls); SET_ALLOW(harmony_destructuring); SET_ALLOW(harmony_spread_arrays); SET_ALLOW(harmony_new_target); diff --git a/src/preparser.h b/src/preparser.h index e9e0f4bfb8..50dbcf1a46 100644 --- a/src/preparser.h +++ b/src/preparser.h @@ -113,7 +113,7 @@ class ParserBase : public Traits { allow_harmony_sloppy_let_(false), allow_harmony_rest_parameters_(false), allow_harmony_default_parameters_(false), - allow_harmony_spreadcalls_(false), + allow_harmony_spread_calls_(false), allow_harmony_destructuring_(false), allow_harmony_spread_arrays_(false), allow_harmony_new_target_(false), @@ -132,7 +132,7 @@ class ParserBase : public Traits { ALLOW_ACCESSORS(harmony_sloppy_let); ALLOW_ACCESSORS(harmony_rest_parameters); ALLOW_ACCESSORS(harmony_default_parameters); - ALLOW_ACCESSORS(harmony_spreadcalls); + ALLOW_ACCESSORS(harmony_spread_calls); ALLOW_ACCESSORS(harmony_destructuring); ALLOW_ACCESSORS(harmony_spread_arrays); ALLOW_ACCESSORS(harmony_new_target); @@ -833,7 +833,7 @@ class ParserBase : public Traits { bool allow_harmony_sloppy_let_; bool allow_harmony_rest_parameters_; bool allow_harmony_default_parameters_; - bool allow_harmony_spreadcalls_; + bool allow_harmony_spread_calls_; bool allow_harmony_destructuring_; bool allow_harmony_spread_arrays_; bool allow_harmony_new_target_; @@ -2835,7 +2835,8 @@ typename Traits::Type::ExpressionList ParserBase::ParseArguments( bool was_unspread = false; int unspread_sequences_count = 0; while (!done) { - bool is_spread = allow_harmony_spreadcalls() && (peek() == Token::ELLIPSIS); + bool is_spread = + allow_harmony_spread_calls() && (peek() == Token::ELLIPSIS); int start_pos = peek_position(); if (is_spread) Consume(Token::ELLIPSIS); diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc index 19b4619550..6300c0987d 100644 --- a/test/cctest/test-parsing.cc +++ b/test/cctest/test-parsing.cc @@ -1528,7 +1528,7 @@ void SetParserFlags(i::ParserBase* parser, flags.Contains(kAllowHarmonyDefaultParameters)); parser->set_allow_harmony_rest_parameters( flags.Contains(kAllowHarmonyRestParameters)); - parser->set_allow_harmony_spreadcalls( + parser->set_allow_harmony_spread_calls( flags.Contains(kAllowHarmonySpreadCalls)); parser->set_allow_harmony_sloppy(flags.Contains(kAllowHarmonySloppy)); parser->set_allow_harmony_sloppy_let(flags.Contains(kAllowHarmonySloppyLet)); diff --git a/test/js-perf-test/JSTests.json b/test/js-perf-test/JSTests.json index 4e238a90f9..911f9f3289 100644 --- a/test/js-perf-test/JSTests.json +++ b/test/js-perf-test/JSTests.json @@ -26,7 +26,7 @@ "path": ["SpreadCalls"], "main": "run.js", "resources": ["spreadcalls.js"], - "flags": ["--harmony-spreadcalls"], + "flags": ["--harmony-spread_calls"], "run_count": 5, "units": "score", "results_regexp": "^%s\\-SpreadCalls\\(Score\\): (.+)$", diff --git a/test/mjsunit/harmony/spread-call-new-class.js b/test/mjsunit/harmony/spread-call-new-class.js index fcd0a21bc9..ed95e6cad7 100644 --- a/test/mjsunit/harmony/spread-call-new-class.js +++ b/test/mjsunit/harmony/spread-call-new-class.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-spreadcalls --harmony-sloppy --harmony-rest-parameters +// Flags: --harmony-spread-calls --harmony-sloppy --harmony-rest-parameters (function testConstructClassStrict() { diff --git a/test/mjsunit/harmony/spread-call-new.js b/test/mjsunit/harmony/spread-call-new.js index 78f873e14b..4ae115e791 100644 --- a/test/mjsunit/harmony/spread-call-new.js +++ b/test/mjsunit/harmony/spread-call-new.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-spreadcalls +// Flags: --harmony-spread-calls (function testNonConstructorStrict() { "use strict"; diff --git a/test/mjsunit/harmony/spread-call-super-property.js b/test/mjsunit/harmony/spread-call-super-property.js index 1eb2abc3b0..cc6cf849bd 100644 --- a/test/mjsunit/harmony/spread-call-super-property.js +++ b/test/mjsunit/harmony/spread-call-super-property.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-spreadcalls --harmony-sloppy --harmony-rest-parameters +// Flags: --harmony-spread-calls --harmony-sloppy --harmony-rest-parameters (function testCallSuperPropertyStrict() { "use strict"; diff --git a/test/mjsunit/harmony/spread-call.js b/test/mjsunit/harmony/spread-call.js index e10a3ec793..7c19ec1ef1 100644 --- a/test/mjsunit/harmony/spread-call.js +++ b/test/mjsunit/harmony/spread-call.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-spreadcalls +// Flags: --harmony-spread-calls (function testSpreadCallsStrict() { "use strict" diff --git a/test/mjsunit/harmony/super.js b/test/mjsunit/harmony/super.js index f7584702b6..d74484ea04 100644 --- a/test/mjsunit/harmony/super.js +++ b/test/mjsunit/harmony/super.js @@ -3,7 +3,7 @@ // found in the LICENSE file. // Flags: --harmony-arrow-functions --allow-natives-syntax -// Flags: --harmony-spreadcalls --harmony-destructuring +// Flags: --harmony-spread-calls --harmony-destructuring // Flags: --harmony-rest-parameters --harmony-sloppy (function TestSuperNamedLoads() { diff --git a/test/mjsunit/strong/function-arity.js b/test/mjsunit/strong/function-arity.js index 9a4f2fc847..67c0d1f195 100644 --- a/test/mjsunit/strong/function-arity.js +++ b/test/mjsunit/strong/function-arity.js @@ -3,7 +3,7 @@ // found in the LICENSE file. // Flags: --strong-mode --harmony-arrow-functions --harmony-reflect -// Flags: --harmony-spreadcalls --harmony-rest-parameters --allow-natives-syntax +// Flags: --harmony-spread-calls --harmony-rest-parameters --allow-natives-syntax 'use strict';