Changeset 247386 in webkit


Ignore:
Timestamp:
Jul 12, 2019 6:24:08 AM (5 years ago)
Author:
keith_miller@apple.com
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.

Location:
trunk/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r247363 r247386  
     12019-07-12  Keith Miller  <keith_miller@apple.com>
     2
     3        getIndexQuickly should be const
     4        https://bugs.webkit.org/show_bug.cgi?id=199747
     5
     6        Reviewed by Yusuke Suzuki.
     7
     8        * runtime/Butterfly.h:
     9        (JSC::Butterfly::indexingPayload const):
     10        (JSC::Butterfly::arrayStorage const):
     11        (JSC::Butterfly::contiguousInt32 const):
     12        (JSC::Butterfly::contiguousDouble const):
     13        (JSC::Butterfly::contiguous const):
     14        * runtime/JSObject.h:
     15        (JSC::JSObject::canGetIndexQuickly const):
     16        (JSC::JSObject::getIndexQuickly const):
     17        (JSC::JSObject::tryGetIndexQuickly const):
     18        (JSC::JSObject::canGetIndexQuickly): Deleted.
     19        (JSC::JSObject::getIndexQuickly): Deleted.
     20
    1212019-07-11  Justin Michaud  <justin_michaud@apple.com>
    222
  • trunk/Source/JavaScriptCore/runtime/Butterfly.h

    r243688 r247386  
    126126};
    127127
    128 typedef ContiguousData<double> ContiguousDoubles;
    129 typedef ContiguousData<WriteBarrier<Unknown>> ContiguousJSValues;
     128using ContiguousDoubles = ContiguousData<double>;
     129using ContiguousJSValues = ContiguousData<WriteBarrier<Unknown>>;
     130using ConstContiguousDoubles = ContiguousData<const double>;
     131using ConstContiguousJSValues = ContiguousData<const WriteBarrier<Unknown>>;
    130132
    131133class Butterfly {
     
    190192    ContiguousDoubles contiguousDouble() { return ContiguousDoubles(indexingPayload<double>(), vectorLength()); }
    191193    ContiguousJSValues contiguous() { return ContiguousJSValues(indexingPayload<WriteBarrier<Unknown>>(), vectorLength()); }
     194
     195    template<typename T>
     196    const T* indexingPayload() const { return reinterpret_cast_ptr<const T*>(this); }
     197    const ArrayStorage* arrayStorage() const { return indexingPayload<ArrayStorage>(); }
     198    ConstContiguousJSValues contiguousInt32() const { return ConstContiguousJSValues(indexingPayload<WriteBarrier<Unknown>>(), vectorLength()); }
     199    ConstContiguousDoubles contiguousDouble() const { return ConstContiguousDoubles(indexingPayload<double>(), vectorLength()); }
     200    ConstContiguousJSValues contiguous() const { return ConstContiguousJSValues(indexingPayload<WriteBarrier<Unknown>>(), vectorLength()); }
    192201   
    193202    static Butterfly* fromContiguous(WriteBarrier<Unknown>* contiguous)
  • trunk/Source/JavaScriptCore/runtime/JSObject.h

    r246801 r247386  
    257257    }
    258258   
    259     bool canGetIndexQuickly(unsigned i)
    260     {
    261         Butterfly* butterfly = this->butterfly();
     259    bool canGetIndexQuickly(unsigned i) const
     260    {
     261        const Butterfly* butterfly = this->butterfly();
    262262        switch (indexingType()) {
    263263        case ALL_BLANK_INDEXING_TYPES:
     
    283283    }
    284284       
    285     JSValue getIndexQuickly(unsigned i)
    286     {
    287         Butterfly* butterfly = this->butterfly();
     285    JSValue getIndexQuickly(unsigned i) const
     286    {
     287        const Butterfly* butterfly = this->butterfly();
    288288        switch (indexingType()) {
    289289        case ALL_INT32_INDEXING_TYPES:
     
    303303    JSValue tryGetIndexQuickly(unsigned i) const
    304304    {
    305         Butterfly* butterfly = const_cast<JSObject*>(this)->butterfly();
     305        const Butterfly* butterfly = this->butterfly();
    306306        switch (indexingType()) {
    307307        case ALL_BLANK_INDEXING_TYPES:
Note: See TracChangeset for help on using the changeset viewer.