Title: [290194] trunk/Source/_javascript_Core
Revision
290194
Author
[email protected]
Date
2022-02-18 19:53:08 -0800 (Fri, 18 Feb 2022)

Log Message

[JSC] Make ArrayPrototype just an array
https://bugs.webkit.org/show_bug.cgi?id=236869

Reviewed by Saam Barati.

Originally, ArrayPrototype has slightly different memory layout & different logic etc.
But now, it is just an array with a lot of properties. We should just make it an array.

* runtime/ArrayPrototype.cpp:
(JSC::ArrayPrototype::finishCreation):
* runtime/ArrayPrototype.h:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (290193 => 290194)


--- trunk/Source/_javascript_Core/ChangeLog	2022-02-19 03:21:11 UTC (rev 290193)
+++ trunk/Source/_javascript_Core/ChangeLog	2022-02-19 03:53:08 UTC (rev 290194)
@@ -1,3 +1,17 @@
+2022-02-18  Yusuke Suzuki  <[email protected]>
+
+        [JSC] Make ArrayPrototype just an array
+        https://bugs.webkit.org/show_bug.cgi?id=236869
+
+        Reviewed by Saam Barati.
+
+        Originally, ArrayPrototype has slightly different memory layout & different logic etc.
+        But now, it is just an array with a lot of properties. We should just make it an array.
+
+        * runtime/ArrayPrototype.cpp:
+        (JSC::ArrayPrototype::finishCreation):
+        * runtime/ArrayPrototype.h:
+
 2022-02-18  Robert Jenner  <[email protected]>
 
         Unreviewed, reverting r290149.

Modified: trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp (290193 => 290194)


--- trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp	2022-02-19 03:21:11 UTC (rev 290193)
+++ trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp	2022-02-19 03:53:08 UTC (rev 290194)
@@ -57,8 +57,6 @@
 
 // ------------------------------ ArrayPrototype ----------------------------
 
-const ClassInfo ArrayPrototype::s_info = {"Array", &JSArray::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(ArrayPrototype)};
-
 ArrayPrototype* ArrayPrototype::create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
 {
     ArrayPrototype* prototype = new (NotNull, allocateCell<ArrayPrototype>(vm)) ArrayPrototype(vm, structure);
@@ -76,6 +74,8 @@
 {
     Base::finishCreation(vm);
     ASSERT(inherits(vm, info()));
+    ASSERT(info() == JSArray::info());
+    ASSERT(type() == ArrayType);
 
     putDirectWithoutTransition(vm, vm.propertyNames->toString, globalObject->arrayProtoToStringFunction(), static_cast<unsigned>(PropertyAttribute::DontEnum));
     putDirectWithoutTransition(vm, vm.propertyNames->builtinNames().valuesPublicName(), globalObject->arrayProtoValuesFunction(), static_cast<unsigned>(PropertyAttribute::DontEnum));

Modified: trunk/Source/_javascript_Core/runtime/ArrayPrototype.h (290193 => 290194)


--- trunk/Source/_javascript_Core/runtime/ArrayPrototype.h	2022-02-19 03:21:11 UTC (rev 290193)
+++ trunk/Source/_javascript_Core/runtime/ArrayPrototype.h	2022-02-19 03:53:08 UTC (rev 290194)
@@ -24,23 +24,17 @@
 
 namespace JSC {
 
+// This is a simple JSArray, only including some special initialization sequence.
+// We must not have special ArrayPrototype::info.
 class ArrayPrototype final : public JSArray {
 public:
     using Base = JSArray;
 
-    enum class SpeciesWatchpointStatus {
-        Uninitialized,
-        Initialized,
-        Fired
-    };
-
     static ArrayPrototype* create(VM&, JSGlobalObject*, Structure*);
-        
-    DECLARE_EXPORT_INFO;
 
     static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
     {
-        return Structure::create(vm, globalObject, prototype, TypeInfo(DerivedArrayType, StructureFlags), info(), ArrayClass);
+        return Base::createStructure(vm, globalObject, prototype, ArrayClass);
     }
 
 private:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to