From a373b089e98ecdb5ac64506a95c54d152dc2b2d9 Mon Sep 17 00:00:00 2001 From: arv Date: Tue, 31 Mar 2015 07:24:13 -0700 Subject: [PATCH] Remove --harmony-numeric-literal flag We have been shipping harmony numeric literals since M41 R=rossberg@chromium.org LOG=Y Review URL: https://codereview.chromium.org/1024603002 Cr-Commit-Position: refs/heads/master@{#27545} --- src/bootstrapper.cc | 3 --- src/flag-definitions.h | 1 - src/parser.cc | 3 --- src/preparser.h | 6 ------ src/runtime/runtime-numbers.cc | 8 +------- src/scanner.cc | 5 ++--- src/scanner.h | 8 -------- test/cctest/test-parsing.cc | 9 ++------- test/mjsunit/es6/numeric-literals.js | 4 ---- 9 files changed, 5 insertions(+), 42 deletions(-) diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc index f094625..3c95736 100644 --- a/src/bootstrapper.cc +++ b/src/bootstrapper.cc @@ -1658,7 +1658,6 @@ EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_classes) EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_object_literals) EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_regexps) EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_arrow_functions) -EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_numeric_literals) EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_tostring) EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_sloppy) EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_unicode) @@ -1688,7 +1687,6 @@ EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_array_includes) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_classes) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_object_literals) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_arrow_functions) -EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_numeric_literals) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tostring) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_proxies) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_sloppy) @@ -2310,7 +2308,6 @@ bool Genesis::InstallExperimentalNatives() { static const char* harmony_regexps_natives[] = { "native harmony-regexp.js", NULL}; static const char* harmony_arrow_functions_natives[] = {NULL}; - static const char* harmony_numeric_literals_natives[] = {NULL}; static const char* harmony_tostring_natives[] = {"native harmony-tostring.js", NULL}; static const char* harmony_sloppy_natives[] = {NULL}; diff --git a/src/flag-definitions.h b/src/flag-definitions.h index 42d8ce3..355e391 100644 --- a/src/flag-definitions.h +++ b/src/flag-definitions.h @@ -202,7 +202,6 @@ DEFINE_IMPLICATION(es_staging, harmony) // Features that are shipping (turned on by default, but internal flag remains). #define HARMONY_SHIPPING(V) \ - V(harmony_numeric_literals, "harmony numeric literals") \ V(harmony_classes, "harmony classes (implies object literal extension)") \ V(harmony_object_literals, "harmony object literal extensions") diff --git a/src/parser.cc b/src/parser.cc index 7ab9be2..a23547e 100644 --- a/src/parser.cc +++ b/src/parser.cc @@ -870,7 +870,6 @@ Parser::Parser(ParseInfo* info) set_allow_natives(FLAG_allow_natives_syntax || info->is_native()); set_allow_harmony_modules(!info->is_native() && FLAG_harmony_modules); set_allow_harmony_arrow_functions(FLAG_harmony_arrow_functions); - set_allow_harmony_numeric_literals(FLAG_harmony_numeric_literals); set_allow_harmony_classes(FLAG_harmony_classes); set_allow_harmony_object_literals(FLAG_harmony_object_literals); set_allow_harmony_sloppy(FLAG_harmony_sloppy); @@ -4172,8 +4171,6 @@ PreParser::PreParseResult Parser::ParseLazyFunctionBodyWithPreParser( reusable_preparser_->set_allow_harmony_modules(allow_harmony_modules()); reusable_preparser_->set_allow_harmony_arrow_functions( allow_harmony_arrow_functions()); - reusable_preparser_->set_allow_harmony_numeric_literals( - allow_harmony_numeric_literals()); reusable_preparser_->set_allow_harmony_classes(allow_harmony_classes()); reusable_preparser_->set_allow_harmony_object_literals( allow_harmony_object_literals()); diff --git a/src/preparser.h b/src/preparser.h index 08963c9..92c762d 100644 --- a/src/preparser.h +++ b/src/preparser.h @@ -100,9 +100,6 @@ class ParserBase : public Traits { return allow_harmony_arrow_functions_; } bool allow_harmony_modules() const { return scanner()->HarmonyModules(); } - bool allow_harmony_numeric_literals() const { - return scanner()->HarmonyNumericLiterals(); - } bool allow_harmony_classes() const { return scanner()->HarmonyClasses(); } bool allow_harmony_object_literals() const { return allow_harmony_object_literals_; @@ -128,9 +125,6 @@ class ParserBase : public Traits { void set_allow_harmony_modules(bool allow) { scanner()->SetHarmonyModules(allow); } - void set_allow_harmony_numeric_literals(bool allow) { - scanner()->SetHarmonyNumericLiterals(allow); - } void set_allow_harmony_classes(bool allow) { scanner()->SetHarmonyClasses(allow); } diff --git a/src/runtime/runtime-numbers.cc b/src/runtime/runtime-numbers.cc index 36ca87b..7948723 100644 --- a/src/runtime/runtime-numbers.cc +++ b/src/runtime/runtime-numbers.cc @@ -185,13 +185,7 @@ RUNTIME_FUNCTION(Runtime_StringToNumber) { } // Slower case. - int flags = ALLOW_HEX; - if (FLAG_harmony_numeric_literals) { - // The current spec draft has not updated "ToNumber Applied to the String - // Type", https://bugs.ecmascript.org/show_bug.cgi?id=1584 - flags |= ALLOW_OCTAL | ALLOW_BINARY; - } - + int flags = ALLOW_HEX | ALLOW_OCTAL | ALLOW_BINARY; return *isolate->factory()->NewNumber( StringToDouble(isolate->unicode_cache(), subject, flags)); } diff --git a/src/scanner.cc b/src/scanner.cc index a40688f..8059289 100644 --- a/src/scanner.cc +++ b/src/scanner.cc @@ -36,7 +36,6 @@ Scanner::Scanner(UnicodeCache* unicode_cache) : unicode_cache_(unicode_cache), octal_pos_(Location::invalid()), harmony_modules_(false), - harmony_numeric_literals_(false), harmony_classes_(false), harmony_unicode_(false) {} @@ -954,7 +953,7 @@ Token::Value Scanner::ScanNumber(bool seen_period) { while (IsHexDigit(c0_)) { AddLiteralCharAdvance(); } - } else if (harmony_numeric_literals_ && (c0_ == 'o' || c0_ == 'O')) { + } else if (c0_ == 'o' || c0_ == 'O') { kind = OCTAL; AddLiteralCharAdvance(); if (!IsOctalDigit(c0_)) { @@ -964,7 +963,7 @@ Token::Value Scanner::ScanNumber(bool seen_period) { while (IsOctalDigit(c0_)) { AddLiteralCharAdvance(); } - } else if (harmony_numeric_literals_ && (c0_ == 'b' || c0_ == 'B')) { + } else if (c0_ == 'b' || c0_ == 'B') { kind = BINARY; AddLiteralCharAdvance(); if (!IsBinaryDigit(c0_)) { diff --git a/src/scanner.h b/src/scanner.h index 8040825..5162fbe 100644 --- a/src/scanner.h +++ b/src/scanner.h @@ -450,12 +450,6 @@ class Scanner { void SetHarmonyModules(bool modules) { harmony_modules_ = modules; } - bool HarmonyNumericLiterals() const { - return harmony_numeric_literals_; - } - void SetHarmonyNumericLiterals(bool numeric_literals) { - harmony_numeric_literals_ = numeric_literals; - } bool HarmonyClasses() const { return harmony_classes_; } @@ -739,8 +733,6 @@ class Scanner { bool has_multiline_comment_before_next_; // Whether we scan 'module', 'import', 'export' as keywords. bool harmony_modules_; - // Whether we scan 0o777 and 0b111 as numbers. - bool harmony_numeric_literals_; // Whether we scan 'class', 'extends', 'static' and 'super' as keywords. bool harmony_classes_; // Whether we allow \u{xxxxx}. diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc index 6969026..ba10d7c 100644 --- a/test/cctest/test-parsing.cc +++ b/test/cctest/test-parsing.cc @@ -1373,7 +1373,6 @@ enum ParserFlag { kAllowLazy, kAllowNatives, kAllowHarmonyModules, - kAllowHarmonyNumericLiterals, kAllowHarmonyArrowFunctions, kAllowHarmonyClasses, kAllowHarmonyObjectLiterals, @@ -1397,8 +1396,6 @@ void SetParserFlags(i::ParserBase* parser, parser->set_allow_lazy(flags.Contains(kAllowLazy)); parser->set_allow_natives(flags.Contains(kAllowNatives)); parser->set_allow_harmony_modules(flags.Contains(kAllowHarmonyModules)); - parser->set_allow_harmony_numeric_literals( - flags.Contains(kAllowHarmonyNumericLiterals)); parser->set_allow_harmony_object_literals( flags.Contains(kAllowHarmonyObjectLiterals)); parser->set_allow_harmony_arrow_functions( @@ -1668,9 +1665,8 @@ TEST(ParserSync) { // Neither Harmony numeric literals nor our natives syntax have any // interaction with the flags above, so test these separately to reduce // the combinatorial explosion. - static const ParserFlag flags2[] = { kAllowHarmonyNumericLiterals }; - TestParserSync("0o1234", flags2, arraysize(flags2)); - TestParserSync("0b1011", flags2, arraysize(flags2)); + TestParserSync("0o1234", NULL, 0); + TestParserSync("0b1011", NULL, 0); static const ParserFlag flags3[] = { kAllowNatives }; TestParserSync("%DebugPrint(123)", flags3, arraysize(flags3)); @@ -4262,7 +4258,6 @@ TEST(ClassDeclarationErrors) { static const ParserFlag always_flags[] = { kAllowHarmonyClasses, - kAllowHarmonyNumericLiterals, kAllowHarmonySloppy }; RunParserSyncTest(context_data, class_data, kError, NULL, 0, diff --git a/test/mjsunit/es6/numeric-literals.js b/test/mjsunit/es6/numeric-literals.js index 7300f3e..0baa26a 100644 --- a/test/mjsunit/es6/numeric-literals.js +++ b/test/mjsunit/es6/numeric-literals.js @@ -25,8 +25,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// Flags: --harmony-numeric-literals - function TestOctalLiteral() { assertEquals(0, 0o0); assertEquals(0, 0O0); @@ -69,8 +67,6 @@ function TestBinaryLiteralUsingNumberFunction() { TestBinaryLiteralUsingNumberFunction(); -// parseInt should (probably) not support 0b and 0o. -// https://bugs.ecmascript.org/show_bug.cgi?id=1585 function TestParseIntDoesNotSupportOctalNorBinary() { assertEquals(0, parseInt('0o77')); assertEquals(0, parseInt('0o77', 8)); -- 2.7.4