Title: [247386] trunk/Source/_javascript_Core
Revision
247386
Author
keith_mil...@apple.com
Date
2019-07-12 06:24:08 -0700 (Fri, 12 Jul 2019)

Log Message

getIndexQuickly should be const
https://bugs.webkit.org/show_bug.cgi?id=199747

Reviewed by Yusuke Suzuki.

* runtime/Butterfly.h:
(JSC::Butterfly::indexingPayload const):
(JSC::Butterfly::arrayStorage const):
(JSC::Butterfly::contiguousInt32 const):
(JSC::Butterfly::contiguousDouble const):
(JSC::Butterfly::contiguous const):
* runtime/JSObject.h:
(JSC::JSObject::canGetIndexQuickly const):
(JSC::JSObject::getIndexQuickly const):
(JSC::JSObject::tryGetIndexQuickly const):
(JSC::JSObject::canGetIndexQuickly): Deleted.
(JSC::JSObject::getIndexQuickly): Deleted.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (247385 => 247386)


--- trunk/Source/_javascript_Core/ChangeLog	2019-07-12 12:31:42 UTC (rev 247385)
+++ trunk/Source/_javascript_Core/ChangeLog	2019-07-12 13:24:08 UTC (rev 247386)
@@ -1,3 +1,23 @@
+2019-07-12  Keith Miller  <keith_mil...@apple.com>
+
+        getIndexQuickly should be const
+        https://bugs.webkit.org/show_bug.cgi?id=199747
+
+        Reviewed by Yusuke Suzuki.
+
+        * runtime/Butterfly.h:
+        (JSC::Butterfly::indexingPayload const):
+        (JSC::Butterfly::arrayStorage const):
+        (JSC::Butterfly::contiguousInt32 const):
+        (JSC::Butterfly::contiguousDouble const):
+        (JSC::Butterfly::contiguous const):
+        * runtime/JSObject.h:
+        (JSC::JSObject::canGetIndexQuickly const):
+        (JSC::JSObject::getIndexQuickly const):
+        (JSC::JSObject::tryGetIndexQuickly const):
+        (JSC::JSObject::canGetIndexQuickly): Deleted.
+        (JSC::JSObject::getIndexQuickly): Deleted.
+
 2019-07-11  Justin Michaud  <justin_mich...@apple.com>
 
         Add b3 macro lowering for CheckMul on arm64

Modified: trunk/Source/_javascript_Core/runtime/Butterfly.h (247385 => 247386)


--- trunk/Source/_javascript_Core/runtime/Butterfly.h	2019-07-12 12:31:42 UTC (rev 247385)
+++ trunk/Source/_javascript_Core/runtime/Butterfly.h	2019-07-12 13:24:08 UTC (rev 247386)
@@ -125,8 +125,10 @@
 #endif
 };
 
-typedef ContiguousData<double> ContiguousDoubles;
-typedef ContiguousData<WriteBarrier<Unknown>> ContiguousJSValues;
+using ContiguousDoubles = ContiguousData<double>;
+using ContiguousJSValues = ContiguousData<WriteBarrier<Unknown>>;
+using ConstContiguousDoubles = ContiguousData<const double>;
+using ConstContiguousJSValues = ContiguousData<const WriteBarrier<Unknown>>;
 
 class Butterfly {
     WTF_MAKE_NONCOPYABLE(Butterfly);
@@ -189,6 +191,13 @@
     ContiguousJSValues contiguousInt32() { return ContiguousJSValues(indexingPayload<WriteBarrier<Unknown>>(), vectorLength()); }
     ContiguousDoubles contiguousDouble() { return ContiguousDoubles(indexingPayload<double>(), vectorLength()); }
     ContiguousJSValues contiguous() { return ContiguousJSValues(indexingPayload<WriteBarrier<Unknown>>(), vectorLength()); }
+
+    template<typename T>
+    const T* indexingPayload() const { return reinterpret_cast_ptr<const T*>(this); }
+    const ArrayStorage* arrayStorage() const { return indexingPayload<ArrayStorage>(); }
+    ConstContiguousJSValues contiguousInt32() const { return ConstContiguousJSValues(indexingPayload<WriteBarrier<Unknown>>(), vectorLength()); }
+    ConstContiguousDoubles contiguousDouble() const { return ConstContiguousDoubles(indexingPayload<double>(), vectorLength()); }
+    ConstContiguousJSValues contiguous() const { return ConstContiguousJSValues(indexingPayload<WriteBarrier<Unknown>>(), vectorLength()); }
     
     static Butterfly* fromContiguous(WriteBarrier<Unknown>* contiguous)
     {

Modified: trunk/Source/_javascript_Core/runtime/JSObject.h (247385 => 247386)


--- trunk/Source/_javascript_Core/runtime/JSObject.h	2019-07-12 12:31:42 UTC (rev 247385)
+++ trunk/Source/_javascript_Core/runtime/JSObject.h	2019-07-12 13:24:08 UTC (rev 247386)
@@ -256,9 +256,9 @@
         return structure(vm)->hasIndexingHeader(this);
     }
     
-    bool canGetIndexQuickly(unsigned i)
+    bool canGetIndexQuickly(unsigned i) const
     {
-        Butterfly* butterfly = this->butterfly();
+        const Butterfly* butterfly = this->butterfly();
         switch (indexingType()) {
         case ALL_BLANK_INDEXING_TYPES:
         case ALL_UNDECIDED_INDEXING_TYPES:
@@ -282,9 +282,9 @@
         }
     }
         
-    JSValue getIndexQuickly(unsigned i)
+    JSValue getIndexQuickly(unsigned i) const
     {
-        Butterfly* butterfly = this->butterfly();
+        const Butterfly* butterfly = this->butterfly();
         switch (indexingType()) {
         case ALL_INT32_INDEXING_TYPES:
             return jsNumber(butterfly->contiguous().at(this, i).get().asInt32());
@@ -302,7 +302,7 @@
         
     JSValue tryGetIndexQuickly(unsigned i) const
     {
-        Butterfly* butterfly = const_cast<JSObject*>(this)->butterfly();
+        const Butterfly* butterfly = this->butterfly();
         switch (indexingType()) {
         case ALL_BLANK_INDEXING_TYPES:
         case ALL_UNDECIDED_INDEXING_TYPES:
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to