Changeset 123819 in webkit


Ignore:
Timestamp:
Jul 26, 2012 5:25:04 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

constructing TypedArray from another TypedArray is slow
https://bugs.webkit.org/show_bug.cgi?id=90838

Patch by Arnaud Renevier <a.renevier@sisa.samsung.com> on 2012-07-26
Reviewed by Kenneth Russell.

PerformanceTests:

  • Bindings/typed-array-construct-from-same-type.html: Added.
  • Bindings/typed-array-construct-from-typed.html: Added.

Source/WebCore:

When constructing a typed array from an array like element, try to
determine if the argument is a typed array. If so, cast the argument
to a typed array, and read each element with .item() method. That
avoid reading the value as a JSValue, and speedups construction by
approximatively 3x (even 30x if TypedArrays are both the same type).

In order to achieve that, we use virtual getType method. We can use
this information to cast the TypedArray to the actual type, and then
read the values from the source.

Introduce constructArrayBufferViewWithTypedArrayArgument template
function which returns a new typed array if first argument is a typed
array, or 0 otherwise.

This patch also replaces previous is<Type>Array() calls with new
getType method.

  • bindings/js/JSArrayBufferViewHelper.h:

(WebCore::constructArrayBufferViewWithTypedArrayArgument):
(WebCore):
(WebCore::constructArrayBufferView):

  • bindings/v8/SerializedScriptValue.cpp:
  • html/canvas/DataView.h:

(DataView):
(WebCore::DataView::getType):

  • html/canvas/WebGLRenderingContext.cpp:

(WebCore):
(WebCore::WebGLRenderingContext::readPixels):
(WebCore::WebGLRenderingContext::validateTexFuncData):

  • page/Crypto.cpp:

Source/WTF:

Introduce virtual method getType on ArrayBufferView. It returns the actual
type of the view. This method replaces previous is<Type>Array() methods.

  • wtf/ArrayBufferView.h:
  • wtf/Float32Array.h:

(WTF::Float32Array::getType):
(Float32Array):

  • wtf/Float64Array.h:

(WTF::Float64Array::getType):
(Float64Array):

  • wtf/Int16Array.h:

(WTF::Int16Array::getType):
(Int16Array):

  • wtf/Int32Array.h:

(WTF::Int32Array::getType):
(Int32Array):

  • wtf/Int8Array.h:

(WTF::Int8Array::getType):
(Int8Array):

  • wtf/IntegralTypedArrayBase.h:
  • wtf/TypedArrayBase.h:

(TypedArrayBase):
(WTF::TypedArrayBase::item):

  • wtf/Uint16Array.h:

(WTF::Uint16Array::getType):
(Uint16Array):

  • wtf/Uint32Array.h:

(WTF::Uint32Array::getType):
(Uint32Array):

  • wtf/Uint8Array.h:

(WTF::Uint8Array::getType):
(Uint8Array):

  • wtf/Uint8ClampedArray.h:

(WTF::Uint8ClampedArray::getType):
(Uint8ClampedArray):

Location:
trunk
Files:
2 added
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/PerformanceTests/ChangeLog

    r123655 r123819  
     12012-07-26  Arnaud Renevier  <a.renevier@sisa.samsung.com>
     2
     3        constructing TypedArray from another TypedArray is slow
     4        https://bugs.webkit.org/show_bug.cgi?id=90838
     5
     6        Reviewed by Kenneth Russell.
     7
     8        * Bindings/typed-array-construct-from-same-type.html: Added.
     9        * Bindings/typed-array-construct-from-typed.html: Added.
     10
    1112012-07-25  Ryosuke Niwa  <rniwa@webkit.org>
    212
  • trunk/Source/WTF/ChangeLog

    r123786 r123819  
     12012-07-26  Arnaud Renevier  <a.renevier@sisa.samsung.com>
     2
     3        constructing TypedArray from another TypedArray is slow
     4        https://bugs.webkit.org/show_bug.cgi?id=90838
     5
     6        Reviewed by Kenneth Russell.
     7
     8        Introduce virtual method getType on ArrayBufferView. It returns the actual
     9        type of the view. This method replaces previous is<Type>Array() methods.
     10
     11        * wtf/ArrayBufferView.h:
     12        * wtf/Float32Array.h:
     13        (WTF::Float32Array::getType):
     14        (Float32Array):
     15        * wtf/Float64Array.h:
     16        (WTF::Float64Array::getType):
     17        (Float64Array):
     18        * wtf/Int16Array.h:
     19        (WTF::Int16Array::getType):
     20        (Int16Array):
     21        * wtf/Int32Array.h:
     22        (WTF::Int32Array::getType):
     23        (Int32Array):
     24        * wtf/Int8Array.h:
     25        (WTF::Int8Array::getType):
     26        (Int8Array):
     27        * wtf/IntegralTypedArrayBase.h:
     28        * wtf/TypedArrayBase.h:
     29        (TypedArrayBase):
     30        (WTF::TypedArrayBase::item):
     31        * wtf/Uint16Array.h:
     32        (WTF::Uint16Array::getType):
     33        (Uint16Array):
     34        * wtf/Uint32Array.h:
     35        (WTF::Uint32Array::getType):
     36        (Uint32Array):
     37        * wtf/Uint8Array.h:
     38        (WTF::Uint8Array::getType):
     39        (Uint8Array):
     40        * wtf/Uint8ClampedArray.h:
     41        (WTF::Uint8ClampedArray::getType):
     42        (Uint8ClampedArray):
     43
    1442012-07-26  Zeno Albisser  <zeno@webkit.org>
    245
  • trunk/Source/WTF/wtf/ArrayBufferView.h

    r112558 r123819  
    3939class WTF_EXPORT_PRIVATE_RTTI ArrayBufferView : public RefCounted<ArrayBufferView> {
    4040  public:
    41     virtual bool isByteArray() const { return false; }
    42     virtual bool isUnsignedByteArray() const { return false; }
    43     virtual bool isUnsignedByteClampedArray() const { return false; }
    44     virtual bool isShortArray() const { return false; }
    45     virtual bool isUnsignedShortArray() const { return false; }
    46     virtual bool isIntArray() const { return false; }
    47     virtual bool isUnsignedIntArray() const { return false; }
    48     virtual bool isFloatArray() const { return false; }
    49     virtual bool isDoubleArray() const { return false; }
    50     virtual bool isDataView() const { return false; }
     41    enum ViewType {
     42        TypeInt8,
     43        TypeUint8,
     44        TypeUint8Clamped,
     45        TypeInt16,
     46        TypeUint16,
     47        TypeInt32,
     48        TypeUint32,
     49        TypeFloat32,
     50        TypeFloat64,
     51        TypeDataView
     52    };
     53    virtual ViewType getType() const = 0;
    5154
    5255    PassRefPtr<ArrayBuffer> buffer() const
  • trunk/Source/WTF/wtf/Float32Array.h

    r111778 r123819  
    4949    }
    5050
    51     // Invoked by the indexed getter. Does not perform range checks; caller
    52     // is responsible for doing so and returning undefined as necessary.
    53     float item(unsigned index) const
    54     {
    55         ASSERT(index < TypedArrayBase<float>::m_length);
    56         float result = TypedArrayBase<float>::data()[index];
    57         return result;
    58     }
    59 
    6051    inline PassRefPtr<Float32Array> subarray(int start) const;
    6152    inline PassRefPtr<Float32Array> subarray(int start, int end) const;
     53
     54    virtual ViewType getType() const
     55    {
     56        return TypeFloat32;
     57    }
    6258
    6359private:
     
    6763    // Make constructor visible to superclass.
    6864    friend class TypedArrayBase<float>;
    69 
    70     // Overridden from ArrayBufferView.
    71     virtual bool isFloatArray() const { return true; }
    7265};
    7366
  • trunk/Source/WTF/wtf/Float64Array.h

    r111778 r123819  
    4949    }
    5050
    51     // Invoked by the indexed getter. Does not perform range checks; caller
    52     // is responsible for doing so and returning undefined as necessary.
    53     double item(unsigned index) const
    54     {
    55         ASSERT(index < TypedArrayBase<double>::m_length);
    56         double result = TypedArrayBase<double>::data()[index];
    57         return result;
    58     }
    59 
    6051    inline PassRefPtr<Float64Array> subarray(int start) const;
    6152    inline PassRefPtr<Float64Array> subarray(int start, int end) const;
     53
     54    virtual ViewType getType() const
     55    {
     56        return TypeFloat64;
     57    }
    6258
    6359private:
     
    6763    // Make constructor visible to superclass.
    6864    friend class TypedArrayBase<double>;
    69 
    70     // Overridden from ArrayBufferView.
    71     virtual bool isDoubleArray() const { return true; }
    7265};
    7366
  • trunk/Source/WTF/wtf/Int16Array.h

    r111778 r123819  
    4646    inline PassRefPtr<Int16Array> subarray(int start, int end) const;
    4747
     48    virtual ViewType getType() const
     49    {
     50        return TypeInt16;
     51    }
     52
    4853private:
    4954    inline Int16Array(PassRefPtr<ArrayBuffer>,
     
    5257    // Make constructor visible to superclass.
    5358    friend class TypedArrayBase<short>;
    54 
    55     // Overridden from ArrayBufferView.
    56     virtual bool isShortArray() const { return true; }
    5759};
    5860
  • trunk/Source/WTF/wtf/Int32Array.h

    r111778 r123819  
    4545    inline PassRefPtr<Int32Array> subarray(int start, int end) const;
    4646
     47    virtual ViewType getType() const
     48    {
     49        return TypeInt32;
     50    }
     51
    4752private:
    4853    inline Int32Array(PassRefPtr<ArrayBuffer>,
     
    5156    // Make constructor visible to superclass.
    5257    friend class TypedArrayBase<int>;
    53 
    54     // Overridden from ArrayBufferView.
    55     virtual bool isIntArray() const { return true; }
    5658};
    5759
  • trunk/Source/WTF/wtf/Int8Array.h

    r111778 r123819  
    4747    inline PassRefPtr<Int8Array> subarray(int start, int end) const;
    4848
     49    virtual ViewType getType() const
     50    {
     51        return TypeInt8;
     52    }
     53
    4954private:
    5055    inline Int8Array(PassRefPtr<ArrayBuffer>,
     
    5358    // Make constructor visible to superclass.
    5459    friend class TypedArrayBase<signed char>;
    55 
    56     // Overridden from ArrayBufferView.
    57     virtual bool isByteArray() const { return true; }
    5860};
    5961
  • trunk/Source/WTF/wtf/IntegralTypedArrayBase.h

    r111778 r123819  
    5151    }
    5252
    53     // Invoked by the indexed getter. Does not perform range checks; caller
    54     // is responsible for doing so and returning undefined as necessary.
    55     T item(unsigned index) const
    56     {
    57         ASSERT(index < TypedArrayBase<T>::m_length);
    58         return TypedArrayBase<T>::data()[index];
    59     }
    60 
    6153  protected:
    6254    IntegralTypedArrayBase(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
  • trunk/Source/WTF/wtf/TypedArrayBase.h

    r114992 r123819  
    6464    {
    6565        return m_length * sizeof(T);
     66    }
     67
     68    // Invoked by the indexed getter. Does not perform range checks; caller
     69    // is responsible for doing so and returning undefined as necessary.
     70    T item(unsigned index) const
     71    {
     72        ASSERT(index < TypedArrayBase<T>::m_length);
     73        return TypedArrayBase<T>::data()[index];
    6674    }
    6775
  • trunk/Source/WTF/wtf/Uint16Array.h

    r111778 r123819  
    4747    inline PassRefPtr<Uint16Array> subarray(int start, int end) const;
    4848
     49    virtual ViewType getType() const
     50    {
     51        return TypeUint16;
     52    }
     53
    4954private:
    5055    inline Uint16Array(PassRefPtr<ArrayBuffer>,
     
    5358    // Make constructor visible to superclass.
    5459    friend class TypedArrayBase<unsigned short>;
    55 
    56     // Overridden from ArrayBufferView.
    57     virtual bool isUnsignedShortArray() const { return true; }
    5860};
    5961
  • trunk/Source/WTF/wtf/Uint32Array.h

    r111778 r123819  
    4747    inline PassRefPtr<Uint32Array> subarray(int start, int end) const;
    4848
     49    virtual ViewType getType() const
     50    {
     51        return TypeUint32;
     52    }
     53
    4954private:
    5055    inline Uint32Array(PassRefPtr<ArrayBuffer>,
     
    5358    // Make constructor visible to superclass.
    5459    friend class TypedArrayBase<unsigned int>;
    55 
    56     // Overridden from ArrayBufferView.
    57     virtual bool isUnsignedIntArray() const { return true; }
    5860};
    5961
  • trunk/Source/WTF/wtf/Uint8Array.h

    r111778 r123819  
    4747    inline PassRefPtr<Uint8Array> subarray(int start, int end) const;
    4848
     49    virtual ViewType getType() const
     50    {
     51        return TypeUint8;
     52    }
     53
    4954protected:
    5055    inline Uint8Array(PassRefPtr<ArrayBuffer>,
     
    5358    // Make constructor visible to superclass.
    5459    friend class TypedArrayBase<unsigned char>;
    55 
    56     // Overridden from ArrayBufferView.
    57     virtual bool isUnsignedByteArray() const { return true; }
    5860};
    5961
  • trunk/Source/WTF/wtf/Uint8ClampedArray.h

    r114992 r123819  
    5656    inline PassRefPtr<Uint8ClampedArray> subarray(int start, int end) const;
    5757
     58    virtual ViewType getType() const
     59    {
     60        return TypeUint8Clamped;
     61    }
     62
    5863private:
    5964    inline Uint8ClampedArray(PassRefPtr<ArrayBuffer>,
     
    6267    // Make constructor visible to superclass.
    6368    friend class TypedArrayBase<unsigned char>;
    64 
    65     // Overridden from ArrayBufferView.
    66     virtual bool isUnsignedByteClampedArray() const { return true; }
    6769};
    6870
  • trunk/Source/WebCore/ChangeLog

    r123818 r123819  
     12012-07-26  Arnaud Renevier  <a.renevier@sisa.samsung.com>
     2
     3        constructing TypedArray from another TypedArray is slow
     4        https://bugs.webkit.org/show_bug.cgi?id=90838
     5
     6        Reviewed by Kenneth Russell.
     7
     8        When constructing a typed array from an array like element, try to
     9        determine if the argument is a typed array. If so, cast the argument
     10        to a typed array, and read each element with .item() method. That
     11        avoid reading the value as a JSValue, and speedups construction by
     12        approximatively 3x (even 30x if TypedArrays are both the same type).
     13
     14        In order to achieve that, we use virtual getType method. We can use
     15        this information to cast the TypedArray to the actual type, and then
     16        read the values from the source.
     17
     18        Introduce constructArrayBufferViewWithTypedArrayArgument template
     19        function which returns a new typed array if first argument is a typed
     20        array, or 0 otherwise.
     21
     22        This patch also replaces previous is<Type>Array() calls with new
     23        getType method.
     24
     25        * bindings/js/JSArrayBufferViewHelper.h:
     26        (WebCore::constructArrayBufferViewWithTypedArrayArgument):
     27        (WebCore):
     28        (WebCore::constructArrayBufferView):
     29        * bindings/v8/SerializedScriptValue.cpp:
     30        * html/canvas/DataView.h:
     31        (DataView):
     32        (WebCore::DataView::getType):
     33        * html/canvas/WebGLRenderingContext.cpp:
     34        (WebCore):
     35        (WebCore::WebGLRenderingContext::readPixels):
     36        (WebCore::WebGLRenderingContext::validateTexFuncData):
     37        * page/Crypto.cpp:
     38
    1392012-07-26  Max Vujovic  <mvujovic@adobe.com>
    240
  • trunk/Source/WebCore/bindings/js/JSArrayBufferViewHelper.h

    r101401 r123819  
    3030#include "ExceptionCode.h"
    3131#include "JSArrayBuffer.h"
     32#include "JSArrayBufferView.h"
    3233#include "JSDOMBinding.h"
    3334#include <interpreter/CallFrame.h>
     
    3738#include <runtime/JSValue.h>
    3839#include <wtf/ArrayBufferView.h>
     40#include <wtf/TypedArrayBase.h>
    3941
    4042namespace WebCore {
     
    8789// If this returns 0, it will already have thrown a JavaScript exception.
    8890template<class C, typename T>
     91PassRefPtr<C> constructArrayBufferViewWithTypedArrayArgument(JSC::ExecState* exec)
     92{
     93    RefPtr<ArrayBufferView> source = toArrayBufferView(exec->argument(0));
     94    if (!source)
     95        return 0;
     96
     97    ArrayBufferView::ViewType sourceType = source->getType();
     98    if (sourceType == ArrayBufferView::TypeDataView)
     99        return 0;
     100
     101    uint32_t length = asObject(exec->argument(0))->get(exec, JSC::Identifier(exec, "length")).toUInt32(exec);
     102    RefPtr<C> array = C::create(length);
     103    if (!array) {
     104        setDOMException(exec, INDEX_SIZE_ERR);
     105        return array;
     106    }
     107
     108    if (array->getType() == sourceType) {
     109        memcpy(array->baseAddress(), source->baseAddress(), length * sizeof(T));
     110        return array;
     111    }
     112
     113    switch (sourceType) {
     114    case ArrayBufferView::TypeInt8:
     115        for (unsigned i = 0; i < length; ++i)
     116            array->set(i, (T)(static_cast<TypedArrayBase<signed char> *>(source.get())->item(i)));
     117        break;
     118    case ArrayBufferView::TypeUint8:
     119    case ArrayBufferView::TypeUint8Clamped:
     120        for (unsigned i = 0; i < length; ++i)
     121            array->set(i, (T)(static_cast<TypedArrayBase<unsigned char> *>(source.get())->item(i)));
     122        break;
     123    case ArrayBufferView::TypeInt16:
     124        for (unsigned i = 0; i < length; ++i)
     125            array->set(i, (T)(static_cast<TypedArrayBase<signed short> *>(source.get())->item(i)));
     126        break;
     127    case ArrayBufferView::TypeUint16:
     128        for (unsigned i = 0; i < length; ++i)
     129            array->set(i, (T)(static_cast<TypedArrayBase<unsigned short> *>(source.get())->item(i)));
     130        break;
     131    case ArrayBufferView::TypeInt32:
     132        for (unsigned i = 0; i < length; ++i)
     133            array->set(i, (T)(static_cast<TypedArrayBase<int> *>(source.get())->item(i)));
     134        break;
     135    case ArrayBufferView::TypeUint32:
     136        for (unsigned i = 0; i < length; ++i)
     137            array->set(i, (T)(static_cast<TypedArrayBase<unsigned int> *>(source.get())->item(i)));
     138        break;
     139    case ArrayBufferView::TypeFloat32:
     140        for (unsigned i = 0; i < length; ++i)
     141            array->set(i, (T)(static_cast<TypedArrayBase<float> *>(source.get())->item(i)));
     142        break;
     143    case ArrayBufferView::TypeFloat64:
     144        for (unsigned i = 0; i < length; ++i)
     145            array->set(i, (T)(static_cast<TypedArrayBase<double> *>(source.get())->item(i)));
     146        break;
     147    default:
     148        return 0;
     149    }
     150
     151    return array;
     152}
     153
     154// Template function used by XXXArrayConstructors.
     155// If this returns 0, it will already have thrown a JavaScript exception.
     156template<class C, typename T>
    89157PassRefPtr<C> constructArrayBufferViewWithArrayBufferArgument(JSC::ExecState* exec)
    90158{
     
    139207            return view;
    140208   
     209        view = constructArrayBufferViewWithTypedArrayArgument<C, T>(exec);
     210        if (view)
     211            return view;
     212
    141213        JSC::JSObject* srcArray = asObject(exec->argument(0));
    142214        uint32_t length = srcArray->get(exec, JSC::Identifier(exec, "length")).toUInt32(exec);
  • trunk/Source/WebCore/bindings/v8/SerializedScriptValue.cpp

    r123269 r123819  
    413413               static_cast<const uint8_t*>(arrayBufferView.baseAddress()));
    414414#endif
    415         if (arrayBufferView.isByteArray())
     415        ArrayBufferView::ViewType type = arrayBufferView.getType();
     416
     417        if (type == ArrayBufferView::TypeInt8)
    416418            append(ByteArrayTag);
    417         else if (arrayBufferView.isUnsignedByteClampedArray())
     419        else if (type == ArrayBufferView::TypeUint8Clamped)
    418420            append(UnsignedByteClampedArrayTag);
    419         else if (arrayBufferView.isUnsignedByteArray())
     421        else if (type == ArrayBufferView::TypeUint8)
    420422            append(UnsignedByteArrayTag);
    421         else if (arrayBufferView.isShortArray())
     423        else if (type == ArrayBufferView::TypeInt16)
    422424            append(ShortArrayTag);
    423         else if (arrayBufferView.isUnsignedShortArray())
     425        else if (type == ArrayBufferView::TypeUint16)
    424426            append(UnsignedShortArrayTag);
    425         else if (arrayBufferView.isIntArray())
     427        else if (type == ArrayBufferView::TypeInt32)
    426428            append(IntArrayTag);
    427         else if (arrayBufferView.isUnsignedIntArray())
     429        else if (type == ArrayBufferView::TypeUint32)
    428430            append(UnsignedIntArrayTag);
    429         else if (arrayBufferView.isFloatArray())
     431        else if (type == ArrayBufferView::TypeFloat32)
    430432            append(FloatArrayTag);
    431         else if (arrayBufferView.isDoubleArray())
     433        else if (type == ArrayBufferView::TypeFloat64)
    432434            append(DoubleArrayTag);
    433         else if (arrayBufferView.isDataView())
     435        else if (type == ArrayBufferView::TypeDataView)
    434436            append(DataViewTag);
    435437        else
  • trunk/Source/WebCore/html/canvas/DataView.h

    r102869 r123819  
    3939    static PassRefPtr<DataView> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned byteLength);
    4040
    41     virtual bool isDataView() const { return true; }
    4241    virtual unsigned length() const { return m_byteLength; }
    4342    virtual unsigned byteLength() const { return m_byteLength; }
     
    7473    void setFloat64(unsigned byteOffset, double value, bool littleEndian, ExceptionCode&);
    7574
     75    virtual ViewType getType() const
     76    {
     77        return TypeDataView;
     78    }
     79
    7680protected:
    7781    virtual void neuter();
  • trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp

    r123816 r123819  
    32813281    }
    32823282    // Validate array type against pixel type.
    3283     if (!pixels->isUnsignedByteArray()) {
     3283    if (pixels->getType() != ArrayBufferView::TypeUint8) {
    32843284        synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "readPixels", "ArrayBufferView not Uint8Array");
    32853285        return;
     
    49384938    switch (type) {
    49394939    case GraphicsContext3D::UNSIGNED_BYTE:
    4940         if (!pixels->isUnsignedByteArray()) {
     4940        if (pixels->getType() != ArrayBufferView::TypeUint8) {
    49414941            synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "type UNSIGNED_BYTE but ArrayBufferView not Uint8Array");
    49424942            return false;
     
    49464946    case GraphicsContext3D::UNSIGNED_SHORT_4_4_4_4:
    49474947    case GraphicsContext3D::UNSIGNED_SHORT_5_5_5_1:
    4948         if (!pixels->isUnsignedShortArray()) {
     4948        if (pixels->getType() != ArrayBufferView::TypeUint16) {
    49494949            synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "type UNSIGNED_SHORT but ArrayBufferView not Uint16Array");
    49504950            return false;
     
    49524952        break;
    49534953    case GraphicsContext3D::FLOAT: // OES_texture_float
    4954         if (!pixels->isFloatArray()) {
     4954        if (pixels->getType() != ArrayBufferView::TypeFloat32) {
    49554955            synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "type FLOAT but ArrayBufferView not Float32Array");
    49564956            return false;
  • trunk/Source/WebCore/page/Crypto.cpp

    r105705 r123819  
    3232
    3333#include "ExceptionCode.h"
    34 #include <wtf/Uint8Array.h>
     34#include <wtf/ArrayBufferView.h>
    3535#include <wtf/CryptographicallyRandomNumber.h>
    3636
     
    4141bool isIntegerArray(ArrayBufferView* array)
    4242{
    43     return array->isByteArray()
    44         || array->isUnsignedByteArray()
    45         || array->isUnsignedByteClampedArray()
    46         || array->isShortArray()
    47         || array->isUnsignedShortArray()
    48         || array->isIntArray()
    49         || array->isUnsignedIntArray();
     43    ArrayBufferView::ViewType type = array->getType();
     44    return type == ArrayBufferView::TypeInt8
     45           || type == ArrayBufferView::TypeUint8
     46           || type == ArrayBufferView::TypeUint8Clamped
     47           || type == ArrayBufferView::TypeInt16
     48           || type == ArrayBufferView::TypeUint16
     49           || type == ArrayBufferView::TypeInt32
     50           || type == ArrayBufferView::TypeUint32;
    5051}
    5152
Note: See TracChangeset for help on using the changeset viewer.