Changeset 43158 in webkit for trunk/JavaScriptCore/API


Ignore:
Timestamp:
May 3, 2009, 12:56:13 PM (16 years ago)
Author:
[email protected]
Message:

JavaScriptCore:

2009-05-03 Sam Weinig <[email protected]>

Roll JSC API number marshaling back out. It still breaks windows.

WebCore:

2009-05-03 Sam Weinig <[email protected]>

Roll JSC API number marshaling back out. It still breaks windows.

Location:
trunk/JavaScriptCore/API
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/API/APICast.h

    r43157 r43158  
    2727#define APICast_h
    2828
    29 #include "JSNumberCell.h"
    3029#include "JSValue.h"
    31 #include <wtf/Platform.h>
    3230
    3331namespace JSC {
     
    5856}
    5957
    60 inline JSC::JSValue toJS(JSC::ExecState* exec, JSValueRef v)
     58inline JSC::JSValue toJS(JSValueRef v)
    6159{
    62     JSC::JSValue jsValue = JSC::JSValue::decode(reinterpret_cast<JSC::EncodedJSValue>(const_cast<OpaqueJSValue*>(v)));
    63 #if !USE(ALTERNATE_JSIMMEDIATE)
    64     if (jsValue && jsValue.isNumber()) {
    65         ASSERT(jsValue.isAPIMangledNumber());
    66         return JSC::jsNumber(exec, jsValue.uncheckedGetNumber());
    67     }
    68 #endif
    69     return jsValue;
     60    return JSC::JSValue::decode(reinterpret_cast<JSC::EncodedJSValue>(const_cast<OpaqueJSValue*>(v)));
    7061}
    7162
     
    8576}
    8677
    87 inline JSValueRef toRef(JSC::ExecState* exec, JSC::JSValue v)
     78inline JSValueRef toRef(JSC::JSValue v)
    8879{
    89 #if !USE(ALTERNATE_JSIMMEDIATE)
    90     if (v && v.isNumber()) {
    91         ASSERT(!v.isAPIMangledNumber());
    92         return reinterpret_cast<JSValueRef>(JSC::JSValue::encode(JSC::jsAPIMangledNumber(exec, v.uncheckedGetNumber())));
    93     }
    94 #endif
    9580    return reinterpret_cast<JSValueRef>(JSC::JSValue::encode(v));
     81}
     82
     83inline JSValueRef* toRef(JSC::JSValue* v)
     84{
     85    return reinterpret_cast<JSValueRef*>(v);
    9686}
    9787
  • trunk/JavaScriptCore/API/JSBase.cpp

    r43157 r43158  
    5656    if (completion.complType() == Throw) {
    5757        if (exception)
    58             *exception = toRef(exec, completion.value());
     58            *exception = toRef(completion.value());
    5959        return 0;
    6060    }
    6161
    6262    if (completion.value())
    63         return toRef(exec, completion.value());
     63        return toRef(completion.value());
    6464   
    6565    // happens, for example, when the only statement is an empty (';') statement
    66     return toRef(exec, jsUndefined());
     66    return toRef(jsUndefined());
    6767}
    6868
     
    7777    if (completion.complType() == Throw) {
    7878        if (exception)
    79             *exception = toRef(exec, completion.value());
     79            *exception = toRef(completion.value());
    8080        return false;
    8181    }
  • trunk/JavaScriptCore/API/JSCallbackConstructor.cpp

    r43157 r43158  
    6262        Vector<JSValueRef, 16> arguments(argumentCount);
    6363        for (int i = 0; i < argumentCount; i++)
    64             arguments[i] = toRef(exec, args.at(i));
    65 
    66         JSValueRef exception = 0;
    67         JSObjectRef result;
    68         {
    69             JSLock::DropAllLocks dropAllLocks(exec);
    70             result = callback(ctx, constructorRef, argumentCount, arguments.data(), &exception);
    71         }
    72         if (exception)
    73             exec->setException(toJS(exec, exception));
    74         return toJS(result);
     64            arguments[i] = toRef(args.at(i));
     65           
     66        JSLock::DropAllLocks dropAllLocks(exec);
     67        return toJS(callback(ctx, constructorRef, argumentCount, arguments.data(), toRef(exec->exceptionSlot())));
    7568    }
    7669   
  • trunk/JavaScriptCore/API/JSCallbackFunction.cpp

    r43157 r43158  
    5656    Vector<JSValueRef, 16> arguments(argumentCount);
    5757    for (int i = 0; i < argumentCount; i++)
    58         arguments[i] = toRef(exec, args.at(i));
     58        arguments[i] = toRef(args.at(i));
    5959
    60     JSValueRef exception = 0;
    61     JSValueRef result;
    62     {
    63         JSLock::DropAllLocks dropAllLocks(exec);
    64         result = static_cast<JSCallbackFunction*>(functionObject)->m_callback(execRef, functionRef, thisObjRef, argumentCount, arguments.data(), &exception);
    65     }
    66     if (exception)
    67         exec->setException(toJS(exec, exception));
    68 
    69     return toJS(exec, result);
     60    JSLock::DropAllLocks dropAllLocks(exec);
     61    return toJS(static_cast<JSCallbackFunction*>(functionObject)->m_callback(execRef, functionRef, thisObjRef, argumentCount, arguments.data(), toRef(exec->exceptionSlot())));
    7062}
    7163
  • trunk/JavaScriptCore/API/JSCallbackObjectFunctions.h

    r43157 r43158  
    126126            if (!propertyNameRef)
    127127                propertyNameRef = OpaqueJSString::create(propertyName.ustring());
    128             JSValueRef exception = 0;
    129             JSValueRef value;
    130             {
    131                 JSLock::DropAllLocks dropAllLocks(exec);
    132                 value = getProperty(ctx, thisRef, propertyNameRef.get(), &exception);
    133             }
    134             exec->setException(toJS(exec, exception));
     128            JSLock::DropAllLocks dropAllLocks(exec);
     129            JSValueRef exception = 0;
     130            JSValueRef value = getProperty(ctx, thisRef, propertyNameRef.get(), &exception);
     131            exec->setException(toJS(exception));
    135132            if (value) {
    136                 slot.setValue(toJS(exec, value));
     133                slot.setValue(toJS(value));
    137134                return true;
    138135            }
     
    173170    JSObjectRef thisRef = toRef(this);
    174171    RefPtr<OpaqueJSString> propertyNameRef;
    175     JSValueRef valueRef = toRef(exec, value);
     172    JSValueRef valueRef = toRef(value);
    176173   
    177174    for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) {
     
    179176            if (!propertyNameRef)
    180177                propertyNameRef = OpaqueJSString::create(propertyName.ustring());
    181             JSValueRef exception = 0;
    182             bool result;
    183             {
    184                 JSLock::DropAllLocks dropAllLocks(exec);
    185                 result = setProperty(ctx, thisRef, propertyNameRef.get(), valueRef, &exception);
    186             }
    187             exec->setException(toJS(exec, exception));
     178            JSLock::DropAllLocks dropAllLocks(exec);
     179            JSValueRef exception = 0;
     180            bool result = setProperty(ctx, thisRef, propertyNameRef.get(), valueRef, &exception);
     181            exec->setException(toJS(exception));
    188182            if (result || exception)
    189183                return;
     
    197191                    if (!propertyNameRef)
    198192                        propertyNameRef = OpaqueJSString::create(propertyName.ustring());
     193                    JSLock::DropAllLocks dropAllLocks(exec);
    199194                    JSValueRef exception = 0;
    200                     bool result;
    201                     {
    202                         JSLock::DropAllLocks dropAllLocks(exec);
    203                         result = setProperty(ctx, thisRef, propertyNameRef.get(), valueRef, &exception);
    204                     }
    205                     exec->setException(toJS(exec, exception));
     195                    bool result = setProperty(ctx, thisRef, propertyNameRef.get(), valueRef, &exception);
     196                    exec->setException(toJS(exception));
    206197                    if (result || exception)
    207198                        return;
     
    235226            if (!propertyNameRef)
    236227                propertyNameRef = OpaqueJSString::create(propertyName.ustring());
    237             JSValueRef exception = 0;
    238             bool result;
    239             {
    240                 JSLock::DropAllLocks dropAllLocks(exec);
    241                 result = deleteProperty(ctx, thisRef, propertyNameRef.get(), &exception);
    242             }
    243             exec->setException(toJS(exec, exception));
     228            JSLock::DropAllLocks dropAllLocks(exec);
     229            JSValueRef exception = 0;
     230            bool result = deleteProperty(ctx, thisRef, propertyNameRef.get(), &exception);
     231            exec->setException(toJS(exception));
    244232            if (result || exception)
    245233                return true;
     
    295283            Vector<JSValueRef, 16> arguments(argumentCount);
    296284            for (int i = 0; i < argumentCount; i++)
    297                 arguments[i] = toRef(exec, args.at(i));
    298             JSValueRef exception = 0;
    299             JSObject* result;
    300             {
    301                 JSLock::DropAllLocks dropAllLocks(exec);
    302                 result = toJS(callAsConstructor(execRef, constructorRef, argumentCount, arguments.data(), &exception));
    303             }
    304             exec->setException(toJS(exec, exception));
     285                arguments[i] = toRef(args.at(i));
     286            JSLock::DropAllLocks dropAllLocks(exec);
     287            JSValueRef exception = 0;
     288            JSObject* result = toJS(callAsConstructor(execRef, constructorRef, argumentCount, arguments.data(), &exception));
     289            exec->setException(toJS(exception));
    305290            return result;
    306291        }
     
    319304    for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) {
    320305        if (JSObjectHasInstanceCallback hasInstance = jsClass->hasInstance) {
    321             JSValueRef exception = 0;
    322             bool result;
    323             {
    324                 JSLock::DropAllLocks dropAllLocks(exec);
    325                 result = hasInstance(execRef, thisRef, toRef(exec, value), &exception);
    326             }
    327             exec->setException(toJS(exec, exception));
     306            JSLock::DropAllLocks dropAllLocks(exec);
     307            JSValueRef exception = 0;
     308            bool result = hasInstance(execRef, thisRef, toRef(value), &exception);
     309            exec->setException(toJS(exception));
    328310            return result;
    329311        }
     
    356338            Vector<JSValueRef, 16> arguments(argumentCount);
    357339            for (int i = 0; i < argumentCount; i++)
    358                 arguments[i] = toRef(exec, args.at(i));
    359             JSValueRef exception = 0;
    360             JSValue result;
    361             {
    362                 JSLock::DropAllLocks dropAllLocks(exec);
    363                 result = toJS(exec, callAsFunction(execRef, functionRef, thisObjRef, argumentCount, arguments.data(), &exception));
    364             }
    365             exec->setException(toJS(exec, exception));
     340                arguments[i] = toRef(args.at(i));
     341            JSLock::DropAllLocks dropAllLocks(exec);
     342            JSValueRef exception = 0;
     343            JSValue result = toJS(callAsFunction(execRef, functionRef, thisObjRef, argumentCount, arguments.data(), &exception));
     344            exec->setException(toJS(exception));
    366345            return result;
    367346        }
     
    423402    for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass)
    424403        if (JSObjectConvertToTypeCallback convertToType = jsClass->convertToType) {
    425             JSValueRef exception = 0;
    426             JSValueRef value;
    427             {
    428                 JSLock::DropAllLocks dropAllLocks(exec);
    429                 value = convertToType(ctx, thisRef, kJSTypeNumber, &exception);
    430             }
    431             exec->setException(toJS(exec, exception));
     404            JSLock::DropAllLocks dropAllLocks(exec);
     405           
     406            JSValueRef exception = 0;
     407            JSValueRef value = convertToType(ctx, thisRef, kJSTypeNumber, &exception);
     408            exec->setException(toJS(exception));
    432409            if (value) {
    433410                double dValue;
    434                 return toJS(exec, value).getNumber(dValue) ? dValue : NaN;
     411                return toJS(value).getNumber(dValue) ? dValue : NaN;
    435412            }
    436413        }
     
    447424    for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass)
    448425        if (JSObjectConvertToTypeCallback convertToType = jsClass->convertToType) {
    449             JSValueRef exception = 0;
    450426            JSValueRef value;
     427            JSValueRef exception = 0;
    451428            {
    452429                JSLock::DropAllLocks dropAllLocks(exec);
    453430                value = convertToType(ctx, thisRef, kJSTypeString, &exception);
    454             }
    455             exec->setException(toJS(exec, exception));
     431                exec->setException(toJS(exception));
     432            }
    456433            if (value)
    457                 return toJS(exec, value).getString();
     434                return toJS(value).getString();
    458435            if (exception)
    459436                return "";
     
    499476                    if (!propertyNameRef)
    500477                        propertyNameRef = OpaqueJSString::create(propertyName.ustring());
     478                    JSLock::DropAllLocks dropAllLocks(exec);
    501479                    JSValueRef exception = 0;
    502                     JSValueRef value;
    503                     {
    504                         JSLock::DropAllLocks dropAllLocks(exec);
    505                         value = getProperty(toRef(exec), thisRef, propertyNameRef.get(), &exception);
    506                     }
    507                     exec->setException(toJS(exec, exception));
     480                    JSValueRef value = getProperty(toRef(exec), thisRef, propertyNameRef.get(), &exception);
     481                    exec->setException(toJS(exception));
    508482                    if (value)
    509                         return toJS(exec, value);
     483                        return toJS(value);
    510484                    if (exception)
    511485                        return jsUndefined();
     
    552526            if (!propertyNameRef)
    553527                propertyNameRef = OpaqueJSString::create(propertyName.ustring());
    554             JSValueRef exception = 0;
    555             JSValueRef value;
    556             {
    557                 JSLock::DropAllLocks dropAllLocks(exec);
    558                 value = getProperty(toRef(exec), thisRef, propertyNameRef.get(), &exception);
    559             }
    560             exec->setException(toJS(exec, exception));
     528            JSLock::DropAllLocks dropAllLocks(exec);
     529
     530            JSValueRef exception = 0;
     531            JSValueRef value = getProperty(toRef(exec), thisRef, propertyNameRef.get(), &exception);
     532            exec->setException(toJS(exception));
    561533            if (value)
    562                 return toJS(exec, value);
     534                return toJS(value);
    563535            if (exception)
    564536                return jsUndefined();
  • trunk/JavaScriptCore/API/JSObjectRef.cpp

    r43157 r43158  
    131131    if (exec->hadException()) {
    132132        if (exception)
    133             *exception = toRef(exec, exec->exception());
     133            *exception = toRef(exec->exception());
    134134        exec->clearException();
    135135        result = 0;
     
    148148        MarkedArgumentBuffer argList;
    149149        for (size_t i = 0; i < argumentCount; ++i)
    150             argList.append(toJS(exec, arguments[i]));
     150            argList.append(toJS(arguments[i]));
    151151
    152152        result = constructArray(exec, argList);
     
    156156    if (exec->hadException()) {
    157157        if (exception)
    158             *exception = toRef(exec, exec->exception());
     158            *exception = toRef(exec->exception());
    159159        exec->clearException();
    160160        result = 0;
     
    172172    MarkedArgumentBuffer argList;
    173173    for (size_t i = 0; i < argumentCount; ++i)
    174         argList.append(toJS(exec, arguments[i]));
     174        argList.append(toJS(arguments[i]));
    175175
    176176    JSObject* result = constructDate(exec, argList);
    177177    if (exec->hadException()) {
    178178        if (exception)
    179             *exception = toRef(exec, exec->exception());
     179            *exception = toRef(exec->exception());
    180180        exec->clearException();
    181181        result = 0;
     
    193193    MarkedArgumentBuffer argList;
    194194    for (size_t i = 0; i < argumentCount; ++i)
    195         argList.append(toJS(exec, arguments[i]));
     195        argList.append(toJS(arguments[i]));
    196196
    197197    JSObject* result = constructError(exec, argList);
    198198    if (exec->hadException()) {
    199199        if (exception)
    200             *exception = toRef(exec, exec->exception());
     200            *exception = toRef(exec->exception());
    201201        exec->clearException();
    202202        result = 0;
     
    214214    MarkedArgumentBuffer argList;
    215215    for (size_t i = 0; i < argumentCount; ++i)
    216         argList.append(toJS(exec, arguments[i]));
     216        argList.append(toJS(arguments[i]));
    217217
    218218    JSObject* result = constructRegExp(exec, argList);
    219219    if (exec->hadException()) {
    220220        if (exception)
    221             *exception = toRef(exec, exec->exception());
     221            *exception = toRef(exec->exception());
    222222        exec->clearException();
    223223        result = 0;
     
    227227}
    228228
    229 JSValueRef JSObjectGetPrototype(JSContextRef ctx, JSObjectRef object)
    230 {
    231     ExecState* exec = toJS(ctx);
    232     exec->globalData().heap.registerThread();
    233     JSLock lock(exec);
    234 
    235     JSObject* jsObject = toJS(object);
    236     return toRef(exec, jsObject->prototype());
    237 }
    238 
    239 void JSObjectSetPrototype(JSContextRef ctx, JSObjectRef object, JSValueRef value)
    240 {
    241     ExecState* exec = toJS(ctx);
    242     exec->globalData().heap.registerThread();
    243     JSLock lock(exec);
    244 
    245     JSObject* jsObject = toJS(object);
    246     JSValue jsValue = toJS(exec, value);
     229JSValueRef JSObjectGetPrototype(JSContextRef, JSObjectRef object)
     230{
     231    JSObject* jsObject = toJS(object);
     232    return toRef(jsObject->prototype());
     233}
     234
     235void JSObjectSetPrototype(JSContextRef, JSObjectRef object, JSValueRef value)
     236{
     237    JSObject* jsObject = toJS(object);
     238    JSValue jsValue = toJS(value);
    247239
    248240    jsObject->setPrototype(jsValue.isObject() ? jsValue : jsNull());
     
    271263    if (exec->hadException()) {
    272264        if (exception)
    273             *exception = toRef(exec, exec->exception());
    274         exec->clearException();
    275     }
    276     return toRef(exec, jsValue);
     265            *exception = toRef(exec->exception());
     266        exec->clearException();
     267    }
     268    return toRef(jsValue);
    277269}
    278270
     
    285277    JSObject* jsObject = toJS(object);
    286278    Identifier name(propertyName->identifier(&exec->globalData()));
    287     JSValue jsValue = toJS(exec, value);
     279    JSValue jsValue = toJS(value);
    288280
    289281    if (attributes && !jsObject->hasProperty(exec, name))
     
    296288    if (exec->hadException()) {
    297289        if (exception)
    298             *exception = toRef(exec, exec->exception());
     290            *exception = toRef(exec->exception());
    299291        exec->clearException();
    300292    }
     
    312304    if (exec->hadException()) {
    313305        if (exception)
    314             *exception = toRef(exec, exec->exception());
    315         exec->clearException();
    316     }
    317     return toRef(exec, jsValue);
     306            *exception = toRef(exec->exception());
     307        exec->clearException();
     308    }
     309    return toRef(jsValue);
    318310}
    319311
     
    326318
    327319    JSObject* jsObject = toJS(object);
    328     JSValue jsValue = toJS(exec, value);
     320    JSValue jsValue = toJS(value);
    329321   
    330322    jsObject->put(exec, propertyIndex, jsValue);
    331323    if (exec->hadException()) {
    332324        if (exception)
    333             *exception = toRef(exec, exec->exception());
     325            *exception = toRef(exec->exception());
    334326        exec->clearException();
    335327    }
     
    347339    if (exec->hadException()) {
    348340        if (exception)
    349             *exception = toRef(exec, exec->exception());
     341            *exception = toRef(exec->exception());
    350342        exec->clearException();
    351343    }
     
    400392    MarkedArgumentBuffer argList;
    401393    for (size_t i = 0; i < argumentCount; i++)
    402         argList.append(toJS(exec, arguments[i]));
     394        argList.append(toJS(arguments[i]));
    403395
    404396    CallData callData;
     
    407399        return 0;
    408400
    409     JSValueRef result = toRef(exec, call(exec, jsObject, callType, callData, jsThisObject, argList));
    410     if (exec->hadException()) {
    411         if (exception)
    412             *exception = toRef(exec, exec->exception());
     401    JSValueRef result = toRef(call(exec, jsObject, callType, callData, jsThisObject, argList));
     402    if (exec->hadException()) {
     403        if (exception)
     404            *exception = toRef(exec->exception());
    413405        exec->clearException();
    414406        result = 0;
     
    439431    MarkedArgumentBuffer argList;
    440432    for (size_t i = 0; i < argumentCount; i++)
    441         argList.append(toJS(exec, arguments[i]));
     433        argList.append(toJS(arguments[i]));
    442434    JSObjectRef result = toRef(construct(exec, jsObject, constructType, constructData, argList));
    443435    if (exec->hadException()) {
    444436        if (exception)
    445             *exception = toRef(exec, exec->exception());
     437            *exception = toRef(exec->exception());
    446438        exec->clearException();
    447439        result = 0;
  • trunk/JavaScriptCore/API/JSValueRef.cpp

    r43157 r43158  
    4242#include <algorithm> // for std::min
    4343
    44 JSType JSValueGetType(JSContextRef ctx, JSValueRef value)
    45 {
    46     JSC::ExecState* exec = toJS(ctx);
    47     exec->globalData().heap.registerThread();
    48     JSC::JSLock lock(exec);
    49 
    50     JSC::JSValue jsValue = toJS(exec, value);
    51 
     44JSType JSValueGetType(JSContextRef, JSValueRef value)
     45{
     46    JSC::JSValue jsValue = toJS(value);
    5247    if (jsValue.isUndefined())
    5348        return kJSTypeUndefined;
     
    6661using namespace JSC; // placed here to avoid conflict between JSC::JSType and JSType, above.
    6762
    68 bool JSValueIsUndefined(JSContextRef ctx, JSValueRef value)
    69 {
    70     ExecState* exec = toJS(ctx);
    71     exec->globalData().heap.registerThread();
    72     JSLock lock(exec);
    73 
    74     JSValue jsValue = toJS(exec, value);
     63bool JSValueIsUndefined(JSContextRef, JSValueRef value)
     64{
     65    JSValue jsValue = toJS(value);
    7566    return jsValue.isUndefined();
    7667}
    7768
    78 bool JSValueIsNull(JSContextRef ctx, JSValueRef value)
    79 {
    80     ExecState* exec = toJS(ctx);
    81     exec->globalData().heap.registerThread();
    82     JSLock lock(exec);
    83 
    84     JSValue jsValue = toJS(exec, value);
     69bool JSValueIsNull(JSContextRef, JSValueRef value)
     70{
     71    JSValue jsValue = toJS(value);
    8572    return jsValue.isNull();
    8673}
    8774
    88 bool JSValueIsBoolean(JSContextRef ctx, JSValueRef value)
    89 {
    90     ExecState* exec = toJS(ctx);
    91     exec->globalData().heap.registerThread();
    92     JSLock lock(exec);
    93 
    94     JSValue jsValue = toJS(exec, value);
     75bool JSValueIsBoolean(JSContextRef, JSValueRef value)
     76{
     77    JSValue jsValue = toJS(value);
    9578    return jsValue.isBoolean();
    9679}
    9780
    98 bool JSValueIsNumber(JSContextRef ctx, JSValueRef value)
    99 {
    100     ExecState* exec = toJS(ctx);
    101     exec->globalData().heap.registerThread();
    102     JSLock lock(exec);
    103 
    104     JSValue jsValue = toJS(exec, value);
     81bool JSValueIsNumber(JSContextRef, JSValueRef value)
     82{
     83    JSValue jsValue = toJS(value);
    10584    return jsValue.isNumber();
    10685}
    10786
    108 bool JSValueIsString(JSContextRef ctx, JSValueRef value)
    109 {
    110     ExecState* exec = toJS(ctx);
    111     exec->globalData().heap.registerThread();
    112     JSLock lock(exec);
    113 
    114     JSValue jsValue = toJS(exec, value);
     87bool JSValueIsString(JSContextRef, JSValueRef value)
     88{
     89    JSValue jsValue = toJS(value);
    11590    return jsValue.isString();
    11691}
    11792
    118 bool JSValueIsObject(JSContextRef ctx, JSValueRef value)
    119 {
    120     ExecState* exec = toJS(ctx);
    121     exec->globalData().heap.registerThread();
    122     JSLock lock(exec);
    123 
    124     JSValue jsValue = toJS(exec, value);
     93bool JSValueIsObject(JSContextRef, JSValueRef value)
     94{
     95    JSValue jsValue = toJS(value);
    12596    return jsValue.isObject();
    12697}
    12798
    128 bool JSValueIsObjectOfClass(JSContextRef ctx, JSValueRef value, JSClassRef jsClass)
    129 {
    130     ExecState* exec = toJS(ctx);
    131     exec->globalData().heap.registerThread();
    132     JSLock lock(exec);
    133 
    134     JSValue jsValue = toJS(exec, value);
     99bool JSValueIsObjectOfClass(JSContextRef, JSValueRef value, JSClassRef jsClass)
     100{
     101    JSValue jsValue = toJS(value);
    135102   
    136103    if (JSObject* o = jsValue.getObject()) {
     
    149116    JSLock lock(exec);
    150117
    151     JSValue jsA = toJS(exec, a);
    152     JSValue jsB = toJS(exec, b);
     118    JSValue jsA = toJS(a);
     119    JSValue jsB = toJS(b);
    153120
    154121    bool result = JSValue::equal(exec, jsA, jsB); // false if an exception is thrown
    155122    if (exec->hadException()) {
    156123        if (exception)
    157             *exception = toRef(exec, exec->exception());
     124            *exception = toRef(exec->exception());
    158125        exec->clearException();
    159126    }
     
    161128}
    162129
    163 bool JSValueIsStrictEqual(JSContextRef ctx, JSValueRef a, JSValueRef b)
    164 {
    165     ExecState* exec = toJS(ctx);
    166     exec->globalData().heap.registerThread();
    167     JSLock lock(exec);
    168 
    169     JSValue jsA = toJS(exec, a);
    170     JSValue jsB = toJS(exec, b);
    171 
    172     return JSValue::strictEqual(jsA, jsB);
     130bool JSValueIsStrictEqual(JSContextRef, JSValueRef a, JSValueRef b)
     131{
     132    JSValue jsA = toJS(a);
     133    JSValue jsB = toJS(b);
     134   
     135    bool result = JSValue::strictEqual(jsA, jsB);
     136    return result;
    173137}
    174138
     
    179143    JSLock lock(exec);
    180144
    181     JSValue jsValue = toJS(exec, value);
    182 
     145    JSValue jsValue = toJS(value);
    183146    JSObject* jsConstructor = toJS(constructor);
    184147    if (!jsConstructor->structure()->typeInfo().implementsHasInstance())
     
    187150    if (exec->hadException()) {
    188151        if (exception)
    189             *exception = toRef(exec, exec->exception());
     152            *exception = toRef(exec->exception());
    190153        exec->clearException();
    191154    }
     
    193156}
    194157
    195 JSValueRef JSValueMakeUndefined(JSContextRef ctx)
    196 {
    197     ExecState* exec = toJS(ctx);
    198     exec->globalData().heap.registerThread();
    199     JSLock lock(exec);
    200 
    201     return toRef(exec, jsUndefined());
    202 }
    203 
    204 JSValueRef JSValueMakeNull(JSContextRef ctx)
    205 {
    206     ExecState* exec = toJS(ctx);
    207     exec->globalData().heap.registerThread();
    208     JSLock lock(exec);
    209 
    210     return toRef(exec, jsNull());
    211 }
    212 
    213 JSValueRef JSValueMakeBoolean(JSContextRef ctx, bool value)
    214 {
    215     ExecState* exec = toJS(ctx);
    216     exec->globalData().heap.registerThread();
    217     JSLock lock(exec);
    218 
    219     return toRef(exec, jsBoolean(value));
     158JSValueRef JSValueMakeUndefined(JSContextRef)
     159{
     160    return toRef(jsUndefined());
     161}
     162
     163JSValueRef JSValueMakeNull(JSContextRef)
     164{
     165    return toRef(jsNull());
     166}
     167
     168JSValueRef JSValueMakeBoolean(JSContextRef, bool value)
     169{
     170    return toRef(jsBoolean(value));
    220171}
    221172
     
    226177    JSLock lock(exec);
    227178
    228     return toRef(exec, jsNumber(exec, value));
     179    return toRef(jsNumber(exec, value));
    229180}
    230181
     
    235186    JSLock lock(exec);
    236187
    237     return toRef(exec, jsString(exec, string->ustring()));
     188    return toRef(jsString(exec, string->ustring()));
    238189}
    239190
     
    241192{
    242193    ExecState* exec = toJS(ctx);
    243     exec->globalData().heap.registerThread();
    244     JSLock lock(exec);
    245 
    246     JSValue jsValue = toJS(exec, value);
     194    JSValue jsValue = toJS(value);
    247195    return jsValue.toBoolean(exec);
    248196}
     
    254202    JSLock lock(exec);
    255203
    256     JSValue jsValue = toJS(exec, value);
     204    JSValue jsValue = toJS(value);
    257205
    258206    double number = jsValue.toNumber(exec);
    259207    if (exec->hadException()) {
    260208        if (exception)
    261             *exception = toRef(exec, exec->exception());
     209            *exception = toRef(exec->exception());
    262210        exec->clearException();
    263211        number = NaN;
     
    272220    JSLock lock(exec);
    273221
    274     JSValue jsValue = toJS(exec, value);
     222    JSValue jsValue = toJS(value);
    275223   
    276224    RefPtr<OpaqueJSString> stringRef(OpaqueJSString::create(jsValue.toString(exec)));
    277225    if (exec->hadException()) {
    278226        if (exception)
    279             *exception = toRef(exec, exec->exception());
     227            *exception = toRef(exec->exception());
    280228        exec->clearException();
    281229        stringRef.clear();
     
    290238    JSLock lock(exec);
    291239
    292     JSValue jsValue = toJS(exec, value);
     240    JSValue jsValue = toJS(value);
    293241   
    294242    JSObjectRef objectRef = toRef(jsValue.toObject(exec));
    295243    if (exec->hadException()) {
    296244        if (exception)
    297             *exception = toRef(exec, exec->exception());
     245            *exception = toRef(exec->exception());
    298246        exec->clearException();
    299247        objectRef = 0;
     
    308256    JSLock lock(exec);
    309257
    310     JSValue jsValue = toJS(exec, value);
     258    JSValue jsValue = toJS(value);
    311259    gcProtect(jsValue);
    312260}
     
    318266    JSLock lock(exec);
    319267
    320     JSValue jsValue = toJS(exec, value);
     268    JSValue jsValue = toJS(value);
    321269    gcUnprotect(jsValue);
    322270}
Note: See TracChangeset for help on using the changeset viewer.