X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/9dae56ea45a0f5f8136a5c93d6f3a7f99399ca73..14957cd040308e3eeec43d26bae5d76da13fcd85:/runtime/JSCell.cpp diff --git a/runtime/JSCell.cpp b/runtime/JSCell.cpp index d449deb..0606cd4 100644 --- a/runtime/JSCell.cpp +++ b/runtime/JSCell.cpp @@ -59,10 +59,10 @@ static const union { } doubles; } NaNInf = { { -#if PLATFORM(BIG_ENDIAN) +#if CPU(BIG_ENDIAN) { 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 }, { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } -#elif PLATFORM(MIDDLE_ENDIAN) +#elif CPU(MIDDLE_ENDIAN) { 0, 0, 0xf8, 0x7f, 0, 0, 0, 0 }, { 0, 0, 0xf0, 0x7f, 0, 0, 0, 0 } #else @@ -76,46 +76,29 @@ 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 -} +const ClassInfo JSCell::s_dummyCellInfo = { "DummyCell", 0, 0, 0 }; 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::getString(UString&stringValue) const +bool JSCell::getString(ExecState* exec, UString&stringValue) const { if (!isString()) return false; - stringValue = static_cast(this)->value(); + stringValue = static_cast(this)->value(exec); return true; } -UString JSCell::getString() const +UString JSCell::getString(ExecState* exec) const { - return isString() ? static_cast(this)->value() : UString(); + return isString() ? static_cast(this)->value(exec) : UString(); } JSObject* JSCell::getObject() { - return isObject() ? static_cast(this) : 0; + return isObject() ? asObject(this) : 0; } const JSObject* JSCell::getObject() const @@ -138,7 +121,7 @@ bool JSCell::getOwnPropertySlot(ExecState* exec, const Identifier& identifier, P // 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); + JSObject* object = toObject(exec, exec->lexicalGlobalObject()); slot.setBase(object); if (!object->getPropertySlot(exec, identifier, slot)) slot.setUndefined(); @@ -150,61 +133,97 @@ bool JSCell::getOwnPropertySlot(ExecState* exec, unsigned identifier, PropertySl // 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); + JSObject* object = toObject(exec, exec->lexicalGlobalObject()); slot.setBase(object); if (!object->getPropertySlot(exec, identifier, slot)) slot.setUndefined(); return true; } -void JSCell::put(ExecState* exec, const Identifier& identifier, JSValuePtr value, PutPropertySlot& slot) +void JSCell::put(ExecState* exec, const Identifier& identifier, JSValue value, PutPropertySlot& slot) { - toObject(exec)->put(exec, identifier, value, slot); + toObject(exec, exec->lexicalGlobalObject())->put(exec, identifier, value, slot); } -void JSCell::put(ExecState* exec, unsigned identifier, JSValuePtr value) +void JSCell::put(ExecState* exec, unsigned identifier, JSValue value) { - toObject(exec)->put(exec, identifier, value); + toObject(exec, exec->lexicalGlobalObject())->put(exec, identifier, value); } bool JSCell::deleteProperty(ExecState* exec, const Identifier& identifier) { - return toObject(exec)->deleteProperty(exec, identifier); + return toObject(exec, exec->lexicalGlobalObject())->deleteProperty(exec, identifier); } bool JSCell::deleteProperty(ExecState* exec, unsigned identifier) { - return toObject(exec)->deleteProperty(exec, identifier); + return toObject(exec, exec->lexicalGlobalObject())->deleteProperty(exec, identifier); } JSObject* JSCell::toThisObject(ExecState* exec) const { - return toObject(exec); + return toObject(exec, exec->lexicalGlobalObject()); } -UString JSCell::toThisString(ExecState* exec) const +JSValue JSCell::getJSNumber() { - return toThisObject(exec)->toString(exec); + return JSValue(); } -JSString* JSCell::toThisJSString(ExecState* exec) +bool JSCell::isGetterSetter() const { - return jsString(exec, toThisString(exec)); + return false; } -const ClassInfo* JSCell::classInfo() const +JSValue JSCell::toPrimitive(ExecState*, PreferredPrimitiveType) const { + ASSERT_NOT_REACHED(); + return JSValue(); +} + +bool JSCell::getPrimitiveNumber(ExecState*, double&, JSValue&) +{ + ASSERT_NOT_REACHED(); + return false; +} + +bool JSCell::toBoolean(ExecState*) const +{ + ASSERT_NOT_REACHED(); + return false; +} + +double JSCell::toNumber(ExecState*) const +{ + ASSERT_NOT_REACHED(); return 0; } -JSValuePtr JSCell::getJSNumber() +UString JSCell::toString(ExecState*) const { - return noValue(); + ASSERT_NOT_REACHED(); + return UString(); } -bool JSCell::isGetterSetter() const +JSObject* JSCell::toObject(ExecState*, JSGlobalObject*) const { + ASSERT_NOT_REACHED(); + return 0; +} + +bool isZombie(const JSCell* cell) +{ +#if ENABLE(JSC_ZOMBIES) + return cell && cell->isZombie(); +#else + UNUSED_PARAM(cell); return false; +#endif +} + +void slowValidateCell(JSCell* cell) +{ + ASSERT_GC_OBJECT_LOOKS_VALID(cell); } } // namespace JSC