Changeset 43160 in webkit for trunk/JavaScriptCore/API/APICast.h


Ignore:
Timestamp:
May 3, 2009, 2:02:04 PM (16 years ago)
Author:
[email protected]
Message:

JavaScriptCore:

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

Roll JSC API number marshaling back in one last time (I hope).

WebCore:

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

Roll JSC API number marshaling back in one last time (I hope).

File:
1 edited

Legend:

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

    r43158 r43160  
    2727#define APICast_h
    2828
     29#include "JSNumberCell.h"
    2930#include "JSValue.h"
     31#include <wtf/Platform.h>
    3032
    3133namespace JSC {
     
    5658}
    5759
    58 inline JSC::JSValue toJS(JSValueRef v)
     60inline JSC::JSValue toJS(JSC::ExecState* exec, JSValueRef v)
    5961{
    60     return JSC::JSValue::decode(reinterpret_cast<JSC::EncodedJSValue>(const_cast<OpaqueJSValue*>(v)));
     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;
    6170}
    6271
     
    7685}
    7786
    78 inline JSValueRef toRef(JSC::JSValue v)
     87inline JSValueRef toRef(JSC::ExecState* exec, JSC::JSValue v)
    7988{
     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
    8095    return reinterpret_cast<JSValueRef>(JSC::JSValue::encode(v));
    81 }
    82 
    83 inline JSValueRef* toRef(JSC::JSValue* v)
    84 {
    85     return reinterpret_cast<JSValueRef*>(v);
    8696}
    8797
Note: See TracChangeset for help on using the changeset viewer.