Commit 6a03b4c4 authored by weinig@apple.com's avatar weinig@apple.com

JavaScriptCore:

2008-07-01  Sam Weinig  <sam@webkit.org>

        Reviewed by Darin Adler.

        Split JSCell and JSNumberCell class declarations out of JSValue.h

        * GNUmakefile.am:
        * JavaScriptCore.pri:
        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
        * JavaScriptCore.xcodeproj/project.pbxproj:
        * JavaScriptCoreSources.bkl:
        * VM/JSPropertyNameIterator.h:
        * kjs/AllInOneFile.cpp:
        * kjs/JSCell.cpp: Copied from JavaScriptCore/kjs/JSValue.cpp.
        * kjs/JSCell.h: Copied from JavaScriptCore/kjs/JSValue.h.
        (KJS::JSValue::getJSNumber):
        * kjs/JSNumberCell.cpp:
        * kjs/JSNumberCell.h: Copied from JavaScriptCore/kjs/JSValue.h.
        * kjs/JSObject.h:
        * kjs/JSString.cpp:
        (KJS::jsString):
        (KJS::jsOwnedString):
        * kjs/JSString.h:
        (KJS::JSValue::toThisJSString):
        * kjs/JSValue.cpp:
        * kjs/JSValue.h:

WebCore:

2008-07-01  Sam Weinig  <sam@webkit.org>

        Reviewed by Darin Adler.

        Split JSCell and JSNumberCell class declarations out of JSValue.h

        * ForwardingHeaders/kjs/JSNumberCell.h: Added.
        * bindings/scripts/CodeGeneratorJS.pm:
        * bridge/c/c_instance.cpp:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34921 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c11a696d
2008-07-01 Sam Weinig <sam@webkit.org>
Reviewed by Darin Adler.
Split JSCell and JSNumberCell class declarations out of JSValue.h
* GNUmakefile.am:
* JavaScriptCore.pri:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* JavaScriptCoreSources.bkl:
* VM/JSPropertyNameIterator.h:
* kjs/AllInOneFile.cpp:
* kjs/JSCell.cpp: Copied from JavaScriptCore/kjs/JSValue.cpp.
* kjs/JSCell.h: Copied from JavaScriptCore/kjs/JSValue.h.
(KJS::JSValue::getJSNumber):
* kjs/JSNumberCell.cpp:
* kjs/JSNumberCell.h: Copied from JavaScriptCore/kjs/JSValue.h.
* kjs/JSObject.h:
* kjs/JSString.cpp:
(KJS::jsString):
(KJS::jsOwnedString):
* kjs/JSString.h:
(KJS::JSValue::toThisJSString):
* kjs/JSValue.cpp:
* kjs/JSValue.h:
2008-07-01 Anders Carlsson <andersca@apple.com>
Build fixes.
......@@ -96,6 +96,7 @@ javascriptcore_sources += \
JavaScriptCore/kjs/ErrorInstance.cpp \
JavaScriptCore/kjs/ErrorPrototype.cpp \
JavaScriptCore/kjs/GetterSetter.cpp \
JavaScriptCore/kjs/JSCell.cpp \
JavaScriptCore/kjs/JSFunction.cpp \
JavaScriptCore/kjs/JSNumberCell.cpp \
JavaScriptCore/kjs/JSString.cpp \
......
......@@ -87,6 +87,7 @@ SOURCES += \
kjs/identifier.cpp \
kjs/InternalFunction.cpp \
kjs/interpreter.cpp \
kjs/JSCell.cpp \
kjs/JSImmediate.cpp \
kjs/JSLock.cpp \
kjs/JSNumberCell.cpp \
......
......@@ -480,6 +480,14 @@
RelativePath="..\..\kjs\JSArray.h"
>
</File>
<File
RelativePath="..\..\kjs\JSCell.cpp"
>
</File>
<File
RelativePath="..\..\kjs\JSCell.h"
>
</File>
<File
RelativePath="..\..\kjs\JSFunction.cpp"
>
......@@ -532,6 +540,10 @@
RelativePath="..\..\kjs\JSNumberCell.cpp"
>
</File>
<File
RelativePath="..\..\kjs\JSNumberCell.h"
>
</File>
<File
RelativePath="..\..\kjs\JSObject.cpp"
>
......
......@@ -98,6 +98,7 @@
BC02E98D0E183E38000F9297 /* ErrorInstance.h in Headers */ = {isa = PBXBuildFile; fileRef = BC02E98B0E183E38000F9297 /* ErrorInstance.h */; };
BC1166020E1997B4008066DD /* DateInstance.h in Headers */ = {isa = PBXBuildFile; fileRef = BC1166010E1997B1008066DD /* DateInstance.h */; };
BC11667B0E199C05008066DD /* InternalFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = BC11667A0E199C05008066DD /* InternalFunction.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC1167DA0E19BCC9008066DD /* JSCell.h in Headers */ = {isa = PBXBuildFile; fileRef = BC1167D80E19BCC9008066DD /* JSCell.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC18C3E40E16F5CD00B34460 /* AlwaysInline.h in Headers */ = {isa = PBXBuildFile; fileRef = 93AA4F770957251F0084B3A7 /* AlwaysInline.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC18C3E50E16F5CD00B34460 /* APICast.h in Headers */ = {isa = PBXBuildFile; fileRef = 1482B78A0A4305AB00517CFC /* APICast.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC18C3E60E16F5CD00B34460 /* ArrayConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7952070E15E8A800A898AB /* ArrayConstructor.h */; };
......@@ -246,6 +247,7 @@
BC18C52C0E16FCD200B34460 /* RegExpObject.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = BC18C52B0E16FCD200B34460 /* RegExpObject.lut.h */; };
BC18C52E0E16FCE100B34460 /* lexer.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = BC18C52D0E16FCE100B34460 /* lexer.lut.h */; };
BC18C5300E16FCEB00B34460 /* grammar.h in Headers */ = {isa = PBXBuildFile; fileRef = BC18C52F0E16FCEB00B34460 /* grammar.h */; };
BC7F8FB90E19D1C3008632C0 /* JSNumberCell.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7F8FB80E19D1C3008632C0 /* JSNumberCell.h */; settings = {ATTRIBUTES = (Private, ); }; };
BCD202C20E1706A7002C7E82 /* RegExpConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD202BE0E1706A7002C7E82 /* RegExpConstructor.h */; };
BCD202C40E1706A7002C7E82 /* RegExpPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD202C00E1706A7002C7E82 /* RegExpPrototype.h */; };
BCD202D60E170708002C7E82 /* RegExpConstructor.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD202D50E170708002C7E82 /* RegExpConstructor.lut.h */; };
......@@ -600,6 +602,7 @@
BC1166000E1997B1008066DD /* DateInstance.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DateInstance.cpp; sourceTree = "<group>"; };
BC1166010E1997B1008066DD /* DateInstance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DateInstance.h; sourceTree = "<group>"; };
BC11667A0E199C05008066DD /* InternalFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InternalFunction.h; sourceTree = "<group>"; };
BC1167D80E19BCC9008066DD /* JSCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCell.h; sourceTree = "<group>"; };
BC18C3C00E16EE3300B34460 /* StringConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StringConstructor.cpp; sourceTree = "<group>"; };
BC18C3C10E16EE3300B34460 /* StringConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringConstructor.h; sourceTree = "<group>"; };
BC18C3C20E16EE3300B34460 /* StringObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StringObject.cpp; sourceTree = "<group>"; };
......@@ -633,6 +636,8 @@
BC7952330E15EB5600A898AB /* BooleanConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BooleanConstructor.h; sourceTree = "<group>"; };
BC7952340E15EB5600A898AB /* BooleanPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BooleanPrototype.cpp; sourceTree = "<group>"; };
BC7952350E15EB5600A898AB /* BooleanPrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BooleanPrototype.h; sourceTree = "<group>"; };
BC7F8FB80E19D1C3008632C0 /* JSNumberCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSNumberCell.h; sourceTree = "<group>"; };
BC7F8FBA0E19D1EF008632C0 /* JSCell.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCell.cpp; sourceTree = "<group>"; };
BC8F3CCF0DAF17BA00577A80 /* ConstructData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConstructData.h; sourceTree = "<group>"; };
BC9BB95B0E19680600DF8855 /* InternalFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InternalFunction.cpp; sourceTree = "<group>"; };
BCD202BD0E1706A7002C7E82 /* RegExpConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RegExpConstructor.cpp; sourceTree = "<group>"; };
......@@ -1082,6 +1087,8 @@
14DA818E0D99FD2000B0A4FB /* JSActivation.h */,
93ADFCE60CCBD7AC00D30B08 /* JSArray.cpp */,
938772E5038BFE19008635CE /* JSArray.h */,
BC7F8FBA0E19D1EF008632C0 /* JSCell.cpp */,
BC1167D80E19BCC9008066DD /* JSCell.h */,
F692A85E0255597D01FF60F7 /* JSFunction.cpp */,
F692A85F0255597D01FF60F7 /* JSFunction.h */,
E18E3A570DF9278C00D90B34 /* JSGlobalData.cpp */,
......@@ -1095,6 +1102,7 @@
A72700780DAC605600E548D7 /* JSNotAnObject.cpp */,
A72700770DAC605600E548D7 /* JSNotAnObject.h */,
BC02E9B90E184580000F9297 /* JSNumberCell.cpp */,
BC7F8FB80E19D1C3008632C0 /* JSNumberCell.h */,
BC22A3980E16E14800AF21C8 /* JSObject.cpp */,
BC22A3990E16E14800AF21C8 /* JSObject.h */,
BC02E9B60E1842FA000F9297 /* JSString.cpp */,
......@@ -1411,6 +1419,8 @@
BC02E98D0E183E38000F9297 /* ErrorInstance.h in Headers */,
BC1166020E1997B4008066DD /* DateInstance.h in Headers */,
BC11667B0E199C05008066DD /* InternalFunction.h in Headers */,
BC1167DA0E19BCC9008066DD /* JSCell.h in Headers */,
BC7F8FB90E19D1C3008632C0 /* JSNumberCell.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......
......@@ -71,6 +71,7 @@ Source files for JSCore.
kjs/InternalFunction.cpp
kjs/interpreter.cpp
kjs/JSActivation.cpp
kjs/JSCell.cpp
kjs/JSGlobalData.cpp
kjs/JSGlobalObject.cpp
kjs/JSVariableObject.cpp
......
......@@ -29,7 +29,7 @@
#ifndef JSPropertyNameIterator_h
#define JSPropertyNameIterator_h
#include "JSValue.h"
#include "JSCell.h"
namespace KJS {
......
......@@ -90,6 +90,7 @@
#include "StringPrototype.cpp"
#include "ustring.cpp"
#include "JSValue.cpp"
#include "JSCell.cpp"
#include "JSVariableObject.cpp"
#include "wtf/FastMalloc.cpp"
#include "wtf/TCSystemAlloc.cpp"
......
/*
* Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
* Copyright (C) 2001 Peter Kelly (pmk@post.com)
* Copyright (C) 2003, 2007, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#include "config.h"
#include "JSCell.h"
#include "JSFunction.h"
#include "JSString.h"
#include "JSObject.h"
#include <wtf/MathExtras.h>
namespace KJS {
#if defined NAN && defined INFINITY
extern const double NaN = NAN;
extern const double Inf = INFINITY;
#else // !(defined NAN && defined INFINITY)
// The trick is to define the NaN and Inf globals with a different type than the declaration.
// This trick works because the mangled name of the globals does not include the type, although
// I'm not sure that's guaranteed. There could be alignment issues with this, since arrays of
// characters don't necessarily need the same alignment doubles do, but for now it seems to work.
// It would be good to figure out a 100% clean way that still avoids code that runs at init time.
// Note, we have to use union to ensure alignment. Otherwise, NaN_Bytes can start anywhere,
// while NaN_double has to be 4-byte aligned for 32-bits.
// With -fstrict-aliasing enabled, unions are the only safe way to do type masquerading.
static const union {
struct {
unsigned char NaN_Bytes[8];
unsigned char Inf_Bytes[8];
} bytes;
struct {
double NaN_Double;
double Inf_Double;
} doubles;
} NaNInf = { {
#if PLATFORM(BIG_ENDIAN)
{ 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 },
{ 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 }
#elif PLATFORM(MIDDLE_ENDIAN)
{ 0, 0, 0xf8, 0x7f, 0, 0, 0, 0 },
{ 0, 0, 0xf0, 0x7f, 0, 0, 0, 0 }
#else
{ 0, 0, 0, 0, 0, 0, 0xf8, 0x7f },
{ 0, 0, 0, 0, 0, 0, 0xf0, 0x7f }
#endif
} } ;
extern const double NaN = NaNInf.doubles.NaN_Double;
extern const double Inf = NaNInf.doubles.Inf_Double;
#endif // !(defined NAN && defined INFINITY)
void* JSCell::operator new(size_t size, ExecState* exec)
{
#ifdef JAVASCRIPTCORE_BUILDING_ALL_IN_ONE_FILE
return exec->heap()->inlineAllocate(size);
#else
return exec->heap()->allocate(size);
#endif
}
bool JSCell::getUInt32(uint32_t&) const
{
return false;
}
bool JSCell::getTruncatedInt32(int32_t&) const
{
return false;
}
bool JSCell::getTruncatedUInt32(uint32_t&) const
{
return false;
}
bool JSCell::getNumber(double& numericValue) const
{
if (!isNumber())
return false;
numericValue = static_cast<const JSNumberCell*>(this)->value();
return true;
}
double JSCell::getNumber() const
{
return isNumber() ? static_cast<const JSNumberCell*>(this)->value() : NaN;
}
bool JSCell::getString(UString&stringValue) const
{
if (!isString())
return false;
stringValue = static_cast<const JSString*>(this)->value();
return true;
}
UString JSCell::getString() const
{
return isString() ? static_cast<const JSString*>(this)->value() : UString();
}
JSObject* JSCell::getObject()
{
return isObject() ? static_cast<JSObject*>(this) : 0;
}
const JSObject* JSCell::getObject() const
{
return isObject() ? static_cast<const JSObject*>(this) : 0;
}
CallType JSCell::getCallData(CallData&)
{
return CallTypeNone;
}
ConstructType JSCell::getConstructData(ConstructData&)
{
return ConstructTypeNone;
}
bool JSCell::getOwnPropertySlot(ExecState* exec, const Identifier& identifier, PropertySlot& slot)
{
// This is not a general purpose implementation of getOwnPropertySlot.
// It should only be called by JSValue::get.
// It calls getPropertySlot, not getOwnPropertySlot.
JSObject* object = toObject(exec);
slot.setBase(object);
if (!object->getPropertySlot(exec, identifier, slot))
slot.setUndefined();
return true;
}
bool JSCell::getOwnPropertySlot(ExecState* exec, unsigned identifier, PropertySlot& slot)
{
// This is not a general purpose implementation of getOwnPropertySlot.
// It should only be called by JSValue::get.
// It calls getPropertySlot, not getOwnPropertySlot.
JSObject* object = toObject(exec);
slot.setBase(object);
if (!object->getPropertySlot(exec, identifier, slot))
slot.setUndefined();
return true;
}
void JSCell::put(ExecState* exec, const Identifier& identifier, JSValue* value)
{
toObject(exec)->put(exec, identifier, value);
}
void JSCell::put(ExecState* exec, unsigned identifier, JSValue* value)
{
toObject(exec)->put(exec, identifier, value);
}
bool JSCell::deleteProperty(ExecState* exec, const Identifier& identifier)
{
return toObject(exec)->deleteProperty(exec, identifier);
}
bool JSCell::deleteProperty(ExecState* exec, unsigned identifier)
{
return toObject(exec)->deleteProperty(exec, identifier);
}
JSObject* JSCell::toThisObject(ExecState* exec) const
{
return toObject(exec);
}
UString JSCell::toThisString(ExecState* exec) const
{
return toThisObject(exec)->toString(exec);
}
JSString* JSCell::toThisJSString(ExecState* exec)
{
return jsString(exec, toThisString(exec));
}
const ClassInfo* JSCell::classInfo() const
{
return 0;
}
JSValue* JSCell::getJSNumber()
{
return 0;
}
} // namespace KJS
/*
* Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
* Copyright (C) 2001 Peter Kelly (pmk@post.com)
* Copyright (C) 2003, 2004, 2005, 2007, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#ifndef JSCell_h
#define JSCell_h
#include "JSValue.h"
#include "collector.h"
namespace KJS {
class JSCell : public JSValue {
friend class Heap;
friend class GetterSetter;
friend class JSObject;
friend class JSPropertyNameIterator;
friend class JSValue;
friend class JSNumberCell;
friend class JSString;
private:
JSCell();
virtual ~JSCell();
public:
// Querying the type.
virtual JSType type() const = 0;
bool isNumber() const;
bool isString() const;
bool isObject() const;
bool isObject(const ClassInfo*) const; // FIXME: Merge with inherits.
// Extracting the value.
bool getNumber(double&) const;
double getNumber() const; // NaN if not a number
bool getString(UString&) const;
UString getString() const; // null string if not a string
JSObject* getObject(); // NULL if not an object
const JSObject* getObject() const; // NULL if not an object
virtual CallType getCallData(CallData&);
virtual ConstructType getConstructData(ConstructData&);
// Extracting integer values.
virtual bool getUInt32(uint32_t&) const;
virtual bool getTruncatedInt32(int32_t&) const;
virtual bool getTruncatedUInt32(uint32_t&) const;
// Basic conversions.
virtual JSValue* toPrimitive(ExecState*, JSType preferredType = UnspecifiedType) const = 0;
virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue*&) = 0;
virtual bool toBoolean(ExecState*) const = 0;
virtual double toNumber(ExecState*) const = 0;
virtual UString toString(ExecState*) const = 0;
virtual JSObject* toObject(ExecState*) const = 0;
// Garbage collection.
void* operator new(size_t, ExecState*);
virtual void mark();
bool marked() const;
// Object operations, with the toObject operation included.
virtual const ClassInfo* classInfo() const;
virtual void put(ExecState*, const Identifier& propertyName, JSValue*);
virtual void put(ExecState*, unsigned propertyName, JSValue*);
virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
virtual bool deleteProperty(ExecState*, unsigned propertyName);
virtual JSObject* toThisObject(ExecState*) const;
virtual UString toThisString(ExecState*) const;
virtual JSString* toThisJSString(ExecState*);
virtual JSValue* getJSNumber();
private:
// Base implementation, but for non-object classes implements getPropertySlot.
virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
virtual bool getOwnPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
};
inline JSCell::JSCell()
{
}
inline JSCell::~JSCell()
{
}
inline bool JSCell::isNumber() const
{
return type() == NumberType;
}
inline bool JSCell::isString() const
{
return type() == StringType;
}
inline bool JSCell::isObject() const
{
return type() == ObjectType;
}
inline bool JSCell::marked() const
{
return Heap::isCellMarked(this);
}
inline void JSCell::mark()
{
return Heap::markCell(this);
}
ALWAYS_INLINE JSCell* JSValue::asCell()
{
ASSERT(!JSImmediate::isImmediate(this));
return static_cast<JSCell*>(this);
}
ALWAYS_INLINE const JSCell* JSValue::asCell() const
{
ASSERT(!JSImmediate::isImmediate(this));
return static_cast<const JSCell*>(this);
}
// --- JSValue inlines ----------------------------
inline bool JSValue::isNumber() const
{
return JSImmediate::isNumber(this) || (!JSImmediate::isImmediate(this) && asCell()->isNumber());
}
inline bool JSValue::isString() const
{
return !JSImmediate::isImmediate(this) && asCell()->isString();
}
inline bool JSValue::isObject() const
{
return !JSImmediate::isImmediate(this) && asCell()->isObject();
}
inline bool JSValue::getNumber(double& v) const
{
if (JSImmediate::isImmediate(this)) {
v = JSImmediate::toDouble(this);
return true;
}
return asCell()->getNumber(v);
}
inline double JSValue::getNumber() const
{
return JSImmediate::isImmediate(this) ? JSImmediate::toDouble(this) : asCell()->getNumber();
}
inline bool JSValue::getString(UString& s) const
{
return !JSImmediate::isImmediate(this) && asCell()->getString(s);
}
inline UString JSValue::getString() const
{
return JSImmediate::isImmediate(this) ? UString() : asCell()->getString();
}
inline JSObject *JSValue::getObject()
{
return JSImmediate::isImmediate(this) ? 0 : asCell()->getObject();
}
inline const JSObject *JSValue::getObject() const
{
return JSImmediate::isImmediate(this) ? 0 : asCell()->getObject();
}
inline CallType JSValue::getCallData(CallData& callData)
{
return JSImmediate::isImmediate(this) ? CallTypeNone : asCell()->getCallData(callData);
}
inline ConstructType JSValue::getConstructData(ConstructData& constructData)
{
return JSImmediate::isImmediate(this) ? ConstructTypeNone : asCell()->getConstructData(constructData);
}
ALWAYS_INLINE bool JSValue::getUInt32(uint32_t& v) const
{
return JSImmediate::isImmediate(this) ? JSImmediate::getUInt32(this, v) : asCell()->getUInt32(v);
}
ALWAYS_INLINE bool JSValue::getTruncatedInt32(int32_t& v) const
{
return JSImmediate::isImmediate(this) ? JSImmediate::getTruncatedInt32(this, v) : asCell()->getTruncatedInt32(v);
}
inline bool JSValue::getTruncatedUInt32(uint32_t& v) const
{
return JSImmediate::isImmediate(this) ? JSImmediate::getTruncatedUInt32(this, v) : asCell()->getTruncatedUInt32(v);
}
inline void JSValue::mark()
{
ASSERT(!JSImmediate::isImmediate(this)); // callers should check !marked() before calling mark()
asCell()->mark();
}
inline bool JSValue::marked() const
{
return JSImmediate::isImmediate(this) || asCell()->marked();
}
inline JSType JSValue::type() const
{
return JSImmediate::isImmediate(this) ? JSImmediate::type(this) : asCell()->type();
}
inline JSValue* JSValue::toPrimitive(ExecState* exec, JSType preferredType) const
{
return JSImmediate::isImmediate(this) ? const_cast<JSValue*>(this) : asCell()->toPrimitive(exec, preferredType);
}