Title: [258071] trunk
Revision
258071
Author
[email protected]
Date
2020-03-07 08:09:58 -0800 (Sat, 07 Mar 2020)

Log Message

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

Reviewed by Mark Lam.

JSTests:

Rename useClassFields to usePublicClassFields to keep separate from usePrivateClassFields once
it is implemented.

* 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-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/generator-syntax.js:
* stress/method-name.js:
* test262/config.yaml:

Source/_javascript_Core:

This patch turns public-class-fields feature on, implemented in r254653.
To separate from private-class-fields, this patch renames the flag from useClassFields to usePublicClassFields,
and first enable public-class-fields feature.

* 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 (258070 => 258071)


--- trunk/JSTests/ChangeLog	2020-03-07 16:06:35 UTC (rev 258070)
+++ trunk/JSTests/ChangeLog	2020-03-07 16:09:58 UTC (rev 258071)
@@ -1,3 +1,30 @@
+2020-03-06  Yusuke Suzuki  <[email protected]>
+
+        [JSC] Enable public class fields
+        https://bugs.webkit.org/show_bug.cgi?id=208756
+
+        Reviewed by Mark Lam.
+
+        Rename useClassFields to usePublicClassFields to keep separate from usePrivateClassFields once
+        it is implemented.
+
+        * 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-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/generator-syntax.js:
+        * stress/method-name.js:
+        * test262/config.yaml:
+
 2020-03-06  Alexey Shvayka  <[email protected]>
 
         JSON.stringify should call replacer on deleted properties

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


--- trunk/JSTests/stress/big-int-as-property-name.js	2020-03-07 16:06:35 UTC (rev 258070)
+++ trunk/JSTests/stress/big-int-as-property-name.js	2020-03-07 16:09:58 UTC (rev 258071)
@@ -1,4 +1,4 @@
-//@ runDefault("--useBigInt=true", "--useClassFields=true")
+//@ runDefault("--useBigInt=true", "--usePublicClassFields=true")
 
 let assert = {
     sameValue(a, e) {

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


--- trunk/JSTests/stress/class-fields-bytecode-cache.js	2020-03-07 16:06:35 UTC (rev 258070)
+++ trunk/JSTests/stress/class-fields-bytecode-cache.js	2020-03-07 16:09:58 UTC (rev 258071)
@@ -1,4 +1,4 @@
-//@ runBytecodeCache("--useClassFields=true")
+//@ runBytecodeCache("--usePublicClassFields=true")
 
 function assert(a, e) {
     if (a !== e)

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


--- trunk/JSTests/stress/class-fields-computed-to-property-key.js	2020-03-07 16:06:35 UTC (rev 258070)
+++ trunk/JSTests/stress/class-fields-computed-to-property-key.js	2020-03-07 16:09:58 UTC (rev 258071)
@@ -1,4 +1,4 @@
-//@ requireOptions("--useClassFields=1")
+//@ requireOptions("--usePublicClassFields=1")
 
 function assert(a, message) {
     if (!a)

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


--- trunk/JSTests/stress/class-fields-function-name.js	2020-03-07 16:06:35 UTC (rev 258070)
+++ trunk/JSTests/stress/class-fields-function-name.js	2020-03-07 16:09:58 UTC (rev 258071)
@@ -1,4 +1,4 @@
-//@ requireOptions("--useClassFields=true")
+//@ requireOptions("--usePublicClassFields=true")
 
 function assert(a, message) {
     if (!a)

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


--- trunk/JSTests/stress/class-fields-harmony.js	2020-03-07 16:06:35 UTC (rev 258070)
+++ trunk/JSTests/stress/class-fields-harmony.js	2020-03-07 16:09:58 UTC (rev 258071)
@@ -1,4 +1,4 @@
-//@ requireOptions("--useClassFields=1")
+//@ requireOptions("--usePublicClassFields=1")
 //@ defaultNoEagerRun
 
 // Copyright 2017 the V8 project authors. All rights reserved.

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


--- trunk/JSTests/stress/class-fields-proxy-define-property.js	2020-03-07 16:06:35 UTC (rev 258070)
+++ trunk/JSTests/stress/class-fields-proxy-define-property.js	2020-03-07 16:09:58 UTC (rev 258071)
@@ -1,4 +1,4 @@
-//@ requireOptions("--useClassFields=1")
+//@ requireOptions("--usePublicClassFields=1")
 //@ defaultNoEagerRun
 
 function assert(a, e, m) {

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


--- trunk/JSTests/stress/class-fields-stress-instance.js	2020-03-07 16:06:35 UTC (rev 258070)
+++ trunk/JSTests/stress/class-fields-stress-instance.js	2020-03-07 16:09:58 UTC (rev 258071)
@@ -1,4 +1,4 @@
-//@ requireOptions("--useClassFields=true")
+//@ requireOptions("--usePublicClassFields=true")
 
 class A {
     a = 0;

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


--- trunk/JSTests/stress/class-fields-to-property-key-const-string-ftl.js	2020-03-07 16:06:35 UTC (rev 258070)
+++ trunk/JSTests/stress/class-fields-to-property-key-const-string-ftl.js	2020-03-07 16:09:58 UTC (rev 258071)
@@ -1,4 +1,4 @@
-//@ requireOptions("--useClassFields=true")
+//@ 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 (258070 => 258071)


--- trunk/JSTests/stress/class-fields-to-property-key-const-symbol-ftl.js	2020-03-07 16:06:35 UTC (rev 258070)
+++ trunk/JSTests/stress/class-fields-to-property-key-const-symbol-ftl.js	2020-03-07 16:09:58 UTC (rev 258071)
@@ -1,4 +1,4 @@
-//@ requireOptions("--useClassFields=true")
+//@ 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 (258070 => 258071)


--- trunk/JSTests/stress/class-fields-to-property-key-slow-object-tostring-ftl.js	2020-03-07 16:06:35 UTC (rev 258070)
+++ trunk/JSTests/stress/class-fields-to-property-key-slow-object-tostring-ftl.js	2020-03-07 16:09:58 UTC (rev 258071)
@@ -1,4 +1,4 @@
-//@ requireOptions("--useClassFields=true")
+//@ 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 (258070 => 258071)


--- trunk/JSTests/stress/class-fields-to-property-key-slow-object-valueof-ftl.js	2020-03-07 16:06:35 UTC (rev 258070)
+++ trunk/JSTests/stress/class-fields-to-property-key-slow-object-valueof-ftl.js	2020-03-07 16:09:58 UTC (rev 258071)
@@ -1,4 +1,4 @@
-//@ requireOptions("--useClassFields=true")
+//@ 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 (258070 => 258071)


--- trunk/JSTests/stress/class-fields-to-property-key-string-object-ftl.js	2020-03-07 16:06:35 UTC (rev 258070)
+++ trunk/JSTests/stress/class-fields-to-property-key-string-object-ftl.js	2020-03-07 16:09:58 UTC (rev 258071)
@@ -1,4 +1,4 @@
-//@ requireOptions("--useClassFields=true")
+//@ 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 (258070 => 258071)


--- trunk/JSTests/stress/class-fields-to-property-key-string-or-string-object-ftl.js	2020-03-07 16:06:35 UTC (rev 258070)
+++ trunk/JSTests/stress/class-fields-to-property-key-string-or-string-object-ftl.js	2020-03-07 16:09:58 UTC (rev 258071)
@@ -1,4 +1,4 @@
-//@ requireOptions("--useClassFields=true")
+//@ requireOptions("--usePublicClassFields=true")
 //@ if isFTLEnabled then runFTLNoCJIT else skip end
 
 let ftlTrue = $vm.ftlTrue;

Modified: trunk/JSTests/stress/generator-syntax.js (258070 => 258071)


--- trunk/JSTests/stress/generator-syntax.js	2020-03-07 16:06:35 UTC (rev 258070)
+++ trunk/JSTests/stress/generator-syntax.js	2020-03-07 16:09:58 UTC (rev 258071)
@@ -1,4 +1,4 @@
-//@ requireOptions("--useClassFields=1")
+//@ requireOptions("--usePublicClassFields=1")
 
 function testSyntax(script) {
     try {

Modified: trunk/JSTests/stress/method-name.js (258070 => 258071)


--- trunk/JSTests/stress/method-name.js	2020-03-07 16:06:35 UTC (rev 258070)
+++ trunk/JSTests/stress/method-name.js	2020-03-07 16:09:58 UTC (rev 258071)
@@ -1,4 +1,4 @@
-//@ requireOptions("--useClassFields=1")
+//@ requireOptions("--usePublicClassFields=1")
 
 function testSyntax(script) {
     try {

Modified: trunk/JSTests/test262/config.yaml (258070 => 258071)


--- trunk/JSTests/test262/config.yaml	2020-03-07 16:06:35 UTC (rev 258070)
+++ trunk/JSTests/test262/config.yaml	2020-03-07 16:09:58 UTC (rev 258071)
@@ -3,7 +3,7 @@
 flags:
   BigInt: useBigInt
   WeakRef: useWeakRefs
-  class-fields-public: useClassFields
+  class-fields-public: usePublicClassFields
 skip:
   features:
     - SharedArrayBuffer

Modified: trunk/Source/_javascript_Core/ChangeLog (258070 => 258071)


--- trunk/Source/_javascript_Core/ChangeLog	2020-03-07 16:06:35 UTC (rev 258070)
+++ trunk/Source/_javascript_Core/ChangeLog	2020-03-07 16:09:58 UTC (rev 258071)
@@ -1,3 +1,22 @@
+2020-03-06  Yusuke Suzuki  <[email protected]>
+
+        [JSC] Enable public class fields
+        https://bugs.webkit.org/show_bug.cgi?id=208756
+
+        Reviewed by Mark Lam.
+
+        This patch turns public-class-fields feature on, implemented in r254653.
+        To separate from private-class-fields, this patch renames the flag from useClassFields to usePublicClassFields,
+        and first enable public-class-fields feature.
+
+        * bytecompiler/BytecodeGenerator.cpp:
+        (JSC::BytecodeGenerator::BytecodeGenerator):
+        * bytecompiler/NodesCodegen.cpp:
+        (JSC::FunctionCallValueNode::emitBytecode):
+        * parser/Parser.cpp:
+        (JSC::Parser<LexerType>::parseClass):
+        * runtime/OptionsList.h:
+
 2020-03-06  Mark Lam  <[email protected]>
 
         Add "AndOrdered" to the names of ordered DoubleConditions.

Modified: trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp (258070 => 258071)


--- trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp	2020-03-07 16:06:35 UTC (rev 258070)
+++ trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp	2020-03-07 16:09:58 UTC (rev 258071)
@@ -699,7 +699,7 @@
                 case ConstructorKind::None:
                 case ConstructorKind::Base:
                     emitCreateThis(&m_thisRegister);
-                    if (Options::useClassFields())
+                    if (Options::usePublicClassFields())
                         emitInstanceFieldInitializationIfNeeded(&m_thisRegister, &m_calleeRegister, m_scopeNode->position(), m_scopeNode->position(), m_scopeNode->position());
                     break;
                 case ConstructorKind::Extends:

Modified: trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp (258070 => 258071)


--- trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp	2020-03-07 16:06:35 UTC (rev 258070)
+++ trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp	2020-03-07 16:09:58 UTC (rev 258071)
@@ -982,7 +982,7 @@
             generator.emitPutThisToArrowFunctionContextScope();
 
         // Initialize instance fields after super-call.
-        if (Options::useClassFields() && generator.needsClassFieldInitializer() == NeedsClassFieldInitializer::Yes) {
+        if (Options::usePublicClassFields() && 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 (258070 => 258071)


--- trunk/Source/_javascript_Core/parser/Parser.cpp	2020-03-07 16:06:35 UTC (rev 258070)
+++ trunk/Source/_javascript_Core/parser/Parser.cpp	2020-03-07 16:09:58 UTC (rev 258071)
@@ -2951,7 +2951,7 @@
             type = static_cast<PropertyNode::Type>(type | (isGetter ? PropertyNode::Getter : PropertyNode::Setter));
             property = parseGetterSetter(context, alwaysStrictInsideClass, type, methodStart, ConstructorKind::None, tag);
             failIfFalse(property, "Cannot parse this method");
-        } else if (Options::useClassFields() && !match(OPENPAREN) && tag == ClassElementTag::Instance && parseMode == SourceParseMode::MethodMode) {
+        } else if (Options::usePublicClassFields() && !match(OPENPAREN) && tag == ClassElementTag::Instance && 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 (258070 => 258071)


--- trunk/Source/_javascript_Core/runtime/OptionsList.h	2020-03-07 16:06:35 UTC (rev 258070)
+++ trunk/Source/_javascript_Core/runtime/OptionsList.h	2020-03-07 16:09:58 UTC (rev 258071)
@@ -499,7 +499,7 @@
     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, useClassFields, false, Normal, "If true, the parser will understand data fields inside classes.") \
+    v(Bool, usePublicClassFields, true, Normal, "If true, the parser will understand public 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