[esnext] Remove always-disabled support for function.sent

This proposal has not moved beyoned stage 2 in two years, and has never
moved past the HARMONY_INPROGRESS state in flag-definitions.h.

It was originally added to aide in desugaring yield*, but is no longer
used for that purpose.

Bug: v8:4700, v8:7310
Change-Id: Ieca40d8e4bf565516bbe71e47b996daa70d2e835
Reviewed-on: https://chromium-review.googlesource.com/935297
Commit-Queue: Adam Klein <adamk@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51582}
This commit is contained in:
Adam Klein 2018-02-26 11:18:37 -08:00 committed by Commit Bot
parent 3669c00e7e
commit 8fa85efd27
15 changed files with 1 additions and 172 deletions

View File

@ -4204,7 +4204,6 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate,
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_do_expressions)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_named_captures)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_property)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_sent)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_tostring)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_public_fields)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_private_fields)

View File

@ -210,7 +210,6 @@ DEFINE_IMPLICATION(harmony_class_fields, harmony_private_fields)
// Features that are still work in progress (behind individual flags).
#define HARMONY_INPROGRESS(V) \
V(harmony_array_prototype_values, "harmony Array.prototype.values") \
V(harmony_function_sent, "harmony function.sent") \
V(harmony_do_expressions, "harmony do-expressions") \
V(harmony_class_fields, "harmony fields in class literals") \
V(harmony_static_fields, "harmony static fields in class literals") \

View File

@ -689,8 +689,6 @@ class ErrorUtils : public AllStatic {
T(TypedArrayTooShort, \
"Derived TypedArray constructor created an array which was too small") \
T(UnexpectedEOS, "Unexpected end of input") \
T(UnexpectedFunctionSent, \
"function.sent expression is not allowed outside a generator") \
T(UnexpectedReserved, "Unexpected reserved word") \
T(UnexpectedStrictReserved, "Unexpected strict mode reserved word") \
T(UnexpectedSuper, "'super' keyword unexpected here") \

View File

@ -278,7 +278,6 @@ class ParserBase {
script_id_(script_id),
allow_natives_(false),
allow_harmony_do_expressions_(false),
allow_harmony_function_sent_(false),
allow_harmony_public_fields_(false),
allow_harmony_static_fields_(false),
allow_harmony_dynamic_import_(false),
@ -293,7 +292,6 @@ class ParserBase {
ALLOW_ACCESSORS(natives);
ALLOW_ACCESSORS(harmony_do_expressions);
ALLOW_ACCESSORS(harmony_function_sent);
ALLOW_ACCESSORS(harmony_public_fields);
ALLOW_ACCESSORS(harmony_static_fields);
ALLOW_ACCESSORS(harmony_dynamic_import);
@ -1553,7 +1551,6 @@ class ParserBase {
bool allow_natives_;
bool allow_harmony_do_expressions_;
bool allow_harmony_function_sent_;
bool allow_harmony_public_fields_;
bool allow_harmony_static_fields_;
bool allow_harmony_dynamic_import_;
@ -3561,22 +3558,6 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseMemberExpression(
Consume(Token::FUNCTION);
int function_token_position = position();
if (allow_harmony_function_sent() && peek() == Token::PERIOD) {
// function.sent
int pos = position();
ExpectMetaProperty(Token::SENT, "function.sent", pos, CHECK_OK);
if (!is_generator()) {
// TODO(neis): allow escaping into closures?
impl()->ReportMessageAt(scanner()->location(),
MessageTemplate::kUnexpectedFunctionSent);
*ok = false;
return impl()->NullExpression();
}
return impl()->FunctionSentExpression(pos);
}
FunctionKind function_kind = Check(Token::MUL)
? FunctionKind::kGeneratorFunction
: FunctionKind::kNormalFunction;

View File

@ -318,16 +318,6 @@ Expression* Parser::NewTargetExpression(int pos) {
return proxy;
}
Expression* Parser::FunctionSentExpression(int pos) {
// We desugar function.sent into %_GeneratorGetInputOrDebugPos(generator).
ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(1, zone());
VariableProxy* generator = factory()->NewVariableProxy(
function_state_->scope()->generator_object_var());
args->Add(generator, zone());
return factory()->NewCallRuntime(Runtime::kInlineGeneratorGetInputOrDebugPos,
args, pos);
}
Expression* Parser::ImportMetaExpression(int pos) {
return factory()->NewCallRuntime(
Runtime::kInlineGetImportMetaObject,
@ -453,7 +443,6 @@ Parser::Parser(ParseInfo* info)
info->extension() == nullptr && can_compile_lazily;
set_allow_natives(FLAG_allow_natives_syntax || info->is_native());
set_allow_harmony_do_expressions(FLAG_harmony_do_expressions);
set_allow_harmony_function_sent(FLAG_harmony_function_sent);
set_allow_harmony_public_fields(FLAG_harmony_public_fields);
set_allow_harmony_static_fields(FLAG_harmony_static_fields);
set_allow_harmony_dynamic_import(FLAG_harmony_dynamic_import);

View File

@ -242,7 +242,6 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
#define SET_ALLOW(name) reusable_preparser_->set_allow_##name(allow_##name());
SET_ALLOW(natives);
SET_ALLOW(harmony_do_expressions);
SET_ALLOW(harmony_function_sent);
SET_ALLOW(harmony_public_fields);
SET_ALLOW(harmony_static_fields);
SET_ALLOW(harmony_dynamic_import);
@ -829,7 +828,6 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
Expression* NewSuperPropertyReference(int pos);
Expression* NewSuperCallReference(int pos);
Expression* NewTargetExpression(int pos);
Expression* FunctionSentExpression(int pos);
Expression* ImportMetaExpression(int pos);
Literal* ExpressionFromLiteral(Token::Value token, int pos);

View File

@ -1590,10 +1590,6 @@ class PreParser : public ParserBase<PreParser> {
return PreParserExpression::NewTargetExpression();
}
V8_INLINE PreParserExpression FunctionSentExpression(int pos) {
return PreParserExpression::Default();
}
V8_INLINE PreParserExpression ImportMetaExpression(int pos) {
return PreParserExpression::Default();
}

View File

@ -1508,7 +1508,6 @@ uc32 Scanner::ScanUnicodeEscape() {
KEYWORD_GROUP('r') \
KEYWORD("return", Token::RETURN) \
KEYWORD_GROUP('s') \
KEYWORD("sent", Token::SENT) \
KEYWORD("set", Token::SET) \
KEYWORD("static", Token::STATIC) \
KEYWORD("super", Token::SUPER) \

View File

@ -188,7 +188,6 @@ namespace internal {
C(SET, "set", 0) \
C(OF, "of", 0) \
C(TARGET, "target", 0) \
C(SENT, "sent", 0) \
C(META, "meta", 0) \
C(AS, "as", 0) \
C(FROM, "from", 0) \

View File

@ -1115,7 +1115,6 @@ const char* ReadString(unsigned* start) {
enum ParserFlag {
kAllowLazy,
kAllowNatives,
kAllowHarmonyFunctionSent,
kAllowHarmonyPublicFields,
kAllowHarmonyPrivateFields,
kAllowHarmonyStaticFields,
@ -1133,7 +1132,6 @@ enum ParserSyncTestResult {
void SetGlobalFlags(i::EnumSet<ParserFlag> flags) {
i::FLAG_allow_natives_syntax = flags.Contains(kAllowNatives);
i::FLAG_harmony_function_sent = flags.Contains(kAllowHarmonyFunctionSent);
i::FLAG_harmony_public_fields = flags.Contains(kAllowHarmonyPublicFields);
i::FLAG_harmony_private_fields = flags.Contains(kAllowHarmonyPrivateFields);
i::FLAG_harmony_static_fields = flags.Contains(kAllowHarmonyStaticFields);
@ -1146,8 +1144,6 @@ void SetGlobalFlags(i::EnumSet<ParserFlag> flags) {
void SetParserFlags(i::PreParser* parser, i::EnumSet<ParserFlag> flags) {
parser->set_allow_natives(flags.Contains(kAllowNatives));
parser->set_allow_harmony_function_sent(
flags.Contains(kAllowHarmonyFunctionSent));
parser->set_allow_harmony_public_fields(
flags.Contains(kAllowHarmonyPublicFields));
parser->set_allow_harmony_private_fields(
@ -8443,26 +8439,6 @@ TEST(EscapeSequenceErrors) {
RunParserSyncTest(context_data, error_data, kError);
}
TEST(FunctionSentErrors) {
// clang-format off
const char* context_data[][2] = {
{ "'use strict'", "" },
{ "", "" },
{ nullptr, nullptr }
};
const char* error_data[] = {
"var x = function.sent",
"function* g() { yield function.s\\u0065nt; }",
nullptr
};
// clang-format on
static const ParserFlag always_flags[] = {kAllowHarmonyFunctionSent};
RunParserSyncTest(context_data, error_data, kError, always_flags,
arraysize(always_flags));
}
TEST(NewTargetErrors) {
// clang-format off
const char* context_data[][2] = {

View File

@ -67,7 +67,7 @@ function Loop() {
// ----------------------------------------------------------------------------
function* multiples(x) {
let skip = function.sent || 0;
let skip = 2;
let next = 0;
while (true) {
if (skip === 0) {

View File

@ -56,7 +56,6 @@
"path": ["Generators"],
"main": "run.js",
"resources": ["generators.js"],
"flags": ["--harmony-function-sent"],
"results_regexp": "^Generators\\-Generators\\(Score\\): (.+)$"
},
{

View File

@ -1,10 +0,0 @@
// 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: --harmony-function-sent
function* f() {
return function.s\u0065nt;
}
for (var i of f()) print(i);

View File

@ -1,4 +0,0 @@
*%(basename)s:8: SyntaxError: 'function.sent' must not contain escaped characters
return function.s\u0065nt;
^^^^^^^^^^^^^^^^^^
SyntaxError: 'function.sent' must not contain escaped characters

View File

@ -1,90 +0,0 @@
// 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: --harmony-function-sent
{
function* g() { return function.sent }
assertEquals({value: 42, done: true}, g().next(42));
}
{
function* g() {
try {
yield function.sent;
} finally {
yield function.sent;
return function.sent;
}
}
{
let x = g();
assertEquals({value: 1, done: false}, x.next(1));
assertEquals({value: 2, done: false}, x.next(2));
assertEquals({value: 3, done: true}, x.next(3));
}
{
let x = g();
assertEquals({value: 1, done: false}, x.next(1));
assertEquals({value: 2, done: false}, x.throw(2));
assertEquals({value: 3, done: true}, x.next(3));
}
{
let x = g();
assertEquals({value: 1, done: false}, x.next(1));
assertEquals({value: 2, done: false}, x.return(2));
assertEquals({value: 3, done: true}, x.next(3));
}
}
{
function* inner() {
try {
yield function.sent;
} finally {
return 23;
}
}
function* g() {
yield function.sent;
yield* inner();
return function.sent;
}
{
let x = g();
assertEquals({value: 1, done: false}, x.next(1));
assertEquals({value: undefined, done: false}, x.next(2));
assertEquals({value: 3, done: true}, x.next(3));
}
{
let x = g();
assertEquals({value: 1, done: false}, x.next(1));
assertEquals({value: undefined, done: false}, x.next(2));
assertEquals({value: 42, done: true}, x.throw(42));
}
{
let x = g();
assertEquals({value: 1, done: false}, x.next(1));
assertEquals({value: undefined, done: false}, x.next(2));
assertEquals({value: 23, done: true}, x.return(42));
}
}
assertThrows("function f() { return function.sent }", SyntaxError);
assertThrows("() => { return function.sent }", SyntaxError);
assertThrows("() => { function.sent }", SyntaxError);
assertThrows("() => function.sent", SyntaxError);
assertThrows("({*f() { function.sent }})", SyntaxError);
assertDoesNotThrow("({*f() { return function.sent }})");