Changeset 74760 in webkit


Ignore:
Timestamp:
Dec 29, 2010 2:20:51 PM (13 years ago)
Author:
Martin Robinson
Message:

2010-12-29 Martin Robinson <mrobinson@igalia.com>

Reviewed by Sam Weinig.

JSDataViewCustom.cpp gives the fastcall calling convention to functions called via C++
https://bugs.webkit.org/show_bug.cgi?id=51722

Remove the JSC_HOST_CALL from methods that are called from C++. JSC_HOST_CALL gives
methods the fastcall calling convention, which leads to runtime errors when they are
called from C++. Also remove a bit of unnecessary code duplication.

No new tests. This is covered by fast/canvas/webgl/data-view-test.html.

  • bindings/js/JSDataViewCustom.cpp: (WebCore::getDataViewMember): Remove duplicated code. (WebCore::JSDataView::getInt8): Remove JSC_HOST_CALL. (WebCore::JSDataView::getUint8): Ditto. (WebCore::JSDataView::getFloat32): Ditto. (WebCore::JSDataView::getFloat64): Ditto. (WebCore::setDataViewMember): Remove duplicated code. (WebCore::JSDataView::setInt8): Remove JSC_HOST_CALL. (WebCore::JSDataView::setUint8): Ditto.
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r74759 r74760  
     12010-12-29  Martin Robinson  <mrobinson@igalia.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        JSDataViewCustom.cpp gives the fastcall calling convention to functions called via C++
     6        https://bugs.webkit.org/show_bug.cgi?id=51722
     7
     8        Remove the JSC_HOST_CALL from methods that are called from C++. JSC_HOST_CALL gives
     9        methods the fastcall calling convention, which leads to runtime errors when they are
     10        called from C++. Also remove a bit of unnecessary code duplication.
     11
     12        No new tests. This is covered by fast/canvas/webgl/data-view-test.html.
     13
     14        * bindings/js/JSDataViewCustom.cpp:
     15        (WebCore::getDataViewMember): Remove duplicated code.
     16        (WebCore::JSDataView::getInt8): Remove JSC_HOST_CALL.
     17        (WebCore::JSDataView::getUint8): Ditto.
     18        (WebCore::JSDataView::getFloat32): Ditto.
     19        (WebCore::JSDataView::getFloat64): Ditto.
     20        (WebCore::setDataViewMember): Remove duplicated code.
     21        (WebCore::JSDataView::setInt8): Remove JSC_HOST_CALL.
     22        (WebCore::JSDataView::setUint8): Ditto.
     23
    1242010-12-29  Dan Bernstein  <mitz@apple.com>
    225
  • trunk/WebCore/bindings/js/JSDataViewCustom.cpp

    r72718 r74760  
    6666}
    6767
    68 static JSValue getDataViewMember(ExecState* exec, DataViewAccessType type)
     68static JSValue getDataViewMember(ExecState* exec, DataView* imp, DataViewAccessType type)
    6969{
    70     JSValue thisValue = exec->hostThisValue();
    71     if (!thisValue.inherits(&JSDataView::s_info))
    72         return throwTypeError(exec);
    73     JSDataView* castedThis = static_cast<JSDataView*>(asObject(thisValue));
    74     DataView* imp = static_cast<DataView*>(castedThis->impl());
    7570    if (exec->argumentCount() < 1)
    7671        return throwError(exec, createSyntaxError(exec, "Not enough arguments"));
     
    108103}
    109104
    110 JSValue JSC_HOST_CALL JSDataView::getInt8(ExecState* exec)
     105JSValue JSDataView::getInt8(ExecState* exec)
    111106{
    112     return getDataViewMember(exec, AccessDataViewMemberAsInt8);
     107    return getDataViewMember(exec, static_cast<DataView*>(impl()), AccessDataViewMemberAsInt8);
    113108}
    114109
    115 JSValue JSC_HOST_CALL JSDataView::getUint8(ExecState* exec)
     110JSValue JSDataView::getUint8(ExecState* exec)
    116111{
    117     return getDataViewMember(exec, AccessDataViewMemberAsUint8);
     112    return getDataViewMember(exec, static_cast<DataView*>(impl()), AccessDataViewMemberAsUint8);
    118113}
    119114
    120 JSValue JSC_HOST_CALL JSDataView::getFloat32(ExecState* exec)
     115JSValue JSDataView::getFloat32(ExecState* exec)
    121116{
    122     return getDataViewMember(exec, AccessDataViewMemberAsFloat32);
     117    return getDataViewMember(exec, static_cast<DataView*>(impl()), AccessDataViewMemberAsFloat32);
    123118}
    124119
    125 JSValue JSC_HOST_CALL JSDataView::getFloat64(ExecState* exec)
     120JSValue JSDataView::getFloat64(ExecState* exec)
    126121{
    127     return getDataViewMember(exec, AccessDataViewMemberAsFloat64);
     122    return getDataViewMember(exec, static_cast<DataView*>(impl()), AccessDataViewMemberAsFloat64);
    128123}
    129124
    130 static JSValue setDataViewMember(ExecState* exec, DataViewAccessType type)
     125static JSValue setDataViewMember(ExecState* exec, DataView* imp, DataViewAccessType type)
    131126{
    132     JSValue thisValue = exec->hostThisValue();
    133     if (!thisValue.inherits(&JSDataView::s_info))
    134         return throwTypeError(exec);
    135     JSDataView* castedThis = static_cast<JSDataView*>(asObject(thisValue));
    136     DataView* imp = static_cast<DataView*>(castedThis->impl());
    137127    if (exec->argumentCount() < 2)
    138128        return throwError(exec, createSyntaxError(exec, "Not enough arguments"));
     
    160150}
    161151
    162 JSValue JSC_HOST_CALL JSDataView::setInt8(ExecState* exec)
     152JSValue JSDataView::setInt8(ExecState* exec)
    163153{
    164     return setDataViewMember(exec, AccessDataViewMemberAsInt8);
     154    return setDataViewMember(exec, static_cast<DataView*>(impl()), AccessDataViewMemberAsInt8);
    165155}
    166156
    167 JSValue JSC_HOST_CALL JSDataView::setUint8(ExecState* exec)
     157JSValue JSDataView::setUint8(ExecState* exec)
    168158{
    169     return setDataViewMember(exec, AccessDataViewMemberAsUint8);
     159    return setDataViewMember(exec, static_cast<DataView*>(impl()), AccessDataViewMemberAsUint8);
    170160}
    171161
Note: See TracChangeset for help on using the changeset viewer.