Title: [272099] trunk
Revision
272099
Author
[email protected]
Date
2021-01-29 20:57:02 -0800 (Fri, 29 Jan 2021)

Log Message

[JSC] Adjust property order of host JSFunction
https://bugs.webkit.org/show_bug.cgi?id=221168

Reviewed by Darin Adler.

JSTests:

* stress/host-function-property-order.js: Added.
(shouldBe):

Source/_javascript_Core:

We should first define "length" before "name".
This will be included in upcoming test262 update[1].

[1]: https://github.com/tc39/test262/pull/2921

* runtime/JSFunction.cpp:
(JSC::JSFunction::finishCreation):

Modified Paths

Added Paths

Diff

Modified: trunk/JSTests/ChangeLog (272098 => 272099)


--- trunk/JSTests/ChangeLog	2021-01-30 03:17:22 UTC (rev 272098)
+++ trunk/JSTests/ChangeLog	2021-01-30 04:57:02 UTC (rev 272099)
@@ -1,5 +1,15 @@
 2021-01-29  Yusuke Suzuki  <[email protected]>
 
+        [JSC] Adjust property order of host JSFunction
+        https://bugs.webkit.org/show_bug.cgi?id=221168
+
+        Reviewed by Darin Adler.
+
+        * stress/host-function-property-order.js: Added.
+        (shouldBe):
+
+2021-01-29  Yusuke Suzuki  <[email protected]>
+
         [JSC] Fix WebAssembly.Global's error message and support "funcref"
         https://bugs.webkit.org/show_bug.cgi?id=221157
 

Added: trunk/JSTests/stress/host-function-property-order.js (0 => 272099)


--- trunk/JSTests/stress/host-function-property-order.js	                        (rev 0)
+++ trunk/JSTests/stress/host-function-property-order.js	2021-01-30 04:57:02 UTC (rev 272099)
@@ -0,0 +1,6 @@
+function shouldBe(actual, expected) {
+    if (actual !== expected)
+        throw new Error('bad value: ' + actual);
+}
+
+shouldBe(JSON.stringify(Object.getOwnPropertyNames(Object.getOwnPropertyNames)), `["length","name"]`);

Modified: trunk/Source/_javascript_Core/ChangeLog (272098 => 272099)


--- trunk/Source/_javascript_Core/ChangeLog	2021-01-30 03:17:22 UTC (rev 272098)
+++ trunk/Source/_javascript_Core/ChangeLog	2021-01-30 04:57:02 UTC (rev 272099)
@@ -1,3 +1,18 @@
+2021-01-29  Yusuke Suzuki  <[email protected]>
+
+        [JSC] Adjust property order of host JSFunction
+        https://bugs.webkit.org/show_bug.cgi?id=221168
+
+        Reviewed by Darin Adler.
+
+        We should first define "length" before "name".
+        This will be included in upcoming test262 update[1].
+
+        [1]: https://github.com/tc39/test262/pull/2921
+
+        * runtime/JSFunction.cpp:
+        (JSC::JSFunction::finishCreation):
+
 2021-01-29  Keith Miller  <[email protected]>
 
         SourceParseMode should be a member of the JSC::Parser

Modified: trunk/Source/_javascript_Core/runtime/JSFunction.cpp (272098 => 272099)


--- trunk/Source/_javascript_Core/runtime/JSFunction.cpp	2021-01-30 03:17:22 UTC (rev 272098)
+++ trunk/Source/_javascript_Core/runtime/JSFunction.cpp	2021-01-30 04:57:02 UTC (rev 272099)
@@ -129,9 +129,9 @@
     // JSBoundFunction instances use finishCreation(VM&) overload and lazily allocate their name string / length.
     ASSERT(!this->inherits<JSBoundFunction>(vm));
 
+    putDirect(vm, vm.propertyNames->length, jsNumber(length), PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum);
     if (!name.isNull())
         putDirect(vm, vm.propertyNames->name, jsString(vm, name), PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum);
-    putDirect(vm, vm.propertyNames->length, jsNumber(length), PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum);
 }
 
 FunctionRareData* JSFunction::allocateRareData(VM& vm)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to