Reviewers: rossberg,
Message:
PTAL
Description:
Remove --harmony-numeric-literal flag
We have been shipping harmony numeric literals since M41
[email protected]
LOG=Y
Please review this at https://codereview.chromium.org/1024603002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+5, -42 lines):
M src/bootstrapper.cc
M src/flag-definitions.h
M src/parser.cc
M src/preparser.h
M src/runtime/runtime-numbers.cc
M src/scanner.h
M src/scanner.cc
M test/cctest/test-parsing.cc
M test/mjsunit/es6/numeric-literals.js
Index: src/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index
d9a5af3a016d7b0053e3898005d68d60baaa0c65..b49cccc5e3c524bd2d880796512cda0511813892
100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -1659,7 +1659,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_templates)
EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_sloppy)
@@ -1690,7 +1689,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_templates)
@@ -2273,7 +2271,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_templates_natives[] = {
Index: src/flag-definitions.h
diff --git a/src/flag-definitions.h b/src/flag-definitions.h
index
c5c41c7248bea555d05a5269b7e81480f9ac8e69..fee9bc5ba7621f1610990a5da5844c15e9339a11
100644
--- a/src/flag-definitions.h
+++ b/src/flag-definitions.h
@@ -201,7 +201,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_strings, "harmony string methods")
\
V(harmony_templates, "harmony template literals")
\
V(harmony_classes, "harmony classes (implies object literal extension)")
\
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index
4bcdfdbda7e2233fd25a710caea8f23d9d6d0510..38ef815ea2f3d26245aebb65580ae0244b9f615f
100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -872,7 +872,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_templates(FLAG_harmony_templates);
@@ -4143,8 +4142,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());
Index: src/preparser.h
diff --git a/src/preparser.h b/src/preparser.h
index
17247e88307f93feaf58bf7f9eedd694264b0ede..e85ed8f67b1067de6e4a858e7b273bff9bee9ec8
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_;
@@ -129,9 +126,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);
}
Index: src/runtime/runtime-numbers.cc
diff --git a/src/runtime/runtime-numbers.cc b/src/runtime/runtime-numbers.cc
index
36ca87bc079490247dd376be4bf712800e3187d3..79487237ee65bdd3f820e7f5d9575f320316bd17
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));
}
Index: src/scanner.cc
diff --git a/src/scanner.cc b/src/scanner.cc
index
69bdd06ed28da7b0e81322b3961fcd9534b03ced..64984b5383dd216541ce232ccddb63b83c862a65
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_templates_(false),
harmony_unicode_(false) {}
@@ -957,7 +956,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_)) {
@@ -967,7 +966,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_)) {
Index: src/scanner.h
diff --git a/src/scanner.h b/src/scanner.h
index
bac53f02a8bfc4bf103dc60b5fc2d7eba6305a22..8869d072a56d2a2203c1d0d8c605b77425274368
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_;
}
@@ -741,8 +735,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 scan TEMPLATE_SPAN and TEMPLATE_TAIL
Index: test/cctest/test-parsing.cc
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
index
dd328359a1c28b94724904f7aa061ce6392ffb35..91a02d9cc40eed2b10a35c4cbd2cd97bc58c02e4
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,
@@ -1398,8 +1397,6 @@ void SetParserFlags(i::ParserBase<Traits>* 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(
@@ -1670,9 +1667,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));
@@ -4245,7 +4241,6 @@ TEST(ClassDeclarationErrors) {
static const ParserFlag always_flags[] = {
kAllowHarmonyClasses,
- kAllowHarmonyNumericLiterals,
kAllowHarmonySloppy
};
RunParserSyncTest(context_data, class_data, kError, NULL, 0,
Index: test/mjsunit/es6/numeric-literals.js
diff --git a/test/mjsunit/es6/numeric-literals.js
b/test/mjsunit/es6/numeric-literals.js
index
7300f3e47edd9918d175f93f9dc041ca35ec4de1..0baa26aafcf209c0d5d741a43bc65f32e6f34353
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));
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.