Commit b20dc769 authored by Adam Klein's avatar Adam Klein Committed by Commit Bot

Remove always-on --harmony-template-escapes flag

It was shipped in Chrome 62.

Bug: v8:5546, v8:4829
Cq-Include-Trybots: master.tryserver.v8:v8_linux_noi18n_rel_ng
Change-Id: I3ac318639f1f7483d4d4f4fe5606387a856be98a
Reviewed-on: https://chromium-review.googlesource.com/777940Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Commit-Queue: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49687}
parent e1913d54
......@@ -4290,7 +4290,6 @@ EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_public_fields)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_class_fields)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_dynamic_import)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_import_meta)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_template_escapes)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_restrict_constructor_return)
void InstallPublicSymbol(Factory* factory, Handle<Context> native_context,
......
......@@ -216,8 +216,6 @@ DEFINE_IMPLICATION(harmony_class_fields, harmony_public_fields)
V(harmony_regexp_named_captures, "harmony regexp named captures") \
V(harmony_regexp_property, "harmony Unicode regexp property classes") \
V(harmony_async_iteration, "harmony async iteration") \
V(harmony_template_escapes, \
"harmony invalid escapes in tagged template literals") \
V(harmony_promise_finally, "harmony Promise.prototype.finally")
#ifdef V8_INTL_SUPPORT
......
......@@ -281,8 +281,7 @@ class ParserBase {
allow_harmony_public_fields_(false),
allow_harmony_dynamic_import_(false),
allow_harmony_import_meta_(false),
allow_harmony_async_iteration_(false),
allow_harmony_template_escapes_(false) {}
allow_harmony_async_iteration_(false) {}
#define ALLOW_ACCESSORS(name) \
bool allow_##name() const { return allow_##name##_; } \
......@@ -295,7 +294,6 @@ class ParserBase {
ALLOW_ACCESSORS(harmony_dynamic_import);
ALLOW_ACCESSORS(harmony_import_meta);
ALLOW_ACCESSORS(harmony_async_iteration);
ALLOW_ACCESSORS(harmony_template_escapes);
#undef ALLOW_ACCESSORS
......@@ -1539,7 +1537,6 @@ class ParserBase {
bool allow_harmony_dynamic_import_;
bool allow_harmony_import_meta_;
bool allow_harmony_async_iteration_;
bool allow_harmony_template_escapes_;
friend class DiscardableZoneScope;
};
......@@ -4617,7 +4614,7 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseTemplateLiteral(
// TEMPLATE_SPAN, or a TEMPLATE_TAIL.
DCHECK(peek() == Token::TEMPLATE_SPAN || peek() == Token::TEMPLATE_TAIL);
bool forbid_illegal_escapes = !allow_harmony_template_escapes() || !tagged;
bool forbid_illegal_escapes = !tagged;
// If we reach a TEMPLATE_TAIL first, we are parsing a NoSubstitutionTemplate.
// In this case we may simply consume the token and build a template with a
......
......@@ -546,7 +546,6 @@ Parser::Parser(ParseInfo* info)
set_allow_harmony_dynamic_import(FLAG_harmony_dynamic_import);
set_allow_harmony_import_meta(FLAG_harmony_import_meta);
set_allow_harmony_async_iteration(FLAG_harmony_async_iteration);
set_allow_harmony_template_escapes(FLAG_harmony_template_escapes);
set_allow_harmony_bigint(FLAG_harmony_bigint);
for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount;
++feature) {
......@@ -3506,7 +3505,6 @@ Parser::TemplateLiteralState Parser::OpenTemplateLiteral(int pos) {
void Parser::AddTemplateSpan(TemplateLiteralState* state, bool should_cook,
bool tail) {
DCHECK(should_cook || allow_harmony_template_escapes());
int end = scanner()->location().end_pos - (tail ? 1 : 2);
const AstRawString* raw = scanner()->CurrentRawSymbol(ast_value_factory());
if (should_cook) {
......
......@@ -295,7 +295,6 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
SET_ALLOW(harmony_dynamic_import);
SET_ALLOW(harmony_import_meta);
SET_ALLOW(harmony_async_iteration);
SET_ALLOW(harmony_template_escapes);
SET_ALLOW(harmony_bigint);
#undef SET_ALLOW
}
......@@ -528,9 +527,8 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
// "should_cook" means that the span can be "cooked": in tagged template
// literals, both the raw and "cooked" representations are available to user
// code ("cooked" meaning that escape sequences are converted to their
// interpreted values). With the --harmony-template-escapes flag, invalid
// escape sequences cause the cooked span to be represented by undefined,
// instead of being a syntax error.
// interpreted values). Invalid escape sequences cause the cooked span
// to be represented by undefined, instead of being a syntax error.
// "tail" indicates that this span is the last in the literal.
void AddTemplateSpan(TemplateLiteralState* state, bool should_cook,
bool tail);
......
......@@ -1317,7 +1317,6 @@ enum ParserFlag {
kAllowHarmonyPublicFields,
kAllowHarmonyDynamicImport,
kAllowHarmonyAsyncIteration,
kAllowHarmonyTemplateEscapes,
kAllowHarmonyImportMeta,
};
......@@ -1334,8 +1333,6 @@ void SetGlobalFlags(i::EnumSet<ParserFlag> flags) {
i::FLAG_harmony_dynamic_import = flags.Contains(kAllowHarmonyDynamicImport);
i::FLAG_harmony_import_meta = flags.Contains(kAllowHarmonyImportMeta);
i::FLAG_harmony_async_iteration = flags.Contains(kAllowHarmonyAsyncIteration);
i::FLAG_harmony_template_escapes =
flags.Contains(kAllowHarmonyTemplateEscapes);
}
void SetParserFlags(i::PreParser* parser, i::EnumSet<ParserFlag> flags) {
......@@ -1350,8 +1347,6 @@ void SetParserFlags(i::PreParser* parser, i::EnumSet<ParserFlag> flags) {
flags.Contains(kAllowHarmonyImportMeta));
parser->set_allow_harmony_async_iteration(
flags.Contains(kAllowHarmonyAsyncIteration));
parser->set_allow_harmony_template_escapes(
flags.Contains(kAllowHarmonyTemplateEscapes));
}
void TestParserSyncWithFlags(i::Handle<i::String> source,
......@@ -6650,13 +6645,7 @@ TEST(TemplateEscapesPositiveTests) {
nullptr};
// clang-format on
// No error with flag
static const ParserFlag flags[] = {kAllowHarmonyTemplateEscapes};
RunParserSyncTest(context_data, data, kSuccess, nullptr, 0, flags,
arraysize(flags));
// Still an error without flag
RunParserSyncTest(context_data, data, kError);
RunParserSyncTest(context_data, data, kSuccess);
}
TEST(TemplateEscapesNegativeTests) {
......@@ -6731,12 +6720,6 @@ TEST(TemplateEscapesNegativeTests) {
nullptr};
// clang-format on
// Error with flag
static const ParserFlag flags[] = {kAllowHarmonyTemplateEscapes};
RunParserSyncTest(context_data, data, kError, nullptr, 0, flags,
arraysize(flags));
// Still an error without flag
RunParserSyncTest(context_data, data, kError);
}
......@@ -8128,7 +8111,6 @@ TEST(EscapeSequenceErrors) {
{ "`${'", "'}`" },
{ "`${\"", "\"}`" },
{ "`${`", "`}`" },
{ "f(tag`", "`);" },
{ nullptr, nullptr }
};
const char* error_data[] = {
......
// Copyright 2016 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.
// Flags: --no-harmony-template-escapes
function tag() {}
tag(tag`\xyy`);
# Copyright 2016 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.
*%(basename)s:9: SyntaxError: Invalid hexadecimal escape sequence
tag(tag`\xyy`);
^^^^
SyntaxError: Invalid hexadecimal escape sequence
// Copyright 2016 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.
// Flags: --no-harmony-template-escapes
function tag() {}
`${tag`\xyy`}`;
# Copyright 2016 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.
*%(basename)s:9: SyntaxError: Invalid hexadecimal escape sequence
`${tag`\xyy`}`;
^^^^
SyntaxError: Invalid hexadecimal escape sequence
......@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --no-harmony-template-escapes
var num = 5;
var str = "str";
function fn() { return "result"; }
......@@ -481,8 +479,9 @@ var obj = {
for (var i = 0; i < 10; i++) {
var code = "`\\0" + i + "`";
assertThrows(code, SyntaxError);
// Not an error if tagged.
code = "(function(){})" + code;
assertThrows(code, SyntaxError);
assertDoesNotThrow(code, SyntaxError);
}
assertEquals('\\0', String.raw`\0`);
......@@ -495,8 +494,9 @@ var obj = {
for (var i = 1; i < 8; i++) {
var code = "`\\" + i + "`";
assertThrows(code, SyntaxError);
// Not an error if tagged.
code = "(function(){})" + code;
assertThrows(code, SyntaxError);
assertDoesNotThrow(code, SyntaxError);
}
})();
......
......@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-template-escapes
function check({cooked, raw, exprs}) {
return function(strs, ...args) {
assertArrayEquals(cooked, strs);
......
......@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-template-escapes
// This test is added because harmony-template-escapes were not properly
// handled in the preparser.
......
......@@ -322,9 +322,6 @@
'annexB/language/eval-code/direct/func-switch-case-eval-func-no-skip-try': [FAIL],
'annexB/language/eval-code/direct/func-switch-dflt-eval-func-no-skip-try': [FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=5546
'language/expressions/tagged-template/invalid-escape-sequences': ['--harmony-template-escapes'],
# https://bugs.chromium.org/p/v8/issues/detail?id=5537
'built-ins/global/*': [SKIP],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment