diff options
| author | Ben Murdoch <benm@google.com> | 2010-10-22 13:02:20 +0100 |
|---|---|---|
| committer | Ben Murdoch <benm@google.com> | 2010-10-26 15:21:41 +0100 |
| commit | a94275402997c11dd2e778633dacf4b7e630a35d (patch) | |
| tree | e66f56c67e3b01f22c9c23cd932271ee9ac558ed /JavaScriptCore/runtime/JSNumberCell.h | |
| parent | 09e26c78506587b3f5d930d7bc72a23287ffbec0 (diff) | |
| download | external_webkit-a94275402997c11dd2e778633dacf4b7e630a35d.zip external_webkit-a94275402997c11dd2e778633dacf4b7e630a35d.tar.gz external_webkit-a94275402997c11dd2e778633dacf4b7e630a35d.tar.bz2 | |
Merge WebKit at r70209: Initial merge by Git
Change-Id: Id23a68efa36e9d1126bcce0b137872db00892c8e
Diffstat (limited to 'JavaScriptCore/runtime/JSNumberCell.h')
| -rw-r--r-- | JavaScriptCore/runtime/JSNumberCell.h | 165 |
1 files changed, 2 insertions, 163 deletions
diff --git a/JavaScriptCore/runtime/JSNumberCell.h b/JavaScriptCore/runtime/JSNumberCell.h index cdd2d8c..a25c531 100644 --- a/JavaScriptCore/runtime/JSNumberCell.h +++ b/JavaScriptCore/runtime/JSNumberCell.h @@ -35,167 +35,6 @@ namespace JSC { extern const double NaN; extern const double Inf; -#if USE(JSVALUE32) - JSValue jsNumberCell(ExecState*, double); - - class Identifier; - class JSCell; - class JSObject; - class JSString; - class PropertySlot; - - struct ClassInfo; - struct Instruction; - - class JSNumberCell : public JSCell { - friend class JIT; - friend JSValue jsNumberCell(JSGlobalData*, double); - friend JSValue jsNumberCell(ExecState*, double); - - public: - double value() const { return m_value; } - - virtual JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const; - virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue& value); - virtual bool toBoolean(ExecState*) const; - virtual double toNumber(ExecState*) const; - virtual UString toString(ExecState*) const; - virtual JSObject* toObject(ExecState*) const; - - virtual JSObject* toThisObject(ExecState*) const; - virtual JSValue getJSNumber(); - - void* operator new(size_t size, ExecState* exec) - { - return exec->heap()->allocateNumber(size); - } - - void* operator new(size_t size, JSGlobalData* globalData) - { - return globalData->heap.allocateNumber(size); - } - - static PassRefPtr<Structure> createStructure(JSValue proto) { return Structure::create(proto, TypeInfo(NumberType, OverridesGetOwnPropertySlot | NeedsThisConversion), AnonymousSlotCount); } - - private: - JSNumberCell(JSGlobalData* globalData, double value) - : JSCell(globalData->numberStructure.get()) - , m_value(value) - { - } - - JSNumberCell(ExecState* exec, double value) - : JSCell(exec->globalData().numberStructure.get()) - , m_value(value) - { - } - - virtual bool getUInt32(uint32_t&) const; - - double m_value; - }; - - JSValue jsNumberCell(JSGlobalData*, double); - - inline bool isNumberCell(JSValue v) - { - return v.isCell() && v.asCell()->isNumber(); - } - - inline JSNumberCell* asNumberCell(JSValue v) - { - ASSERT(isNumberCell(v)); - return static_cast<JSNumberCell*>(v.asCell()); - } - - ALWAYS_INLINE JSValue::JSValue(EncodeAsDoubleTag, ExecState* exec, double d) - { - *this = jsNumberCell(exec, d); - } - - inline JSValue::JSValue(ExecState* exec, double d) - { - JSValue v = JSImmediate::from(d); - *this = v ? v : jsNumberCell(exec, d); - } - - inline JSValue::JSValue(ExecState* exec, int i) - { - JSValue v = JSImmediate::from(i); - *this = v ? v : jsNumberCell(exec, i); - } - - inline JSValue::JSValue(ExecState* exec, unsigned i) - { - JSValue v = JSImmediate::from(i); - *this = v ? v : jsNumberCell(exec, i); - } - - inline JSValue::JSValue(ExecState* exec, long i) - { - JSValue v = JSImmediate::from(i); - *this = v ? v : jsNumberCell(exec, i); - } - - inline JSValue::JSValue(ExecState* exec, unsigned long i) - { - JSValue v = JSImmediate::from(i); - *this = v ? v : jsNumberCell(exec, i); - } - - inline JSValue::JSValue(ExecState* exec, long long i) - { - JSValue v = JSImmediate::from(i); - *this = v ? v : jsNumberCell(exec, static_cast<double>(i)); - } - - inline JSValue::JSValue(ExecState* exec, unsigned long long i) - { - JSValue v = JSImmediate::from(i); - *this = v ? v : jsNumberCell(exec, static_cast<double>(i)); - } - - inline JSValue::JSValue(JSGlobalData* globalData, double d) - { - JSValue v = JSImmediate::from(d); - *this = v ? v : jsNumberCell(globalData, d); - } - - inline JSValue::JSValue(JSGlobalData* globalData, int i) - { - JSValue v = JSImmediate::from(i); - *this = v ? v : jsNumberCell(globalData, i); - } - - inline JSValue::JSValue(JSGlobalData* globalData, unsigned i) - { - JSValue v = JSImmediate::from(i); - *this = v ? v : jsNumberCell(globalData, i); - } - - inline bool JSValue::isDouble() const - { - return isNumberCell(asValue()); - } - - inline double JSValue::asDouble() const - { - return asNumberCell(asValue())->value(); - } - - inline bool JSValue::isNumber() const - { - return JSImmediate::isNumber(asValue()) || isDouble(); - } - - inline double JSValue::uncheckedGetNumber() const - { - ASSERT(isNumber()); - return JSImmediate::isImmediate(asValue()) ? JSImmediate::toDouble(asValue()) : asDouble(); - } - -#endif // USE(JSVALUE32) - #if USE(JSVALUE64) ALWAYS_INLINE JSValue::JSValue(EncodeAsDoubleTag, ExecState*, double d) { @@ -295,7 +134,7 @@ namespace JSC { #endif // USE(JSVALUE64) -#if USE(JSVALUE32) || USE(JSVALUE64) +#if USE(JSVALUE64) inline JSValue::JSValue(ExecState*, char i) { @@ -351,7 +190,7 @@ namespace JSC { return true; } -#endif // USE(JSVALUE32) || USE(JSVALUE64) +#endif // USE(JSVALUE64) } // namespace JSC |
