diff options
author | Ben Murdoch <benm@google.com> | 2009-08-11 17:01:47 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2009-08-11 18:21:02 +0100 |
commit | 0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5 (patch) | |
tree | 2943df35f62d885c89d01063cc528dd73b480fea /JavaScriptCore/API/APICast.h | |
parent | 7e7a70bfa49a1122b2597a1e6367d89eb4035eca (diff) | |
download | external_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.zip external_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.tar.gz external_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.tar.bz2 |
Merge in WebKit r47029.
Diffstat (limited to 'JavaScriptCore/API/APICast.h')
-rw-r--r-- | JavaScriptCore/API/APICast.h | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/JavaScriptCore/API/APICast.h b/JavaScriptCore/API/APICast.h index 762a15e..b6d1532 100644 --- a/JavaScriptCore/API/APICast.h +++ b/JavaScriptCore/API/APICast.h @@ -26,7 +26,7 @@ #ifndef APICast_h #define APICast_h -#include "JSNumberCell.h" +#include "JSAPIValueWrapper.h" #include "JSValue.h" #include <wtf/Platform.h> #include <wtf/UnusedParam.h> @@ -58,18 +58,18 @@ inline JSC::ExecState* toJS(JSGlobalContextRef c) return reinterpret_cast<JSC::ExecState*>(c); } -inline JSC::JSValue toJS(JSC::ExecState* exec, JSValueRef v) +inline JSC::JSValue toJS(JSC::ExecState*, JSValueRef v) { - JSC::JSValue jsValue = JSC::JSValue::decode(reinterpret_cast<JSC::EncodedJSValue>(const_cast<OpaqueJSValue*>(v))); -#if USE(ALTERNATE_JSIMMEDIATE) - UNUSED_PARAM(exec); +#if USE(JSVALUE32_64) + JSC::JSCell* jsCell = reinterpret_cast<JSC::JSCell*>(const_cast<OpaqueJSValue*>(v)); + if (!jsCell) + return JSC::JSValue(); + if (jsCell->isAPIValueWrapper()) + return static_cast<JSC::JSAPIValueWrapper*>(jsCell)->value(); + return jsCell; #else - if (jsValue && jsValue.isNumber()) { - ASSERT(jsValue.isAPIMangledNumber()); - return JSC::jsNumber(exec, jsValue.uncheckedGetNumber()); - } + return JSC::JSValue::decode(reinterpret_cast<JSC::EncodedJSValue>(const_cast<OpaqueJSValue*>(v))); #endif - return jsValue; } inline JSC::JSObject* toJS(JSObjectRef o) @@ -89,15 +89,16 @@ inline JSC::JSGlobalData* toJS(JSContextGroupRef g) inline JSValueRef toRef(JSC::ExecState* exec, JSC::JSValue v) { -#if USE(ALTERNATE_JSIMMEDIATE) - UNUSED_PARAM(exec); +#if USE(JSVALUE32_64) + if (!v) + return 0; + if (!v.isCell()) + return reinterpret_cast<JSValueRef>(asCell(JSC::jsAPIValueWrapper(exec, v))); + return reinterpret_cast<JSValueRef>(asCell(v)); #else - if (v && v.isNumber()) { - ASSERT(!v.isAPIMangledNumber()); - return reinterpret_cast<JSValueRef>(JSC::JSValue::encode(JSC::jsAPIMangledNumber(exec, v.uncheckedGetNumber()))); - } -#endif + UNUSED_PARAM(exec); return reinterpret_cast<JSValueRef>(JSC::JSValue::encode(v)); +#endif } inline JSObjectRef toRef(JSC::JSObject* o) |