Title: [269939] trunk
Revision
269939
Author
[email protected]
Date
2020-11-17 19:19:04 -0800 (Tue, 17 Nov 2020)

Log Message

[JSC] Enable static public class fields
https://bugs.webkit.org/show_bug.cgi?id=219058

Reviewed by Saam Barati.

JSTests:

* stress/big-int-as-property-name.js:
* stress/class-fields-bytecode-cache.js:
* stress/class-fields-computed-to-property-key.js:
* stress/class-fields-function-name.js:
* stress/class-fields-harmony.js:
* stress/class-fields-private-use-eval.js:
* stress/class-fields-proxy-define-property.js:
* stress/class-fields-stress-instance.js:
* stress/class-fields-to-property-key-const-string-ftl.js:
* stress/class-fields-to-property-key-const-symbol-ftl.js:
* stress/class-fields-to-property-key-slow-object-tostring-ftl.js:
* stress/class-fields-to-property-key-slow-object-valueof-ftl.js:
* stress/class-fields-to-property-key-string-object-ftl.js:
* stress/class-fields-to-property-key-string-or-string-object-ftl.js:
* stress/class-fields-with-special-names.js:
* stress/generator-syntax.js:
* stress/method-name.js:
* stress/private-name-access-in-computed-property.js:
* test262/config.yaml:

Source/_javascript_Core:

Let's flip the runtime flag (usePublicStaticClassFields). And we drop usePublicClassFields flag since it is already shipped.

* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::BytecodeGenerator):
* bytecompiler/NodesCodegen.cpp:
(JSC::FunctionCallValueNode::emitBytecode):
* parser/Parser.cpp:
(JSC::Parser<LexerType>::parseClass):
* runtime/OptionsList.h:

Modified Paths

Diff

Modified: trunk/JSTests/ChangeLog (269938 => 269939)


--- trunk/JSTests/ChangeLog	2020-11-18 01:31:05 UTC (rev 269938)
+++ trunk/JSTests/ChangeLog	2020-11-18 03:19:04 UTC (rev 269939)
@@ -1,3 +1,30 @@
+2020-11-17  Yusuke Suzuki  <[email protected]>
+
+        [JSC] Enable static public class fields
+        https://bugs.webkit.org/show_bug.cgi?id=219058
+
+        Reviewed by Saam Barati.
+
+        * stress/big-int-as-property-name.js:
+        * stress/class-fields-bytecode-cache.js:
+        * stress/class-fields-computed-to-property-key.js:
+        * stress/class-fields-function-name.js:
+        * stress/class-fields-harmony.js:
+        * stress/class-fields-private-use-eval.js:
+        * stress/class-fields-proxy-define-property.js:
+        * stress/class-fields-stress-instance.js:
+        * stress/class-fields-to-property-key-const-string-ftl.js:
+        * stress/class-fields-to-property-key-const-symbol-ftl.js:
+        * stress/class-fields-to-property-key-slow-object-tostring-ftl.js:
+        * stress/class-fields-to-property-key-slow-object-valueof-ftl.js:
+        * stress/class-fields-to-property-key-string-object-ftl.js:
+        * stress/class-fields-to-property-key-string-or-string-object-ftl.js:
+        * stress/class-fields-with-special-names.js:
+        * stress/generator-syntax.js:
+        * stress/method-name.js:
+        * stress/private-name-access-in-computed-property.js:
+        * test262/config.yaml:
+
 2020-11-17  Sergey Rubanov  <[email protected]>
 
         Add support for the Wasm i32 sign-extension-ops proposal

Modified: trunk/JSTests/stress/big-int-as-property-name.js (269938 => 269939)


--- trunk/JSTests/stress/big-int-as-property-name.js	2020-11-18 01:31:05 UTC (rev 269938)
+++ trunk/JSTests/stress/big-int-as-property-name.js	2020-11-18 03:19:04 UTC (rev 269939)
@@ -1,5 +1,3 @@
-//@ runDefault("--usePublicClassFields=true")
-
 let assert = {
     sameValue(a, e) {
         if (a !== e)

Modified: trunk/JSTests/stress/class-fields-bytecode-cache.js (269938 => 269939)


--- trunk/JSTests/stress/class-fields-bytecode-cache.js	2020-11-18 01:31:05 UTC (rev 269938)
+++ trunk/JSTests/stress/class-fields-bytecode-cache.js	2020-11-18 03:19:04 UTC (rev 269939)
@@ -1,5 +1,3 @@
-//@ runBytecodeCache("--usePublicClassFields=true")
-
 function assert(a, e) {
     if (a !== e)
         throw new Erro("Expected: " + e + " but got: " + a);

Modified: trunk/JSTests/stress/class-fields-computed-to-property-key.js (269938 => 269939)


--- trunk/JSTests/stress/class-fields-computed-to-property-key.js	2020-11-18 01:31:05 UTC (rev 269938)
+++ trunk/JSTests/stress/class-fields-computed-to-property-key.js	2020-11-18 03:19:04 UTC (rev 269939)
@@ -1,5 +1,3 @@
-//@ requireOptions("--usePublicClassFields=1")
-
 function assert(a, message) {
     if (!a)
         throw new Error(message);

Modified: trunk/JSTests/stress/class-fields-function-name.js (269938 => 269939)


--- trunk/JSTests/stress/class-fields-function-name.js	2020-11-18 01:31:05 UTC (rev 269938)
+++ trunk/JSTests/stress/class-fields-function-name.js	2020-11-18 03:19:04 UTC (rev 269939)
@@ -1,5 +1,3 @@
-//@ requireOptions("--usePublicClassFields=true")
-
 function assert(a, message) {
     if (!a)
         throw new Error(message);

Modified: trunk/JSTests/stress/class-fields-harmony.js (269938 => 269939)


--- trunk/JSTests/stress/class-fields-harmony.js	2020-11-18 01:31:05 UTC (rev 269938)
+++ trunk/JSTests/stress/class-fields-harmony.js	2020-11-18 03:19:04 UTC (rev 269939)
@@ -1,4 +1,3 @@
-//@ requireOptions("--usePublicClassFields=1")
 //@ defaultNoEagerRun
 
 // Copyright 2017 the V8 project authors. All rights reserved.

Modified: trunk/JSTests/stress/class-fields-private-use-eval.js (269938 => 269939)


--- trunk/JSTests/stress/class-fields-private-use-eval.js	2020-11-18 01:31:05 UTC (rev 269938)
+++ trunk/JSTests/stress/class-fields-private-use-eval.js	2020-11-18 03:19:04 UTC (rev 269939)
@@ -1,4 +1,4 @@
-//@ requireOptions("--usePrivateClassFields=1", "--usePublicClassFields=1")
+//@ requireOptions("--usePrivateClassFields=1")
 
 function assert(a, message) {
     if (!a)

Modified: trunk/JSTests/stress/class-fields-proxy-define-property.js (269938 => 269939)


--- trunk/JSTests/stress/class-fields-proxy-define-property.js	2020-11-18 01:31:05 UTC (rev 269938)
+++ trunk/JSTests/stress/class-fields-proxy-define-property.js	2020-11-18 03:19:04 UTC (rev 269939)
@@ -1,4 +1,3 @@
-//@ requireOptions("--usePublicClassFields=1")
 //@ defaultNoEagerRun
 
 function assert(a, e, m) {

Modified: trunk/JSTests/stress/class-fields-stress-instance.js (269938 => 269939)


--- trunk/JSTests/stress/class-fields-stress-instance.js	2020-11-18 01:31:05 UTC (rev 269938)
+++ trunk/JSTests/stress/class-fields-stress-instance.js	2020-11-18 03:19:04 UTC (rev 269939)
@@ -1,4 +1,4 @@
-//@ requireOptions("--usePublicClassFields=true", "--usePrivateClassFields=true")
+//@ requireOptions("--usePrivateClassFields=true")
 
 class A {
     a = 0;

Modified: trunk/JSTests/stress/class-fields-to-property-key-const-string-ftl.js (269938 => 269939)


--- trunk/JSTests/stress/class-fields-to-property-key-const-string-ftl.js	2020-11-18 01:31:05 UTC (rev 269938)
+++ trunk/JSTests/stress/class-fields-to-property-key-const-string-ftl.js	2020-11-18 03:19:04 UTC (rev 269939)
@@ -1,4 +1,3 @@
-//@ requireOptions("--usePublicClassFields=true")
 //@ if isFTLEnabled then runFTLNoCJIT else skip end
 
 let ftlTrue = $vm.ftlTrue;

Modified: trunk/JSTests/stress/class-fields-to-property-key-const-symbol-ftl.js (269938 => 269939)


--- trunk/JSTests/stress/class-fields-to-property-key-const-symbol-ftl.js	2020-11-18 01:31:05 UTC (rev 269938)
+++ trunk/JSTests/stress/class-fields-to-property-key-const-symbol-ftl.js	2020-11-18 03:19:04 UTC (rev 269939)
@@ -1,4 +1,3 @@
-//@ requireOptions("--usePublicClassFields=true")
 //@ if isFTLEnabled then runFTLNoCJIT else skip end
 
 let ftlTrue = $vm.ftlTrue;

Modified: trunk/JSTests/stress/class-fields-to-property-key-slow-object-tostring-ftl.js (269938 => 269939)


--- trunk/JSTests/stress/class-fields-to-property-key-slow-object-tostring-ftl.js	2020-11-18 01:31:05 UTC (rev 269938)
+++ trunk/JSTests/stress/class-fields-to-property-key-slow-object-tostring-ftl.js	2020-11-18 03:19:04 UTC (rev 269939)
@@ -1,4 +1,3 @@
-//@ requireOptions("--usePublicClassFields=true")
 //@ if isFTLEnabled then runFTLNoCJIT else skip end
 
 let ftlTrue = $vm.ftlTrue;

Modified: trunk/JSTests/stress/class-fields-to-property-key-slow-object-valueof-ftl.js (269938 => 269939)


--- trunk/JSTests/stress/class-fields-to-property-key-slow-object-valueof-ftl.js	2020-11-18 01:31:05 UTC (rev 269938)
+++ trunk/JSTests/stress/class-fields-to-property-key-slow-object-valueof-ftl.js	2020-11-18 03:19:04 UTC (rev 269939)
@@ -1,4 +1,3 @@
-//@ requireOptions("--usePublicClassFields=true")
 //@ if isFTLEnabled then runFTLNoCJIT else skip end
 
 let ftlTrue = $vm.ftlTrue;

Modified: trunk/JSTests/stress/class-fields-to-property-key-string-object-ftl.js (269938 => 269939)


--- trunk/JSTests/stress/class-fields-to-property-key-string-object-ftl.js	2020-11-18 01:31:05 UTC (rev 269938)
+++ trunk/JSTests/stress/class-fields-to-property-key-string-object-ftl.js	2020-11-18 03:19:04 UTC (rev 269939)
@@ -1,4 +1,3 @@
-//@ requireOptions("--usePublicClassFields=true")
 //@ if isFTLEnabled then runFTLNoCJIT else skip end
 
 let ftlTrue = $vm.ftlTrue;

Modified: trunk/JSTests/stress/class-fields-to-property-key-string-or-string-object-ftl.js (269938 => 269939)


--- trunk/JSTests/stress/class-fields-to-property-key-string-or-string-object-ftl.js	2020-11-18 01:31:05 UTC (rev 269938)
+++ trunk/JSTests/stress/class-fields-to-property-key-string-or-string-object-ftl.js	2020-11-18 03:19:04 UTC (rev 269939)
@@ -1,4 +1,3 @@
-//@ requireOptions("--usePublicClassFields=true")
 //@ if isFTLEnabled then runFTLNoCJIT else skip end
 
 let ftlTrue = $vm.ftlTrue;

Modified: trunk/JSTests/stress/class-fields-with-special-names.js (269938 => 269939)


--- trunk/JSTests/stress/class-fields-with-special-names.js	2020-11-18 01:31:05 UTC (rev 269938)
+++ trunk/JSTests/stress/class-fields-with-special-names.js	2020-11-18 03:19:04 UTC (rev 269939)
@@ -1,5 +1,3 @@
-//@ requireOptions("--usePublicClassFields=true")
-
 function assertEquals(e, a) {
     if (a !== e)
         throw new Error("Expected: " + e + " but got: " + a);

Modified: trunk/JSTests/stress/generator-syntax.js (269938 => 269939)


--- trunk/JSTests/stress/generator-syntax.js	2020-11-18 01:31:05 UTC (rev 269938)
+++ trunk/JSTests/stress/generator-syntax.js	2020-11-18 03:19:04 UTC (rev 269939)
@@ -1,5 +1,3 @@
-//@ requireOptions("--usePublicClassFields=1")
-
 function testSyntax(script) {
     try {
         eval(script);

Modified: trunk/JSTests/stress/method-name.js (269938 => 269939)


--- trunk/JSTests/stress/method-name.js	2020-11-18 01:31:05 UTC (rev 269938)
+++ trunk/JSTests/stress/method-name.js	2020-11-18 03:19:04 UTC (rev 269939)
@@ -1,5 +1,3 @@
-//@ requireOptions("--usePublicClassFields=1")
-
 function testSyntax(script) {
     try {
         eval(script);

Modified: trunk/JSTests/stress/private-name-access-in-computed-property.js (269938 => 269939)


--- trunk/JSTests/stress/private-name-access-in-computed-property.js	2020-11-18 01:31:05 UTC (rev 269938)
+++ trunk/JSTests/stress/private-name-access-in-computed-property.js	2020-11-18 03:19:04 UTC (rev 269939)
@@ -1,4 +1,4 @@
-//@ requireOptions("--usePublicClassFields=1", "--usePrivateClassFields=1")
+//@ requireOptions("--usePrivateClassFields=1")
 
 let assert = {
     throws: (expectedError, functor) => {

Modified: trunk/JSTests/test262/config.yaml (269938 => 269939)


--- trunk/JSTests/test262/config.yaml	2020-11-18 01:31:05 UTC (rev 269938)
+++ trunk/JSTests/test262/config.yaml	2020-11-18 03:19:04 UTC (rev 269939)
@@ -3,7 +3,6 @@
 flags:
   WeakRef: useWeakRefs
   FinalizationRegistry: useWeakRefs
-  class-fields-public: usePublicClassFields
   class-fields-private: usePrivateClassFields
   class-static-fields-public: usePublicStaticClassFields
   Intl.DateTimeFormat-dayPeriod: useIntlDateTimeFormatDayPeriod

Modified: trunk/Source/_javascript_Core/ChangeLog (269938 => 269939)


--- trunk/Source/_javascript_Core/ChangeLog	2020-11-18 01:31:05 UTC (rev 269938)
+++ trunk/Source/_javascript_Core/ChangeLog	2020-11-18 03:19:04 UTC (rev 269939)
@@ -1,3 +1,20 @@
+2020-11-17  Yusuke Suzuki  <[email protected]>
+
+        [JSC] Enable static public class fields
+        https://bugs.webkit.org/show_bug.cgi?id=219058
+
+        Reviewed by Saam Barati.
+
+        Let's flip the runtime flag (usePublicStaticClassFields). And we drop usePublicClassFields flag since it is already shipped.
+
+        * bytecompiler/BytecodeGenerator.cpp:
+        (JSC::BytecodeGenerator::BytecodeGenerator):
+        * bytecompiler/NodesCodegen.cpp:
+        (JSC::FunctionCallValueNode::emitBytecode):
+        * parser/Parser.cpp:
+        (JSC::Parser<LexerType>::parseClass):
+        * runtime/OptionsList.h:
+
 2020-11-17  Michael Catanzaro  <[email protected]>
 
         [CMake] generate_offset_extractor.rb missing build dependency for llint/WebAssembly.asm

Modified: trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp (269938 => 269939)


--- trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp	2020-11-18 01:31:05 UTC (rev 269938)
+++ trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp	2020-11-18 03:19:04 UTC (rev 269939)
@@ -708,8 +708,7 @@
                 case ConstructorKind::None:
                 case ConstructorKind::Base:
                     emitCreateThis(&m_thisRegister);
-                    if (Options::usePublicClassFields())
-                        emitInstanceFieldInitializationIfNeeded(&m_thisRegister, &m_calleeRegister, m_scopeNode->position(), m_scopeNode->position(), m_scopeNode->position());
+                    emitInstanceFieldInitializationIfNeeded(&m_thisRegister, &m_calleeRegister, m_scopeNode->position(), m_scopeNode->position(), m_scopeNode->position());
                     break;
                 case ConstructorKind::Extends:
                     moveEmptyValue(&m_thisRegister);

Modified: trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp (269938 => 269939)


--- trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp	2020-11-18 01:31:05 UTC (rev 269938)
+++ trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp	2020-11-18 03:19:04 UTC (rev 269939)
@@ -1091,7 +1091,7 @@
             generator.emitPutThisToArrowFunctionContextScope();
 
         // Initialize instance fields after super-call.
-        if (Options::usePublicClassFields() && generator.needsClassFieldInitializer() == NeedsClassFieldInitializer::Yes) {
+        if (generator.needsClassFieldInitializer() == NeedsClassFieldInitializer::Yes) {
             ASSERT(generator.isConstructor() || generator.isDerivedConstructorContext());
             func = generator.emitLoadDerivedConstructor();
             generator.emitInstanceFieldInitializationIfNeeded(generator.thisRegister(), func.get(), divot(), divotStart(), divotEnd());

Modified: trunk/Source/_javascript_Core/parser/Parser.cpp (269938 => 269939)


--- trunk/Source/_javascript_Core/parser/Parser.cpp	2020-11-18 01:31:05 UTC (rev 269938)
+++ trunk/Source/_javascript_Core/parser/Parser.cpp	2020-11-18 03:19:04 UTC (rev 269939)
@@ -2992,7 +2992,7 @@
             type = static_cast<PropertyNode::Type>(type | (isGetter ? PropertyNode::Getter : PropertyNode::Setter));
             property = parseGetterSetter(context, type, methodStart, ConstructorKind::None, tag);
             failIfFalse(property, "Cannot parse this method");
-        } else if (Options::usePublicClassFields() && !match(OPENPAREN) && (tag == ClassElementTag::Instance || Options::usePublicStaticClassFields()) && parseMode == SourceParseMode::MethodMode) {
+        } else if (!match(OPENPAREN) && (tag == ClassElementTag::Instance || Options::usePublicStaticClassFields()) && parseMode == SourceParseMode::MethodMode) {
             ASSERT(!isGetter && !isSetter);
             if (ident) {
                 semanticFailIfTrue(*ident == propertyNames.constructor, "Cannot declare class field named 'constructor'");

Modified: trunk/Source/_javascript_Core/runtime/OptionsList.h (269938 => 269939)


--- trunk/Source/_javascript_Core/runtime/OptionsList.h	2020-11-18 01:31:05 UTC (rev 269938)
+++ trunk/Source/_javascript_Core/runtime/OptionsList.h	2020-11-18 03:19:04 UTC (rev 269939)
@@ -513,7 +513,6 @@
     v(Bool, useUnlinkedCodeBlockJettisoning, false, Normal, "If true, UnlinkedCodeBlock can be jettisoned.") \
     v(Bool, forceOSRExitToLLInt, false, Normal, "If true, we always exit to the LLInt. If false, we exit to whatever is most convenient.") \
     v(Unsigned, getByValICMaxNumberOfIdentifiers, 4, Normal, "Number of identifiers we see in the LLInt that could cause us to bail on generating an IC for get_by_val.") \
-    v(Bool, usePublicClassFields, true, Normal, "If true, the parser will understand public data fields inside classes.") \
     v(Bool, useRandomizingExecutableIslandAllocation, false, Normal, "For the arm64 ExecutableAllocator, if true, select which region to use randomly. This is useful for testing that jump islands work.") \
     v(Bool, exposeProfilersOnGlobalObject, false, Normal, "If true, we will expose functions to enable/disable both the sampling profiler and the super sampler") \
     v(Bool, allowUnsupportedTiers, false, Normal, "If true, we will not disable DFG or FTL when an experimental feature is enabled.") \
@@ -525,7 +524,7 @@
     v(Double, allowHoistingLICMProbability, 0.5, Normal, nullptr) \
     v(Bool, exposeCustomSettersOnGlobalObjectForTesting, false, Normal, nullptr) \
     v(Bool, useJITCage, canUseJITCage(), Normal, nullptr) \
-    v(Bool, usePublicStaticClassFields, false, Normal, "If true, the parser will understand public static data fields inside classes.") \
+    v(Bool, usePublicStaticClassFields, true, Normal, "If true, the parser will understand public static data fields inside classes.") \
 
 enum OptionEquivalence {
     SameOption,
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to