JSObject* JSValue::synthesizePrototype(ExecState* exec) const { ASSERT(!isCell()); if (isNumber()) return exec->lexicalGlobalObject()->numberPrototype(); if (isBoolean()) return exec->lexicalGlobalObject()->booleanPrototype(); JSNotAnObjectErrorStub* exception = createNotAnObjectErrorStub(exec, isNull()); exec->setException(exception); return new (exec) JSNotAnObject(exec, exception); }
JSObject* JSValue::synthesizeObject(ExecState* exec) const { ASSERT(!isCell()); if (isNumber()) return constructNumber(exec, asValue()); if (isBoolean()) return constructBooleanFromImmediateBoolean(exec, asValue()); JSNotAnObjectErrorStub* exception = createNotAnObjectErrorStub(exec, isNull()); exec->setException(exception); return new (exec) JSNotAnObject(exec, exception); }
JSObject* JSImmediate::prototype(JSValue* v, ExecState* exec) { ASSERT(isImmediate(v)); if (isNumber(v)) return exec->lexicalGlobalObject()->numberPrototype(); if (isBoolean(v)) return exec->lexicalGlobalObject()->booleanPrototype(); JSNotAnObjectErrorStub* exception = createNotAnObjectErrorStub(exec, v->isNull()); exec->setException(exception); return new (exec) JSNotAnObject(exec, exception); }
JSObject* JSImmediate::toObject(JSValue* v, ExecState* exec) { ASSERT(isImmediate(v)); if (isNumber(v)) return constructNumberFromImmediateNumber(exec, v); if (isBoolean(v)) return constructBooleanFromImmediateBoolean(exec, v); JSNotAnObjectErrorStub* exception = createNotAnObjectErrorStub(exec, v->isNull()); exec->setException(exception); return new (exec) JSNotAnObject(exec, exception); }
JSObject* JSValue::toObjectSlowCase(ExecState* exec) const { ASSERT(!isCell()); if (isInt32() || isDouble()) return constructNumber(exec, asValue()); if (isTrue() || isFalse()) return constructBooleanFromImmediateBoolean(exec, asValue()); ASSERT(isUndefinedOrNull()); JSNotAnObjectErrorStub* exception = createNotAnObjectErrorStub(exec, isNull()); exec->setException(exception); return new (exec) JSNotAnObject(exec, exception); }