diff options
Diffstat (limited to 'JavaScriptCore/runtime/JSCell.h')
| -rw-r--r-- | JavaScriptCore/runtime/JSCell.h | 64 |
1 files changed, 37 insertions, 27 deletions
diff --git a/JavaScriptCore/runtime/JSCell.h b/JavaScriptCore/runtime/JSCell.h index 3c8c829..7d4929d 100644 --- a/JavaScriptCore/runtime/JSCell.h +++ b/JavaScriptCore/runtime/JSCell.h @@ -23,6 +23,8 @@ #ifndef JSCell_h #define JSCell_h +#include "CallData.h" +#include "ConstructData.h" #include "Collector.h" #include "JSImmediate.h" #include "JSValue.h" @@ -32,7 +34,24 @@ namespace JSC { - class JSCell : public NoncopyableCustomAllocated { +#if COMPILER(MSVC) + // If WTF_MAKE_NONCOPYABLE is applied to JSCell we end up with a bunch of + // undefined references to the JSCell copy constructor and assignment operator + // when linking JavaScriptCore. + class MSVCBugWorkaround { + WTF_MAKE_NONCOPYABLE(MSVCBugWorkaround); + + protected: + MSVCBugWorkaround() { } + ~MSVCBugWorkaround() { } + }; + + class JSCell : MSVCBugWorkaround { +#else + class JSCell { + WTF_MAKE_NONCOPYABLE(JSCell); +#endif + friend class GetterSetter; friend class Heap; friend class JIT; @@ -56,9 +75,6 @@ namespace JSC { } // Querying the type. -#if USE(JSVALUE32) - bool isNumber() const; -#endif bool isString() const; bool isObject() const; virtual bool isGetterSetter() const; @@ -107,18 +123,21 @@ namespace JSC { virtual bool deleteProperty(ExecState*, unsigned propertyName); virtual JSObject* toThisObject(ExecState*) const; - virtual UString toThisString(ExecState*) const; - virtual JSString* toThisJSString(ExecState*); virtual JSValue getJSNumber(); void* vptr() { return *reinterpret_cast<void**>(this); } void setVPtr(void* vptr) { *reinterpret_cast<void**>(this) = vptr; } + // FIXME: Rename getOwnPropertySlot to virtualGetOwnPropertySlot, and + // fastGetOwnPropertySlot to getOwnPropertySlot. Callers should always + // call this function, not its slower virtual counterpart. (For integer + // property names, we want a similar interface with appropriate optimizations.) + bool fastGetOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&); + protected: static const unsigned AnonymousSlotCount = 0; private: // Base implementation; for non-object classes implements getPropertySlot. - bool fastGetOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&); virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&); virtual bool getOwnPropertySlot(ExecState*, unsigned propertyName, PropertySlot&); @@ -134,13 +153,6 @@ namespace JSC { { } -#if USE(JSVALUE32) - inline bool JSCell::isNumber() const - { - return m_structure->typeInfo().type() == NumberType; - } -#endif - inline bool JSCell::isObject() const { return m_structure->typeInfo().type() == ObjectType; @@ -202,14 +214,18 @@ namespace JSC { return isCell() ? asCell()->getObject() : 0; } - inline CallType JSValue::getCallData(CallData& callData) + inline CallType getCallData(JSValue value, CallData& callData) { - return isCell() ? asCell()->getCallData(callData) : CallTypeNone; + CallType result = value.isCell() ? value.asCell()->getCallData(callData) : CallTypeNone; + ASSERT(result == CallTypeNone || value.isValidCallee()); + return result; } - inline ConstructType JSValue::getConstructData(ConstructData& constructData) + inline ConstructType getConstructData(JSValue value, ConstructData& constructData) { - return isCell() ? asCell()->getConstructData(constructData) : ConstructTypeNone; + ConstructType result = value.isCell() ? value.asCell()->getConstructData(constructData) : ConstructTypeNone; + ASSERT(result == ConstructTypeNone || value.isValidCallee()); + return result; } ALWAYS_INLINE bool JSValue::getUInt32(uint32_t& v) const @@ -227,13 +243,13 @@ namespace JSC { return false; } -#if !USE(JSVALUE32_64) +#if USE(JSVALUE64) ALWAYS_INLINE JSCell* JSValue::asCell() const { ASSERT(isCell()); return m_ptr; } -#endif // !USE(JSVALUE32_64) +#endif // USE(JSVALUE64) inline JSValue JSValue::toPrimitive(ExecState* exec, PreferredPrimitiveType preferredType) const { @@ -301,11 +317,6 @@ namespace JSC { return asCell()->structure()->typeInfo().needsThisConversion(); } - inline UString JSValue::toThisString(ExecState* exec) const - { - return isCell() ? asCell()->toThisString(exec) : toString(exec); - } - inline JSValue JSValue::getJSNumber() { if (isInt32() || isDouble()) @@ -329,9 +340,8 @@ namespace JSC { { ASSERT(!m_isCheckingForDefaultMarkViolation); ASSERT(cell); - if (Heap::isCellMarked(cell)) + if (Heap::checkMarkCell(cell)) return; - Heap::markCell(cell); if (cell->structure()->typeInfo().type() >= CompoundType) m_values.append(cell); } |
