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

JavaScriptCore:

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

Roll JSC API number marshaling back in.

WebCore:

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

Roll JSC API number marshaling back in.

File:
1 edited

Legend:

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

    r43153 r43157  
    126126            if (!propertyNameRef)
    127127                propertyNameRef = OpaqueJSString::create(propertyName.ustring());
    128             JSLock::DropAllLocks dropAllLocks(exec);
    129             JSValueRef exception = 0;
    130             JSValueRef value = getProperty(ctx, thisRef, propertyNameRef.get(), &exception);
    131             exec->setException(toJS(exception));
     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));
    132135            if (value) {
    133                 slot.setValue(toJS(value));
     136                slot.setValue(toJS(exec, value));
    134137                return true;
    135138            }
     
    170173    JSObjectRef thisRef = toRef(this);
    171174    RefPtr<OpaqueJSString> propertyNameRef;
    172     JSValueRef valueRef = toRef(value);
     175    JSValueRef valueRef = toRef(exec, value);
    173176   
    174177    for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) {
     
    176179            if (!propertyNameRef)
    177180                propertyNameRef = OpaqueJSString::create(propertyName.ustring());
    178             JSLock::DropAllLocks dropAllLocks(exec);
    179             JSValueRef exception = 0;
    180             bool result = setProperty(ctx, thisRef, propertyNameRef.get(), valueRef, &exception);
    181             exec->setException(toJS(exception));
     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));
    182188            if (result || exception)
    183189                return;
     
    191197                    if (!propertyNameRef)
    192198                        propertyNameRef = OpaqueJSString::create(propertyName.ustring());
    193                     JSLock::DropAllLocks dropAllLocks(exec);
    194199                    JSValueRef exception = 0;
    195                     bool result = setProperty(ctx, thisRef, propertyNameRef.get(), valueRef, &exception);
    196                     exec->setException(toJS(exception));
     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));
    197206                    if (result || exception)
    198207                        return;
     
    226235            if (!propertyNameRef)
    227236                propertyNameRef = OpaqueJSString::create(propertyName.ustring());
    228             JSLock::DropAllLocks dropAllLocks(exec);
    229             JSValueRef exception = 0;
    230             bool result = deleteProperty(ctx, thisRef, propertyNameRef.get(), &exception);
    231             exec->setException(toJS(exception));
     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));
    232244            if (result || exception)
    233245                return true;
     
    283295            Vector<JSValueRef, 16> arguments(argumentCount);
    284296            for (int i = 0; i < argumentCount; i++)
    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));
     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));
    290305            return result;
    291306        }
     
    304319    for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) {
    305320        if (JSObjectHasInstanceCallback hasInstance = jsClass->hasInstance) {
    306             JSLock::DropAllLocks dropAllLocks(exec);
    307             JSValueRef exception = 0;
    308             bool result = hasInstance(execRef, thisRef, toRef(value), &exception);
    309             exec->setException(toJS(exception));
     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));
    310328            return result;
    311329        }
     
    338356            Vector<JSValueRef, 16> arguments(argumentCount);
    339357            for (int i = 0; i < argumentCount; i++)
    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));
     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));
    345366            return result;
    346367        }
     
    402423    for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass)
    403424        if (JSObjectConvertToTypeCallback convertToType = jsClass->convertToType) {
    404             JSLock::DropAllLocks dropAllLocks(exec);
    405            
    406             JSValueRef exception = 0;
    407             JSValueRef value = convertToType(ctx, thisRef, kJSTypeNumber, &exception);
    408             exec->setException(toJS(exception));
     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));
    409432            if (value) {
    410433                double dValue;
    411                 return toJS(value).getNumber(dValue) ? dValue : NaN;
     434                return toJS(exec, value).getNumber(dValue) ? dValue : NaN;
    412435            }
    413436        }
     
    424447    for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass)
    425448        if (JSObjectConvertToTypeCallback convertToType = jsClass->convertToType) {
     449            JSValueRef exception = 0;
    426450            JSValueRef value;
    427             JSValueRef exception = 0;
    428451            {
    429452                JSLock::DropAllLocks dropAllLocks(exec);
    430453                value = convertToType(ctx, thisRef, kJSTypeString, &exception);
    431                 exec->setException(toJS(exception));
    432             }
     454            }
     455            exec->setException(toJS(exec, exception));
    433456            if (value)
    434                 return toJS(value).getString();
     457                return toJS(exec, value).getString();
    435458            if (exception)
    436459                return "";
     
    476499                    if (!propertyNameRef)
    477500                        propertyNameRef = OpaqueJSString::create(propertyName.ustring());
    478                     JSLock::DropAllLocks dropAllLocks(exec);
    479501                    JSValueRef exception = 0;
    480                     JSValueRef value = getProperty(toRef(exec), thisRef, propertyNameRef.get(), &exception);
    481                     exec->setException(toJS(exception));
     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));
    482508                    if (value)
    483                         return toJS(value);
     509                        return toJS(exec, value);
    484510                    if (exception)
    485511                        return jsUndefined();
     
    526552            if (!propertyNameRef)
    527553                propertyNameRef = OpaqueJSString::create(propertyName.ustring());
    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));
     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));
    533561            if (value)
    534                 return toJS(value);
     562                return toJS(exec, value);
    535563            if (exception)
    536564                return jsUndefined();
Note: See TracChangeset for help on using the changeset viewer.