Commit 94dfb8a1 authored by Sathya Gunasekaran's avatar Sathya Gunasekaran Committed by Commit Bot

[class] Add harmony-public-fields flag

Change the existing uses of the harmony-class-fields flag to
harmony-public-fields so that we can stage this separately
from the upcoming harmony-private-fields to get some
clusterfuzz coverage.

Bug: v8:5367
Change-Id: I76cdefa4faf34eae73d3a5f6d6089cf75677732a
Reviewed-on: https://chromium-review.googlesource.com/792940
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49661}
parent 34657ab3
...@@ -4286,6 +4286,7 @@ EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_named_captures) ...@@ -4286,6 +4286,7 @@ EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_named_captures)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_property) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_property)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_sent) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_sent)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_tostring) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_tostring)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_public_fields)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_class_fields) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_class_fields)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_dynamic_import) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_dynamic_import)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_import_meta) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_import_meta)
......
...@@ -190,6 +190,7 @@ DEFINE_BOOL(harmony_shipping, true, "enable all shipped harmony features") ...@@ -190,6 +190,7 @@ DEFINE_BOOL(harmony_shipping, true, "enable all shipped harmony features")
DEFINE_IMPLICATION(es_staging, harmony) DEFINE_IMPLICATION(es_staging, harmony)
// Enabling import.meta requires to also enable import() // Enabling import.meta requires to also enable import()
DEFINE_IMPLICATION(harmony_import_meta, harmony_dynamic_import) DEFINE_IMPLICATION(harmony_import_meta, harmony_dynamic_import)
DEFINE_IMPLICATION(harmony_class_fields, harmony_public_fields)
// Features that are still work in progress (behind individual flags). // Features that are still work in progress (behind individual flags).
#define HARMONY_INPROGRESS(V) \ #define HARMONY_INPROGRESS(V) \
...@@ -197,7 +198,8 @@ DEFINE_IMPLICATION(harmony_import_meta, harmony_dynamic_import) ...@@ -197,7 +198,8 @@ DEFINE_IMPLICATION(harmony_import_meta, harmony_dynamic_import)
V(harmony_array_prototype_values, "harmony Array.prototype.values") \ V(harmony_array_prototype_values, "harmony Array.prototype.values") \
V(harmony_function_sent, "harmony function.sent") \ V(harmony_function_sent, "harmony function.sent") \
V(harmony_do_expressions, "harmony do-expressions") \ V(harmony_do_expressions, "harmony do-expressions") \
V(harmony_class_fields, "harmony public fields in class literals") \ V(harmony_class_fields, "harmony fields in class literals") \
V(harmony_public_fields, "harmony public fields in class literals") \
V(harmony_bigint, "harmony arbitrary precision integers") V(harmony_bigint, "harmony arbitrary precision integers")
// Features that are complete (but still behind --harmony/es-staging flag). // Features that are complete (but still behind --harmony/es-staging flag).
......
...@@ -278,7 +278,7 @@ class ParserBase { ...@@ -278,7 +278,7 @@ class ParserBase {
allow_natives_(false), allow_natives_(false),
allow_harmony_do_expressions_(false), allow_harmony_do_expressions_(false),
allow_harmony_function_sent_(false), allow_harmony_function_sent_(false),
allow_harmony_class_fields_(false), allow_harmony_public_fields_(false),
allow_harmony_dynamic_import_(false), allow_harmony_dynamic_import_(false),
allow_harmony_import_meta_(false), allow_harmony_import_meta_(false),
allow_harmony_async_iteration_(false), allow_harmony_async_iteration_(false),
...@@ -291,7 +291,7 @@ class ParserBase { ...@@ -291,7 +291,7 @@ class ParserBase {
ALLOW_ACCESSORS(natives); ALLOW_ACCESSORS(natives);
ALLOW_ACCESSORS(harmony_do_expressions); ALLOW_ACCESSORS(harmony_do_expressions);
ALLOW_ACCESSORS(harmony_function_sent); ALLOW_ACCESSORS(harmony_function_sent);
ALLOW_ACCESSORS(harmony_class_fields); ALLOW_ACCESSORS(harmony_public_fields);
ALLOW_ACCESSORS(harmony_dynamic_import); ALLOW_ACCESSORS(harmony_dynamic_import);
ALLOW_ACCESSORS(harmony_import_meta); ALLOW_ACCESSORS(harmony_import_meta);
ALLOW_ACCESSORS(harmony_async_iteration); ALLOW_ACCESSORS(harmony_async_iteration);
...@@ -1534,7 +1534,7 @@ class ParserBase { ...@@ -1534,7 +1534,7 @@ class ParserBase {
bool allow_natives_; bool allow_natives_;
bool allow_harmony_do_expressions_; bool allow_harmony_do_expressions_;
bool allow_harmony_function_sent_; bool allow_harmony_function_sent_;
bool allow_harmony_class_fields_; bool allow_harmony_public_fields_;
bool allow_harmony_dynamic_import_; bool allow_harmony_dynamic_import_;
bool allow_harmony_import_meta_; bool allow_harmony_import_meta_;
bool allow_harmony_async_iteration_; bool allow_harmony_async_iteration_;
...@@ -2314,7 +2314,7 @@ ParserBase<Impl>::ParseClassPropertyDefinition( ...@@ -2314,7 +2314,7 @@ ParserBase<Impl>::ParseClassPropertyDefinition(
// as an uninitialized field. // as an uninitialized field.
case PropertyKind::kShorthandProperty: case PropertyKind::kShorthandProperty:
case PropertyKind::kValueProperty: case PropertyKind::kValueProperty:
if (allow_harmony_class_fields()) { if (allow_harmony_public_fields()) {
*property_kind = ClassLiteralProperty::FIELD; *property_kind = ClassLiteralProperty::FIELD;
ExpressionT initializer = ParseClassFieldInitializer( ExpressionT initializer = ParseClassFieldInitializer(
class_info, *is_static, CHECK_OK_CUSTOM(NullLiteralProperty)); class_info, *is_static, CHECK_OK_CUSTOM(NullLiteralProperty));
......
...@@ -542,7 +542,7 @@ Parser::Parser(ParseInfo* info) ...@@ -542,7 +542,7 @@ Parser::Parser(ParseInfo* info)
set_allow_natives(FLAG_allow_natives_syntax || info->is_native()); set_allow_natives(FLAG_allow_natives_syntax || info->is_native());
set_allow_harmony_do_expressions(FLAG_harmony_do_expressions); set_allow_harmony_do_expressions(FLAG_harmony_do_expressions);
set_allow_harmony_function_sent(FLAG_harmony_function_sent); set_allow_harmony_function_sent(FLAG_harmony_function_sent);
set_allow_harmony_class_fields(FLAG_harmony_class_fields); set_allow_harmony_public_fields(FLAG_harmony_public_fields);
set_allow_harmony_dynamic_import(FLAG_harmony_dynamic_import); set_allow_harmony_dynamic_import(FLAG_harmony_dynamic_import);
set_allow_harmony_import_meta(FLAG_harmony_import_meta); set_allow_harmony_import_meta(FLAG_harmony_import_meta);
set_allow_harmony_async_iteration(FLAG_harmony_async_iteration); set_allow_harmony_async_iteration(FLAG_harmony_async_iteration);
...@@ -3241,7 +3241,7 @@ void Parser::DeclareClassProperty(const AstRawString* class_name, ...@@ -3241,7 +3241,7 @@ void Parser::DeclareClassProperty(const AstRawString* class_name,
return; return;
} }
DCHECK(allow_harmony_class_fields()); DCHECK(allow_harmony_public_fields());
if (is_static) { if (is_static) {
class_info->static_fields->Add(property, zone()); class_info->static_fields->Add(property, zone());
......
...@@ -291,7 +291,7 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) { ...@@ -291,7 +291,7 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
SET_ALLOW(natives); SET_ALLOW(natives);
SET_ALLOW(harmony_do_expressions); SET_ALLOW(harmony_do_expressions);
SET_ALLOW(harmony_function_sent); SET_ALLOW(harmony_function_sent);
SET_ALLOW(harmony_class_fields); SET_ALLOW(harmony_public_fields);
SET_ALLOW(harmony_dynamic_import); SET_ALLOW(harmony_dynamic_import);
SET_ALLOW(harmony_import_meta); SET_ALLOW(harmony_import_meta);
SET_ALLOW(harmony_async_iteration); SET_ALLOW(harmony_async_iteration);
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
--- ---
wrap: yes wrap: yes
class fields: yes public fields: yes
--- ---
snippet: " snippet: "
......
...@@ -44,7 +44,7 @@ class ProgramOptions final { ...@@ -44,7 +44,7 @@ class ProgramOptions final {
top_level_(false), top_level_(false),
do_expressions_(false), do_expressions_(false),
async_iteration_(false), async_iteration_(false),
class_fields_(false), public_fields_(false),
verbose_(false) {} verbose_(false) {}
bool Validate() const; bool Validate() const;
...@@ -64,7 +64,7 @@ class ProgramOptions final { ...@@ -64,7 +64,7 @@ class ProgramOptions final {
bool top_level() const { return top_level_; } bool top_level() const { return top_level_; }
bool do_expressions() const { return do_expressions_; } bool do_expressions() const { return do_expressions_; }
bool async_iteration() const { return async_iteration_; } bool async_iteration() const { return async_iteration_; }
bool class_fields() const { return class_fields_; } bool public_fields() const { return public_fields_; }
bool verbose() const { return verbose_; } bool verbose() const { return verbose_; }
bool suppress_runtime_errors() const { return rebaseline_ && !verbose_; } bool suppress_runtime_errors() const { return rebaseline_ && !verbose_; }
std::vector<std::string> input_filenames() const { return input_filenames_; } std::vector<std::string> input_filenames() const { return input_filenames_; }
...@@ -82,7 +82,7 @@ class ProgramOptions final { ...@@ -82,7 +82,7 @@ class ProgramOptions final {
bool top_level_; bool top_level_;
bool do_expressions_; bool do_expressions_;
bool async_iteration_; bool async_iteration_;
bool class_fields_; bool public_fields_;
bool verbose_; bool verbose_;
std::vector<std::string> input_filenames_; std::vector<std::string> input_filenames_;
std::string output_filename_; std::string output_filename_;
...@@ -172,8 +172,8 @@ ProgramOptions ProgramOptions::FromCommandLine(int argc, char** argv) { ...@@ -172,8 +172,8 @@ ProgramOptions ProgramOptions::FromCommandLine(int argc, char** argv) {
options.do_expressions_ = true; options.do_expressions_ = true;
} else if (strcmp(argv[i], "--async-iteration") == 0) { } else if (strcmp(argv[i], "--async-iteration") == 0) {
options.async_iteration_ = true; options.async_iteration_ = true;
} else if (strcmp(argv[i], "--class-fields") == 0) { } else if (strcmp(argv[i], "--public-fields") == 0) {
options.class_fields_ = true; options.public_fields_ = true;
} else if (strcmp(argv[i], "--verbose") == 0) { } else if (strcmp(argv[i], "--verbose") == 0) {
options.verbose_ = true; options.verbose_ = true;
} else if (strncmp(argv[i], "--output=", 9) == 0) { } else if (strncmp(argv[i], "--output=", 9) == 0) {
...@@ -278,8 +278,8 @@ void ProgramOptions::UpdateFromHeader(std::istream& stream) { ...@@ -278,8 +278,8 @@ void ProgramOptions::UpdateFromHeader(std::istream& stream) {
do_expressions_ = ParseBoolean(line.c_str() + 16); do_expressions_ = ParseBoolean(line.c_str() + 16);
} else if (line.compare(0, 17, "async iteration: ") == 0) { } else if (line.compare(0, 17, "async iteration: ") == 0) {
async_iteration_ = ParseBoolean(line.c_str() + 17); async_iteration_ = ParseBoolean(line.c_str() + 17);
} else if (line.compare(0, 14, "class fields: ") == 0) { } else if (line.compare(0, 14, "public fields: ") == 0) {
class_fields_ = ParseBoolean(line.c_str() + 14); public_fields_ = ParseBoolean(line.c_str() + 14);
} else if (line == "---") { } else if (line == "---") {
break; break;
} else if (line.empty()) { } else if (line.empty()) {
...@@ -303,7 +303,7 @@ void ProgramOptions::PrintHeader(std::ostream& stream) const { // NOLINT ...@@ -303,7 +303,7 @@ void ProgramOptions::PrintHeader(std::ostream& stream) const { // NOLINT
if (top_level_) stream << "\ntop level: yes"; if (top_level_) stream << "\ntop level: yes";
if (do_expressions_) stream << "\ndo expressions: yes"; if (do_expressions_) stream << "\ndo expressions: yes";
if (async_iteration_) stream << "\nasync iteration: yes"; if (async_iteration_) stream << "\nasync iteration: yes";
if (class_fields_) stream << "\nclass fields: yes"; if (public_fields_) stream << "\npublic fields: yes";
stream << "\n\n"; stream << "\n\n";
} }
...@@ -408,7 +408,7 @@ void GenerateExpectationsFile(std::ostream& stream, // NOLINT ...@@ -408,7 +408,7 @@ void GenerateExpectationsFile(std::ostream& stream, // NOLINT
if (options.do_expressions()) i::FLAG_harmony_do_expressions = true; if (options.do_expressions()) i::FLAG_harmony_do_expressions = true;
if (options.async_iteration()) i::FLAG_harmony_async_iteration = true; if (options.async_iteration()) i::FLAG_harmony_async_iteration = true;
if (options.class_fields()) i::FLAG_harmony_class_fields = true; if (options.public_fields()) i::FLAG_harmony_public_fields = true;
stream << "#\n# Autogenerated by generate-bytecode-expectations.\n#\n\n"; stream << "#\n# Autogenerated by generate-bytecode-expectations.\n#\n\n";
options.PrintHeader(stream); options.PrintHeader(stream);
...@@ -418,7 +418,7 @@ void GenerateExpectationsFile(std::ostream& stream, // NOLINT ...@@ -418,7 +418,7 @@ void GenerateExpectationsFile(std::ostream& stream, // NOLINT
i::FLAG_harmony_do_expressions = false; i::FLAG_harmony_do_expressions = false;
i::FLAG_harmony_async_iteration = false; i::FLAG_harmony_async_iteration = false;
i::FLAG_harmony_class_fields = false; i::FLAG_harmony_public_fields = false;
} }
bool WriteExpectationsFile(const std::vector<std::string>& snippet_list, bool WriteExpectationsFile(const std::vector<std::string>& snippet_list,
...@@ -466,7 +466,7 @@ void PrintUsage(const char* exec_path) { ...@@ -466,7 +466,7 @@ void PrintUsage(const char* exec_path) {
" --top-level Process top level code, not the top-level function.\n" " --top-level Process top level code, not the top-level function.\n"
" --do-expressions Enable harmony_do_expressions flag.\n" " --do-expressions Enable harmony_do_expressions flag.\n"
" --async-iteration Enable harmony_async_iteration flag.\n" " --async-iteration Enable harmony_async_iteration flag.\n"
" --class-fields Enable harmony_class_fields flag.\n" " --public-fields Enable harmony_public_fields flag.\n"
" --output=file.name\n" " --output=file.name\n"
" Specify the output file. If not specified, output goes to " " Specify the output file. If not specified, output goes to "
"stdout.\n" "stdout.\n"
......
...@@ -2234,8 +2234,8 @@ TEST(ClassAndSuperClass) { ...@@ -2234,8 +2234,8 @@ TEST(ClassAndSuperClass) {
} }
TEST(ClassFields) { TEST(ClassFields) {
bool old_flag = i::FLAG_harmony_class_fields; bool old_flag = i::FLAG_harmony_public_fields;
i::FLAG_harmony_class_fields = true; i::FLAG_harmony_public_fields = true;
InitializedIgnitionHandleScope scope; InitializedIgnitionHandleScope scope;
BytecodeExpectationsPrinter printer(CcTest::isolate()); BytecodeExpectationsPrinter printer(CcTest::isolate());
...@@ -2269,7 +2269,7 @@ TEST(ClassFields) { ...@@ -2269,7 +2269,7 @@ TEST(ClassFields) {
CHECK(CompareTexts(BuildActual(printer, snippets), CHECK(CompareTexts(BuildActual(printer, snippets),
LoadGolden("ClassFields.golden"))); LoadGolden("ClassFields.golden")));
i::FLAG_harmony_class_fields = old_flag; i::FLAG_harmony_public_fields = old_flag;
} }
TEST(Generators) { TEST(Generators) {
......
...@@ -1314,7 +1314,7 @@ enum ParserFlag { ...@@ -1314,7 +1314,7 @@ enum ParserFlag {
kAllowLazy, kAllowLazy,
kAllowNatives, kAllowNatives,
kAllowHarmonyFunctionSent, kAllowHarmonyFunctionSent,
kAllowHarmonyClassFields, kAllowHarmonyPublicFields,
kAllowHarmonyDynamicImport, kAllowHarmonyDynamicImport,
kAllowHarmonyAsyncIteration, kAllowHarmonyAsyncIteration,
kAllowHarmonyTemplateEscapes, kAllowHarmonyTemplateEscapes,
...@@ -1330,7 +1330,7 @@ enum ParserSyncTestResult { ...@@ -1330,7 +1330,7 @@ enum ParserSyncTestResult {
void SetGlobalFlags(i::EnumSet<ParserFlag> flags) { void SetGlobalFlags(i::EnumSet<ParserFlag> flags) {
i::FLAG_allow_natives_syntax = flags.Contains(kAllowNatives); i::FLAG_allow_natives_syntax = flags.Contains(kAllowNatives);
i::FLAG_harmony_function_sent = flags.Contains(kAllowHarmonyFunctionSent); i::FLAG_harmony_function_sent = flags.Contains(kAllowHarmonyFunctionSent);
i::FLAG_harmony_class_fields = flags.Contains(kAllowHarmonyClassFields); i::FLAG_harmony_public_fields = flags.Contains(kAllowHarmonyPublicFields);
i::FLAG_harmony_dynamic_import = flags.Contains(kAllowHarmonyDynamicImport); i::FLAG_harmony_dynamic_import = flags.Contains(kAllowHarmonyDynamicImport);
i::FLAG_harmony_import_meta = flags.Contains(kAllowHarmonyImportMeta); i::FLAG_harmony_import_meta = flags.Contains(kAllowHarmonyImportMeta);
i::FLAG_harmony_async_iteration = flags.Contains(kAllowHarmonyAsyncIteration); i::FLAG_harmony_async_iteration = flags.Contains(kAllowHarmonyAsyncIteration);
...@@ -1342,8 +1342,8 @@ void SetParserFlags(i::PreParser* parser, i::EnumSet<ParserFlag> flags) { ...@@ -1342,8 +1342,8 @@ void SetParserFlags(i::PreParser* parser, i::EnumSet<ParserFlag> flags) {
parser->set_allow_natives(flags.Contains(kAllowNatives)); parser->set_allow_natives(flags.Contains(kAllowNatives));
parser->set_allow_harmony_function_sent( parser->set_allow_harmony_function_sent(
flags.Contains(kAllowHarmonyFunctionSent)); flags.Contains(kAllowHarmonyFunctionSent));
parser->set_allow_harmony_class_fields( parser->set_allow_harmony_public_fields(
flags.Contains(kAllowHarmonyClassFields)); flags.Contains(kAllowHarmonyPublicFields));
parser->set_allow_harmony_dynamic_import( parser->set_allow_harmony_dynamic_import(
flags.Contains(kAllowHarmonyDynamicImport)); flags.Contains(kAllowHarmonyDynamicImport));
parser->set_allow_harmony_import_meta( parser->set_allow_harmony_import_meta(
...@@ -4809,7 +4809,7 @@ TEST(ClassFieldsNoErrors) { ...@@ -4809,7 +4809,7 @@ TEST(ClassFieldsNoErrors) {
}; };
// clang-format on // clang-format on
static const ParserFlag always_flags[] = {kAllowHarmonyClassFields}; static const ParserFlag always_flags[] = {kAllowHarmonyPublicFields};
RunParserSyncTest(context_data, class_body_data, kSuccess, nullptr, 0, RunParserSyncTest(context_data, class_body_data, kSuccess, nullptr, 0,
always_flags, arraysize(always_flags)); always_flags, arraysize(always_flags));
} }
...@@ -4850,7 +4850,7 @@ TEST(ClassFieldsErrors) { ...@@ -4850,7 +4850,7 @@ TEST(ClassFieldsErrors) {
}; };
// clang-format on // clang-format on
static const ParserFlag always_flags[] = {kAllowHarmonyClassFields}; static const ParserFlag always_flags[] = {kAllowHarmonyPublicFields};
RunParserSyncTest(context_data, class_body_data, kError, nullptr, 0, RunParserSyncTest(context_data, class_body_data, kError, nullptr, 0,
always_flags, arraysize(always_flags)); always_flags, arraysize(always_flags));
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --harmony-class-fields // Flags: --harmony-public-fields
"use strict"; "use strict";
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --harmony-class-fields // Flags: --harmony-public-fields
"use strict"; "use strict";
......
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