[webkit-changes] cvs commit: WebCore/kwq DOMUtility.mm
KWQKHTMLPart.mm WebCoreBridge.mm WebCoreScriptDebugger.mm
Darin
darin at opensource.apple.com
Sun Aug 7 21:07:49 PDT 2005
darin 05/08/07 21:07:47
Modified: . ChangeLog
JavaScriptCore.xcodeproj project.pbxproj
bindings NP_jsobject.cpp runtime.cpp runtime.h
runtime_array.cpp runtime_array.h
runtime_method.cpp runtime_method.h
runtime_object.cpp runtime_object.h
bindings/c c_instance.cpp c_instance.h c_runtime.cpp
c_runtime.h c_utility.cpp c_utility.h
bindings/jni jni_instance.cpp jni_instance.h
jni_jsobject.cpp jni_jsobject.h jni_objc.mm
jni_runtime.cpp jni_runtime.h jni_utility.cpp
jni_utility.h
bindings/objc WebScriptObject.mm WebScriptObjectPrivate.h
objc_class.h objc_class.mm objc_instance.h
objc_instance.mm objc_runtime.h objc_runtime.mm
objc_utility.h objc_utility.mm
kjs array_instance.h array_object.cpp array_object.h
bool_object.cpp bool_object.h collector.cpp
completion.h context.h date_object.cpp
date_object.h debugger.cpp debugger.h
error_object.cpp error_object.h function.cpp
function.h function_object.cpp function_object.h
internal.cpp internal.h interpreter.cpp
interpreter.h list.cpp list.h lookup.h
math_object.cpp math_object.h nodes.cpp nodes.h
number_object.cpp number_object.h object.cpp
object.h object_object.cpp object_object.h
operations.cpp operations.h property_map.cpp
property_map.h property_slot.cpp property_slot.h
protect.h protected_object.h protected_values.cpp
protected_values.h reference.cpp reference.h
regexp_object.cpp regexp_object.h string_object.cpp
string_object.h testkjs.cpp value.cpp value.h
. ChangeLog
khtml/ecma domparser.cpp domparser.h kjs_binding.cpp
kjs_binding.h kjs_css.cpp kjs_css.h kjs_dom.cpp
kjs_dom.h kjs_events.cpp kjs_events.h kjs_html.cpp
kjs_html.h kjs_navigator.cpp kjs_navigator.h
kjs_proxy.cpp kjs_range.cpp kjs_range.h
kjs_traversal.cpp kjs_traversal.h kjs_views.cpp
kjs_views.h kjs_window.cpp kjs_window.h
xmlhttprequest.cpp xmlhttprequest.h
xmlserializer.cpp xmlserializer.h
kwq DOMUtility.mm KWQKHTMLPart.mm WebCoreBridge.mm
WebCoreScriptDebugger.mm
Log:
JavaScriptCore:
Rubber stamped by Maciej.
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4313
eliminate KJS::Value and KJS::Object smart pointer wrappers (for simplicity and speed)
* JavaScriptCore.xcodeproj/project.pbxproj: Removed object_wrapper.h.
Global replaces and other wonderful stuff.
* bindings/NP_jsobject.cpp:
(_NPN_Invoke):
(_NPN_Evaluate):
(_NPN_GetProperty):
(_NPN_SetProperty):
(_NPN_HasMethod):
(_NPN_SetException):
* bindings/c/c_instance.cpp:
(KJS::Bindings::CInstance::CInstance):
(KJS::Bindings::CInstance::invokeMethod):
(KJS::Bindings::CInstance::invokeDefaultMethod):
(KJS::Bindings::CInstance::defaultValue):
(KJS::Bindings::CInstance::stringValue):
(KJS::Bindings::CInstance::numberValue):
(KJS::Bindings::CInstance::booleanValue):
(KJS::Bindings::CInstance::valueOf):
* bindings/c/c_instance.h:
* bindings/c/c_runtime.cpp:
(CField::valueFromInstance):
(CField::setValueToInstance):
* bindings/c/c_runtime.h:
* bindings/c/c_utility.cpp:
(convertNPStringToUTF16):
(convertUTF8ToUTF16):
(coerceValueToNPVariantStringType):
(convertValueToNPVariant):
(convertNPVariantToValue):
* bindings/c/c_utility.h:
* bindings/jni/jni_instance.cpp:
(JavaInstance::stringValue):
(JavaInstance::numberValue):
(JavaInstance::booleanValue):
(JavaInstance::invokeMethod):
(JavaInstance::invokeDefaultMethod):
(JavaInstance::defaultValue):
(JavaInstance::valueOf):
* bindings/jni/jni_instance.h:
* bindings/jni/jni_jsobject.cpp:
(JSObject::invoke):
(JSObject::call):
(JSObject::eval):
(JSObject::getMember):
(JSObject::getSlot):
(JSObject::toString):
(JSObject::convertValueToJObject):
(JSObject::convertJObjectToValue):
(JSObject::listFromJArray):
* bindings/jni/jni_jsobject.h:
* bindings/jni/jni_objc.mm:
(KJS::Bindings::dispatchJNICall):
* bindings/jni/jni_runtime.cpp:
(JavaArray::convertJObjectToArray):
(JavaField::dispatchValueFromInstance):
(JavaField::valueFromInstance):
(JavaField::dispatchSetValueToInstance):
(JavaField::setValueToInstance):
(JavaArray::setValueAt):
(JavaArray::valueAt):
* bindings/jni/jni_runtime.h:
(KJS::Bindings::JavaString::ustring):
* bindings/jni/jni_utility.cpp:
(KJS::Bindings::getJavaVM):
(KJS::Bindings::getJNIEnv):
(KJS::Bindings::getMethodID):
(KJS::Bindings::callJNIVoidMethod):
(KJS::Bindings::callJNIObjectMethod):
(KJS::Bindings::callJNIBooleanMethod):
(KJS::Bindings::callJNIStaticBooleanMethod):
(KJS::Bindings::callJNIByteMethod):
(KJS::Bindings::callJNICharMethod):
(KJS::Bindings::callJNIShortMethod):
(KJS::Bindings::callJNIIntMethod):
(KJS::Bindings::callJNILongMethod):
(KJS::Bindings::callJNIFloatMethod):
(KJS::Bindings::callJNIDoubleMethod):
(KJS::Bindings::callJNIVoidMethodA):
(KJS::Bindings::callJNIObjectMethodA):
(KJS::Bindings::callJNIByteMethodA):
(KJS::Bindings::callJNICharMethodA):
(KJS::Bindings::callJNIShortMethodA):
(KJS::Bindings::callJNIIntMethodA):
(KJS::Bindings::callJNILongMethodA):
(KJS::Bindings::callJNIFloatMethodA):
(KJS::Bindings::callJNIDoubleMethodA):
(KJS::Bindings::callJNIBooleanMethodA):
(KJS::Bindings::callJNIVoidMethodIDA):
(KJS::Bindings::callJNIObjectMethodIDA):
(KJS::Bindings::callJNIByteMethodIDA):
(KJS::Bindings::callJNICharMethodIDA):
(KJS::Bindings::callJNIShortMethodIDA):
(KJS::Bindings::callJNIIntMethodIDA):
(KJS::Bindings::callJNILongMethodIDA):
(KJS::Bindings::callJNIFloatMethodIDA):
(KJS::Bindings::callJNIDoubleMethodIDA):
(KJS::Bindings::callJNIBooleanMethodIDA):
(KJS::Bindings::getCharactersFromJString):
(KJS::Bindings::releaseCharactersForJString):
(KJS::Bindings::getCharactersFromJStringInEnv):
(KJS::Bindings::releaseCharactersForJStringInEnv):
(KJS::Bindings::getUCharactersFromJStringInEnv):
(KJS::Bindings::releaseUCharactersForJStringInEnv):
(KJS::Bindings::JNITypeFromClassName):
(KJS::Bindings::signatureFromPrimitiveType):
(KJS::Bindings::JNITypeFromPrimitiveType):
(KJS::Bindings::getJNIField):
(KJS::Bindings::convertValueToJValue):
* bindings/jni/jni_utility.h:
* bindings/objc/WebScriptObject.mm:
(_didExecute):
(-[WebScriptObject _initializeWithObjectImp:originExecutionContext:Bindings::executionContext:Bindings::]):
(-[WebScriptObject _initWithObjectImp:originExecutionContext:Bindings::executionContext:Bindings::]):
(-[WebScriptObject _imp]):
(-[WebScriptObject _executionContext]):
(-[WebScriptObject _setExecutionContext:]):
(-[WebScriptObject _originExecutionContext]):
(-[WebScriptObject _setOriginExecutionContext:]):
(+[WebScriptObject throwException:]):
(listFromNSArray):
(-[WebScriptObject callWebScriptMethod:withArguments:]):
(-[WebScriptObject evaluateWebScript:]):
(-[WebScriptObject setValue:forKey:]):
(-[WebScriptObject valueForKey:]):
(-[WebScriptObject removeWebScriptKey:]):
(-[WebScriptObject stringRepresentation]):
(-[WebScriptObject webScriptValueAtIndex:]):
(-[WebScriptObject setException:]):
(+[WebScriptObject _convertValueToObjcValue:originExecutionContext:executionContext:Bindings::]):
* bindings/objc/WebScriptObjectPrivate.h:
* bindings/objc/objc_class.h:
* bindings/objc/objc_class.mm:
(KJS::Bindings::ObjcClass::fallbackObject):
* bindings/objc/objc_instance.h:
* bindings/objc/objc_instance.mm:
(ObjcInstance::invokeMethod):
(ObjcInstance::invokeDefaultMethod):
(ObjcInstance::setValueOfField):
(ObjcInstance::setValueOfUndefinedField):
(ObjcInstance::getValueOfField):
(ObjcInstance::getValueOfUndefinedField):
(ObjcInstance::defaultValue):
(ObjcInstance::stringValue):
(ObjcInstance::numberValue):
(ObjcInstance::booleanValue):
(ObjcInstance::valueOf):
* bindings/objc/objc_runtime.h:
* bindings/objc/objc_runtime.mm:
(ObjcField::valueFromInstance):
(convertValueToObjcObject):
(ObjcField::setValueToInstance):
(ObjcArray::setValueAt):
(ObjcArray::valueAt):
(ObjcFallbackObjectImp::put):
(ObjcFallbackObjectImp::callAsFunction):
(ObjcFallbackObjectImp::defaultValue):
* bindings/objc/objc_utility.h:
* bindings/objc/objc_utility.mm:
(Bindings::JSMethodNameToObjCMethodName):
(Bindings::convertValueToObjcValue):
(Bindings::convertNSStringToString):
(Bindings::convertObjcValueToValue):
(Bindings::objcValueTypeForType):
(Bindings::createObjcInstanceForValue):
* bindings/runtime.cpp:
(Instance::getValueOfField):
(Instance::setValueOfField):
(Instance::createRuntimeObject):
(Instance::createLanguageInstanceForValue):
* bindings/runtime.h:
(KJS::Bindings::Constructor::~Constructor):
(KJS::Bindings::Field::~Field):
(KJS::Bindings::MethodList::MethodList):
(KJS::Bindings::Class::fallbackObject):
(KJS::Bindings::Class::~Class):
(KJS::Bindings::Instance::Instance):
(KJS::Bindings::Instance::getValueOfUndefinedField):
(KJS::Bindings::Instance::supportsSetValueOfUndefinedField):
(KJS::Bindings::Instance::setValueOfUndefinedField):
(KJS::Bindings::Instance::valueOf):
(KJS::Bindings::Instance::setExecutionContext):
(KJS::Bindings::Instance::~Instance):
(KJS::Bindings::Array::~Array):
* bindings/runtime_array.cpp:
(RuntimeArrayImp::RuntimeArrayImp):
(RuntimeArrayImp::lengthGetter):
(RuntimeArrayImp::indexGetter):
(RuntimeArrayImp::put):
* bindings/runtime_array.h:
* bindings/runtime_method.cpp:
(RuntimeMethodImp::lengthGetter):
(RuntimeMethodImp::callAsFunction):
* bindings/runtime_method.h:
* bindings/runtime_object.cpp:
(RuntimeObjectImp::fallbackObjectGetter):
(RuntimeObjectImp::fieldGetter):
(RuntimeObjectImp::methodGetter):
(RuntimeObjectImp::getOwnPropertySlot):
(RuntimeObjectImp::put):
(RuntimeObjectImp::defaultValue):
(RuntimeObjectImp::callAsFunction):
* bindings/runtime_object.h:
* kjs/array_instance.h:
* kjs/array_object.cpp:
(ArrayInstanceImp::ArrayInstanceImp):
(ArrayInstanceImp::lengthGetter):
(ArrayInstanceImp::getOwnPropertySlot):
(ArrayInstanceImp::put):
(ArrayInstanceImp::propList):
(ArrayInstanceImp::setLength):
(compareByStringForQSort):
(compareWithCompareFunctionForQSort):
(ArrayInstanceImp::sort):
(ArrayInstanceImp::pushUndefinedObjectsToEnd):
(ArrayPrototypeImp::ArrayPrototypeImp):
(ArrayProtoFuncImp::ArrayProtoFuncImp):
(ArrayProtoFuncImp::callAsFunction):
(ArrayObjectImp::ArrayObjectImp):
(ArrayObjectImp::construct):
(ArrayObjectImp::callAsFunction):
* kjs/array_object.h:
* kjs/bool_object.cpp:
(BooleanPrototypeImp::BooleanPrototypeImp):
(BooleanProtoFuncImp::BooleanProtoFuncImp):
(BooleanProtoFuncImp::callAsFunction):
(BooleanObjectImp::BooleanObjectImp):
(BooleanObjectImp::construct):
(BooleanObjectImp::callAsFunction):
* kjs/bool_object.h:
* kjs/collector.cpp:
(KJS::Collector::markStackObjectsConservatively):
(KJS::Collector::collect):
(KJS::className):
* kjs/completion.h:
(KJS::Completion::Completion):
(KJS::Completion::value):
(KJS::Completion::isValueCompletion):
* kjs/context.h:
(KJS::ContextImp::variableObject):
(KJS::ContextImp::setVariableObject):
(KJS::ContextImp::thisValue):
(KJS::ContextImp::activationObject):
(KJS::ContextImp::pushScope):
* kjs/date_object.cpp:
(formatLocaleDate):
(KJS::timeFromArgs):
(KJS::DatePrototypeImp::DatePrototypeImp):
(KJS::DateProtoFuncImp::DateProtoFuncImp):
(KJS::DateProtoFuncImp::callAsFunction):
(KJS::DateObjectImp::DateObjectImp):
(KJS::DateObjectImp::construct):
(KJS::DateObjectImp::callAsFunction):
(KJS::DateObjectFuncImp::DateObjectFuncImp):
(KJS::DateObjectFuncImp::callAsFunction):
(KJS::parseDate):
(KJS::KRFCDate_parseDate):
(KJS::timeClip):
* kjs/date_object.h:
* kjs/debugger.cpp:
(Debugger::exception):
(Debugger::callEvent):
(Debugger::returnEvent):
* kjs/debugger.h:
* kjs/error_object.cpp:
(ErrorPrototypeImp::ErrorPrototypeImp):
(ErrorProtoFuncImp::ErrorProtoFuncImp):
(ErrorProtoFuncImp::callAsFunction):
(ErrorObjectImp::ErrorObjectImp):
(ErrorObjectImp::construct):
(ErrorObjectImp::callAsFunction):
(NativeErrorPrototypeImp::NativeErrorPrototypeImp):
(NativeErrorImp::NativeErrorImp):
(NativeErrorImp::construct):
(NativeErrorImp::callAsFunction):
* kjs/error_object.h:
* kjs/function.cpp:
(KJS::FunctionImp::FunctionImp):
(KJS::FunctionImp::callAsFunction):
(KJS::FunctionImp::processParameters):
(KJS::FunctionImp::argumentsGetter):
(KJS::FunctionImp::lengthGetter):
(KJS::FunctionImp::put):
(KJS::DeclaredFunctionImp::DeclaredFunctionImp):
(KJS::DeclaredFunctionImp::construct):
(KJS::ArgumentsImp::ArgumentsImp):
(KJS::ArgumentsImp::mappedIndexGetter):
(KJS::ArgumentsImp::put):
(KJS::ActivationImp::argumentsGetter):
(KJS::GlobalFuncImp::GlobalFuncImp):
(KJS::encode):
(KJS::decode):
(KJS::GlobalFuncImp::callAsFunction):
* kjs/function.h:
* kjs/function_object.cpp:
(FunctionPrototypeImp::FunctionPrototypeImp):
(FunctionPrototypeImp::callAsFunction):
(FunctionProtoFuncImp::FunctionProtoFuncImp):
(FunctionProtoFuncImp::callAsFunction):
(FunctionObjectImp::FunctionObjectImp):
(FunctionObjectImp::construct):
(FunctionObjectImp::callAsFunction):
* kjs/function_object.h:
* kjs/internal.cpp:
(KJS::UndefinedImp::toPrimitive):
(KJS::UndefinedImp::toObject):
(KJS::NullImp::toPrimitive):
(KJS::NullImp::toObject):
(KJS::BooleanImp::toPrimitive):
(KJS::BooleanImp::toObject):
(KJS::StringImp::toPrimitive):
(KJS::StringImp::toObject):
(KJS::NumberImp::toPrimitive):
(KJS::NumberImp::toObject):
(KJS::NumberImp::getUInt32):
(KJS::LabelStack::push):
(KJS::ContextImp::ContextImp):
(KJS::InterpreterImp::globalInit):
(KJS::InterpreterImp::globalClear):
(KJS::InterpreterImp::InterpreterImp):
(KJS::InterpreterImp::initGlobalObject):
(KJS::InterpreterImp::clear):
(KJS::InterpreterImp::mark):
(KJS::InterpreterImp::evaluate):
(KJS::InternalFunctionImp::hasInstance):
(KJS::roundValue):
(KJS::printInfo):
* kjs/internal.h:
(KJS::InterpreterImp::builtinObject):
(KJS::InterpreterImp::builtinFunction):
(KJS::InterpreterImp::builtinArray):
(KJS::InterpreterImp::builtinBoolean):
(KJS::InterpreterImp::builtinString):
(KJS::InterpreterImp::builtinNumber):
(KJS::InterpreterImp::builtinDate):
(KJS::InterpreterImp::builtinRegExp):
(KJS::InterpreterImp::builtinError):
(KJS::InterpreterImp::builtinObjectPrototype):
(KJS::InterpreterImp::builtinFunctionPrototype):
(KJS::InterpreterImp::builtinArrayPrototype):
(KJS::InterpreterImp::builtinBooleanPrototype):
(KJS::InterpreterImp::builtinStringPrototype):
(KJS::InterpreterImp::builtinNumberPrototype):
(KJS::InterpreterImp::builtinDatePrototype):
(KJS::InterpreterImp::builtinRegExpPrototype):
(KJS::InterpreterImp::builtinErrorPrototype):
(KJS::InterpreterImp::builtinEvalError):
(KJS::InterpreterImp::builtinRangeError):
(KJS::InterpreterImp::builtinReferenceError):
(KJS::InterpreterImp::builtinSyntaxError):
(KJS::InterpreterImp::builtinTypeError):
(KJS::InterpreterImp::builtinURIError):
(KJS::InterpreterImp::builtinEvalErrorPrototype):
(KJS::InterpreterImp::builtinRangeErrorPrototype):
(KJS::InterpreterImp::builtinReferenceErrorPrototype):
(KJS::InterpreterImp::builtinSyntaxErrorPrototype):
(KJS::InterpreterImp::builtinTypeErrorPrototype):
(KJS::InterpreterImp::builtinURIErrorPrototype):
* kjs/interpreter.cpp:
(Context::variableObject):
(Context::thisValue):
(Interpreter::Interpreter):
(Interpreter::globalObject):
(Interpreter::evaluate):
(Interpreter::builtinObject):
(Interpreter::builtinFunction):
(Interpreter::builtinArray):
(Interpreter::builtinBoolean):
(Interpreter::builtinString):
(Interpreter::builtinNumber):
(Interpreter::builtinDate):
(Interpreter::builtinRegExp):
(Interpreter::builtinError):
(Interpreter::builtinObjectPrototype):
(Interpreter::builtinFunctionPrototype):
(Interpreter::builtinArrayPrototype):
(Interpreter::builtinBooleanPrototype):
(Interpreter::builtinStringPrototype):
(Interpreter::builtinNumberPrototype):
(Interpreter::builtinDatePrototype):
(Interpreter::builtinRegExpPrototype):
(Interpreter::builtinErrorPrototype):
(Interpreter::builtinEvalError):
(Interpreter::builtinRangeError):
(Interpreter::builtinReferenceError):
(Interpreter::builtinSyntaxError):
(Interpreter::builtinTypeError):
(Interpreter::builtinURIError):
(Interpreter::builtinEvalErrorPrototype):
(Interpreter::builtinRangeErrorPrototype):
(Interpreter::builtinReferenceErrorPrototype):
(Interpreter::builtinSyntaxErrorPrototype):
(Interpreter::builtinTypeErrorPrototype):
(Interpreter::builtinURIErrorPrototype):
(Interpreter::createLanguageInstanceForValue):
* kjs/interpreter.h:
(KJS::Interpreter::isGlobalObject):
(KJS::ExecState::setException):
(KJS::ExecState::clearException):
(KJS::ExecState::exception):
(KJS::ExecState::hadException):
(KJS::ExecState::ExecState):
* kjs/list.cpp:
(KJS::List::at):
* kjs/list.h:
(KJS::List::operator[]):
(KJS::ListIterator::operator->):
(KJS::ListIterator::operator*):
(KJS::ListIterator::operator++):
(KJS::ListIterator::operator--):
* kjs/lookup.h:
(KJS::staticFunctionGetter):
(KJS::staticValueGetter):
(KJS::lookupPut):
(KJS::cacheGlobalObject):
* kjs/math_object.cpp:
(MathObjectImp::getValueProperty):
(MathFuncImp::MathFuncImp):
(MathFuncImp::callAsFunction):
* kjs/math_object.h:
* kjs/nodes.cpp:
(Node::evaluateReference):
(Node::throwError):
(Node::setExceptionDetailsIfNeeded):
(NullNode::evaluate):
(BooleanNode::evaluate):
(NumberNode::evaluate):
(StringNode::evaluate):
(RegExpNode::evaluate):
(ThisNode::evaluate):
(ResolveNode::evaluate):
(ResolveNode::evaluateReference):
(GroupNode::evaluate):
(ElementNode::evaluate):
(ArrayNode::evaluate):
(ObjectLiteralNode::evaluate):
(PropertyValueNode::evaluate):
(PropertyNode::evaluate):
(AccessorNode1::evaluate):
(AccessorNode1::evaluateReference):
(AccessorNode2::evaluate):
(AccessorNode2::evaluateReference):
(ArgumentListNode::evaluate):
(ArgumentListNode::evaluateList):
(ArgumentsNode::evaluate):
(NewExprNode::evaluate):
(FunctionCallNode::evaluate):
(PostfixNode::evaluate):
(DeleteNode::evaluate):
(VoidNode::evaluate):
(TypeOfNode::evaluate):
(PrefixNode::evaluate):
(UnaryPlusNode::evaluate):
(NegateNode::evaluate):
(BitwiseNotNode::evaluate):
(LogicalNotNode::evaluate):
(MultNode::evaluate):
(AddNode::evaluate):
(ShiftNode::evaluate):
(RelationalNode::evaluate):
(EqualNode::evaluate):
(BitOperNode::evaluate):
(BinaryLogicalNode::evaluate):
(ConditionalNode::evaluate):
(AssignNode::evaluate):
(CommaNode::evaluate):
(StatListNode::execute):
(AssignExprNode::evaluate):
(VarDeclNode::evaluate):
(VarDeclNode::processVarDecls):
(VarDeclListNode::evaluate):
(ExprStatementNode::execute):
(IfNode::execute):
(DoWhileNode::execute):
(WhileNode::execute):
(ForNode::execute):
(ForInNode::execute):
(ContinueNode::execute):
(BreakNode::execute):
(ReturnNode::execute):
(WithNode::execute):
(CaseClauseNode::evaluate):
(ClauseListNode::evaluate):
(CaseBlockNode::evaluate):
(CaseBlockNode::evalBlock):
(SwitchNode::execute):
(ThrowNode::execute):
(CatchNode::execute):
(TryNode::execute):
(ParameterNode::evaluate):
(FuncDeclNode::processFuncDecl):
(FuncExprNode::evaluate):
(SourceElementsNode::execute):
* kjs/nodes.h:
(KJS::StatementNode::evaluate):
* kjs/number_object.cpp:
(NumberPrototypeImp::NumberPrototypeImp):
(NumberProtoFuncImp::NumberProtoFuncImp):
(NumberProtoFuncImp::callAsFunction):
(NumberObjectImp::NumberObjectImp):
(NumberObjectImp::getValueProperty):
(NumberObjectImp::construct):
(NumberObjectImp::callAsFunction):
* kjs/number_object.h:
* kjs/object.cpp:
(KJS::ObjectImp::call):
(KJS::ObjectImp::mark):
(KJS::ObjectImp::classInfo):
(KJS::ObjectImp::get):
(KJS::ObjectImp::getProperty):
(KJS::ObjectImp::getPropertySlot):
(KJS::ObjectImp::put):
(KJS::ObjectImp::hasOwnProperty):
(KJS::ObjectImp::defaultValue):
(KJS::ObjectImp::findPropertyHashEntry):
(KJS::ObjectImp::construct):
(KJS::ObjectImp::callAsFunction):
(KJS::ObjectImp::hasInstance):
(KJS::ObjectImp::propList):
(KJS::ObjectImp::toPrimitive):
(KJS::ObjectImp::toNumber):
(KJS::ObjectImp::toString):
(KJS::ObjectImp::toObject):
(KJS::ObjectImp::putDirect):
(KJS::Error::create):
(KJS::error):
* kjs/object.h:
(KJS::):
(KJS::ObjectImp::getPropertySlot):
(KJS::AllocatedValueImp::isObject):
(KJS::ObjectImp::ObjectImp):
(KJS::ObjectImp::internalValue):
(KJS::ObjectImp::setInternalValue):
(KJS::ObjectImp::prototype):
(KJS::ObjectImp::setPrototype):
(KJS::ObjectImp::inherits):
* kjs/object_object.cpp:
(ObjectPrototypeImp::ObjectPrototypeImp):
(ObjectProtoFuncImp::ObjectProtoFuncImp):
(ObjectProtoFuncImp::callAsFunction):
(ObjectObjectImp::ObjectObjectImp):
(ObjectObjectImp::construct):
(ObjectObjectImp::callAsFunction):
* kjs/object_object.h:
* kjs/operations.cpp:
(KJS::equal):
(KJS::strictEqual):
(KJS::relation):
(KJS::add):
(KJS::mult):
* kjs/operations.h:
* kjs/property_map.cpp:
(KJS::PropertyMap::mark):
(KJS::PropertyMap::addEnumerablesToReferenceList):
(KJS::PropertyMap::addSparseArrayPropertiesToReferenceList):
(KJS::PropertyMap::save):
(KJS::PropertyMap::restore):
* kjs/property_map.h:
* kjs/property_slot.cpp:
(KJS::PropertySlot::undefinedGetter):
* kjs/property_slot.h:
(KJS::PropertySlot::getValue):
* kjs/protect.h:
(KJS::gcUnprotectNullTolerant):
(KJS::ProtectedValue::ProtectedValue):
(KJS::ProtectedValue::~ProtectedValue):
(KJS::ProtectedValue::operator=):
(KJS::ProtectedValue::operator ValueImp *):
(KJS::ProtectedValue::operator->):
* kjs/protected_object.h:
(KJS::ProtectedObject::ProtectedObject):
(KJS::ProtectedObject::operator=):
(KJS::ProtectedObject::operator ValueImp *):
(KJS::ProtectedObject::operator ObjectImp *):
(KJS::ProtectedObject::operator->):
(KJS::ProtectedReference::ProtectedReference):
(KJS::ProtectedReference::~ProtectedReference):
(KJS::ProtectedReference::operator=):
* kjs/protected_values.cpp:
(KJS::ProtectedValues::getProtectCount):
(KJS::ProtectedValues::increaseProtectCount):
(KJS::ProtectedValues::insert):
(KJS::ProtectedValues::decreaseProtectCount):
* kjs/protected_values.h:
* kjs/reference.cpp:
(KJS::Reference::Reference):
(KJS::Reference::makeValueReference):
(KJS::Reference::getBase):
(KJS::Reference::getValue):
(KJS::Reference::putValue):
(KJS::Reference::deleteValue):
* kjs/reference.h:
(KJS::Reference::baseIfMutable):
* kjs/regexp_object.cpp:
(RegExpPrototypeImp::RegExpPrototypeImp):
(RegExpProtoFuncImp::RegExpProtoFuncImp):
(RegExpProtoFuncImp::callAsFunction):
(RegExpObjectImp::RegExpObjectImp):
(RegExpObjectImp::arrayOfMatches):
(RegExpObjectImp::backrefGetter):
(RegExpObjectImp::construct):
(RegExpObjectImp::callAsFunction):
* kjs/regexp_object.h:
* kjs/string_object.cpp:
(StringInstanceImp::lengthGetter):
(StringInstanceImp::indexGetter):
(StringInstanceImp::getOwnPropertySlot):
(StringInstanceImp::put):
(StringPrototypeImp::StringPrototypeImp):
(StringProtoFuncImp::StringProtoFuncImp):
(regExpIsGlobal):
(replace):
(StringProtoFuncImp::callAsFunction):
(StringObjectImp::StringObjectImp):
(StringObjectImp::construct):
(StringObjectImp::callAsFunction):
(StringObjectFuncImp::StringObjectFuncImp):
(StringObjectFuncImp::callAsFunction):
* kjs/string_object.h:
* kjs/testkjs.cpp:
(TestFunctionImp::callAsFunction):
(VersionFunctionImp::callAsFunction):
(main):
* kjs/value.cpp:
(KJS::AllocatedValueImp::operator new):
(KJS::AllocatedValueImp::getUInt32):
(KJS::ValueImp::toInteger):
(KJS::ValueImp::toInt32):
(KJS::ValueImp::toUInt32):
(KJS::ValueImp::toUInt16):
(KJS::ValueImp::toObject):
(KJS::AllocatedValueImp::getBoolean):
(KJS::AllocatedValueImp::getNumber):
(KJS::AllocatedValueImp::getString):
(KJS::AllocatedValueImp::getObject):
(KJS::jsString):
(KJS::jsNumber):
(KJS::ConstantValues::init):
(KJS::ConstantValues::clear):
(KJS::ConstantValues::mark):
* kjs/value.h:
(KJS::):
(KJS::jsUndefined):
(KJS::jsNull):
(KJS::jsBoolean):
(KJS::jsNaN):
(KJS::ValueImp::ValueImp):
(KJS::ValueImp::~ValueImp):
(KJS::AllocatedValueImp::AllocatedValueImp):
(KJS::AllocatedValueImp::~AllocatedValueImp):
(KJS::AllocatedValueImp::isBoolean):
(KJS::AllocatedValueImp::isNumber):
(KJS::AllocatedValueImp::isString):
(KJS::AllocatedValueImp::isObject):
(KJS::AllocatedValueImp::marked):
(KJS::AllocatedValueImp::mark):
(KJS::ValueImp::downcast):
(KJS::ValueImp::isUndefined):
(KJS::ValueImp::isNull):
(KJS::ValueImp::isUndefinedOrNull):
(KJS::ValueImp::isBoolean):
(KJS::ValueImp::isNumber):
(KJS::ValueImp::isString):
(KJS::ValueImp::isObject):
(KJS::ValueImp::getBoolean):
(KJS::ValueImp::getNumber):
(KJS::ValueImp::getString):
(KJS::ValueImp::getObject):
(KJS::ValueImp::getUInt32):
(KJS::ValueImp::mark):
(KJS::ValueImp::marked):
(KJS::ValueImp::type):
(KJS::ValueImp::toPrimitive):
(KJS::ValueImp::toBoolean):
(KJS::ValueImp::toNumber):
(KJS::ValueImp::toString):
(KJS::jsZero):
(KJS::jsOne):
(KJS::jsTwo):
(KJS::Undefined):
(KJS::Null):
(KJS::Boolean):
(KJS::Number):
(KJS::String):
WebCore:
Rubber stamped by Maciej.
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4313
eliminate KJS::Value and KJS::Object smart pointer wrappers (for simplicity and speed)
* khtml/ecma/domparser.cpp:
(KJS::DOMParserConstructorImp::construct):
(KJS::DOMParserProtoFunc::callAsFunction):
* khtml/ecma/domparser.h:
* khtml/ecma/kjs_binding.cpp:
(KJS::ScriptInterpreter::ScriptInterpreter):
(KJS::ScriptInterpreter::isGlobalObject):
(KJS::ScriptInterpreter::createLanguageInstanceForValue):
(KJS::getStringOrNull):
(KJS::ValueToVariant):
(KJS::setDOMException):
* khtml/ecma/kjs_binding.h:
(KJS::DOMFunction::toPrimitive):
(KJS::cacheDOMObject):
* khtml/ecma/kjs_css.cpp:
(KJS::DOMCSSStyleDeclaration::indexGetter):
(KJS::DOMCSSStyleDeclaration::cssPropertyGetter):
(KJS::DOMCSSStyleDeclaration::getValueProperty):
(KJS::DOMCSSStyleDeclaration::put):
(KJS::DOMCSSStyleDeclarationProtoFunc::callAsFunction):
(KJS::DOMStyleSheet::getValueProperty):
(KJS::DOMStyleSheet::put):
(KJS::DOMStyleSheetList::getValueProperty):
(KJS::DOMStyleSheetList::indexGetter):
(KJS::DOMStyleSheetList::nameGetter):
(KJS::DOMStyleSheetListFunc::callAsFunction):
(KJS::DOMMediaList::getValueProperty):
(KJS::DOMMediaList::indexGetter):
(KJS::DOMMediaList::put):
(KJS::KJS::DOMMediaListProtoFunc::callAsFunction):
(KJS::DOMCSSStyleSheet::getValueProperty):
(KJS::DOMCSSStyleSheetProtoFunc::callAsFunction):
(KJS::DOMCSSRuleList::getValueProperty):
(KJS::DOMCSSRuleList::indexGetter):
(KJS::DOMCSSRuleListFunc::callAsFunction):
(KJS::DOMCSSRule::getValueProperty):
(KJS::DOMCSSRule::put):
(KJS::DOMCSSRule::putValueProperty):
(KJS::DOMCSSRuleFunc::callAsFunction):
(KJS::CSSRuleConstructor::getValueProperty):
(KJS::getCSSRuleConstructor):
(KJS::DOMCSSValue::getValueProperty):
(KJS::DOMCSSValue::put):
(KJS::getDOMCSSValue):
(KJS::CSSValueConstructor::getValueProperty):
(KJS::getCSSValueConstructor):
(KJS::DOMCSSPrimitiveValue::getValueProperty):
(KJS::DOMCSSPrimitiveValueProtoFunc::callAsFunction):
(KJS::CSSPrimitiveValueConstructor::getValueProperty):
(KJS::getCSSPrimitiveValueConstructor):
(KJS::DOMCSSValueList::getValueProperty):
(KJS::DOMCSSValueList::indexGetter):
(KJS::DOMCSSValueListFunc::callAsFunction):
(KJS::DOMRGBColor::getValueProperty):
(KJS::DOMRect::getValueProperty):
(KJS::DOMCounter::getValueProperty):
* khtml/ecma/kjs_css.h:
* khtml/ecma/kjs_dom.cpp:
(KJS::DOMNode::getValueProperty):
(KJS::DOMNode::put):
(KJS::DOMNode::putValueProperty):
(KJS::DOMNode::toPrimitive):
(KJS::DOMNode::getListener):
(KJS::DOMNodeProtoFunc::callAsFunction):
(KJS::DOMNodeList::toPrimitive):
(KJS::DOMNodeList::getValueProperty):
(KJS::DOMNodeList::indexGetter):
(KJS::DOMNodeList::nameGetter):
(KJS::DOMNodeList::callAsFunction):
(KJS::DOMNodeListFunc::DOMNodeListFunc):
(KJS::DOMNodeListFunc::callAsFunction):
(KJS::DOMAttr::getValueProperty):
(KJS::DOMAttr::put):
(KJS::DOMAttr::putValueProperty):
(KJS::DOMDocument::getValueProperty):
(KJS::DOMDocument::put):
(KJS::DOMDocument::putValueProperty):
(KJS::DOMDocumentProtoFunc::callAsFunction):
(KJS::DOMElement::getValueProperty):
(KJS::DOMElement::attributeGetter):
(KJS::DOMElement::getOwnPropertySlot):
(KJS::DOMElementProtoFunc::callAsFunction):
(KJS::DOMDOMImplementationProtoFunc::callAsFunction):
(KJS::DOMDocumentType::getValueProperty):
(KJS::DOMNamedNodeMap::lengthGetter):
(KJS::DOMNamedNodeMap::indexGetter):
(KJS::DOMNamedNodeMapProtoFunc::callAsFunction):
(KJS::DOMProcessingInstruction::getValueProperty):
(KJS::DOMProcessingInstruction::put):
(KJS::DOMNotation::getValueProperty):
(KJS::DOMEntity::getValueProperty):
(KJS::NodeConstructor::getValueProperty):
(KJS::DOMExceptionConstructor::getValueProperty):
(KJS::DOMNamedNodesCollection::lengthGetter):
(KJS::DOMNamedNodesCollection::indexGetter):
(KJS::DOMCharacterData::getValueProperty):
(KJS::DOMCharacterData::put):
(KJS::DOMCharacterDataProtoFunc::callAsFunction):
(KJS::DOMTextProtoFunc::callAsFunction):
* khtml/ecma/kjs_dom.h:
* khtml/ecma/kjs_events.cpp:
(KJS::JSAbstractEventListener::handleEvent):
(KJS::JSUnprotectedEventListener::JSUnprotectedEventListener):
(KJS::JSUnprotectedEventListener::~JSUnprotectedEventListener):
(KJS::JSUnprotectedEventListener::listenerObj):
(KJS::JSUnprotectedEventListener::windowObj):
(KJS::JSUnprotectedEventListener::mark):
(KJS::JSEventListener::JSEventListener):
(KJS::JSEventListener::~JSEventListener):
(KJS::JSEventListener::listenerObj):
(KJS::JSEventListener::windowObj):
(KJS::JSLazyEventListener::JSLazyEventListener):
(KJS::JSLazyEventListener::handleEvent):
(KJS::JSLazyEventListener::listenerObj):
(KJS::JSLazyEventListener::parseCode):
(KJS::getNodeEventListener):
(KJS::EventConstructor::getValueProperty):
(KJS::getEventConstructor):
(KJS::DOMEvent::getValueProperty):
(KJS::DOMEvent::put):
(KJS::DOMEvent::putValueProperty):
(KJS::DOMEventProtoFunc::callAsFunction):
(KJS::getDOMEvent):
(KJS::EventExceptionConstructor::getValueProperty):
(KJS::getEventExceptionConstructor):
(KJS::DOMUIEvent::getValueProperty):
(KJS::DOMUIEventProtoFunc::callAsFunction):
(KJS::DOMMouseEvent::getValueProperty):
(KJS::DOMMouseEventProtoFunc::callAsFunction):
(KJS::DOMKeyboardEvent::getValueProperty):
(KJS::DOMKeyboardEventProtoFunc::callAsFunction):
(KJS::MutationEventConstructor::getValueProperty):
(KJS::getMutationEventConstructor):
(KJS::DOMMutationEvent::getValueProperty):
(KJS::DOMMutationEventProtoFunc::callAsFunction):
(KJS::DOMWheelEvent::getValueProperty):
(KJS::DOMWheelEventProtoFunc::callAsFunction):
(KJS::stringOrUndefined):
(KJS::Clipboard::getValueProperty):
(KJS::Clipboard::put):
(KJS::Clipboard::putValueProperty):
(KJS::ClipboardProtoFunc::callAsFunction):
* khtml/ecma/kjs_events.h:
(KJS::JSAbstractEventListener::listenerObjImp):
* khtml/ecma/kjs_html.cpp:
(KJS::KJS::HTMLDocFunction::callAsFunction):
(KJS::HTMLDocument::namedItemGetter):
(KJS::HTMLDocument::getValueProperty):
(KJS::KJS::HTMLDocument::put):
(KJS::KJS::HTMLDocument::putValueProperty):
(KJS::HTMLElement::formIndexGetter):
(KJS::HTMLElement::formNameGetter):
(KJS::HTMLElement::selectIndexGetter):
(KJS::HTMLElement::framesetNameGetter):
(KJS::HTMLElement::frameWindowPropertyGetter):
(KJS::HTMLElement::runtimeObjectGetter):
(KJS::HTMLElement::runtimeObjectPropertyGetter):
(KJS::HTMLElement::getOwnPropertySlot):
(KJS::KJS::HTMLElement::implementsCall):
(KJS::KJS::HTMLElement::callAsFunction):
(KJS::HTMLElement::htmlGetter):
(KJS::HTMLElement::headGetter):
(KJS::HTMLElement::linkGetter):
(KJS::HTMLElement::titleGetter):
(KJS::HTMLElement::metaGetter):
(KJS::HTMLElement::baseGetter):
(KJS::HTMLElement::isIndexGetter):
(KJS::HTMLElement::styleGetter):
(KJS::HTMLElement::bodyGetter):
(KJS::HTMLElement::formGetter):
(KJS::HTMLElement::selectGetter):
(KJS::HTMLElement::optGroupGetter):
(KJS::HTMLElement::optionGetter):
(KJS::getInputSelectionStart):
(KJS::getInputSelectionEnd):
(KJS::HTMLElement::inputGetter):
(KJS::HTMLElement::textAreaGetter):
(KJS::HTMLElement::buttonGetter):
(KJS::HTMLElement::labelGetter):
(KJS::HTMLElement::fieldSetGetter):
(KJS::HTMLElement::legendGetter):
(KJS::HTMLElement::uListGetter):
(KJS::HTMLElement::oListGetter):
(KJS::HTMLElement::dListGetter):
(KJS::HTMLElement::dirGetter):
(KJS::HTMLElement::menuGetter):
(KJS::HTMLElement::liGetter):
(KJS::HTMLElement::divGetter):
(KJS::HTMLElement::paragraphGetter):
(KJS::HTMLElement::headingGetter):
(KJS::HTMLElement::blockQuoteGetter):
(KJS::HTMLElement::quoteGetter):
(KJS::HTMLElement::preGetter):
(KJS::HTMLElement::brGetter):
(KJS::HTMLElement::baseFontGetter):
(KJS::HTMLElement::fontGetter):
(KJS::HTMLElement::hrGetter):
(KJS::HTMLElement::modGetter):
(KJS::HTMLElement::anchorGetter):
(KJS::HTMLElement::imageGetter):
(KJS::HTMLElement::objectGetter):
(KJS::HTMLElement::paramGetter):
(KJS::HTMLElement::appletGetter):
(KJS::HTMLElement::mapGetter):
(KJS::HTMLElement::areaGetter):
(KJS::HTMLElement::scriptGetter):
(KJS::HTMLElement::tableGetter):
(KJS::HTMLElement::tableCaptionGetter):
(KJS::HTMLElement::tableColGetter):
(KJS::HTMLElement::tableSectionGetter):
(KJS::HTMLElement::tableRowGetter):
(KJS::HTMLElement::tableCellGetter):
(KJS::HTMLElement::frameSetGetter):
(KJS::HTMLElement::frameGetter):
(KJS::HTMLElement::iFrameGetter):
(KJS::HTMLElement::marqueeGetter):
(KJS::HTMLElement::getValueProperty):
(KJS::HTMLElementFunction::HTMLElementFunction):
(KJS::KJS::HTMLElementFunction::callAsFunction):
(KJS::KJS::HTMLElement::put):
(KJS::HTMLElement::htmlSetter):
(KJS::HTMLElement::headSetter):
(KJS::HTMLElement::linkSetter):
(KJS::HTMLElement::titleSetter):
(KJS::HTMLElement::metaSetter):
(KJS::HTMLElement::baseSetter):
(KJS::HTMLElement::isIndexSetter):
(KJS::HTMLElement::styleSetter):
(KJS::HTMLElement::bodySetter):
(KJS::HTMLElement::formSetter):
(KJS::HTMLElement::selectSetter):
(KJS::HTMLElement::optGroupSetter):
(KJS::HTMLElement::optionSetter):
(KJS::HTMLElement::inputSetter):
(KJS::HTMLElement::textAreaSetter):
(KJS::HTMLElement::buttonSetter):
(KJS::HTMLElement::labelSetter):
(KJS::HTMLElement::fieldSetSetter):
(KJS::HTMLElement::legendSetter):
(KJS::HTMLElement::uListSetter):
(KJS::HTMLElement::oListSetter):
(KJS::HTMLElement::dListSetter):
(KJS::HTMLElement::dirSetter):
(KJS::HTMLElement::menuSetter):
(KJS::HTMLElement::liSetter):
(KJS::HTMLElement::divSetter):
(KJS::HTMLElement::paragraphSetter):
(KJS::HTMLElement::headingSetter):
(KJS::HTMLElement::blockQuoteSetter):
(KJS::HTMLElement::quoteSetter):
(KJS::HTMLElement::preSetter):
(KJS::HTMLElement::brSetter):
(KJS::HTMLElement::baseFontSetter):
(KJS::HTMLElement::fontSetter):
(KJS::HTMLElement::hrSetter):
(KJS::HTMLElement::modSetter):
(KJS::HTMLElement::anchorSetter):
(KJS::HTMLElement::imageSetter):
(KJS::HTMLElement::objectSetter):
(KJS::HTMLElement::paramSetter):
(KJS::HTMLElement::appletSetter):
(KJS::HTMLElement::mapSetter):
(KJS::HTMLElement::areaSetter):
(KJS::HTMLElement::scriptSetter):
(KJS::HTMLElement::tableSetter):
(KJS::HTMLElement::tableCaptionSetter):
(KJS::HTMLElement::tableColSetter):
(KJS::HTMLElement::tableSectionSetter):
(KJS::HTMLElement::tableRowSetter):
(KJS::HTMLElement::tableCellSetter):
(KJS::HTMLElement::frameSetSetter):
(KJS::HTMLElement::frameSetter):
(KJS::HTMLElement::iFrameSetter):
(KJS::HTMLElement::marqueeSetter):
(KJS::HTMLElement::putValueProperty):
(KJS::HTMLCollection::lengthGetter):
(KJS::HTMLCollection::indexGetter):
(KJS::HTMLCollection::nameGetter):
(KJS::HTMLCollection::getOwnPropertySlot):
(KJS::KJS::HTMLCollection::callAsFunction):
(KJS::KJS::HTMLCollection::getNamedItems):
(KJS::KJS::HTMLCollectionProtoFunc::callAsFunction):
(KJS::HTMLSelectCollection::selectedIndexGetter):
(KJS::KJS::HTMLSelectCollection::put):
(KJS::OptionConstructorImp::construct):
(KJS::ImageConstructorImp::construct):
(KJS::Image::getValueProperty):
(KJS::Image::put):
(KJS::Image::putValueProperty):
(KJS::isGradient):
(KJS::isImagePattern):
(KJS::KJS::Context2DFunction::callAsFunction):
(KJS::Context2D::getValueProperty):
(KJS::Context2D::put):
(KJS::colorRefFromValue):
(KJS::colorFromValue):
(KJS::Context2D::setShadow):
(KJS::Context2D::updateFillImagePattern):
(KJS::Context2D::updateStrokeImagePattern):
(KJS::Context2D::putValueProperty):
(KJS::Context2D::Context2D):
(KJS::Context2D::mark):
(KJS::GradientFunction::callAsFunction):
(KJS::Gradient::getValueProperty):
(KJS::Gradient::put):
(KJS::Gradient::putValueProperty):
(KJS::ImagePattern::getValueProperty):
(KJS::ImagePattern::put):
(KJS::ImagePattern::putValueProperty):
* khtml/ecma/kjs_html.h:
* khtml/ecma/kjs_navigator.cpp:
(KJS::Navigator::getValueProperty):
(KJS::Plugins::getValueProperty):
(KJS::Plugins::indexGetter):
(KJS::Plugins::nameGetter):
(KJS::MimeTypes::getValueProperty):
(KJS::MimeTypes::indexGetter):
(KJS::MimeTypes::nameGetter):
(KJS::Plugin::getValueProperty):
(KJS::Plugin::indexGetter):
(KJS::Plugin::nameGetter):
(KJS::MimeType::getValueProperty):
(KJS::PluginsFunc::callAsFunction):
(KJS::NavigatorFunc::callAsFunction):
* khtml/ecma/kjs_navigator.h:
* khtml/ecma/kjs_proxy.cpp:
(KJSProxyImpl::evaluate):
(TestFunctionImp::callAsFunction):
(KJSProxyImpl::initScript):
(KJSProxy::proxy):
* khtml/ecma/kjs_range.cpp:
(KJS::DOMRange::getValueProperty):
(KJS::DOMRangeProtoFunc::callAsFunction):
(KJS::RangeConstructor::getValueProperty):
* khtml/ecma/kjs_range.h:
* khtml/ecma/kjs_traversal.cpp:
(KJS::DOMNodeIterator::getValueProperty):
(KJS::DOMNodeIteratorProtoFunc::callAsFunction):
(KJS::NodeFilterConstructor::getValueProperty):
(KJS::getNodeFilterConstructor):
(KJS::DOMNodeFilterProtoFunc::callAsFunction):
(KJS::DOMTreeWalker::getValueProperty):
(KJS::DOMTreeWalker::put):
(KJS::DOMTreeWalkerProtoFunc::callAsFunction):
(KJS::JSNodeFilterCondition::JSNodeFilterCondition):
(KJS::JSNodeFilterCondition::acceptNode):
* khtml/ecma/kjs_traversal.h:
* khtml/ecma/kjs_views.cpp:
(KJS::DOMAbstractView::getValueProperty):
(KJS::DOMAbstractViewFunc::callAsFunction):
* khtml/ecma/kjs_views.h:
* khtml/ecma/kjs_window.cpp:
(KJS::Screen::getValueProperty):
(KJS::Window::retrieveWindow):
(KJS::Window::retrieveActive):
(KJS::Window::retrieve):
(KJS::parseFeatures):
(KJS::showModalDialog):
(KJS::Window::getValueProperty):
(KJS::Window::childFrameGetter):
(KJS::Window::namedFrameGetter):
(KJS::Window::indexGetter):
(KJS::Window::namedItemGetter):
(KJS::Window::put):
(KJS::Window::installTimeout):
(KJS::Window::setListener):
(KJS::Window::getListener):
(KJS::Window::getJSEventListener):
(KJS::Window::getJSUnprotectedEventListener):
(KJS::Window::getJSLazyEventListener):
(KJS::WindowFunc::callAsFunction):
(KJS::ScheduledAction::ScheduledAction):
(KJS::ScheduledAction::execute):
(KJS::WindowQObject::installTimeout):
(KJS::FrameArray::getValueProperty):
(KJS::FrameArray::indexGetter):
(KJS::FrameArray::nameGetter):
(KJS::Location::getValueProperty):
(KJS::Location::put):
(KJS::Location::toPrimitive):
(KJS::LocationFunc::callAsFunction):
(KJS::Selection::getValueProperty):
(KJS::Selection::toPrimitive):
(KJS::SelectionFunc::callAsFunction):
(KJS::BarInfo::getValueProperty):
(KJS::History::getValueProperty):
(KJS::HistoryFunc::callAsFunction):
(KJS::Konqueror::get):
(KJS::KonquerorFunc::callAsFunction):
* khtml/ecma/kjs_window.h:
* khtml/ecma/xmlhttprequest.cpp:
(KJS::XMLHttpRequestConstructorImp::construct):
(KJS::XMLHttpRequest::getValueProperty):
(KJS::XMLHttpRequest::put):
(KJS::XMLHttpRequest::putValueProperty):
(KJS::XMLHttpRequest::getAllResponseHeaders):
(KJS::XMLHttpRequest::getResponseHeader):
(KJS::XMLHttpRequest::getStatus):
(KJS::XMLHttpRequest::getStatusText):
(KJS::XMLHttpRequestProtoFunc::callAsFunction):
* khtml/ecma/xmlhttprequest.h:
* khtml/ecma/xmlserializer.cpp:
(KJS::XMLSerializerConstructorImp::construct):
(KJS::XMLSerializerProtoFunc::callAsFunction):
* khtml/ecma/xmlserializer.h:
* kwq/DOMUtility.mm:
(KJS::ScriptInterpreter::createObjcInstanceForValue):
* kwq/KWQKHTMLPart.mm:
(KWQKHTMLPart::bindingRootObject):
(KWQKHTMLPart::windowScriptObject):
(KWQKHTMLPart::windowScriptNPObject):
* kwq/WebCoreBridge.mm:
(-[WebCoreBridge executionContextForView:]):
* kwq/WebCoreScriptDebugger.mm:
(WebCoreScriptDebuggerImp::callEvent):
(WebCoreScriptDebuggerImp::returnEvent):
(-[WebCoreScriptDebugger finalize]):
(-[WebCoreScriptCallFrame _convertValueToObjcValue:]):
(-[WebCoreScriptCallFrame scopeChain]):
(-[WebCoreScriptCallFrame evaluateWebScript:]):
Revision Changes Path
1.778 +693 -0 JavaScriptCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/JavaScriptCore/ChangeLog,v
retrieving revision 1.777
retrieving revision 1.778
diff -u -r1.777 -r1.778
--- ChangeLog 7 Aug 2005 06:17:31 -0000 1.777
+++ ChangeLog 8 Aug 2005 04:07:21 -0000 1.778
@@ -1,3 +1,696 @@
+2005-08-07 Darin Adler <darin at apple.com>
+
+ Rubber stamped by Maciej.
+
+ - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4313
+ eliminate KJS::Value and KJS::Object smart pointer wrappers (for simplicity and speed)
+
+ * JavaScriptCore.xcodeproj/project.pbxproj: Removed object_wrapper.h.
+
+ Global replaces and other wonderful stuff.
+
+ * bindings/NP_jsobject.cpp:
+ (_NPN_Invoke):
+ (_NPN_Evaluate):
+ (_NPN_GetProperty):
+ (_NPN_SetProperty):
+ (_NPN_HasMethod):
+ (_NPN_SetException):
+ * bindings/c/c_instance.cpp:
+ (KJS::Bindings::CInstance::CInstance):
+ (KJS::Bindings::CInstance::invokeMethod):
+ (KJS::Bindings::CInstance::invokeDefaultMethod):
+ (KJS::Bindings::CInstance::defaultValue):
+ (KJS::Bindings::CInstance::stringValue):
+ (KJS::Bindings::CInstance::numberValue):
+ (KJS::Bindings::CInstance::booleanValue):
+ (KJS::Bindings::CInstance::valueOf):
+ * bindings/c/c_instance.h:
+ * bindings/c/c_runtime.cpp:
+ (CField::valueFromInstance):
+ (CField::setValueToInstance):
+ * bindings/c/c_runtime.h:
+ * bindings/c/c_utility.cpp:
+ (convertNPStringToUTF16):
+ (convertUTF8ToUTF16):
+ (coerceValueToNPVariantStringType):
+ (convertValueToNPVariant):
+ (convertNPVariantToValue):
+ * bindings/c/c_utility.h:
+ * bindings/jni/jni_instance.cpp:
+ (JavaInstance::stringValue):
+ (JavaInstance::numberValue):
+ (JavaInstance::booleanValue):
+ (JavaInstance::invokeMethod):
+ (JavaInstance::invokeDefaultMethod):
+ (JavaInstance::defaultValue):
+ (JavaInstance::valueOf):
+ * bindings/jni/jni_instance.h:
+ * bindings/jni/jni_jsobject.cpp:
+ (JSObject::invoke):
+ (JSObject::call):
+ (JSObject::eval):
+ (JSObject::getMember):
+ (JSObject::getSlot):
+ (JSObject::toString):
+ (JSObject::convertValueToJObject):
+ (JSObject::convertJObjectToValue):
+ (JSObject::listFromJArray):
+ * bindings/jni/jni_jsobject.h:
+ * bindings/jni/jni_objc.mm:
+ (KJS::Bindings::dispatchJNICall):
+ * bindings/jni/jni_runtime.cpp:
+ (JavaArray::convertJObjectToArray):
+ (JavaField::dispatchValueFromInstance):
+ (JavaField::valueFromInstance):
+ (JavaField::dispatchSetValueToInstance):
+ (JavaField::setValueToInstance):
+ (JavaArray::setValueAt):
+ (JavaArray::valueAt):
+ * bindings/jni/jni_runtime.h:
+ (KJS::Bindings::JavaString::ustring):
+ * bindings/jni/jni_utility.cpp:
+ (KJS::Bindings::getJavaVM):
+ (KJS::Bindings::getJNIEnv):
+ (KJS::Bindings::getMethodID):
+ (KJS::Bindings::callJNIVoidMethod):
+ (KJS::Bindings::callJNIObjectMethod):
+ (KJS::Bindings::callJNIBooleanMethod):
+ (KJS::Bindings::callJNIStaticBooleanMethod):
+ (KJS::Bindings::callJNIByteMethod):
+ (KJS::Bindings::callJNICharMethod):
+ (KJS::Bindings::callJNIShortMethod):
+ (KJS::Bindings::callJNIIntMethod):
+ (KJS::Bindings::callJNILongMethod):
+ (KJS::Bindings::callJNIFloatMethod):
+ (KJS::Bindings::callJNIDoubleMethod):
+ (KJS::Bindings::callJNIVoidMethodA):
+ (KJS::Bindings::callJNIObjectMethodA):
+ (KJS::Bindings::callJNIByteMethodA):
+ (KJS::Bindings::callJNICharMethodA):
+ (KJS::Bindings::callJNIShortMethodA):
+ (KJS::Bindings::callJNIIntMethodA):
+ (KJS::Bindings::callJNILongMethodA):
+ (KJS::Bindings::callJNIFloatMethodA):
+ (KJS::Bindings::callJNIDoubleMethodA):
+ (KJS::Bindings::callJNIBooleanMethodA):
+ (KJS::Bindings::callJNIVoidMethodIDA):
+ (KJS::Bindings::callJNIObjectMethodIDA):
+ (KJS::Bindings::callJNIByteMethodIDA):
+ (KJS::Bindings::callJNICharMethodIDA):
+ (KJS::Bindings::callJNIShortMethodIDA):
+ (KJS::Bindings::callJNIIntMethodIDA):
+ (KJS::Bindings::callJNILongMethodIDA):
+ (KJS::Bindings::callJNIFloatMethodIDA):
+ (KJS::Bindings::callJNIDoubleMethodIDA):
+ (KJS::Bindings::callJNIBooleanMethodIDA):
+ (KJS::Bindings::getCharactersFromJString):
+ (KJS::Bindings::releaseCharactersForJString):
+ (KJS::Bindings::getCharactersFromJStringInEnv):
+ (KJS::Bindings::releaseCharactersForJStringInEnv):
+ (KJS::Bindings::getUCharactersFromJStringInEnv):
+ (KJS::Bindings::releaseUCharactersForJStringInEnv):
+ (KJS::Bindings::JNITypeFromClassName):
+ (KJS::Bindings::signatureFromPrimitiveType):
+ (KJS::Bindings::JNITypeFromPrimitiveType):
+ (KJS::Bindings::getJNIField):
+ (KJS::Bindings::convertValueToJValue):
+ * bindings/jni/jni_utility.h:
+ * bindings/objc/WebScriptObject.mm:
+ (_didExecute):
+ (-[WebScriptObject _initializeWithObjectImp:originExecutionContext:Bindings::executionContext:Bindings::]):
+ (-[WebScriptObject _initWithObjectImp:originExecutionContext:Bindings::executionContext:Bindings::]):
+ (-[WebScriptObject _imp]):
+ (-[WebScriptObject _executionContext]):
+ (-[WebScriptObject _setExecutionContext:]):
+ (-[WebScriptObject _originExecutionContext]):
+ (-[WebScriptObject _setOriginExecutionContext:]):
+ (+[WebScriptObject throwException:]):
+ (listFromNSArray):
+ (-[WebScriptObject callWebScriptMethod:withArguments:]):
+ (-[WebScriptObject evaluateWebScript:]):
+ (-[WebScriptObject setValue:forKey:]):
+ (-[WebScriptObject valueForKey:]):
+ (-[WebScriptObject removeWebScriptKey:]):
+ (-[WebScriptObject stringRepresentation]):
+ (-[WebScriptObject webScriptValueAtIndex:]):
+ (-[WebScriptObject setException:]):
+ (+[WebScriptObject _convertValueToObjcValue:originExecutionContext:executionContext:Bindings::]):
+ * bindings/objc/WebScriptObjectPrivate.h:
+ * bindings/objc/objc_class.h:
+ * bindings/objc/objc_class.mm:
+ (KJS::Bindings::ObjcClass::fallbackObject):
+ * bindings/objc/objc_instance.h:
+ * bindings/objc/objc_instance.mm:
+ (ObjcInstance::invokeMethod):
+ (ObjcInstance::invokeDefaultMethod):
+ (ObjcInstance::setValueOfField):
+ (ObjcInstance::setValueOfUndefinedField):
+ (ObjcInstance::getValueOfField):
+ (ObjcInstance::getValueOfUndefinedField):
+ (ObjcInstance::defaultValue):
+ (ObjcInstance::stringValue):
+ (ObjcInstance::numberValue):
+ (ObjcInstance::booleanValue):
+ (ObjcInstance::valueOf):
+ * bindings/objc/objc_runtime.h:
+ * bindings/objc/objc_runtime.mm:
+ (ObjcField::valueFromInstance):
+ (convertValueToObjcObject):
+ (ObjcField::setValueToInstance):
+ (ObjcArray::setValueAt):
+ (ObjcArray::valueAt):
+ (ObjcFallbackObjectImp::put):
+ (ObjcFallbackObjectImp::callAsFunction):
+ (ObjcFallbackObjectImp::defaultValue):
+ * bindings/objc/objc_utility.h:
+ * bindings/objc/objc_utility.mm:
+ (Bindings::JSMethodNameToObjCMethodName):
+ (Bindings::convertValueToObjcValue):
+ (Bindings::convertNSStringToString):
+ (Bindings::convertObjcValueToValue):
+ (Bindings::objcValueTypeForType):
+ (Bindings::createObjcInstanceForValue):
+ * bindings/runtime.cpp:
+ (Instance::getValueOfField):
+ (Instance::setValueOfField):
+ (Instance::createRuntimeObject):
+ (Instance::createLanguageInstanceForValue):
+ * bindings/runtime.h:
+ (KJS::Bindings::Constructor::~Constructor):
+ (KJS::Bindings::Field::~Field):
+ (KJS::Bindings::MethodList::MethodList):
+ (KJS::Bindings::Class::fallbackObject):
+ (KJS::Bindings::Class::~Class):
+ (KJS::Bindings::Instance::Instance):
+ (KJS::Bindings::Instance::getValueOfUndefinedField):
+ (KJS::Bindings::Instance::supportsSetValueOfUndefinedField):
+ (KJS::Bindings::Instance::setValueOfUndefinedField):
+ (KJS::Bindings::Instance::valueOf):
+ (KJS::Bindings::Instance::setExecutionContext):
+ (KJS::Bindings::Instance::~Instance):
+ (KJS::Bindings::Array::~Array):
+ * bindings/runtime_array.cpp:
+ (RuntimeArrayImp::RuntimeArrayImp):
+ (RuntimeArrayImp::lengthGetter):
+ (RuntimeArrayImp::indexGetter):
+ (RuntimeArrayImp::put):
+ * bindings/runtime_array.h:
+ * bindings/runtime_method.cpp:
+ (RuntimeMethodImp::lengthGetter):
+ (RuntimeMethodImp::callAsFunction):
+ * bindings/runtime_method.h:
+ * bindings/runtime_object.cpp:
+ (RuntimeObjectImp::fallbackObjectGetter):
+ (RuntimeObjectImp::fieldGetter):
+ (RuntimeObjectImp::methodGetter):
+ (RuntimeObjectImp::getOwnPropertySlot):
+ (RuntimeObjectImp::put):
+ (RuntimeObjectImp::defaultValue):
+ (RuntimeObjectImp::callAsFunction):
+ * bindings/runtime_object.h:
+ * kjs/array_instance.h:
+ * kjs/array_object.cpp:
+ (ArrayInstanceImp::ArrayInstanceImp):
+ (ArrayInstanceImp::lengthGetter):
+ (ArrayInstanceImp::getOwnPropertySlot):
+ (ArrayInstanceImp::put):
+ (ArrayInstanceImp::propList):
+ (ArrayInstanceImp::setLength):
+ (compareByStringForQSort):
+ (compareWithCompareFunctionForQSort):
+ (ArrayInstanceImp::sort):
+ (ArrayInstanceImp::pushUndefinedObjectsToEnd):
+ (ArrayPrototypeImp::ArrayPrototypeImp):
+ (ArrayProtoFuncImp::ArrayProtoFuncImp):
+ (ArrayProtoFuncImp::callAsFunction):
+ (ArrayObjectImp::ArrayObjectImp):
+ (ArrayObjectImp::construct):
+ (ArrayObjectImp::callAsFunction):
+ * kjs/array_object.h:
+ * kjs/bool_object.cpp:
+ (BooleanPrototypeImp::BooleanPrototypeImp):
+ (BooleanProtoFuncImp::BooleanProtoFuncImp):
+ (BooleanProtoFuncImp::callAsFunction):
+ (BooleanObjectImp::BooleanObjectImp):
+ (BooleanObjectImp::construct):
+ (BooleanObjectImp::callAsFunction):
+ * kjs/bool_object.h:
+ * kjs/collector.cpp:
+ (KJS::Collector::markStackObjectsConservatively):
+ (KJS::Collector::collect):
+ (KJS::className):
+ * kjs/completion.h:
+ (KJS::Completion::Completion):
+ (KJS::Completion::value):
+ (KJS::Completion::isValueCompletion):
+ * kjs/context.h:
+ (KJS::ContextImp::variableObject):
+ (KJS::ContextImp::setVariableObject):
+ (KJS::ContextImp::thisValue):
+ (KJS::ContextImp::activationObject):
+ (KJS::ContextImp::pushScope):
+ * kjs/date_object.cpp:
+ (formatLocaleDate):
+ (KJS::timeFromArgs):
+ (KJS::DatePrototypeImp::DatePrototypeImp):
+ (KJS::DateProtoFuncImp::DateProtoFuncImp):
+ (KJS::DateProtoFuncImp::callAsFunction):
+ (KJS::DateObjectImp::DateObjectImp):
+ (KJS::DateObjectImp::construct):
+ (KJS::DateObjectImp::callAsFunction):
+ (KJS::DateObjectFuncImp::DateObjectFuncImp):
+ (KJS::DateObjectFuncImp::callAsFunction):
+ (KJS::parseDate):
+ (KJS::KRFCDate_parseDate):
+ (KJS::timeClip):
+ * kjs/date_object.h:
+ * kjs/debugger.cpp:
+ (Debugger::exception):
+ (Debugger::callEvent):
+ (Debugger::returnEvent):
+ * kjs/debugger.h:
+ * kjs/error_object.cpp:
+ (ErrorPrototypeImp::ErrorPrototypeImp):
+ (ErrorProtoFuncImp::ErrorProtoFuncImp):
+ (ErrorProtoFuncImp::callAsFunction):
+ (ErrorObjectImp::ErrorObjectImp):
+ (ErrorObjectImp::construct):
+ (ErrorObjectImp::callAsFunction):
+ (NativeErrorPrototypeImp::NativeErrorPrototypeImp):
+ (NativeErrorImp::NativeErrorImp):
+ (NativeErrorImp::construct):
+ (NativeErrorImp::callAsFunction):
+ * kjs/error_object.h:
+ * kjs/function.cpp:
+ (KJS::FunctionImp::FunctionImp):
+ (KJS::FunctionImp::callAsFunction):
+ (KJS::FunctionImp::processParameters):
+ (KJS::FunctionImp::argumentsGetter):
+ (KJS::FunctionImp::lengthGetter):
+ (KJS::FunctionImp::put):
+ (KJS::DeclaredFunctionImp::DeclaredFunctionImp):
+ (KJS::DeclaredFunctionImp::construct):
+ (KJS::ArgumentsImp::ArgumentsImp):
+ (KJS::ArgumentsImp::mappedIndexGetter):
+ (KJS::ArgumentsImp::put):
+ (KJS::ActivationImp::argumentsGetter):
+ (KJS::GlobalFuncImp::GlobalFuncImp):
+ (KJS::encode):
+ (KJS::decode):
+ (KJS::GlobalFuncImp::callAsFunction):
+ * kjs/function.h:
+ * kjs/function_object.cpp:
+ (FunctionPrototypeImp::FunctionPrototypeImp):
+ (FunctionPrototypeImp::callAsFunction):
+ (FunctionProtoFuncImp::FunctionProtoFuncImp):
+ (FunctionProtoFuncImp::callAsFunction):
+ (FunctionObjectImp::FunctionObjectImp):
+ (FunctionObjectImp::construct):
+ (FunctionObjectImp::callAsFunction):
+ * kjs/function_object.h:
+ * kjs/internal.cpp:
+ (KJS::UndefinedImp::toPrimitive):
+ (KJS::UndefinedImp::toObject):
+ (KJS::NullImp::toPrimitive):
+ (KJS::NullImp::toObject):
+ (KJS::BooleanImp::toPrimitive):
+ (KJS::BooleanImp::toObject):
+ (KJS::StringImp::toPrimitive):
+ (KJS::StringImp::toObject):
+ (KJS::NumberImp::toPrimitive):
+ (KJS::NumberImp::toObject):
+ (KJS::NumberImp::getUInt32):
+ (KJS::LabelStack::push):
+ (KJS::ContextImp::ContextImp):
+ (KJS::InterpreterImp::globalInit):
+ (KJS::InterpreterImp::globalClear):
+ (KJS::InterpreterImp::InterpreterImp):
+ (KJS::InterpreterImp::initGlobalObject):
+ (KJS::InterpreterImp::clear):
+ (KJS::InterpreterImp::mark):
+ (KJS::InterpreterImp::evaluate):
+ (KJS::InternalFunctionImp::hasInstance):
+ (KJS::roundValue):
+ (KJS::printInfo):
+ * kjs/internal.h:
+ (KJS::InterpreterImp::builtinObject):
+ (KJS::InterpreterImp::builtinFunction):
+ (KJS::InterpreterImp::builtinArray):
+ (KJS::InterpreterImp::builtinBoolean):
+ (KJS::InterpreterImp::builtinString):
+ (KJS::InterpreterImp::builtinNumber):
+ (KJS::InterpreterImp::builtinDate):
+ (KJS::InterpreterImp::builtinRegExp):
+ (KJS::InterpreterImp::builtinError):
+ (KJS::InterpreterImp::builtinObjectPrototype):
+ (KJS::InterpreterImp::builtinFunctionPrototype):
+ (KJS::InterpreterImp::builtinArrayPrototype):
+ (KJS::InterpreterImp::builtinBooleanPrototype):
+ (KJS::InterpreterImp::builtinStringPrototype):
+ (KJS::InterpreterImp::builtinNumberPrototype):
+ (KJS::InterpreterImp::builtinDatePrototype):
+ (KJS::InterpreterImp::builtinRegExpPrototype):
+ (KJS::InterpreterImp::builtinErrorPrototype):
+ (KJS::InterpreterImp::builtinEvalError):
+ (KJS::InterpreterImp::builtinRangeError):
+ (KJS::InterpreterImp::builtinReferenceError):
+ (KJS::InterpreterImp::builtinSyntaxError):
+ (KJS::InterpreterImp::builtinTypeError):
+ (KJS::InterpreterImp::builtinURIError):
+ (KJS::InterpreterImp::builtinEvalErrorPrototype):
+ (KJS::InterpreterImp::builtinRangeErrorPrototype):
+ (KJS::InterpreterImp::builtinReferenceErrorPrototype):
+ (KJS::InterpreterImp::builtinSyntaxErrorPrototype):
+ (KJS::InterpreterImp::builtinTypeErrorPrototype):
+ (KJS::InterpreterImp::builtinURIErrorPrototype):
+ * kjs/interpreter.cpp:
+ (Context::variableObject):
+ (Context::thisValue):
+ (Interpreter::Interpreter):
+ (Interpreter::globalObject):
+ (Interpreter::evaluate):
+ (Interpreter::builtinObject):
+ (Interpreter::builtinFunction):
+ (Interpreter::builtinArray):
+ (Interpreter::builtinBoolean):
+ (Interpreter::builtinString):
+ (Interpreter::builtinNumber):
+ (Interpreter::builtinDate):
+ (Interpreter::builtinRegExp):
+ (Interpreter::builtinError):
+ (Interpreter::builtinObjectPrototype):
+ (Interpreter::builtinFunctionPrototype):
+ (Interpreter::builtinArrayPrototype):
+ (Interpreter::builtinBooleanPrototype):
+ (Interpreter::builtinStringPrototype):
+ (Interpreter::builtinNumberPrototype):
+ (Interpreter::builtinDatePrototype):
+ (Interpreter::builtinRegExpPrototype):
+ (Interpreter::builtinErrorPrototype):
+ (Interpreter::builtinEvalError):
+ (Interpreter::builtinRangeError):
+ (Interpreter::builtinReferenceError):
+ (Interpreter::builtinSyntaxError):
+ (Interpreter::builtinTypeError):
+ (Interpreter::builtinURIError):
+ (Interpreter::builtinEvalErrorPrototype):
+ (Interpreter::builtinRangeErrorPrototype):
+ (Interpreter::builtinReferenceErrorPrototype):
+ (Interpreter::builtinSyntaxErrorPrototype):
+ (Interpreter::builtinTypeErrorPrototype):
+ (Interpreter::builtinURIErrorPrototype):
+ (Interpreter::createLanguageInstanceForValue):
+ * kjs/interpreter.h:
+ (KJS::Interpreter::isGlobalObject):
+ (KJS::ExecState::setException):
+ (KJS::ExecState::clearException):
+ (KJS::ExecState::exception):
+ (KJS::ExecState::hadException):
+ (KJS::ExecState::ExecState):
+ * kjs/list.cpp:
+ (KJS::List::at):
+ * kjs/list.h:
+ (KJS::List::operator[]):
+ (KJS::ListIterator::operator->):
+ (KJS::ListIterator::operator*):
+ (KJS::ListIterator::operator++):
+ (KJS::ListIterator::operator--):
+ * kjs/lookup.h:
+ (KJS::staticFunctionGetter):
+ (KJS::staticValueGetter):
+ (KJS::lookupPut):
+ (KJS::cacheGlobalObject):
+ * kjs/math_object.cpp:
+ (MathObjectImp::getValueProperty):
+ (MathFuncImp::MathFuncImp):
+ (MathFuncImp::callAsFunction):
+ * kjs/math_object.h:
+ * kjs/nodes.cpp:
+ (Node::evaluateReference):
+ (Node::throwError):
+ (Node::setExceptionDetailsIfNeeded):
+ (NullNode::evaluate):
+ (BooleanNode::evaluate):
+ (NumberNode::evaluate):
+ (StringNode::evaluate):
+ (RegExpNode::evaluate):
+ (ThisNode::evaluate):
+ (ResolveNode::evaluate):
+ (ResolveNode::evaluateReference):
+ (GroupNode::evaluate):
+ (ElementNode::evaluate):
+ (ArrayNode::evaluate):
+ (ObjectLiteralNode::evaluate):
+ (PropertyValueNode::evaluate):
+ (PropertyNode::evaluate):
+ (AccessorNode1::evaluate):
+ (AccessorNode1::evaluateReference):
+ (AccessorNode2::evaluate):
+ (AccessorNode2::evaluateReference):
+ (ArgumentListNode::evaluate):
+ (ArgumentListNode::evaluateList):
+ (ArgumentsNode::evaluate):
+ (NewExprNode::evaluate):
+ (FunctionCallNode::evaluate):
+ (PostfixNode::evaluate):
+ (DeleteNode::evaluate):
+ (VoidNode::evaluate):
+ (TypeOfNode::evaluate):
+ (PrefixNode::evaluate):
+ (UnaryPlusNode::evaluate):
+ (NegateNode::evaluate):
+ (BitwiseNotNode::evaluate):
+ (LogicalNotNode::evaluate):
+ (MultNode::evaluate):
+ (AddNode::evaluate):
+ (ShiftNode::evaluate):
+ (RelationalNode::evaluate):
+ (EqualNode::evaluate):
+ (BitOperNode::evaluate):
+ (BinaryLogicalNode::evaluate):
+ (ConditionalNode::evaluate):
+ (AssignNode::evaluate):
+ (CommaNode::evaluate):
+ (StatListNode::execute):
+ (AssignExprNode::evaluate):
+ (VarDeclNode::evaluate):
+ (VarDeclNode::processVarDecls):
+ (VarDeclListNode::evaluate):
+ (ExprStatementNode::execute):
+ (IfNode::execute):
+ (DoWhileNode::execute):
+ (WhileNode::execute):
+ (ForNode::execute):
+ (ForInNode::execute):
+ (ContinueNode::execute):
+ (BreakNode::execute):
+ (ReturnNode::execute):
+ (WithNode::execute):
+ (CaseClauseNode::evaluate):
+ (ClauseListNode::evaluate):
+ (CaseBlockNode::evaluate):
+ (CaseBlockNode::evalBlock):
+ (SwitchNode::execute):
+ (ThrowNode::execute):
+ (CatchNode::execute):
+ (TryNode::execute):
+ (ParameterNode::evaluate):
+ (FuncDeclNode::processFuncDecl):
+ (FuncExprNode::evaluate):
+ (SourceElementsNode::execute):
+ * kjs/nodes.h:
+ (KJS::StatementNode::evaluate):
+ * kjs/number_object.cpp:
+ (NumberPrototypeImp::NumberPrototypeImp):
+ (NumberProtoFuncImp::NumberProtoFuncImp):
+ (NumberProtoFuncImp::callAsFunction):
+ (NumberObjectImp::NumberObjectImp):
+ (NumberObjectImp::getValueProperty):
+ (NumberObjectImp::construct):
+ (NumberObjectImp::callAsFunction):
+ * kjs/number_object.h:
+ * kjs/object.cpp:
+ (KJS::ObjectImp::call):
+ (KJS::ObjectImp::mark):
+ (KJS::ObjectImp::classInfo):
+ (KJS::ObjectImp::get):
+ (KJS::ObjectImp::getProperty):
+ (KJS::ObjectImp::getPropertySlot):
+ (KJS::ObjectImp::put):
+ (KJS::ObjectImp::hasOwnProperty):
+ (KJS::ObjectImp::defaultValue):
+ (KJS::ObjectImp::findPropertyHashEntry):
+ (KJS::ObjectImp::construct):
+ (KJS::ObjectImp::callAsFunction):
+ (KJS::ObjectImp::hasInstance):
+ (KJS::ObjectImp::propList):
+ (KJS::ObjectImp::toPrimitive):
+ (KJS::ObjectImp::toNumber):
+ (KJS::ObjectImp::toString):
+ (KJS::ObjectImp::toObject):
+ (KJS::ObjectImp::putDirect):
+ (KJS::Error::create):
+ (KJS::error):
+ * kjs/object.h:
+ (KJS::):
+ (KJS::ObjectImp::getPropertySlot):
+ (KJS::AllocatedValueImp::isObject):
+ (KJS::ObjectImp::ObjectImp):
+ (KJS::ObjectImp::internalValue):
+ (KJS::ObjectImp::setInternalValue):
+ (KJS::ObjectImp::prototype):
+ (KJS::ObjectImp::setPrototype):
+ (KJS::ObjectImp::inherits):
+ * kjs/object_object.cpp:
+ (ObjectPrototypeImp::ObjectPrototypeImp):
+ (ObjectProtoFuncImp::ObjectProtoFuncImp):
+ (ObjectProtoFuncImp::callAsFunction):
+ (ObjectObjectImp::ObjectObjectImp):
+ (ObjectObjectImp::construct):
+ (ObjectObjectImp::callAsFunction):
+ * kjs/object_object.h:
+ * kjs/operations.cpp:
+ (KJS::equal):
+ (KJS::strictEqual):
+ (KJS::relation):
+ (KJS::add):
+ (KJS::mult):
+ * kjs/operations.h:
+ * kjs/property_map.cpp:
+ (KJS::PropertyMap::mark):
+ (KJS::PropertyMap::addEnumerablesToReferenceList):
+ (KJS::PropertyMap::addSparseArrayPropertiesToReferenceList):
+ (KJS::PropertyMap::save):
+ (KJS::PropertyMap::restore):
+ * kjs/property_map.h:
+ * kjs/property_slot.cpp:
+ (KJS::PropertySlot::undefinedGetter):
+ * kjs/property_slot.h:
+ (KJS::PropertySlot::getValue):
+ * kjs/protect.h:
+ (KJS::gcUnprotectNullTolerant):
+ (KJS::ProtectedValue::ProtectedValue):
+ (KJS::ProtectedValue::~ProtectedValue):
+ (KJS::ProtectedValue::operator=):
+ (KJS::ProtectedValue::operator ValueImp *):
+ (KJS::ProtectedValue::operator->):
+ * kjs/protected_object.h:
+ (KJS::ProtectedObject::ProtectedObject):
+ (KJS::ProtectedObject::operator=):
+ (KJS::ProtectedObject::operator ValueImp *):
+ (KJS::ProtectedObject::operator ObjectImp *):
+ (KJS::ProtectedObject::operator->):
+ (KJS::ProtectedReference::ProtectedReference):
+ (KJS::ProtectedReference::~ProtectedReference):
+ (KJS::ProtectedReference::operator=):
+ * kjs/protected_values.cpp:
+ (KJS::ProtectedValues::getProtectCount):
+ (KJS::ProtectedValues::increaseProtectCount):
+ (KJS::ProtectedValues::insert):
+ (KJS::ProtectedValues::decreaseProtectCount):
+ * kjs/protected_values.h:
+ * kjs/reference.cpp:
+ (KJS::Reference::Reference):
+ (KJS::Reference::makeValueReference):
+ (KJS::Reference::getBase):
+ (KJS::Reference::getValue):
+ (KJS::Reference::putValue):
+ (KJS::Reference::deleteValue):
+ * kjs/reference.h:
+ (KJS::Reference::baseIfMutable):
+ * kjs/regexp_object.cpp:
+ (RegExpPrototypeImp::RegExpPrototypeImp):
+ (RegExpProtoFuncImp::RegExpProtoFuncImp):
+ (RegExpProtoFuncImp::callAsFunction):
+ (RegExpObjectImp::RegExpObjectImp):
+ (RegExpObjectImp::arrayOfMatches):
+ (RegExpObjectImp::backrefGetter):
+ (RegExpObjectImp::construct):
+ (RegExpObjectImp::callAsFunction):
+ * kjs/regexp_object.h:
+ * kjs/string_object.cpp:
+ (StringInstanceImp::lengthGetter):
+ (StringInstanceImp::indexGetter):
+ (StringInstanceImp::getOwnPropertySlot):
+ (StringInstanceImp::put):
+ (StringPrototypeImp::StringPrototypeImp):
+ (StringProtoFuncImp::StringProtoFuncImp):
+ (regExpIsGlobal):
+ (replace):
+ (StringProtoFuncImp::callAsFunction):
+ (StringObjectImp::StringObjectImp):
+ (StringObjectImp::construct):
+ (StringObjectImp::callAsFunction):
+ (StringObjectFuncImp::StringObjectFuncImp):
+ (StringObjectFuncImp::callAsFunction):
+ * kjs/string_object.h:
+ * kjs/testkjs.cpp:
+ (TestFunctionImp::callAsFunction):
+ (VersionFunctionImp::callAsFunction):
+ (main):
+ * kjs/value.cpp:
+ (KJS::AllocatedValueImp::operator new):
+ (KJS::AllocatedValueImp::getUInt32):
+ (KJS::ValueImp::toInteger):
+ (KJS::ValueImp::toInt32):
+ (KJS::ValueImp::toUInt32):
+ (KJS::ValueImp::toUInt16):
+ (KJS::ValueImp::toObject):
+ (KJS::AllocatedValueImp::getBoolean):
+ (KJS::AllocatedValueImp::getNumber):
+ (KJS::AllocatedValueImp::getString):
+ (KJS::AllocatedValueImp::getObject):
+ (KJS::jsString):
+ (KJS::jsNumber):
+ (KJS::ConstantValues::init):
+ (KJS::ConstantValues::clear):
+ (KJS::ConstantValues::mark):
+ * kjs/value.h:
+ (KJS::):
+ (KJS::jsUndefined):
+ (KJS::jsNull):
+ (KJS::jsBoolean):
+ (KJS::jsNaN):
+ (KJS::ValueImp::ValueImp):
+ (KJS::ValueImp::~ValueImp):
+ (KJS::AllocatedValueImp::AllocatedValueImp):
+ (KJS::AllocatedValueImp::~AllocatedValueImp):
+ (KJS::AllocatedValueImp::isBoolean):
+ (KJS::AllocatedValueImp::isNumber):
+ (KJS::AllocatedValueImp::isString):
+ (KJS::AllocatedValueImp::isObject):
+ (KJS::AllocatedValueImp::marked):
+ (KJS::AllocatedValueImp::mark):
+ (KJS::ValueImp::downcast):
+ (KJS::ValueImp::isUndefined):
+ (KJS::ValueImp::isNull):
+ (KJS::ValueImp::isUndefinedOrNull):
+ (KJS::ValueImp::isBoolean):
+ (KJS::ValueImp::isNumber):
+ (KJS::ValueImp::isString):
+ (KJS::ValueImp::isObject):
+ (KJS::ValueImp::getBoolean):
+ (KJS::ValueImp::getNumber):
+ (KJS::ValueImp::getString):
+ (KJS::ValueImp::getObject):
+ (KJS::ValueImp::getUInt32):
+ (KJS::ValueImp::mark):
+ (KJS::ValueImp::marked):
+ (KJS::ValueImp::type):
+ (KJS::ValueImp::toPrimitive):
+ (KJS::ValueImp::toBoolean):
+ (KJS::ValueImp::toNumber):
+ (KJS::ValueImp::toString):
+ (KJS::jsZero):
+ (KJS::jsOne):
+ (KJS::jsTwo):
+ (KJS::Undefined):
+ (KJS::Null):
+ (KJS::Boolean):
+ (KJS::Number):
+ (KJS::String):
+
2005-08-06 Maciej Stachowiak <mjs at apple.com>
Reviewed by Darin.
1.5 +0 -6 JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
Index: project.pbxproj
===================================================================
RCS file: /cvs/root/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- project.pbxproj 7 Aug 2005 06:17:32 -0000 1.4
+++ project.pbxproj 8 Aug 2005 04:07:21 -0000 1.5
@@ -27,12 +27,10 @@
/* Begin PBXBuildFile section */
65305EAF08A58DDE00F31E73 /* protected_object.h in Headers */ = {isa = PBXBuildFile; fileRef = 65305EAE08A58DDE00F31E73 /* protected_object.h */; settings = {ATTRIBUTES = (Private, ); }; };
65305EB008A58E0900F31E73 /* protected_object.h in Headers */ = {isa = PBXBuildFile; fileRef = 65305EAE08A58DDE00F31E73 /* protected_object.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 6539AACB08A3225A00223EE2 /* object_wrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 6539AACA08A3225A00223EE2 /* object_wrapper.h */; settings = {ATTRIBUTES = (Private, ); }; };
65621E6D089E859700760F35 /* property_slot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65621E6B089E859700760F35 /* property_slot.cpp */; };
65621E6E089E859700760F35 /* property_slot.h in Headers */ = {isa = PBXBuildFile; fileRef = 65621E6C089E859700760F35 /* property_slot.h */; settings = {ATTRIBUTES = (Private, ); }; };
65621E6F089E85D300760F35 /* property_slot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65621E6B089E859700760F35 /* property_slot.cpp */; };
65621E70089E85D300760F35 /* property_slot.h in Headers */ = {isa = PBXBuildFile; fileRef = 65621E6C089E859700760F35 /* property_slot.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 65BBAEE008A329B300357728 /* object_wrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 6539AACA08A3225A00223EE2 /* object_wrapper.h */; settings = {ATTRIBUTES = (Private, ); }; };
932F5B400822A1C700736975 /* array_object.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A84E0255597D01FF60F7 /* array_object.h */; settings = {ATTRIBUTES = (Private, ); }; };
932F5B420822A1C700736975 /* collector.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A8530255597D01FF60F7 /* collector.h */; settings = {ATTRIBUTES = (Private, ); }; };
932F5B430822A1C700736975 /* date_object.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A8560255597D01FF60F7 /* date_object.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -458,7 +456,6 @@
651F6412039D5B5F0078395C /* dtoa.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = dtoa.cpp; sourceTree = "<group>"; };
651F6413039D5B5F0078395C /* dtoa.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = dtoa.h; sourceTree = "<group>"; };
65305EAE08A58DDE00F31E73 /* protected_object.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = protected_object.h; sourceTree = "<group>"; };
- 6539AACA08A3225A00223EE2 /* object_wrapper.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = object_wrapper.h; sourceTree = "<group>"; };
65417205039E02E70058BFEB /* get.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = get.c; path = pcre/get.c; sourceTree = "<group>"; };
65417206039E02E70058BFEB /* maketables.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = maketables.c; path = pcre/maketables.c; sourceTree = "<group>"; };
65417207039E02E70058BFEB /* pcre.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pcre.c; path = pcre/pcre.c; sourceTree = "<group>"; };
@@ -645,7 +642,6 @@
isa = PBXGroup;
children = (
65305EAE08A58DDE00F31E73 /* protected_object.h */,
- 6539AACA08A3225A00223EE2 /* object_wrapper.h */,
65621E6B089E859700760F35 /* property_slot.cpp */,
65621E6C089E859700760F35 /* property_slot.h */,
938772E5038BFE19008635CE /* array_instance.h */,
@@ -918,7 +914,6 @@
932F5B8F0822A1C700736975 /* fast_malloc.h in Headers */,
932FC11D0824A6A3005B3C75 /* create_hash_table in Headers */,
65621E6E089E859700760F35 /* property_slot.h in Headers */,
- 6539AACB08A3225A00223EE2 /* object_wrapper.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -942,7 +937,6 @@
A85D8204087B2822006A9172 /* nodes.h in Headers */,
A85D8205087B2822006A9172 /* number_object.h in Headers */,
A85D8206087B2822006A9172 /* object_object.h in Headers */,
- 65BBAEE008A329B300357728 /* object_wrapper.h in Headers */,
A85D8207087B2822006A9172 /* object.h in Headers */,
A85D8208087B2822006A9172 /* operations.h in Headers */,
A85D8209087B2822006A9172 /* property_map.h in Headers */,
1.20 +14 -28 JavaScriptCore/bindings/NP_jsobject.cpp
Index: NP_jsobject.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/bindings/NP_jsobject.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- NP_jsobject.cpp 27 Apr 2005 01:03:57 -0000 1.19
+++ NP_jsobject.cpp 8 Aug 2005 04:07:22 -0000 1.20
@@ -149,24 +149,24 @@
// Lookup the function object.
ExecState *exec = obj->executionContext->interpreter()->globalExec();
Interpreter::lock();
- Value func = obj->imp->get (exec, identiferFromNPIdentifier(i->value.string));
+ ValueImp *func = obj->imp->get (exec, identiferFromNPIdentifier(i->value.string));
Interpreter::unlock();
- if (func.isNull()) {
+ if (func->isNull()) {
NPN_InitializeVariantAsNull(result);
return false;
}
- else if ( func.type() == UndefinedType) {
+ else if (func->isUndefined()) {
NPN_InitializeVariantAsUndefined(result);
return false;
}
else {
// Call the function object.
- ObjectImp *funcImp = static_cast<ObjectImp*>(func.imp());
- Object thisObj = Object(const_cast<ObjectImp*>(obj->imp));
+ ObjectImp *funcImp = static_cast<ObjectImp*>(func);
+ ObjectImp *thisObj = const_cast<ObjectImp*>(obj->imp);
List argList = listFromVariantArgs(exec, args, argCount);
Interpreter::lock();
- Value resultV = funcImp->call (exec, thisObj, argList);
+ ValueImp *resultV = funcImp->call (exec, thisObj, argList);
Interpreter::unlock();
// Convert and return the result of the function call.
@@ -193,8 +193,7 @@
return false;
ExecState *exec = obj->executionContext->interpreter()->globalExec();
- Object thisObj = Object(const_cast<ObjectImp*>(obj->imp));
- Value result;
+ ValueImp *result;
Interpreter::lock();
NPUTF16 *scriptString;
@@ -205,7 +204,7 @@
if (type == Normal) {
result = completion.value();
- if (result.isNull()) {
+ if (!result) {
result = Undefined();
}
}
@@ -234,21 +233,9 @@
ExecState *exec = obj->executionContext->interpreter()->globalExec();
PrivateIdentifier *i = (PrivateIdentifier *)propertyName;
- if (i->isString) {
- if (!obj->imp->hasProperty (exec, identiferFromNPIdentifier(i->value.string))) {
- NPN_InitializeVariantAsNull(variant);
- return false;
- }
- }
- else {
- if (!obj->imp->hasProperty (exec, i->value.number)) {
- NPN_InitializeVariantAsNull(variant);
- return false;
- }
- }
Interpreter::lock();
- Value result;
+ ValueImp *result;
if (i->isString) {
result = obj->imp->get (exec, identiferFromNPIdentifier(i->value.string));
}
@@ -257,11 +244,11 @@
}
Interpreter::unlock();
- if (result.isNull()) {
+ if (result->isNull()) {
NPN_InitializeVariantAsNull(variant);
return false;
}
- else if (result.type() == UndefinedType) {
+ else if (result->isUndefined()) {
NPN_InitializeVariantAsUndefined(variant);
return false;
}
@@ -292,7 +279,6 @@
ExecState *exec = obj->executionContext->interpreter()->globalExec();
Interpreter::lock();
- Value result;
PrivateIdentifier *i = (PrivateIdentifier *)propertyName;
if (i->isString) {
obj->imp->put (exec, identiferFromNPIdentifier(i->value.string), convertNPVariantToValue(exec, variant));
@@ -394,10 +380,10 @@
// Lookup the function object.
ExecState *exec = obj->executionContext->interpreter()->globalExec();
Interpreter::lock();
- Value func = obj->imp->get (exec, identiferFromNPIdentifier(i->value.string));
+ ValueImp *func = obj->imp->get (exec, identiferFromNPIdentifier(i->value.string));
Interpreter::unlock();
- if (func.isNull() || func.type() == UndefinedType) {
+ if (func->isUndefined()) {
return false;
}
@@ -417,7 +403,7 @@
JavaScriptObject *obj = (JavaScriptObject *)o;
ExecState *exec = obj->executionContext->interpreter()->globalExec();
Interpreter::lock();
- Object err = Error::create(exec, GeneralError, message);
+ ObjectImp *err = Error::create(exec, GeneralError, message);
exec->setException (err);
Interpreter::unlock();
}
1.19 +7 -7 JavaScriptCore/bindings/runtime.cpp
Index: runtime.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/bindings/runtime.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- runtime.cpp 12 Feb 2005 00:58:13 -0000 1.18
+++ runtime.cpp 8 Aug 2005 04:07:22 -0000 1.19
@@ -91,11 +91,11 @@
void Instance::setDidExecuteFunction (KJSDidExecuteFunctionPtr func) { _DidExecuteFunction = func; }
KJSDidExecuteFunctionPtr Instance::didExecuteFunction () { return _DidExecuteFunction; }
-Value Instance::getValueOfField (KJS::ExecState *exec, const Field *aField) const {
+ValueImp *Instance::getValueOfField (KJS::ExecState *exec, const Field *aField) const {
return aField->valueFromInstance (exec, this);
}
-void Instance::setValueOfField (KJS::ExecState *exec, const Field *aField, const Value &aValue) const {
+void Instance::setValueOfField (KJS::ExecState *exec, const Field *aField, ValueImp *aValue) const {
aField->setValueToInstance (exec, this, aValue);
}
@@ -126,25 +126,25 @@
return newInstance;
}
-Object Instance::createRuntimeObject (BindingLanguage language, void *nativeInstance, const RootObject *executionContext)
+ObjectImp *Instance::createRuntimeObject (BindingLanguage language, void *nativeInstance, const RootObject *executionContext)
{
Instance *interfaceObject = Instance::createBindingForLanguageInstance (language, (void *)nativeInstance, executionContext);
Interpreter::lock();
- Object theObject(new RuntimeObjectImp(interfaceObject,true));
+ ObjectImp *theObject(new RuntimeObjectImp(interfaceObject,true));
Interpreter::unlock();
return theObject;
}
-void *Instance::createLanguageInstanceForValue (ExecState *exec, BindingLanguage language, const Object &value, const RootObject *origin, const RootObject *current)
+void *Instance::createLanguageInstanceForValue (ExecState *exec, BindingLanguage language, ObjectImp *value, const RootObject *origin, const RootObject *current)
{
void *result = 0;
- if (value.type() != ObjectType)
+ if (!value->isObject())
return 0;
- ObjectImp *imp = static_cast<ObjectImp*>(value.imp());
+ ObjectImp *imp = static_cast<ObjectImp*>(value);
switch (language) {
case Instance::ObjectiveCLanguage: {
1.30 +32 -32 JavaScriptCore/bindings/runtime.h
Index: runtime.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/bindings/runtime.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- runtime.h 12 Feb 2005 00:58:13 -0000 1.29
+++ runtime.h 8 Aug 2005 04:07:22 -0000 1.30
@@ -59,7 +59,7 @@
virtual Parameter *parameterAt(long i) const = 0;
virtual long numParameters() const = 0;
- virtual ~Constructor() {};
+ virtual ~Constructor() {}
};
class Field
@@ -68,25 +68,25 @@
virtual const char *name() const = 0;
virtual RuntimeType type() const = 0;
- virtual KJS::Value valueFromInstance(ExecState *exec, const Instance *instance) const = 0;
- virtual void setValueToInstance(ExecState *exec, const Instance *instance, const Value &aValue) const = 0;
+ virtual ValueImp *valueFromInstance(ExecState *, const Instance *) const = 0;
+ virtual void setValueToInstance(ExecState *, const Instance *, ValueImp *) const = 0;
- virtual ~Field() {};
+ virtual ~Field() {}
};
class MethodList
{
public:
- MethodList() : _methods(0), _length(0) {};
+ MethodList() : _methods(0), _length(0) {}
- void addMethod (Method *aMethod);
+ void addMethod(Method *aMethod);
unsigned int length() const;
- Method *methodAt (unsigned int index) const;
+ Method *methodAt(unsigned int index) const;
~MethodList();
- MethodList (const MethodList &other);
+ MethodList(const MethodList &other);
MethodList &operator=(const MethodList &other);
private:
@@ -117,9 +117,9 @@
virtual Field *fieldNamed(const char *name, Instance *instance) const = 0;
- virtual Value fallbackObject(ExecState *exec, Bindings::Instance *instance, const Identifier &propertyName) { return Undefined(); }
+ virtual ValueImp *fallbackObject(ExecState *, Instance *, const Identifier &) { return Undefined(); }
- virtual ~Class() {};
+ virtual ~Class() {}
};
typedef void (*KJSDidExecuteFunctionPtr)(ExecState *exec, ObjectImp *rootObject);
@@ -133,16 +133,16 @@
CLanguage
} BindingLanguage;
- static void setDidExecuteFunction (KJSDidExecuteFunctionPtr func);
- static KJSDidExecuteFunctionPtr didExecuteFunction ();
+ static void setDidExecuteFunction(KJSDidExecuteFunctionPtr func);
+ static KJSDidExecuteFunctionPtr didExecuteFunction();
- static Instance *createBindingForLanguageInstance (BindingLanguage language, void *nativeInstance, const RootObject *r = 0);
- static void *createLanguageInstanceForValue (ExecState *exec, BindingLanguage language, const Object &value, const RootObject *origin, const RootObject *current);
- static Object createRuntimeObject (BindingLanguage language, void *nativeInstance, const RootObject *r = 0);
+ static Instance *createBindingForLanguageInstance(BindingLanguage language, void *nativeInstance, const RootObject *r = 0);
+ static void *createLanguageInstanceForValue(ExecState *exec, BindingLanguage language, ObjectImp *value, const RootObject *origin, const RootObject *current);
+ static ObjectImp *createRuntimeObject(BindingLanguage language, void *nativeInstance, const RootObject *r = 0);
- Instance () : _executionContext(0) {};
+ Instance() : _executionContext(0) {};
- Instance (const Instance &other);
+ Instance(const Instance &other);
Instance &operator=(const Instance &other);
@@ -154,23 +154,23 @@
virtual Class *getClass() const = 0;
- virtual Value getValueOfField (ExecState *exec, const Field *aField) const;
- virtual Value getValueOfUndefinedField (ExecState *exec, const Identifier &property, Type hint) const { return Undefined(); };
- virtual void setValueOfField (ExecState *exec, const Field *aField, const Value &aValue) const;
- virtual bool supportsSetValueOfUndefinedField () { return false; };
- virtual void setValueOfUndefinedField (ExecState *exec, const Identifier &property, const Value &aValue) {};
+ virtual ValueImp *getValueOfField(ExecState *exec, const Field *aField) const;
+ virtual ValueImp *getValueOfUndefinedField(ExecState *exec, const Identifier &property, Type hint) const { return Undefined(); };
+ virtual void setValueOfField(ExecState *exec, const Field *aField, ValueImp *aValue) const;
+ virtual bool supportsSetValueOfUndefinedField() { return false; };
+ virtual void setValueOfUndefinedField(ExecState *exec, const Identifier &property, ValueImp *aValue) {};
- virtual Value invokeMethod (ExecState *exec, const MethodList &method, const List &args) = 0;
- virtual Value invokeDefaultMethod (ExecState *exec, const List &args) = 0;
+ virtual ValueImp *invokeMethod(ExecState *exec, const MethodList &method, const List &args) = 0;
+ virtual ValueImp *invokeDefaultMethod(ExecState *exec, const List &args) = 0;
- virtual Value defaultValue (Type hint) const = 0;
+ virtual ValueImp *defaultValue(Type hint) const = 0;
- virtual Value valueOf() const { return String(getClass()->name()); };
+ virtual ValueImp *valueOf() const { return String(getClass()->name()); };
- void setExecutionContext (const RootObject *r) { _executionContext = r; }
+ void setExecutionContext(const RootObject *r) { _executionContext = r; }
const RootObject *executionContext() const { return _executionContext; }
- virtual ~Instance() {};
+ virtual ~Instance() {}
protected:
const RootObject *_executionContext;
@@ -179,13 +179,13 @@
class Array
{
public:
- virtual void setValueAt(ExecState *exec, unsigned int index, const Value &aValue) const = 0;
- virtual Value valueAt(ExecState *exec, unsigned int index) const = 0;
+ virtual void setValueAt(ExecState *, unsigned index, ValueImp *) const = 0;
+ virtual ValueImp *valueAt(ExecState *, unsigned index) const = 0;
virtual unsigned int getLength() const = 0;
- virtual ~Array() {};
+ virtual ~Array() {}
};
-const char *signatureForParameters(const KJS::List &aList);
+const char *signatureForParameters(const List &aList);
} // namespace Bindings
1.10 +7 -7 JavaScriptCore/bindings/runtime_array.cpp
Index: runtime_array.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/bindings/runtime_array.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- runtime_array.cpp 7 Aug 2005 06:17:33 -0000 1.9
+++ runtime_array.cpp 8 Aug 2005 04:07:22 -0000 1.10
@@ -32,7 +32,7 @@
const ClassInfo RuntimeArrayImp::info = {"RuntimeArray", &ArrayInstanceImp::info, 0, 0};
RuntimeArrayImp::RuntimeArrayImp(ExecState *exec, Bindings::Array *a)
- : ArrayInstanceImp (exec->lexicalInterpreter()->builtinArrayPrototype().imp(), a->getLength())
+ : ArrayInstanceImp(exec->lexicalInterpreter()->builtinArrayPrototype(), a->getLength())
{
// Always takes ownership of concrete array.
_array = a;
@@ -43,13 +43,13 @@
delete _array;
}
-Value RuntimeArrayImp::lengthGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *RuntimeArrayImp::lengthGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
RuntimeArrayImp *thisObj = static_cast<RuntimeArrayImp *>(slot.slotBase());
return Number(thisObj->getLength());
}
-Value RuntimeArrayImp::indexGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *RuntimeArrayImp::indexGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
RuntimeArrayImp *thisObj = static_cast<RuntimeArrayImp *>(slot.slotBase());
return thisObj->getConcreteArray()->valueAt(exec, slot.index());
@@ -84,10 +84,10 @@
return ArrayInstanceImp::getOwnPropertySlot(exec, index, slot);
}
-void RuntimeArrayImp::put(ExecState *exec, const Identifier &propertyName, const Value &value, int attr)
+void RuntimeArrayImp::put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr)
{
if (propertyName == lengthPropertyName) {
- Object err = Error::create(exec,RangeError);
+ ObjectImp *err = Error::create(exec,RangeError);
exec->setException(err);
return;
}
@@ -102,10 +102,10 @@
ObjectImp::put(exec, propertyName, value, attr);
}
-void RuntimeArrayImp::put(ExecState *exec, unsigned index, const Value &value, int attr)
+void RuntimeArrayImp::put(ExecState *exec, unsigned index, ValueImp *value, int attr)
{
if (index >= getLength()) {
- Object err = Error::create(exec,RangeError);
+ ObjectImp *err = Error::create(exec,RangeError);
exec->setException(err);
return;
}
1.12 +4 -4 JavaScriptCore/bindings/runtime_array.h
Index: runtime_array.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/bindings/runtime_array.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- runtime_array.h 7 Aug 2005 06:17:33 -0000 1.11
+++ runtime_array.h 8 Aug 2005 04:07:22 -0000 1.12
@@ -39,8 +39,8 @@
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
virtual bool getOwnPropertySlot(ExecState *, unsigned, PropertySlot&);
- virtual void put(ExecState *exec, const Identifier &propertyName, const Value &value, int attr = None);
- virtual void put(ExecState *exec, unsigned propertyName, const Value &value, int attr = None);
+ virtual void put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr = None);
+ virtual void put(ExecState *exec, unsigned propertyName, ValueImp *value, int attr = None);
virtual bool deleteProperty(ExecState *exec, const Identifier &propertyName);
virtual bool deleteProperty(ExecState *exec, unsigned propertyName);
@@ -54,8 +54,8 @@
static const ClassInfo info;
private:
- static Value lengthGetter(ExecState *, const Identifier&, const PropertySlot&);
- static Value indexGetter(ExecState *, const Identifier&, const PropertySlot&);
+ static ValueImp *lengthGetter(ExecState *, const Identifier&, const PropertySlot&);
+ static ValueImp *indexGetter(ExecState *, const Identifier&, const PropertySlot&);
Bindings::Array *_array;
};
1.13 +7 -7 JavaScriptCore/bindings/runtime_method.cpp
Index: runtime_method.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/bindings/runtime_method.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- runtime_method.cpp 7 Aug 2005 06:17:33 -0000 1.12
+++ runtime_method.cpp 8 Aug 2005 04:07:22 -0000 1.13
@@ -40,7 +40,7 @@
{
}
-Value RuntimeMethodImp::lengthGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *RuntimeMethodImp::lengthGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
RuntimeMethodImp *thisObj = static_cast<RuntimeMethodImp *>(slot.slotBase());
@@ -68,26 +68,26 @@
return true;
}
-Value RuntimeMethodImp::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *RuntimeMethodImp::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
if (_methodList.length() > 0) {
RuntimeObjectImp *imp;
// If thisObj is the DOM object for a plugin, get the corresponding
// runtime object from the DOM object.
- if (thisObj.classInfo() != &KJS::RuntimeObjectImp::info) {
- Value runtimeObject = thisObj.get(exec, "__apple_runtime_object");
- imp = static_cast<RuntimeObjectImp*>(runtimeObject.imp());
+ if (thisObj->classInfo() != &KJS::RuntimeObjectImp::info) {
+ ValueImp *runtimeObject = thisObj->get(exec, "__apple_runtime_object");
+ imp = static_cast<RuntimeObjectImp*>(runtimeObject);
}
else {
- imp = static_cast<RuntimeObjectImp*>(thisObj.imp());
+ imp = static_cast<RuntimeObjectImp*>(thisObj);
}
if (imp) {
Instance *instance = imp->getInternalInstance();
instance->begin();
- Value aValue = instance->invokeMethod(exec, _methodList, args);
+ ValueImp *aValue = instance->invokeMethod(exec, _methodList, args);
instance->end();
1.7 +2 -2 JavaScriptCore/bindings/runtime_method.h
Index: runtime_method.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/bindings/runtime_method.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- runtime_method.h 7 Aug 2005 06:17:33 -0000 1.6
+++ runtime_method.h 8 Aug 2005 04:07:22 -0000 1.7
@@ -41,14 +41,14 @@
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
virtual bool implementsCall() const;
- virtual Value call(ExecState *exec, Object &thisObj, const List &args);
+ virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args);
virtual CodeType codeType() const;
virtual Completion execute(ExecState *exec);
private:
- static Value lengthGetter(ExecState *, const Identifier&, const PropertySlot&);
+ static ValueImp *lengthGetter(ExecState *, const Identifier&, const PropertySlot&);
Bindings::MethodList _methodList;
};
1.28 +12 -12 JavaScriptCore/bindings/runtime_object.cpp
Index: runtime_object.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/bindings/runtime_object.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- runtime_object.cpp 7 Aug 2005 06:17:33 -0000 1.27
+++ runtime_object.cpp 8 Aug 2005 04:07:22 -0000 1.28
@@ -60,7 +60,7 @@
instance = i;
}
-Value RuntimeObjectImp::fallbackObjectGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *RuntimeObjectImp::fallbackObjectGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
RuntimeObjectImp *thisObj = static_cast<RuntimeObjectImp *>(slot.slotBase());
Bindings::Instance *instance = thisObj->instance;
@@ -68,14 +68,14 @@
instance->begin();
Class *aClass = instance->getClass();
- Value result = aClass->fallbackObject(exec, instance, propertyName);
+ ValueImp *result = aClass->fallbackObject(exec, instance, propertyName);
instance->end();
return result;
}
-Value RuntimeObjectImp::fieldGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *RuntimeObjectImp::fieldGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
RuntimeObjectImp *thisObj = static_cast<RuntimeObjectImp *>(slot.slotBase());
Bindings::Instance *instance = thisObj->instance;
@@ -84,14 +84,14 @@
Class *aClass = instance->getClass();
Field *aField = aClass->fieldNamed(propertyName.ascii(), instance);
- Value result = instance->getValueOfField(exec, aField);
+ ValueImp *result = instance->getValueOfField(exec, aField);
instance->end();
return result;
}
-Value RuntimeObjectImp::methodGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *RuntimeObjectImp::methodGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
RuntimeObjectImp *thisObj = static_cast<RuntimeObjectImp *>(slot.slotBase());
Bindings::Instance *instance = thisObj->instance;
@@ -100,7 +100,7 @@
Class *aClass = instance->getClass();
MethodList methodList = aClass->methodsNamed(propertyName.ascii(), instance);
- Value result = Object(new RuntimeMethodImp(exec, propertyName, methodList));
+ ValueImp *result = new RuntimeMethodImp(exec, propertyName, methodList);
instance->end();
@@ -132,7 +132,7 @@
}
// Try a fallback object.
- if (!aClass->fallbackObject(exec, instance, propertyName).type() != UndefinedType) {
+ if (!aClass->fallbackObject(exec, instance, propertyName)->isUndefined()) {
slot.setCustom(this, fallbackObjectGetter);
instance->end();
return true;
@@ -146,7 +146,7 @@
}
void RuntimeObjectImp::put(ExecState *exec, const Identifier &propertyName,
- const Value &value, int attr)
+ ValueImp *value, int attr)
{
instance->begin();
@@ -187,9 +187,9 @@
return false;
}
-Value RuntimeObjectImp::defaultValue(ExecState *exec, Type hint) const
+ValueImp *RuntimeObjectImp::defaultValue(ExecState *exec, Type hint) const
{
- Value result;
+ ValueImp *result;
instance->begin();
@@ -206,11 +206,11 @@
return true;
}
-Value RuntimeObjectImp::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *RuntimeObjectImp::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
instance->begin();
- Value aValue = getInternalInstance()->invokeDefaultMethod(exec, args);
+ ValueImp *aValue = getInternalInstance()->invokeDefaultMethod(exec, args);
instance->end();
1.16 +6 -6 JavaScriptCore/bindings/runtime_object.h
Index: runtime_object.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/bindings/runtime_object.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- runtime_object.h 7 Aug 2005 06:17:33 -0000 1.15
+++ runtime_object.h 8 Aug 2005 04:07:22 -0000 1.16
@@ -44,27 +44,27 @@
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
virtual void put(ExecState *exec, const Identifier &propertyName,
- const Value &value, int attr = None);
+ ValueImp *value, int attr = None);
virtual bool canPut(ExecState *exec, const Identifier &propertyName) const;
virtual bool deleteProperty(ExecState *exec,
const Identifier &propertyName);
- virtual Value defaultValue(ExecState *exec, Type hint) const;
+ virtual ValueImp *defaultValue(ExecState *exec, Type hint) const;
void setInternalInstance (Bindings::Instance *i) { instance = i; }
Bindings::Instance *getInternalInstance() const { return instance; }
virtual bool implementsCall() const;
- virtual Value call(ExecState *exec, Object &thisObj, const List &args);
+ virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args);
static const ClassInfo info;
private:
- static Value fallbackObjectGetter(ExecState *, const Identifier&, const PropertySlot&);
- static Value fieldGetter(ExecState *, const Identifier&, const PropertySlot&);
- static Value methodGetter(ExecState *, const Identifier&, const PropertySlot&);
+ static ValueImp *fallbackObjectGetter(ExecState *, const Identifier&, const PropertySlot&);
+ static ValueImp *fieldGetter(ExecState *, const Identifier&, const PropertySlot&);
+ static ValueImp *methodGetter(ExecState *, const Identifier&, const PropertySlot&);
Bindings::Instance *instance;
bool ownsInstance;
1.13 +23 -23 JavaScriptCore/bindings/c/c_instance.cpp
Index: c_instance.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/bindings/c/c_instance.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- c_instance.cpp 17 Jan 2005 22:41:22 -0000 1.12
+++ c_instance.cpp 8 Aug 2005 04:07:23 -0000 1.13
@@ -39,15 +39,15 @@
}
#endif
-using namespace KJS::Bindings;
-using namespace KJS;
+namespace KJS {
+namespace Bindings {
CInstance::CInstance (NPObject *o)
{
_object = _NPN_RetainObject (o);
_class = 0;
setExecutionContext (0);
-};
+}
CInstance::~CInstance ()
{
@@ -94,9 +94,9 @@
// Do nothing.
}
-Value CInstance::invokeMethod (KJS::ExecState *exec, const MethodList &methodList, const List &args)
+ValueImp *CInstance::invokeMethod (ExecState *exec, const MethodList &methodList, const List &args)
{
- Value resultValue;
+ ValueImp *resultValue;
// Overloading methods are not allowed by NPObjects. Should only be one
// name match for a particular method.
@@ -146,9 +146,9 @@
}
-Value CInstance::invokeDefaultMethod (KJS::ExecState *exec, const List &args)
+ValueImp *CInstance::invokeDefaultMethod (ExecState *exec, const List &args)
{
- Value resultValue;
+ ValueImp *resultValue;
if (_object->_class->invokeDefault) {
unsigned i, count = args.size();
@@ -188,44 +188,44 @@
}
-KJS::Value CInstance::defaultValue (KJS::Type hint) const
+ValueImp *CInstance::defaultValue (Type hint) const
{
- if (hint == KJS::StringType) {
+ if (hint == StringType) {
return stringValue();
}
- else if (hint == KJS::NumberType) {
+ else if (hint == NumberType) {
return numberValue();
}
- else if (hint == KJS::BooleanType) {
+ else if (hint == BooleanType) {
return booleanValue();
}
return valueOf();
}
-KJS::Value CInstance::stringValue() const
+ValueImp *CInstance::stringValue() const
{
char buf[1024];
- snprintf (buf, 1024, "NPObject %p, NPClass %p", _object, _object->_class);
- KJS::String v(buf);
- return v;
+ snprintf(buf, 1024, "NPObject %p, NPClass %p", _object, _object->_class);
+ return jsString(buf);
}
-KJS::Value CInstance::numberValue() const
+ValueImp *CInstance::numberValue() const
{
// FIXME: Implement something sensible
- KJS::Number v(0);
- return v;
+ return jsNumber(0);
}
-KJS::Value CInstance::booleanValue() const
+ValueImp *CInstance::booleanValue() const
{
// FIXME: Implement something sensible
- KJS::Boolean v((bool)0);
- return v;
+ return jsBoolean(false);
}
-KJS::Value CInstance::valueOf() const
+ValueImp *CInstance::valueOf() const
{
return stringValue();
-};
+}
+
+}
+}
1.7 +7 -7 JavaScriptCore/bindings/c/c_instance.h
Index: c_instance.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/bindings/c/c_instance.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- c_instance.h 17 Jan 2005 22:41:22 -0000 1.6
+++ c_instance.h 8 Aug 2005 04:07:23 -0000 1.7
@@ -51,15 +51,15 @@
virtual void begin();
virtual void end();
- virtual Value valueOf() const;
- virtual Value defaultValue (KJS::Type hint) const;
+ virtual ValueImp *valueOf() const;
+ virtual ValueImp *defaultValue (KJS::Type hint) const;
- virtual Value invokeMethod (ExecState *exec, const MethodList &method, const List &args);
- virtual Value invokeDefaultMethod (ExecState *exec, const List &args);
+ virtual ValueImp *invokeMethod (ExecState *exec, const MethodList &method, const List &args);
+ virtual ValueImp *invokeDefaultMethod (ExecState *exec, const List &args);
- Value stringValue() const;
- Value numberValue() const;
- Value booleanValue() const;
+ ValueImp *stringValue() const;
+ ValueImp *numberValue() const;
+ ValueImp *booleanValue() const;
NPObject *getObject() const { return _object; }
1.7 +3 -3 JavaScriptCore/bindings/c/c_runtime.cpp
Index: c_runtime.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/bindings/c/c_runtime.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- c_runtime.cpp 1 Nov 2004 23:46:31 -0000 1.6
+++ c_runtime.cpp 8 Aug 2005 04:07:23 -0000 1.7
@@ -41,11 +41,11 @@
// ---------------------- CField ----------------------
-Value CField::valueFromInstance(KJS::ExecState *exec, const Instance *inst) const
+ValueImp *CField::valueFromInstance(ExecState *exec, const Instance *inst) const
{
const CInstance *instance = static_cast<const CInstance*>(inst);
NPObject *obj = instance->getObject();
- Value aValue;
+ ValueImp *aValue;
NPVariant property;
VOID_TO_NPVARIANT(property);
if (obj->_class->getProperty) {
@@ -58,7 +58,7 @@
return aValue;
}
-void CField::setValueToInstance(KJS::ExecState *exec, const Instance *inst, const KJS::Value &aValue) const
+void CField::setValueToInstance(ExecState *exec, const Instance *inst, ValueImp *aValue) const
{
const CInstance *instance = static_cast<const CInstance*>(inst);
NPObject *obj = instance->getObject();
1.6 +4 -5 JavaScriptCore/bindings/c/c_runtime.h
Index: c_runtime.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/bindings/c/c_runtime.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- c_runtime.h 30 Sep 2004 01:32:04 -0000 1.5
+++ c_runtime.h 8 Aug 2005 04:07:23 -0000 1.6
@@ -35,7 +35,6 @@
namespace KJS
{
-class Value;
namespace Bindings
{
@@ -49,8 +48,8 @@
_fieldIdentifier = ident;
};
- virtual KJS::Value valueFromInstance(KJS::ExecState *exec, const Instance *instance) const;
- virtual void setValueToInstance(KJS::ExecState *exec, const Instance *instance, const KJS::Value &aValue) const;
+ virtual ValueImp *valueFromInstance(ExecState *exec, const Instance *instance) const;
+ virtual void setValueToInstance(ExecState *exec, const Instance *instance, ValueImp *aValue) const;
virtual const char *name() const { return _NPN_UTF8FromIdentifier(_fieldIdentifier); }
virtual RuntimeType type() const { return ""; }
@@ -85,8 +84,8 @@
CArray &operator=(const CArray &other);
- virtual void setValueAt(KJS::ExecState *exec, unsigned int index, const KJS::Value &aValue) const;
- virtual KJS::Value valueAt(KJS::ExecState *exec, unsigned int index) const;
+ virtual void setValueAt(ExecState *exec, unsigned int index, ValueImp *aValue) const;
+ virtual ValueImp *valueAt(ExecState *exec, unsigned int index) const;
virtual unsigned int getLength() const;
virtual ~CArray();
1.10 +45 -45 JavaScriptCore/bindings/c/c_utility.cpp
Index: c_utility.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/bindings/c/c_utility.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- c_utility.cpp 12 Feb 2005 00:58:13 -0000 1.9
+++ c_utility.cpp 8 Aug 2005 04:07:23 -0000 1.10
@@ -37,55 +37,55 @@
using namespace KJS::Bindings;
// Requires free() of returned UTF16Chars.
-void convertNPStringToUTF16 (const NPString *string, NPUTF16 **UTF16Chars, unsigned int *UTF16Length)
+void convertNPStringToUTF16(const NPString *string, NPUTF16 **UTF16Chars, unsigned int *UTF16Length)
{
- convertUTF8ToUTF16 (string->UTF8Characters, string->UTF8Length, UTF16Chars, UTF16Length);
+ convertUTF8ToUTF16(string->UTF8Characters, string->UTF8Length, UTF16Chars, UTF16Length);
}
// Requires free() of returned UTF16Chars.
-void convertUTF8ToUTF16 (const NPUTF8 *UTF8Chars, int UTF8Length, NPUTF16 **UTF16Chars, unsigned int *UTF16Length)
+void convertUTF8ToUTF16(const NPUTF8 *UTF8Chars, int UTF8Length, NPUTF16 **UTF16Chars, unsigned int *UTF16Length)
{
- assert (UTF8Chars);
+ assert(UTF8Chars);
if (UTF8Length == -1)
UTF8Length = strlen(UTF8Chars);
- CFStringRef stringRef = CFStringCreateWithBytes (NULL, (const UInt8*)UTF8Chars, (CFIndex)UTF8Length, kCFStringEncodingUTF8, false);
+ CFStringRef stringRef = CFStringCreateWithBytes(NULL, (const UInt8*)UTF8Chars, (CFIndex)UTF8Length, kCFStringEncodingUTF8, false);
- *UTF16Length = (unsigned int)CFStringGetLength (stringRef);
- *UTF16Chars = (NPUTF16 *)malloc (sizeof(NPUTF16) * (*UTF16Length));
+ *UTF16Length = (unsigned int)CFStringGetLength(stringRef);
+ *UTF16Chars = (NPUTF16 *)malloc(sizeof(NPUTF16) * (*UTF16Length));
// Convert the string to UTF16.
CFRange range = { 0, *UTF16Length };
- CFStringGetCharacters (stringRef, range, (UniChar *)*UTF16Chars);
- CFRelease (stringRef);
+ CFStringGetCharacters(stringRef, range, (UniChar *)*UTF16Chars);
+ CFRelease(stringRef);
}
// Variant value must be released with NPReleaseVariantValue()
-void coerceValueToNPVariantStringType (KJS::ExecState *exec, const KJS::Value &value, NPVariant *result)
+void coerceValueToNPVariantStringType(ExecState *exec, ValueImp *value, NPVariant *result)
{
- UString ustring = value.toString(exec);
+ UString ustring = value->toString(exec);
CString cstring = ustring.UTF8String();
NPString string = { (const NPUTF8 *)cstring.c_str(), cstring.size() };
- NPN_InitializeVariantWithStringCopy (result, &string);
+ NPN_InitializeVariantWithStringCopy(result, &string);
}
// Variant value must be released with NPReleaseVariantValue()
-void convertValueToNPVariant (KJS::ExecState *exec, const KJS::Value &value, NPVariant *result)
+void convertValueToNPVariant(ExecState *exec, ValueImp *value, NPVariant *result)
{
- Type type = value.type();
+ Type type = value->type();
if (type == StringType) {
- UString ustring = value.toString(exec);
+ UString ustring = value->toString(exec);
CString cstring = ustring.UTF8String();
NPString string = { (const NPUTF8 *)cstring.c_str(), cstring.size() };
- NPN_InitializeVariantWithStringCopy (result, &string );
+ NPN_InitializeVariantWithStringCopy(result, &string );
}
else if (type == NumberType) {
- NPN_InitializeVariantWithDouble (result, value.toNumber(exec));
+ NPN_InitializeVariantWithDouble(result, value->toNumber(exec));
}
else if (type == BooleanType) {
- NPN_InitializeVariantWithBool (result, value.toBoolean(exec));
+ NPN_InitializeVariantWithBool(result, value->toBoolean(exec));
}
else if (type == UnspecifiedType) {
NPN_InitializeVariantAsUndefined(result);
@@ -94,20 +94,20 @@
NPN_InitializeVariantAsNull(result);
}
else if (type == ObjectType) {
- KJS::ObjectImp *objectImp = static_cast<KJS::ObjectImp*>(value.imp());
- if (objectImp->classInfo() == &KJS::RuntimeObjectImp::info) {
- KJS::RuntimeObjectImp *imp = static_cast<KJS::RuntimeObjectImp *>(value.imp());
+ ObjectImp *objectImp = static_cast<ObjectImp*>(value);
+ if (objectImp->classInfo() == &RuntimeObjectImp::info) {
+ RuntimeObjectImp *imp = static_cast<RuntimeObjectImp *>(value);
CInstance *instance = static_cast<CInstance*>(imp->getInternalInstance());
- NPN_InitializeVariantWithObject (result, instance->getObject());
+ NPN_InitializeVariantWithObject(result, instance->getObject());
}
else {
- KJS::Interpreter *originInterpreter = exec->interpreter();
+ Interpreter *originInterpreter = exec->interpreter();
const Bindings::RootObject *originExecutionContext = rootForInterpreter(originInterpreter);
- KJS::Interpreter *interpreter = 0;
+ Interpreter *interpreter = 0;
if (originInterpreter->isGlobalObject(value)) {
- interpreter = originInterpreter->interpreterForGlobalObject (value.imp());
+ interpreter = originInterpreter->interpreterForGlobalObject(value);
}
if (!interpreter)
@@ -115,29 +115,29 @@
const Bindings::RootObject *executionContext = rootForInterpreter(interpreter);
if (!executionContext) {
- Bindings::RootObject *newExecutionContext = new KJS::Bindings::RootObject(0);
- newExecutionContext->setInterpreter (interpreter);
+ Bindings::RootObject *newExecutionContext = new Bindings::RootObject(0);
+ newExecutionContext->setInterpreter(interpreter);
executionContext = newExecutionContext;
}
- NPObject *obj = (NPObject *)exec->interpreter()->createLanguageInstanceForValue (exec, Instance::CLanguage, value.toObject(exec), originExecutionContext, executionContext);
- NPN_InitializeVariantWithObject (result, obj);
- _NPN_ReleaseObject (obj);
+ NPObject *obj = (NPObject *)exec->interpreter()->createLanguageInstanceForValue(exec, Instance::CLanguage, value->toObject(exec), originExecutionContext, executionContext);
+ NPN_InitializeVariantWithObject(result, obj);
+ _NPN_ReleaseObject(obj);
}
}
else
NPN_InitializeVariantAsUndefined(result);
}
-Value convertNPVariantToValue (KJS::ExecState *exec, const NPVariant *variant)
+ValueImp *convertNPVariantToValue(ExecState *exec, const NPVariant *variant)
{
NPVariantType type = variant->type;
if (type == NPVariantType_Bool) {
NPBool aBool;
- if (NPN_VariantToBool (variant, &aBool))
- return KJS::Boolean (aBool);
- return KJS::Boolean (false);
+ if (NPN_VariantToBool(variant, &aBool))
+ return jsBoolean(aBool);
+ return jsBoolean(false);
}
else if (type == NPVariantType_Null) {
return Null();
@@ -147,23 +147,23 @@
}
else if (type == NPVariantType_Int32) {
int32_t anInt;
- if (NPN_VariantToInt32 (variant, &anInt))
- return Number (anInt);
- return Number (0);
+ if (NPN_VariantToInt32(variant, &anInt))
+ return Number(anInt);
+ return Number(0);
}
else if (type == NPVariantType_Double) {
double aDouble;
- if (NPN_VariantToDouble (variant, &aDouble))
- return Number (aDouble);
- return Number (0);
+ if (NPN_VariantToDouble(variant, &aDouble))
+ return Number(aDouble);
+ return Number(0);
}
else if (type == NPVariantType_String) {
NPUTF16 *stringValue;
unsigned int UTF16Length;
- convertNPStringToUTF16 (&variant->value.stringValue, &stringValue, &UTF16Length); // requires free() of returned memory.
- String resultString(UString((const UChar *)stringValue,UTF16Length));
- free (stringValue);
- return resultString;
+ convertNPStringToUTF16(&variant->value.stringValue, &stringValue, &UTF16Length); // requires free() of returned memory.
+ UString resultString((const UChar *)stringValue,UTF16Length);
+ free(stringValue);
+ return jsString(resultString);
}
else if (type == NPVariantType_Object) {
NPObject *obj = variant->value.objectValue;
@@ -171,7 +171,7 @@
if (obj->_class == NPScriptObjectClass) {
// Get ObjectImp from NP_JavaScriptObject.
JavaScriptObject *o = (JavaScriptObject *)obj;
- return Object(const_cast<ObjectImp*>(o->imp));
+ return const_cast<ObjectImp*>(o->imp);
}
else {
// Wrap NPObject in a CInstance.
1.7 +5 -6 JavaScriptCore/bindings/c/c_utility.h
Index: c_utility.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/bindings/c/c_utility.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- c_utility.h 24 Jun 2004 00:36:33 -0000 1.6
+++ c_utility.h 8 Aug 2005 04:07:23 -0000 1.7
@@ -45,12 +45,11 @@
NP_InvalidValueType
} NP_ValueType;
-
-extern void convertNPStringToUTF16 (const NPString *string, NPUTF16 **UTF16Chars, unsigned int *UTF16Length);
-extern void convertUTF8ToUTF16 (const NPUTF8 *UTF8Chars, int UTF8Length, NPUTF16 **UTF16Chars, unsigned int *UTF16Length);
-extern void coerceValueToNPVariantStringType (KJS::ExecState *exec, const KJS::Value &value, NPVariant *result);
-extern void convertValueToNPVariant (KJS::ExecState *exec, const KJS::Value &value, NPVariant *result);
-extern KJS::Value convertNPVariantToValue (KJS::ExecState *exec, const NPVariant *variant);
+void convertNPStringToUTF16(const NPString *string, NPUTF16 **UTF16Chars, unsigned int *UTF16Length);
+void convertUTF8ToUTF16(const NPUTF8 *UTF8Chars, int UTF8Length, NPUTF16 **UTF16Chars, unsigned int *UTF16Length);
+void coerceValueToNPVariantStringType(KJS::ExecState *exec, KJS::ValueImp *value, NPVariant *result);
+void convertValueToNPVariant(KJS::ExecState *exec, KJS::ValueImp *value, NPVariant *result);
+KJS::ValueImp *convertNPVariantToValue(KJS::ExecState *exec, const NPVariant *variant);
typedef struct
{
1.26 +19 -23 JavaScriptCore/bindings/jni/jni_instance.cpp
Index: jni_instance.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/bindings/jni/jni_instance.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- jni_instance.cpp 12 Feb 2005 00:58:13 -0000 1.25
+++ jni_instance.cpp 8 Aug 2005 04:07:24 -0000 1.26
@@ -81,36 +81,33 @@
return _class;
}
-KJS::Value JavaInstance::stringValue() const
+ValueImp *JavaInstance::stringValue() const
{
jstring stringValue = (jstring)callJNIObjectMethod (_instance->_instance, "toString", "()Ljava/lang/String;");
JNIEnv *env = getJNIEnv();
- const UChar *c = (const UChar *)getUCharactersFromJStringInEnv (env, stringValue);
- UString u(c, (int)env->GetStringLength(stringValue));
- String v(u);
- releaseUCharactersForJStringInEnv (env, stringValue, (const jchar *)c);
- return v;
+ const jchar *c = getUCharactersFromJStringInEnv(env, stringValue);
+ UString u((const UChar *)c, (int)env->GetStringLength(stringValue));
+ releaseUCharactersForJStringInEnv(env, stringValue, c);
+ return jsString(u);
}
-KJS::Value JavaInstance::numberValue() const
+ValueImp *JavaInstance::numberValue() const
{
jdouble doubleValue = callJNIDoubleMethod (_instance->_instance, "doubleValue", "()D");
- KJS::Number v(doubleValue);
- return v;
+ return jsNumber(doubleValue);
}
-KJS::Value JavaInstance::booleanValue() const
+ValueImp *JavaInstance::booleanValue() const
{
jboolean booleanValue = callJNIBooleanMethod (_instance->_instance, "booleanValue", "()Z");
- KJS::Boolean v(booleanValue);
- return v;
+ return jsBoolean(booleanValue);
}
-Value JavaInstance::invokeMethod (KJS::ExecState *exec, const MethodList &methodList, const List &args)
+ValueImp *JavaInstance::invokeMethod (ExecState *exec, const MethodList &methodList, const List &args)
{
int i, count = args.size();
jvalue *jArgs;
- Value resultValue;
+ ValueImp *resultValue;
Method *method = 0;
unsigned int numMethods = methodList.length();
@@ -145,7 +142,7 @@
for (i = 0; i < count; i++) {
JavaParameter *aParameter = static_cast<JavaParameter *>(jMethod->parameterAt(i));
jArgs[i] = convertValueToJValue (exec, args.at(i), aParameter->getJNIType(), aParameter->type());
- JS_LOG("arg[%d] = %s\n", i, args.at(i).toString(exec).ascii());
+ JS_LOG("arg[%d] = %s\n", i, args.at(i)->toString(exec).ascii());
}
@@ -158,12 +155,11 @@
bool handled = false;
if (execContext && execContext->nativeHandle()) {
jobject obj = _instance->_instance;
- Value exceptionDescription;
+ ValueImp *exceptionDescription;
const char *callingURL = 0; // FIXME, need to propagate calling URL to Java
handled = dispatchJNICall (execContext->nativeHandle(), obj, jMethod->isStatic(), jMethod->JNIReturnType(), jMethod->methodID(obj), jArgs, result, callingURL, exceptionDescription);
- if (!exceptionDescription.isNull()) {
- Object error = Error::create(exec, GeneralError, exceptionDescription.toString(exec).UTF8String().c_str());
-
+ if (exceptionDescription) {
+ ObjectImp *error = Error::create(exec, GeneralError, exceptionDescription->toString(exec).UTF8String().c_str());
exec->setException(error);
free (jArgs);
@@ -256,7 +252,7 @@
break;
case boolean_type: {
- resultValue = KJS::Boolean(result.z);
+ resultValue = Boolean(result.z);
}
break;
@@ -307,13 +303,13 @@
return resultValue;
}
-KJS::Value JavaInstance::invokeDefaultMethod (KJS::ExecState *exec, const KJS::List &args)
+ValueImp *JavaInstance::invokeDefaultMethod (ExecState *exec, const List &args)
{
return Undefined();
}
-KJS::Value JavaInstance::defaultValue (KJS::Type hint) const
+ValueImp *JavaInstance::defaultValue (Type hint) const
{
if (hint == StringType) {
return stringValue();
@@ -340,7 +336,7 @@
return valueOf();
}
-KJS::Value JavaInstance::valueOf() const
+ValueImp *JavaInstance::valueOf() const
{
return stringValue();
};
1.18 +7 -7 JavaScriptCore/bindings/jni/jni_instance.h
Index: jni_instance.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/bindings/jni/jni_instance.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- jni_instance.h 17 Jan 2005 22:41:22 -0000 1.17
+++ jni_instance.h 8 Aug 2005 04:07:24 -0000 1.18
@@ -90,17 +90,17 @@
virtual void begin();
virtual void end();
- virtual Value valueOf() const;
- virtual Value defaultValue (Type hint) const;
+ virtual ValueImp *valueOf() const;
+ virtual ValueImp *defaultValue (Type hint) const;
- virtual Value invokeMethod (ExecState *exec, const MethodList &method, const List &args);
- virtual Value invokeDefaultMethod (ExecState *exec, const List &args);
+ virtual ValueImp *invokeMethod (ExecState *exec, const MethodList &method, const List &args);
+ virtual ValueImp *invokeDefaultMethod (ExecState *exec, const List &args);
jobject javaInstance() const { return _instance->_instance; }
- Value stringValue() const;
- Value numberValue() const;
- Value booleanValue() const;
+ ValueImp *stringValue() const;
+ ValueImp *numberValue() const;
+ ValueImp *booleanValue() const;
private:
JObjectWrapper *_instance;
1.12 +32 -32 JavaScriptCore/bindings/jni/jni_jsobject.cpp
Index: jni_jsobject.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/bindings/jni/jni_jsobject.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- jni_jsobject.cpp 29 Apr 2005 00:22:55 -0000 1.11
+++ jni_jsobject.cpp 8 Aug 2005 04:07:24 -0000 1.12
@@ -77,7 +77,7 @@
result.j = JSObject::createNative(nativeHandle);
}
else {
- KJS::ObjectImp *imp = jlong_to_impptr(nativeHandle);
+ ObjectImp *imp = jlong_to_impptr(nativeHandle);
if (!rootForImp(imp)) {
fprintf (stderr, "%s:%d: Attempt to access JavaScript from destroyed applet, type %d.\n", __FILE__, __LINE__, context->type);
return result;
@@ -173,19 +173,19 @@
Interpreter::lock();
Identifier identifier(JavaString(methodName).ustring());
- Value func = _imp->get (exec, identifier);
+ ValueImp *func = _imp->get (exec, identifier);
Interpreter::unlock();
- if (func.isNull() || func.type() == UndefinedType) {
+ if (func->isUndefinedOrNull()) {
// Maybe throw an exception here?
return 0;
}
// Call the function object.
- ObjectImp *funcImp = static_cast<ObjectImp*>(func.imp());
- Object thisObj = Object(const_cast<ObjectImp*>(_imp));
+ ObjectImp *funcImp = static_cast<ObjectImp*>(func);
+ ObjectImp *thisObj = const_cast<ObjectImp*>(_imp);
List argList = listFromJArray(args);
Interpreter::lock();
- Value result = funcImp->call (exec, thisObj, argList);
+ ValueImp *result = funcImp->call (exec, thisObj, argList);
Interpreter::unlock();
// Convert and return the result of the function call.
@@ -196,8 +196,8 @@
{
JS_LOG ("script = %s\n", JavaString(script).UTF8String());
- Object thisObj = Object(const_cast<ObjectImp*>(_imp));
- Value result;
+ ObjectImp *thisObj = const_cast<ObjectImp*>(_imp);
+ ValueImp *result;
Interpreter::lock();
@@ -206,7 +206,7 @@
if (type == Normal) {
result = completion.value();
- if (result.isNull()) {
+ if (!result) {
result = Undefined();
}
}
@@ -225,7 +225,7 @@
ExecState *exec = _root->interpreter()->globalExec();
Interpreter::lock();
- Value result = _imp->get (exec, Identifier (JavaString(memberName).ustring()));
+ ValueImp *result = _imp->get (exec, Identifier (JavaString(memberName).ustring()));
Interpreter::unlock();
return convertValueToJObject (result);
@@ -258,7 +258,7 @@
ExecState *exec = _root->interpreter()->globalExec();
Interpreter::lock();
- Value result = _imp->get (exec, (unsigned)index);
+ ValueImp *result = _imp->get (exec, (unsigned)index);
Interpreter::unlock();
return convertValueToJObject (result);
@@ -281,7 +281,7 @@
JS_LOG ("\n");
Interpreter::lock();
- Object thisObj = Object(const_cast<ObjectImp*>(_imp));
+ ObjectImp *thisObj = const_cast<ObjectImp*>(_imp);
ExecState *exec = _root->interpreter()->globalExec();
jstring result = (jstring)convertValueToJValue (exec, thisObj, object_type, "java.lang.String").l;
@@ -328,7 +328,7 @@
return ptr_to_jlong(0);
}
-jobject JSObject::convertValueToJObject (KJS::Value value) const
+jobject JSObject::convertValueToJObject (ValueImp *value) const
{
ExecState *exec = _root->interpreter()->globalExec();
JNIEnv *env = getJNIEnv();
@@ -342,39 +342,39 @@
// Java instance -> Java instance
// Everything else -> JSObject
- KJS::Type type = value.type();
- if (type == KJS::NumberType) {
+ Type type = value->type();
+ if (type == NumberType) {
jclass JSObjectClass = env->FindClass ("java/lang/Double");
jmethodID constructorID = env->GetMethodID (JSObjectClass, "<init>", "(D)V");
if (constructorID != NULL) {
- result = env->NewObject (JSObjectClass, constructorID, (jdouble)value.toNumber(exec));
+ result = env->NewObject (JSObjectClass, constructorID, (jdouble)value->toNumber(exec));
}
}
- else if (type == KJS::StringType) {
- KJS::UString stringValue = value.toString(exec);
+ else if (type == StringType) {
+ UString stringValue = value->toString(exec);
JNIEnv *env = getJNIEnv();
result = env->NewString ((const jchar *)stringValue.data(), stringValue.size());
}
- else if (type == KJS::BooleanType) {
+ else if (type == BooleanType) {
jclass JSObjectClass = env->FindClass ("java/lang/Boolean");
jmethodID constructorID = env->GetMethodID (JSObjectClass, "<init>", "(Z)V");
if (constructorID != NULL) {
- result = env->NewObject (JSObjectClass, constructorID, (jboolean)value.toBoolean(exec));
+ result = env->NewObject (JSObjectClass, constructorID, (jboolean)value->toBoolean(exec));
}
}
else {
// Create a JSObject.
jlong nativeHandle;
- if (type == KJS::ObjectType){
- KJS::ObjectImp *imp = static_cast<KJS::ObjectImp*>(value.imp());
+ if (type == ObjectType){
+ ObjectImp *imp = static_cast<ObjectImp*>(value);
// We either have a wrapper around a Java instance or a JavaScript
// object. If we have a wrapper around a Java instance, return that
// instance, otherwise create a new Java JSObject with the ObjectImp*
// as it's nativeHandle.
if (imp->classInfo() && strcmp(imp->classInfo()->className, "RuntimeObject") == 0) {
- KJS::RuntimeObjectImp *runtimeImp = static_cast<KJS::RuntimeObjectImp*>(value.imp());
+ RuntimeObjectImp *runtimeImp = static_cast<RuntimeObjectImp*>(value);
Bindings::JavaInstance *runtimeInstance = static_cast<Bindings::JavaInstance *>(runtimeImp->getInternalInstance());
return runtimeInstance->javaInstance();
}
@@ -411,7 +411,7 @@
return result;
}
-KJS::Value JSObject::convertJObjectToValue (jobject theObject) const
+ValueImp *JSObject::convertJObjectToValue (jobject theObject) const
{
// Instances of netscape.javascript.JSObject get converted back to
// JavaScript objects. All other objects are wrapped. It's not
@@ -427,28 +427,28 @@
JNIEnv *env = getJNIEnv();
jfieldID fieldID = env->GetFieldID((jclass)classOfInstance, "nativeJSObject", "long");
if (fieldID == NULL) {
- return KJS::Undefined();
+ return Undefined();
}
jlong nativeHandle = env->GetLongField(theObject, fieldID);
if (nativeHandle == UndefinedHandle) {
- return KJS::Undefined();
+ return Undefined();
}
- KJS::ObjectImp *imp = static_cast<KJS::ObjectImp*>(jlong_to_impptr(nativeHandle));
- return KJS::Object(const_cast<KJS::ObjectImp*>(imp));
+ ObjectImp *imp = static_cast<ObjectImp*>(jlong_to_impptr(nativeHandle));
+ return imp;
}
Interpreter::lock();
- KJS::RuntimeObjectImp *newImp = new KJS::RuntimeObjectImp(new Bindings::JavaInstance (theObject, _root));
+ RuntimeObjectImp *newImp = new RuntimeObjectImp(new Bindings::JavaInstance (theObject, _root));
Interpreter::unlock();
- return KJS::Object(newImp);
+ return newImp;
}
-KJS::List JSObject::listFromJArray(jobjectArray jArray) const
+List JSObject::listFromJArray(jobjectArray jArray) const
{
JNIEnv *env = getJNIEnv();
long i, numObjects = jArray ? env->GetArrayLength (jArray) : 0;
- KJS::List aList;
+ List aList;
for (i = 0; i < numObjects; i++) {
jobject anObject = env->GetObjectArrayElement ((jobjectArray)jArray, i);
1.4 +6 -6 JavaScriptCore/bindings/jni/jni_jsobject.h
Index: jni_jsobject.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/bindings/jni/jni_jsobject.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- jni_jsobject.h 19 May 2004 14:33:25 -0000 1.3
+++ jni_jsobject.h 8 Aug 2005 04:07:24 -0000 1.4
@@ -88,13 +88,13 @@
static jvalue invoke (JSObjectCallContext *context);
- jobject convertValueToJObject (KJS::Value value) const;
- KJS::Value convertJObjectToValue (jobject theObject) const;
- KJS::List listFromJArray(jobjectArray jArray) const;
+ jobject convertValueToJObject (ValueImp *value) const;
+ ValueImp *convertJObjectToValue (jobject theObject) const;
+ List listFromJArray(jobjectArray jArray) const;
private:
- const Bindings::RootObject *_root;
- KJS::ObjectImp *_imp;
+ const RootObject *_root;
+ ObjectImp *_imp;
};
@@ -116,6 +116,6 @@
void KJS_JSObject_JSObjectSetSlot (JNIEnv *env, jclass jsClass, jlong nativeJSObject, jstring jurl, jint jindex, jobject value, jboolean ctx);
jstring KJS_JSObject_JSObjectToString (JNIEnv *env, jclass clazz, jlong nativeJSObject);
-} // namespace Bindings
+}
#endif
\ No newline at end of file
1.4 +1 -1 JavaScriptCore/bindings/jni/jni_objc.mm
Index: jni_objc.mm
===================================================================
RCS file: /cvs/root/JavaScriptCore/bindings/jni/jni_objc.mm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- jni_objc.mm 15 Dec 2004 02:00:33 -0000 1.3
+++ jni_objc.mm 8 Aug 2005 04:07:24 -0000 1.4
@@ -43,7 +43,7 @@
- (NSURL *)_webViewURL;
@end
-bool KJS::Bindings::dispatchJNICall (const void *targetAppletView, jobject obj, bool isStatic, JNIType returnType, jmethodID methodID, jvalue *args, jvalue &result, const char *callingURL, Value &exceptionDescription)
+bool KJS::Bindings::dispatchJNICall (const void *targetAppletView, jobject obj, bool isStatic, JNIType returnType, jmethodID methodID, jvalue *args, jvalue &result, const char *callingURL, ValueImp *&exceptionDescription)
{
id view = (id)targetAppletView;
1.26 +19 -19 JavaScriptCore/bindings/jni/jni_runtime.cpp
Index: jni_runtime.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/bindings/jni/jni_runtime.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- jni_runtime.cpp 4 May 2005 00:09:47 -0000 1.25
+++ jni_runtime.cpp 8 Aug 2005 04:07:24 -0000 1.26
@@ -67,15 +67,15 @@
_field = new JavaInstance(aField, 0);
}
-KJS::Value JavaArray::convertJObjectToArray (KJS::ExecState *exec, jobject anObject, const char *type, const RootObject *r)
+ValueImp *JavaArray::convertJObjectToArray (ExecState *exec, jobject anObject, const char *type, const RootObject *r)
{
if (type[0] != '[')
return Undefined();
- return KJS::Object(new RuntimeArrayImp(exec, new JavaArray ((jobject)anObject, type, r)));
+ return new RuntimeArrayImp(exec, new JavaArray((jobject)anObject, type, r));
}
-jvalue JavaField::dispatchValueFromInstance(KJS::ExecState *exec, const JavaInstance *instance, const char *name, const char *sig, JNIType returnType) const
+jvalue JavaField::dispatchValueFromInstance(ExecState *exec, const JavaInstance *instance, const char *name, const char *sig, JNIType returnType) const
{
jobject jinstance = instance->javaInstance();
jobject fieldJInstance = _field->javaInstance();
@@ -90,13 +90,13 @@
{
const RootObject *execContext = instance->executionContext();
if (execContext && execContext->nativeHandle()) {
- Value exceptionDescription;
+ ValueImp *exceptionDescription;
jvalue args[1];
args[0].l = jinstance;
dispatchJNICall (execContext->nativeHandle(), fieldJInstance, false, returnType, mid, args, result, 0, exceptionDescription);
- if (!exceptionDescription.isNull()) {
- Object error = Error::create(exec, GeneralError, exceptionDescription.toString(exec).UTF8String().c_str());
+ if (exceptionDescription) {
+ ObjectImp *error = Error::create(exec, GeneralError, exceptionDescription->toString(exec).UTF8String().c_str());
exec->setException(error);
}
}
@@ -105,11 +105,11 @@
return result;
}
-KJS::Value JavaField::valueFromInstance(KJS::ExecState *exec, const Instance *i) const
+ValueImp *JavaField::valueFromInstance(ExecState *exec, const Instance *i) const
{
const JavaInstance *instance = static_cast<const JavaInstance *>(i);
- Value jsresult = Undefined();
+ ValueImp *jsresult = Undefined();
switch (_JNIType) {
case object_type: {
@@ -129,7 +129,7 @@
case boolean_type: {
jvalue result = dispatchValueFromInstance (exec, instance, "getBoolean", "(Ljava/lang/Object;)Z", boolean_type);
jboolean value = result.z;
- jsresult = KJS::Boolean((bool)value);
+ jsresult = Boolean((bool)value);
}
break;
@@ -158,12 +158,12 @@
break;
}
- JS_LOG ("getting %s = %s\n", name(), jsresult.toString(exec).ascii());
+ JS_LOG ("getting %s = %s\n", name(), jsresult->toString(exec).ascii());
return jsresult;
}
-void JavaField::dispatchSetValueToInstance(KJS::ExecState *exec, const JavaInstance *instance, jvalue javaValue, const char *name, const char *sig) const
+void JavaField::dispatchSetValueToInstance(ExecState *exec, const JavaInstance *instance, jvalue javaValue, const char *name, const char *sig) const
{
jobject jinstance = instance->javaInstance();
jobject fieldJInstance = _field->javaInstance();
@@ -176,15 +176,15 @@
{
const RootObject *execContext = instance->executionContext();
if (execContext && execContext->nativeHandle()) {
- Value exceptionDescription;
+ ValueImp *exceptionDescription;
jvalue args[2];
jvalue result;
args[0].l = jinstance;
args[1] = javaValue;
dispatchJNICall (execContext->nativeHandle(), fieldJInstance, false, void_type, mid, args, result, 0, exceptionDescription);
- if (!exceptionDescription.isNull()) {
- Object error = Error::create(exec, GeneralError, exceptionDescription.toString(exec).UTF8String().c_str());
+ if (exceptionDescription) {
+ ObjectImp *error = Error::create(exec, GeneralError, exceptionDescription->toString(exec).UTF8String().c_str());
exec->setException(error);
}
}
@@ -192,12 +192,12 @@
}
}
-void JavaField::setValueToInstance(KJS::ExecState *exec, const Instance *i, const KJS::Value &aValue) const
+void JavaField::setValueToInstance(ExecState *exec, const Instance *i, ValueImp *aValue) const
{
const JavaInstance *instance = static_cast<const JavaInstance *>(i);
jvalue javaValue = convertValueToJValue (exec, aValue, _JNIType, type());
- JS_LOG ("setting value %s to %s\n", name(), aValue.toString(exec).ascii());
+ JS_LOG ("setting value %s to %s\n", name(), aValue->toString(exec).ascii());
switch (_JNIType) {
case object_type: {
@@ -394,7 +394,7 @@
_type = strdup(other._type);
};
-void JavaArray::setValueAt(KJS::ExecState *exec, unsigned int index, const KJS::Value &aValue) const
+void JavaArray::setValueAt(ExecState *exec, unsigned int index, ValueImp *aValue) const
{
JNIEnv *env = getJNIEnv();
char *javaClassName = 0;
@@ -462,7 +462,7 @@
}
-KJS::Value JavaArray::valueAt(KJS::ExecState *exec, unsigned int index) const
+ValueImp *JavaArray::valueAt(ExecState *exec, unsigned int index) const
{
JNIEnv *env = getJNIEnv();
JNIType arrayType = JNITypeFromPrimitiveType(_type[1]);
@@ -489,7 +489,7 @@
jbooleanArray booleanArray = (jbooleanArray)javaArray();
jboolean aBoolean;
env->GetBooleanArrayRegion(booleanArray, index, 1, &aBoolean);
- return KJS::Boolean (aBoolean);
+ return Boolean (aBoolean);
}
case byte_type: {
1.26 +9 -10 JavaScriptCore/bindings/jni/jni_runtime.h
Index: jni_runtime.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/bindings/jni/jni_runtime.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- jni_runtime.h 12 Jan 2005 22:03:55 -0000 1.25
+++ jni_runtime.h 8 Aug 2005 04:07:24 -0000 1.26
@@ -35,7 +35,6 @@
namespace KJS
{
-class Value;
namespace Bindings
{
@@ -68,7 +67,7 @@
}
const jchar *uchars() const { return (const jchar *)_ustring.data(); }
int length() const { return _ustring.size(); }
- KJS::UString ustring() const { return _ustring; }
+ UString ustring() const { return _ustring; }
private:
UString _ustring;
@@ -182,8 +181,8 @@
return *this;
}
- virtual KJS::Value valueFromInstance(KJS::ExecState *exec, const Instance *instance) const;
- virtual void setValueToInstance(KJS::ExecState *exec, const Instance *instance, const KJS::Value &aValue) const;
+ virtual ValueImp *valueFromInstance(ExecState *exec, const Instance *instance) const;
+ virtual void setValueToInstance(ExecState *exec, const Instance *instance, ValueImp *aValue) const;
virtual const char *name() const { return _name.UTF8String(); }
virtual RuntimeType type() const { return _type.UTF8String(); }
@@ -191,8 +190,8 @@
JNIType getJNIType() const { return _JNIType; }
private:
- void JavaField::dispatchSetValueToInstance(KJS::ExecState *exec, const JavaInstance *instance, jvalue javaValue, const char *name, const char *sig) const;
- jvalue JavaField::dispatchValueFromInstance(KJS::ExecState *exec, const JavaInstance *instance, const char *name, const char *sig, JNIType returnType) const;
+ void JavaField::dispatchSetValueToInstance(ExecState *exec, const JavaInstance *instance, jvalue javaValue, const char *name, const char *sig) const;
+ jvalue JavaField::dispatchValueFromInstance(ExecState *exec, const JavaInstance *instance, const char *name, const char *sig, JNIType returnType) const;
JavaString _name;
JavaString _type;
@@ -261,7 +260,7 @@
JavaParameter *_parameters;
long _numParameters;
JavaString _name;
- mutable KJS::UString *_signature;
+ mutable UString *_signature;
JavaString _returnType;
JNIType _JNIReturnType;
mutable jmethodID _methodID;
@@ -291,15 +290,15 @@
return *this;
};
- virtual void setValueAt(KJS::ExecState *exec, unsigned int index, const KJS::Value &aValue) const;
- virtual KJS::Value valueAt(KJS::ExecState *exec, unsigned int index) const;
+ virtual void setValueAt(ExecState *exec, unsigned int index, ValueImp *aValue) const;
+ virtual ValueImp *valueAt(ExecState *exec, unsigned int index) const;
virtual unsigned int getLength() const;
virtual ~JavaArray();
jobject javaArray() const { return _array->_instance; }
- static KJS::Value convertJObjectToArray (KJS::ExecState *exec, jobject anObject, const char *type, const RootObject *r);
+ static ValueImp *convertJObjectToArray (ExecState *exec, jobject anObject, const char *type, const RootObject *r);
const RootObject *executionContext() const { return _root; }
1.24 +68 -63 JavaScriptCore/bindings/jni/jni_utility.cpp
Index: jni_utility.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/bindings/jni/jni_utility.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- jni_utility.cpp 29 Apr 2005 00:22:55 -0000 1.23
+++ jni_utility.cpp 8 Aug 2005 04:07:24 -0000 1.24
@@ -30,11 +30,13 @@
#include "runtime_array.h"
#include "runtime_object.h"
-using namespace KJS::Bindings;
+namespace KJS {
+
+namespace Bindings {
static JavaVM *jvm = 0;
-JavaVM *KJS::Bindings::getJavaVM()
+JavaVM *getJavaVM()
{
if (jvm)
return jvm;
@@ -55,7 +57,7 @@
return jvm;
}
-JNIEnv *KJS::Bindings::getJNIEnv()
+JNIEnv *getJNIEnv()
{
JNIEnv *env;
jint jniError = 0;
@@ -270,7 +272,7 @@
return result;
}
-jmethodID KJS::Bindings::getMethodID (jobject obj, const char *name, const char *sig)
+jmethodID getMethodID (jobject obj, const char *name, const char *sig)
{
JNIEnv *env = getJNIEnv();
jmethodID mid = 0;
@@ -309,200 +311,200 @@
\
va_end (args);
-void KJS::Bindings::callJNIVoidMethod (jobject obj, const char *name, const char *sig, ... )
+void callJNIVoidMethod (jobject obj, const char *name, const char *sig, ... )
{
CALL_JNI_METHOD (void_type, obj, name, sig);
}
-jobject KJS::Bindings::callJNIObjectMethod (jobject obj, const char *name, const char *sig, ... )
+jobject callJNIObjectMethod (jobject obj, const char *name, const char *sig, ... )
{
CALL_JNI_METHOD (object_type, obj, name, sig);
return result.l;
}
-jboolean KJS::Bindings::callJNIBooleanMethod( jobject obj, const char *name, const char *sig, ... )
+jboolean callJNIBooleanMethod( jobject obj, const char *name, const char *sig, ... )
{
CALL_JNI_METHOD (boolean_type, obj, name, sig);
return result.z;
}
-jboolean KJS::Bindings::callJNIStaticBooleanMethod (jclass cls, const char *name, const char *sig, ... )
+jboolean callJNIStaticBooleanMethod (jclass cls, const char *name, const char *sig, ... )
{
CALL_JNI_STATIC_METHOD (boolean_type, cls, name, sig);
return result.z;
}
-jbyte KJS::Bindings::callJNIByteMethod( jobject obj, const char *name, const char *sig, ... )
+jbyte callJNIByteMethod( jobject obj, const char *name, const char *sig, ... )
{
CALL_JNI_METHOD (byte_type, obj, name, sig);
return result.b;
}
-jchar KJS::Bindings::callJNICharMethod (jobject obj, const char *name, const char *sig, ... )
+jchar callJNICharMethod (jobject obj, const char *name, const char *sig, ... )
{
CALL_JNI_METHOD (char_type, obj, name, sig);
return result.c;
}
-jshort KJS::Bindings::callJNIShortMethod (jobject obj, const char *name, const char *sig, ... )
+jshort callJNIShortMethod (jobject obj, const char *name, const char *sig, ... )
{
CALL_JNI_METHOD (short_type, obj, name, sig);
return result.s;
}
-jint KJS::Bindings::callJNIIntMethod (jobject obj, const char *name, const char *sig, ... )
+jint callJNIIntMethod (jobject obj, const char *name, const char *sig, ... )
{
CALL_JNI_METHOD (int_type, obj, name, sig);
return result.i;
}
-jlong KJS::Bindings::callJNILongMethod (jobject obj, const char *name, const char *sig, ... )
+jlong callJNILongMethod (jobject obj, const char *name, const char *sig, ... )
{
CALL_JNI_METHOD (long_type, obj, name, sig);
return result.j;
}
-jfloat KJS::Bindings::callJNIFloatMethod (jobject obj, const char *name, const char *sig, ... )
+jfloat callJNIFloatMethod (jobject obj, const char *name, const char *sig, ... )
{
CALL_JNI_METHOD (float_type, obj, name, sig);
return result.f;
}
-jdouble KJS::Bindings::callJNIDoubleMethod (jobject obj, const char *name, const char *sig, ... )
+jdouble callJNIDoubleMethod (jobject obj, const char *name, const char *sig, ... )
{
CALL_JNI_METHOD (double_type, obj, name, sig);
return result.d;
}
-void KJS::Bindings::callJNIVoidMethodA (jobject obj, const char *name, const char *sig, jvalue *args)
+void callJNIVoidMethodA (jobject obj, const char *name, const char *sig, jvalue *args)
{
jvalue result = callJNIMethodA (void_type, obj, name, sig, args);
}
-jobject KJS::Bindings::callJNIObjectMethodA (jobject obj, const char *name, const char *sig, jvalue *args)
+jobject callJNIObjectMethodA (jobject obj, const char *name, const char *sig, jvalue *args)
{
jvalue result = callJNIMethodA (object_type, obj, name, sig, args);
return result.l;
}
-jbyte KJS::Bindings::callJNIByteMethodA ( jobject obj, const char *name, const char *sig, jvalue *args)
+jbyte callJNIByteMethodA ( jobject obj, const char *name, const char *sig, jvalue *args)
{
jvalue result = callJNIMethodA (byte_type, obj, name, sig, args);
return result.b;
}
-jchar KJS::Bindings::callJNICharMethodA (jobject obj, const char *name, const char *sig, jvalue *args)
+jchar callJNICharMethodA (jobject obj, const char *name, const char *sig, jvalue *args)
{
jvalue result = callJNIMethodA (char_type, obj, name, sig, args);
return result.c;
}
-jshort KJS::Bindings::callJNIShortMethodA (jobject obj, const char *name, const char *sig, jvalue *args)
+jshort callJNIShortMethodA (jobject obj, const char *name, const char *sig, jvalue *args)
{
jvalue result = callJNIMethodA (short_type, obj, name, sig, args);
return result.s;
}
-jint KJS::Bindings::callJNIIntMethodA (jobject obj, const char *name, const char *sig, jvalue *args)
+jint callJNIIntMethodA (jobject obj, const char *name, const char *sig, jvalue *args)
{
jvalue result = callJNIMethodA (int_type, obj, name, sig, args);
return result.i;
}
-jlong KJS::Bindings::callJNILongMethodA (jobject obj, const char *name, const char *sig, jvalue *args)
+jlong callJNILongMethodA (jobject obj, const char *name, const char *sig, jvalue *args)
{
jvalue result = callJNIMethodA (long_type, obj, name, sig, args);
return result.j;
}
-jfloat KJS::Bindings::callJNIFloatMethodA (jobject obj, const char *name, const char *sig, jvalue *args)
+jfloat callJNIFloatMethodA (jobject obj, const char *name, const char *sig, jvalue *args)
{
jvalue result = callJNIMethodA (float_type, obj, name, sig, args);
return result.f;
}
-jdouble KJS::Bindings::callJNIDoubleMethodA (jobject obj, const char *name, const char *sig, jvalue *args)
+jdouble callJNIDoubleMethodA (jobject obj, const char *name, const char *sig, jvalue *args)
{
jvalue result = callJNIMethodA (double_type, obj, name, sig, args);
return result.d;
}
-jboolean KJS::Bindings::callJNIBooleanMethodA (jobject obj, const char *name, const char *sig, jvalue *args)
+jboolean callJNIBooleanMethodA (jobject obj, const char *name, const char *sig, jvalue *args)
{
jvalue result = callJNIMethodA (boolean_type, obj, name, sig, args);
return result.z;
}
-void KJS::Bindings::callJNIVoidMethodIDA (jobject obj, jmethodID methodID, jvalue *args)
+void callJNIVoidMethodIDA (jobject obj, jmethodID methodID, jvalue *args)
{
jvalue result = callJNIMethodIDA (void_type, obj, methodID, args);
}
-jobject KJS::Bindings::callJNIObjectMethodIDA (jobject obj, jmethodID methodID, jvalue *args)
+jobject callJNIObjectMethodIDA (jobject obj, jmethodID methodID, jvalue *args)
{
jvalue result = callJNIMethodIDA (object_type, obj, methodID, args);
return result.l;
}
-jbyte KJS::Bindings::callJNIByteMethodIDA ( jobject obj, jmethodID methodID, jvalue *args)
+jbyte callJNIByteMethodIDA ( jobject obj, jmethodID methodID, jvalue *args)
{
jvalue result = callJNIMethodIDA (byte_type, obj, methodID, args);
return result.b;
}
-jchar KJS::Bindings::callJNICharMethodIDA (jobject obj, jmethodID methodID, jvalue *args)
+jchar callJNICharMethodIDA (jobject obj, jmethodID methodID, jvalue *args)
{
jvalue result = callJNIMethodIDA (char_type, obj, methodID, args);
return result.c;
}
-jshort KJS::Bindings::callJNIShortMethodIDA (jobject obj, jmethodID methodID, jvalue *args)
+jshort callJNIShortMethodIDA (jobject obj, jmethodID methodID, jvalue *args)
{
jvalue result = callJNIMethodIDA (short_type, obj, methodID, args);
return result.s;
}
-jint KJS::Bindings::callJNIIntMethodIDA (jobject obj, jmethodID methodID, jvalue *args)
+jint callJNIIntMethodIDA (jobject obj, jmethodID methodID, jvalue *args)
{
jvalue result = callJNIMethodIDA (int_type, obj, methodID, args);
return result.i;
}
-jlong KJS::Bindings::callJNILongMethodIDA (jobject obj, jmethodID methodID, jvalue *args)
+jlong callJNILongMethodIDA (jobject obj, jmethodID methodID, jvalue *args)
{
jvalue result = callJNIMethodIDA (long_type, obj, methodID, args);
return result.j;
}
-jfloat KJS::Bindings::callJNIFloatMethodIDA (jobject obj, jmethodID methodID, jvalue *args)
+jfloat callJNIFloatMethodIDA (jobject obj, jmethodID methodID, jvalue *args)
{
jvalue result = callJNIMethodIDA (float_type, obj, methodID, args);
return result.f;
}
-jdouble KJS::Bindings::callJNIDoubleMethodIDA (jobject obj, jmethodID methodID, jvalue *args)
+jdouble callJNIDoubleMethodIDA (jobject obj, jmethodID methodID, jvalue *args)
{
jvalue result = callJNIMethodIDA (double_type, obj, methodID, args);
return result.d;
}
-jboolean KJS::Bindings::callJNIBooleanMethodIDA (jobject obj, jmethodID methodID, jvalue *args)
+jboolean callJNIBooleanMethodIDA (jobject obj, jmethodID methodID, jvalue *args)
{
jvalue result = callJNIMethodIDA (boolean_type, obj, methodID, args);
return result.z;
}
-const char *KJS::Bindings::getCharactersFromJString (jstring aJString)
+const char *getCharactersFromJString (jstring aJString)
{
return getCharactersFromJStringInEnv (getJNIEnv(), aJString);
}
-void KJS::Bindings::releaseCharactersForJString (jstring aJString, const char *s)
+void releaseCharactersForJString (jstring aJString, const char *s)
{
releaseCharactersForJStringInEnv (getJNIEnv(), aJString, s);
}
-const char *KJS::Bindings::getCharactersFromJStringInEnv (JNIEnv *env, jstring aJString)
+const char *getCharactersFromJStringInEnv (JNIEnv *env, jstring aJString)
{
jboolean isCopy;
const char *s = env->GetStringUTFChars((jstring)aJString, &isCopy);
@@ -514,12 +516,12 @@
return s;
}
-void KJS::Bindings::releaseCharactersForJStringInEnv (JNIEnv *env, jstring aJString, const char *s)
+void releaseCharactersForJStringInEnv (JNIEnv *env, jstring aJString, const char *s)
{
env->ReleaseStringUTFChars (aJString, s);
}
-const jchar *KJS::Bindings::getUCharactersFromJStringInEnv (JNIEnv *env, jstring aJString)
+const jchar *getUCharactersFromJStringInEnv (JNIEnv *env, jstring aJString)
{
jboolean isCopy;
const jchar *s = env->GetStringChars((jstring)aJString, &isCopy);
@@ -531,12 +533,12 @@
return s;
}
-void KJS::Bindings::releaseUCharactersForJStringInEnv (JNIEnv *env, jstring aJString, const jchar *s)
+void releaseUCharactersForJStringInEnv (JNIEnv *env, jstring aJString, const jchar *s)
{
env->ReleaseStringChars (aJString, s);
}
-JNIType KJS::Bindings::JNITypeFromClassName(const char *name)
+JNIType JNITypeFromClassName(const char *name)
{
JNIType type;
@@ -564,7 +566,7 @@
return type;
}
-const char *KJS::Bindings::signatureFromPrimitiveType(JNIType type)
+const char *signatureFromPrimitiveType(JNIType type)
{
switch (type){
case void_type:
@@ -604,7 +606,7 @@
return "";
}
-JNIType KJS::Bindings::JNITypeFromPrimitiveType(char type)
+JNIType JNITypeFromPrimitiveType(char type)
{
switch (type){
case 'V':
@@ -644,7 +646,7 @@
return invalid_type;
}
-jvalue KJS::Bindings::getJNIField( jobject obj, JNIType type, const char *name, const char *signature)
+jvalue getJNIField( jobject obj, JNIType type, const char *name, const char *signature)
{
JavaVM *jvm = getJavaVM();
JNIEnv *env = getJNIEnv();
@@ -706,7 +708,7 @@
return result;
}
-jvalue KJS::Bindings::convertValueToJValue (KJS::ExecState *exec, KJS::Value value, JNIType _JNIType, const char *javaClassName)
+jvalue convertValueToJValue (ExecState *exec, ValueImp *value, JNIType _JNIType, const char *javaClassName)
{
jvalue result;
@@ -715,15 +717,15 @@
result.l = (jobject)0;
// First see if we have a Java instance.
- if (value.type() == KJS::ObjectType){
- KJS::ObjectImp *objectImp = static_cast<KJS::ObjectImp*>(value.imp());
- if (objectImp->classInfo() == &KJS::RuntimeObjectImp::info) {
- KJS::RuntimeObjectImp *imp = static_cast<KJS::RuntimeObjectImp *>(value.imp());
+ if (value->isObject()){
+ ObjectImp *objectImp = static_cast<ObjectImp*>(value);
+ if (objectImp->classInfo() == &RuntimeObjectImp::info) {
+ RuntimeObjectImp *imp = static_cast<RuntimeObjectImp *>(value);
JavaInstance *instance = static_cast<JavaInstance*>(imp->getInternalInstance());
result.l = instance->javaInstance();
}
- else if (objectImp->classInfo() == &KJS::RuntimeArrayImp::info) {
- KJS::RuntimeArrayImp *imp = static_cast<KJS::RuntimeArrayImp *>(value.imp());
+ else if (objectImp->classInfo() == &RuntimeArrayImp::info) {
+ RuntimeArrayImp *imp = static_cast<RuntimeArrayImp *>(value);
JavaArray *array = static_cast<JavaArray*>(imp->getConcreteArray());
result.l = array->javaArray();
}
@@ -733,7 +735,7 @@
// converting from a Null.
if (result.l == 0 && strcmp(javaClassName, "java.lang.String") == 0) {
#if CONVERT_NULL_TO_EMPTY_STRING
- if (value.type() == KJS::NullType) {
+ if (value->isNull()) {
JNIEnv *env = getJNIEnv();
jchar buf[2];
jobject javaString = env->functions->NewString (env, buf, 0);
@@ -741,10 +743,10 @@
}
else
#else
- if (value.type() != KJS::NullType)
+ if (!value->isNull())
#endif
{
- KJS::UString stringValue = value.toString(exec);
+ UString stringValue = value->toString(exec);
JNIEnv *env = getJNIEnv();
jobject javaString = env->functions->NewString (env, (const jchar *)stringValue.data(), stringValue.size());
result.l = javaString;
@@ -754,42 +756,42 @@
break;
case boolean_type: {
- result.z = (jboolean)value.toNumber(exec);
+ result.z = (jboolean)value->toNumber(exec);
}
break;
case byte_type: {
- result.b = (jbyte)value.toNumber(exec);
+ result.b = (jbyte)value->toNumber(exec);
}
break;
case char_type: {
- result.c = (jchar)value.toNumber(exec);
+ result.c = (jchar)value->toNumber(exec);
}
break;
case short_type: {
- result.s = (jshort)value.toNumber(exec);
+ result.s = (jshort)value->toNumber(exec);
}
break;
case int_type: {
- result.i = (jint)value.toNumber(exec);
+ result.i = (jint)value->toNumber(exec);
}
break;
case long_type: {
- result.j = (jlong)value.toNumber(exec);
+ result.j = (jlong)value->toNumber(exec);
}
break;
case float_type: {
- result.f = (jfloat)value.toNumber(exec);
+ result.f = (jfloat)value->toNumber(exec);
}
break;
case double_type: {
- result.d = (jdouble)value.toNumber(exec);
+ result.d = (jdouble)value->toNumber(exec);
}
break;
@@ -805,3 +807,6 @@
return result;
}
+}
+
+}
1.18 +43 -43 JavaScriptCore/bindings/jni/jni_utility.h
Index: jni_utility.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/bindings/jni/jni_utility.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- jni_utility.h 14 Dec 2004 02:44:45 -0000 1.17
+++ jni_utility.h 8 Aug 2005 04:07:24 -0000 1.18
@@ -51,62 +51,62 @@
{
class JavaParameter;
-const char *getCharactersFromJString (jstring aJString);
-void releaseCharactersForJString (jstring aJString, const char *s);
+const char *getCharactersFromJString(jstring aJString);
+void releaseCharactersForJString(jstring aJString, const char *s);
-const char *getCharactersFromJStringInEnv (JNIEnv *env, jstring aJString);
-void releaseCharactersForJStringInEnv (JNIEnv *env, jstring aJString, const char *s);
-const jchar *getUCharactersFromJStringInEnv (JNIEnv *env, jstring aJString);
-void releaseUCharactersForJStringInEnv (JNIEnv *env, jstring aJString, const jchar *s);
+const char *getCharactersFromJStringInEnv(JNIEnv *env, jstring aJString);
+void releaseCharactersForJStringInEnv(JNIEnv *env, jstring aJString, const char *s);
+const jchar *getUCharactersFromJStringInEnv(JNIEnv *env, jstring aJString);
+void releaseUCharactersForJStringInEnv(JNIEnv *env, jstring aJString, const jchar *s);
JNIType JNITypeFromClassName(const char *name);
JNIType JNITypeFromPrimitiveType(char type);
const char *signatureFromPrimitiveType(JNIType type);
-jvalue convertValueToJValue (KJS::ExecState *exec, KJS::Value value, JNIType _JNIType, const char *javaClassName);
+jvalue convertValueToJValue(ExecState *exec, ValueImp *value, JNIType _JNIType, const char *javaClassName);
-jvalue getJNIField (jobject obj, JNIType type, const char *name, const char *signature);
+jvalue getJNIField(jobject obj, JNIType type, const char *name, const char *signature);
-jmethodID getMethodID (jobject obj, const char *name, const char *sig);
+jmethodID getMethodID(jobject obj, const char *name, const char *sig);
-jobject callJNIObjectMethod (jobject obj, const char *name, const char *sig, ... );
-void callJNIVoidMethod (jobject obj, const char *name, const char *sig, ... );
-jboolean callJNIBooleanMethod (jobject obj, const char *name, const char *sig, ... );
-jboolean callJNIStaticBooleanMethod (jclass cls, const char *name, const char *sig, ... );
-jbyte callJNIByteMethod (jobject obj, const char *name, const char *sig, ... );
-jchar callJNICharMethod (jobject obj, const char *name, const char *sig, ... );
-jshort callJNIShortMethod (jobject obj, const char *name, const char *sig, ... );
-jint callJNIIntMethod (jobject obj, const char *name, const char *sig, ... );
-jlong callJNILongMethod (jobject obj, const char *name, const char *sig, ... );
-jfloat callJNIFloatMethod (jobject obj, const char *name, const char *sig, ... );
-jdouble callJNIDoubleMethod (jobject obj, const char *name, const char *sig, ... );
-
-jobject callJNIObjectMethodA (jobject obj, const char *name, const char *sig, jvalue *args);
-void callJNIVoidMethodA (jobject obj, const char *name, const char *sig, jvalue *args);
-jboolean callJNIBooleanMethodA (jobject obj, const char *name, const char *sig, jvalue *args);
-jbyte callJNIByteMethodA (jobject obj, const char *name, const char *sig, jvalue *args);
-jchar callJNICharMethodA (jobject obj, const char *name, const char *sig, jvalue *args);
-jshort callJNIShortMethodA (jobject obj, const char *name, const char *sig, jvalue *args);
-jint callJNIIntMethodA (jobject obj, const char *name, const char *sig, jvalue *args);
-jlong callJNILongMethodA (jobject obj, const char *name, const char *sig, jvalue *args);
-jfloat callJNIFloatMethodA (jobject obj, const char *name, const char *sig, jvalue *args);
-jdouble callJNIDoubleMethodA (jobject obj, const char *name, const char *sig, jvalue *args);
-
-jobject callJNIObjectMethodIDA (jobject obj, jmethodID methodID, jvalue *args);
-void callJNIVoidMethodIDA (jobject obj, jmethodID methodID, jvalue *args);
-jboolean callJNIBooleanMethodIDA (jobject obj, jmethodID methodID, jvalue *args);
-jbyte callJNIByteMethodIDA (jobject obj, jmethodID methodID, jvalue *args);
-jchar callJNICharMethodIDA (jobject obj, jmethodID methodID, jvalue *args);
-jshort callJNIShortMethodIDA (jobject obj, jmethodID methodID, jvalue *args);
-jint callJNIIntMethodIDA (jobject obj, jmethodID methodID, jvalue *args);
-jlong callJNILongMethodIDA (jobject obj, jmethodID methodID, jvalue *args);
-jfloat callJNIFloatMethodIDA (jobject obj, jmethodID methodID, jvalue *args);
-jdouble callJNIDoubleMethodIDA (jobject obj, jmethodID methodID, jvalue *args);
+jobject callJNIObjectMethod(jobject obj, const char *name, const char *sig, ... );
+void callJNIVoidMethod(jobject obj, const char *name, const char *sig, ... );
+jboolean callJNIBooleanMethod(jobject obj, const char *name, const char *sig, ... );
+jboolean callJNIStaticBooleanMethod(jclass cls, const char *name, const char *sig, ... );
+jbyte callJNIByteMethod(jobject obj, const char *name, const char *sig, ... );
+jchar callJNICharMethod(jobject obj, const char *name, const char *sig, ... );
+jshort callJNIShortMethod(jobject obj, const char *name, const char *sig, ... );
+jint callJNIIntMethod(jobject obj, const char *name, const char *sig, ... );
+jlong callJNILongMethod(jobject obj, const char *name, const char *sig, ... );
+jfloat callJNIFloatMethod(jobject obj, const char *name, const char *sig, ... );
+jdouble callJNIDoubleMethod(jobject obj, const char *name, const char *sig, ... );
+
+jobject callJNIObjectMethodA(jobject obj, const char *name, const char *sig, jvalue *args);
+void callJNIVoidMethodA(jobject obj, const char *name, const char *sig, jvalue *args);
+jboolean callJNIBooleanMethodA(jobject obj, const char *name, const char *sig, jvalue *args);
+jbyte callJNIByteMethodA(jobject obj, const char *name, const char *sig, jvalue *args);
+jchar callJNICharMethodA(jobject obj, const char *name, const char *sig, jvalue *args);
+jshort callJNIShortMethodA(jobject obj, const char *name, const char *sig, jvalue *args);
+jint callJNIIntMethodA(jobject obj, const char *name, const char *sig, jvalue *args);
+jlong callJNILongMethodA(jobject obj, const char *name, const char *sig, jvalue *args);
+jfloat callJNIFloatMethodA(jobject obj, const char *name, const char *sig, jvalue *args);
+jdouble callJNIDoubleMethodA(jobject obj, const char *name, const char *sig, jvalue *args);
+
+jobject callJNIObjectMethodIDA(jobject obj, jmethodID methodID, jvalue *args);
+void callJNIVoidMethodIDA(jobject obj, jmethodID methodID, jvalue *args);
+jboolean callJNIBooleanMethodIDA(jobject obj, jmethodID methodID, jvalue *args);
+jbyte callJNIByteMethodIDA(jobject obj, jmethodID methodID, jvalue *args);
+jchar callJNICharMethodIDA(jobject obj, jmethodID methodID, jvalue *args);
+jshort callJNIShortMethodIDA(jobject obj, jmethodID methodID, jvalue *args);
+jint callJNIIntMethodIDA(jobject obj, jmethodID methodID, jvalue *args);
+jlong callJNILongMethodIDA(jobject obj, jmethodID methodID, jvalue *args);
+jfloat callJNIFloatMethodIDA(jobject obj, jmethodID methodID, jvalue *args);
+jdouble callJNIDoubleMethodIDA(jobject obj, jmethodID methodID, jvalue *args);
JavaVM *getJavaVM();
JNIEnv *getJNIEnv();
-bool dispatchJNICall (const void *targetAppletView, jobject obj, bool isStatic, JNIType returnType, jmethodID methodID, jvalue *args, jvalue &result, const char *callingURL, Value &exceptionDescription);
+bool dispatchJNICall(const void *targetAppletView, jobject obj, bool isStatic, JNIType returnType, jmethodID methodID, jvalue *args, jvalue &result, const char *callingURL, ValueImp *&exceptionDescription);
} // namespace Bindings
1.21 +48 -50 JavaScriptCore/bindings/objc/WebScriptObject.mm
Index: WebScriptObject.mm
===================================================================
RCS file: /cvs/root/JavaScriptCore/bindings/objc/WebScriptObject.mm,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- WebScriptObject.mm 30 Jun 2005 18:19:42 -0000 1.20
+++ WebScriptObject.mm 8 Aug 2005 04:07:26 -0000 1.21
@@ -49,7 +49,7 @@
#define LOG_EXCEPTION(exec) \
if (Interpreter::shouldPrintExceptions()) \
- printf("%s:%d:[%d] JavaScript exception: %s\n", __FILE__, __LINE__, getpid(), exec->exception().toObject(exec).get(exec, messagePropertyName).toString(exec).ascii());
+ printf("%s:%d:[%d] JavaScript exception: %s\n", __FILE__, __LINE__, getpid(), exec->exception()->toObject(exec)->get(exec, messagePropertyName)->toString(exec).ascii());
@implementation WebScriptObjectPrivate
@@ -62,10 +62,10 @@
ExecState *exec = [obj _executionContext]->interpreter()->globalExec();
KJSDidExecuteFunctionPtr func = Instance::didExecuteFunction();
if (func)
- func (exec, static_cast<KJS::ObjectImp*>([obj _executionContext]->rootObjectImp()));
+ func (exec, static_cast<ObjectImp*>([obj _executionContext]->rootObjectImp()));
}
-- (void)_initializeWithObjectImp:(KJS::ObjectImp *)imp originExecutionContext:(const Bindings::RootObject *)originExecutionContext executionContext:(const Bindings::RootObject *)executionContext
+- (void)_initializeWithObjectImp:(ObjectImp *)imp originExecutionContext:(const Bindings::RootObject *)originExecutionContext executionContext:(const Bindings::RootObject *)executionContext
{
_private->imp = imp;
_private->executionContext = executionContext;
@@ -74,7 +74,7 @@
addNativeReference (executionContext, imp);
}
-- _initWithObjectImp:(KJS::ObjectImp *)imp originExecutionContext:(const Bindings::RootObject *)originExecutionContext executionContext:(const Bindings::RootObject *)executionContext
+- _initWithObjectImp:(ObjectImp *)imp originExecutionContext:(const Bindings::RootObject *)originExecutionContext executionContext:(const Bindings::RootObject *)executionContext
{
assert (imp != 0);
//assert (root != 0);
@@ -88,7 +88,7 @@
return self;
}
-- (KJS::ObjectImp *)_imp
+- (ObjectImp *)_imp
{
if (!_private->imp && _private->isCreatedByDOMWrapper) {
// Associate the WebScriptObject with the JS wrapper for the ObjC DOM
@@ -98,23 +98,23 @@
return _private->imp;
}
-- (const KJS::Bindings::RootObject *)_executionContext
+- (const RootObject *)_executionContext
{
return _private->executionContext;
}
-- (void)_setExecutionContext:(const KJS::Bindings::RootObject *)context
+- (void)_setExecutionContext:(const RootObject *)context
{
_private->executionContext = context;
}
-- (const KJS::Bindings::RootObject *)_originExecutionContext
+- (const RootObject *)_originExecutionContext
{
return _private->originExecutionContext;
}
-- (void)_setOriginExecutionContext:(const KJS::Bindings::RootObject *)originExecutionContext
+- (void)_setOriginExecutionContext:(const RootObject *)originExecutionContext
{
_private->originExecutionContext = originExecutionContext;
}
@@ -158,7 +158,7 @@
ExecState *exec = interp->globalExec();
// If the interpreter has a context, we set the exception.
if (interp->context()) {
- Object err = Error::create(exec, GeneralError, [exceptionMessage UTF8String]);
+ ObjectImp *err = Error::create(exec, GeneralError, [exceptionMessage UTF8String]);
exec->setException (err);
return YES;
}
@@ -168,10 +168,10 @@
return NO;
}
-static KJS::List listFromNSArray(ExecState *exec, NSArray *array)
+static List listFromNSArray(ExecState *exec, NSArray *array)
{
long i, numObjects = array ? [array count] : 0;
- KJS::List aList;
+ List aList;
for (i = 0; i < numObjects; i++) {
id anObject = [array objectAtIndex:i];
@@ -193,21 +193,21 @@
Interpreter::lock();
- Value v = convertObjcValueToValue(exec, &name, ObjcObjectType);
- Identifier identifier(v.toString(exec));
- Value func = [self _imp]->get (exec, identifier);
+ ValueImp *v = convertObjcValueToValue(exec, &name, ObjcObjectType);
+ Identifier identifier(v->toString(exec));
+ ValueImp *func = [self _imp]->get (exec, identifier);
Interpreter::unlock();
- if (func.isNull() || func.type() == UndefinedType) {
+ if (!func || func->isUndefined()) {
// Maybe throw an exception here?
return 0;
}
// Call the function object.
Interpreter::lock();
- ObjectImp *funcImp = static_cast<ObjectImp*>(func.imp());
- Object thisObj = Object(const_cast<ObjectImp*>([self _imp]));
+ ObjectImp *funcImp = static_cast<ObjectImp*>(func);
+ ObjectImp *thisObj = const_cast<ObjectImp*>([self _imp]);
List argList = listFromNSArray(exec, args);
- Value result = funcImp->call (exec, thisObj, argList);
+ ValueImp *result = funcImp->call (exec, thisObj, argList);
Interpreter::unlock();
if (exec->hadException()) {
@@ -233,18 +233,17 @@
ExecState *exec = [self _executionContext]->interpreter()->globalExec();
- Object thisObj = Object(const_cast<ObjectImp*>([self _imp]));
- Value result;
+ ValueImp *result;
Interpreter::lock();
- Value v = convertObjcValueToValue(exec, &script, ObjcObjectType);
- Completion completion = [self _executionContext]->interpreter()->evaluate(UString(), 0, v.toString(exec));
+ ValueImp *v = convertObjcValueToValue(exec, &script, ObjcObjectType);
+ Completion completion = [self _executionContext]->interpreter()->evaluate(UString(), 0, v->toString(exec));
ComplType type = completion.complType();
if (type == Normal) {
result = completion.value();
- if (result.isNull()) {
+ if (!result) {
result = Undefined();
}
}
@@ -276,8 +275,8 @@
ExecState *exec = [self _executionContext]->interpreter()->globalExec();
Interpreter::lock();
- Value v = convertObjcValueToValue(exec, &key, ObjcObjectType);
- [self _imp]->put (exec, Identifier (v.toString(exec)), (convertObjcValueToValue(exec, &value, ObjcObjectType)));
+ ValueImp *v = convertObjcValueToValue(exec, &key, ObjcObjectType);
+ [self _imp]->put (exec, Identifier (v->toString(exec)), (convertObjcValueToValue(exec, &value, ObjcObjectType)));
Interpreter::unlock();
if (exec->hadException()) {
@@ -298,8 +297,8 @@
ExecState *exec = [self _executionContext]->interpreter()->globalExec();
Interpreter::lock();
- Value v = convertObjcValueToValue(exec, &key, ObjcObjectType);
- Value result = [self _imp]->get (exec, Identifier (v.toString(exec)));
+ ValueImp *v = convertObjcValueToValue(exec, &key, ObjcObjectType);
+ ValueImp *result = [self _imp]->get (exec, Identifier (v->toString(exec)));
Interpreter::unlock();
if (exec->hadException()) {
@@ -325,8 +324,8 @@
ExecState *exec = [self _executionContext]->interpreter()->globalExec();
Interpreter::lock();
- Value v = convertObjcValueToValue(exec, &key, ObjcObjectType);
- [self _imp]->deleteProperty (exec, Identifier (v.toString(exec)));
+ ValueImp *v = convertObjcValueToValue(exec, &key, ObjcObjectType);
+ [self _imp]->deleteProperty (exec, Identifier (v->toString(exec)));
Interpreter::unlock();
if (exec->hadException()) {
@@ -343,7 +342,7 @@
return @"Undefined";
Interpreter::lock();
- Object thisObj = Object(const_cast<ObjectImp*>([self _imp]));
+ ObjectImp *thisObj = const_cast<ObjectImp*>([self _imp]);
ExecState *exec = [self _executionContext]->interpreter()->globalExec();
id result = convertValueToObjcValue(exec, thisObj, ObjcObjectType).objectValue;
@@ -367,7 +366,7 @@
ExecState *exec = [self _executionContext]->interpreter()->globalExec();
Interpreter::lock();
- Value result = [self _imp]->get (exec, (unsigned)index);
+ ValueImp *result = [self _imp]->get (exec, (unsigned)index);
Interpreter::unlock();
if (exec->hadException()) {
@@ -408,30 +407,30 @@
return;
ExecState *exec = [self _executionContext]->interpreter()->globalExec();
- Object err = Error::create(exec, GeneralError, [description UTF8String]);
+ ObjectImp *err = Error::create(exec, GeneralError, [description UTF8String]);
exec->setException (err);
}
-+ (id)_convertValueToObjcValue:(KJS::Value)value originExecutionContext:(const Bindings::RootObject *)originExecutionContext executionContext:(const Bindings::RootObject *)executionContext
++ (id)_convertValueToObjcValue:(ValueImp *)value originExecutionContext:(const RootObject *)originExecutionContext executionContext:(const Bindings::RootObject *)executionContext
{
id result = 0;
// First see if we have a ObjC instance.
- if (value.type() == KJS::ObjectType){
- ObjectImp *objectImp = static_cast<ObjectImp*>(value.imp());
+ if (value->isObject()) {
+ ObjectImp *objectImp = static_cast<ObjectImp*>(value);
Interpreter *intepreter = executionContext->interpreter();
ExecState *exec = intepreter->globalExec();
Interpreter::lock();
- if (objectImp->classInfo() != &KJS::RuntimeObjectImp::info) {
- Value runtimeObject = objectImp->get(exec, "__apple_runtime_object");
- if (!runtimeObject.isNull() && runtimeObject.type() == KJS::ObjectType)
- objectImp = static_cast<RuntimeObjectImp*>(runtimeObject.imp());
+ if (objectImp->classInfo() != &RuntimeObjectImp::info) {
+ ValueImp *runtimeObject = objectImp->get(exec, "__apple_runtime_object");
+ if (!runtimeObject && runtimeObject->isObject())
+ objectImp = static_cast<RuntimeObjectImp*>(runtimeObject);
}
Interpreter::unlock();
- if (objectImp->classInfo() == &KJS::RuntimeObjectImp::info) {
+ if (objectImp->classInfo() == &RuntimeObjectImp::info) {
RuntimeObjectImp *imp = static_cast<RuntimeObjectImp *>(objectImp);
ObjcInstance *instance = static_cast<ObjcInstance*>(imp->getInternalInstance());
if (instance)
@@ -439,13 +438,13 @@
}
// Convert to a WebScriptObject
else {
- result = (id)intepreter->createLanguageInstanceForValue (exec, Instance::ObjectiveCLanguage, value.toObject(exec), originExecutionContext, executionContext);
+ result = (id)intepreter->createLanguageInstanceForValue (exec, Instance::ObjectiveCLanguage, value->toObject(exec), originExecutionContext, executionContext);
}
}
// Convert JavaScript String value to NSString?
- else if (value.type() == KJS::StringType) {
- StringImp *s = static_cast<KJS::StringImp*>(value.imp());
+ else if (value->isString()) {
+ StringImp *s = static_cast<StringImp*>(value);
UString u = s->value();
NSString *string = [NSString stringWithCharacters:(const unichar*)u.data() length:u.size()];
@@ -453,18 +452,17 @@
}
// Convert JavaScript Number value to NSNumber?
- else if (value.type() == KJS::NumberType) {
- Number n = Number::dynamicCast(value);
- result = [NSNumber numberWithDouble:n.value()];
+ else if (value->isNumber()) {
+ result = [NSNumber numberWithDouble:value->getNumber()];
}
- else if (value.type() == KJS::BooleanType) {
- KJS::BooleanImp *b = static_cast<KJS::BooleanImp*>(value.imp());
+ else if (value->isBoolean()) {
+ BooleanImp *b = static_cast<BooleanImp*>(value);
result = [NSNumber numberWithBool:b->value()];
}
// Convert JavaScript Undefined types to WebUndefined
- else if (value.type() == KJS::UndefinedType) {
+ else if (value->isUndefined()) {
result = [WebUndefined undefined];
}
1.8 +1 -1 JavaScriptCore/bindings/objc/WebScriptObjectPrivate.h
Index: WebScriptObjectPrivate.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/bindings/objc/WebScriptObjectPrivate.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- WebScriptObjectPrivate.h 12 Feb 2005 00:58:13 -0000 1.7
+++ WebScriptObjectPrivate.h 8 Aug 2005 04:07:26 -0000 1.8
@@ -13,7 +13,7 @@
#include <JavaScriptCore/value.h>
@interface WebScriptObject (Private)
-+ (id)_convertValueToObjcValue:(KJS::Value)value originExecutionContext:(const KJS::Bindings::RootObject *)originExecutionContext executionContext:(const KJS::Bindings::RootObject *)executionContext;
++ (id)_convertValueToObjcValue:(KJS::ValueImp *)value originExecutionContext:(const KJS::Bindings::RootObject *)originExecutionContext executionContext:(const KJS::Bindings::RootObject *)executionContext;
- _init;
- _initWithObjectImp:(KJS::ObjectImp *)imp originExecutionContext:(const KJS::Bindings::RootObject *)originExecutionContext executionContext:(const KJS::Bindings::RootObject *)executionContext ;
- (void)_initializeWithObjectImp:(KJS::ObjectImp *)imp originExecutionContext:(const KJS::Bindings::RootObject *)originExecutionContext executionContext:(const KJS::Bindings::RootObject *)executionContext ;
1.4 +1 -1 JavaScriptCore/bindings/objc/objc_class.h
Index: objc_class.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/bindings/objc/objc_class.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- objc_class.h 1 Oct 2004 00:24:39 -0000 1.3
+++ objc_class.h 8 Aug 2005 04:07:26 -0000 1.4
@@ -77,7 +77,7 @@
virtual Field *fieldNamed(const char *name, Instance *instance) const;
- virtual Value fallbackObject(ExecState *exec, Instance *instance, const Identifier &propertyName);
+ virtual ValueImp *fallbackObject(ExecState *exec, Instance *instance, const Identifier &propertyName);
virtual Constructor *constructorAt(long i) const {
return 0;
1.10 +7 -3 JavaScriptCore/bindings/objc/objc_class.mm
Index: objc_class.mm
===================================================================
RCS file: /cvs/root/JavaScriptCore/bindings/objc/objc_class.mm,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- objc_class.mm 4 Aug 2005 00:40:20 -0000 1.9
+++ objc_class.mm 8 Aug 2005 04:07:26 -0000 1.10
@@ -30,7 +30,8 @@
#include <objc_utility.h>
#include <WebScriptObject.h>
-using namespace KJS::Bindings;
+namespace KJS {
+namespace Bindings {
void ObjcClass::_commonDelete() {
CFRelease (_fields);
@@ -232,7 +233,10 @@
return aField;
}
-KJS::Value ObjcClass::fallbackObject (ExecState *exec, Instance *instance, const Identifier &propertyName)
+ValueImp *ObjcClass::fallbackObject (ExecState *exec, Instance *instance, const Identifier &propertyName)
{
- return Object (new ObjcFallbackObjectImp(static_cast<ObjcInstance*>(instance), propertyName));
+ return new ObjcFallbackObjectImp(static_cast<ObjcInstance*>(instance), propertyName);
+}
+
+}
}
1.7 +11 -11 JavaScriptCore/bindings/objc/objc_instance.h
Index: objc_instance.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/bindings/objc/objc_instance.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- objc_instance.h 19 Jan 2005 02:34:21 -0000 1.6
+++ objc_instance.h 8 Aug 2005 04:07:26 -0000 1.7
@@ -53,24 +53,24 @@
virtual void begin();
virtual void end();
- virtual Value valueOf() const;
- virtual Value defaultValue (Type hint) const;
+ virtual ValueImp *valueOf() const;
+ virtual ValueImp *defaultValue (Type hint) const;
- virtual Value invokeMethod (ExecState *exec, const MethodList &method, const List &args);
- virtual Value invokeDefaultMethod (ExecState *exec, const List &args);
+ virtual ValueImp *invokeMethod (ExecState *exec, const MethodList &method, const List &args);
+ virtual ValueImp *invokeDefaultMethod (ExecState *exec, const List &args);
- virtual void setValueOfField (ExecState *exec, const Field *aField, const Value &aValue) const;
+ virtual void setValueOfField (ExecState *exec, const Field *aField, ValueImp *aValue) const;
virtual bool supportsSetValueOfUndefinedField ();
- virtual void setValueOfUndefinedField (ExecState *exec, const Identifier &property, const Value &aValue);
+ virtual void setValueOfUndefinedField (ExecState *exec, const Identifier &property, ValueImp *aValue);
- virtual Value ObjcInstance::getValueOfField (ExecState *exec, const Field *aField) const;
- virtual Value getValueOfUndefinedField (ExecState *exec, const Identifier &property, Type hint) const;
+ virtual ValueImp *ObjcInstance::getValueOfField (ExecState *exec, const Field *aField) const;
+ virtual ValueImp *getValueOfUndefinedField (ExecState *exec, const Identifier &property, Type hint) const;
ObjectStructPtr getObject() const { return _instance; }
- Value stringValue() const;
- Value numberValue() const;
- Value booleanValue() const;
+ ValueImp *stringValue() const;
+ ValueImp *numberValue() const;
+ ValueImp *booleanValue() const;
private:
ObjectStructPtr _instance;
1.13 +23 -25 JavaScriptCore/bindings/objc/objc_instance.mm
Index: objc_instance.mm
===================================================================
RCS file: /cvs/root/JavaScriptCore/bindings/objc/objc_instance.mm,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- objc_instance.mm 19 Jan 2005 02:34:21 -0000 1.12
+++ objc_instance.mm 8 Aug 2005 04:07:26 -0000 1.13
@@ -122,9 +122,9 @@
return static_cast<Bindings::Class*>(_class);
}
-Value ObjcInstance::invokeMethod (KJS::ExecState *exec, const MethodList &methodList, const List &args)
+ValueImp *ObjcInstance::invokeMethod (ExecState *exec, const MethodList &methodList, const List &args)
{
- Value resultValue;
+ ValueImp *resultValue;
// Overloading methods is not allowed in ObjectiveC. Should only be one
// name match for a particular method.
@@ -221,7 +221,7 @@
// type.
assert (objcValueType != ObjcInvalidType);
- // Get the return value and convert it to a KJS::Value. Length
+ // Get the return value and convert it to a JavaScript value. Length
// of return value will never exceed the size of largest scalar
// or a pointer.
char buffer[1024];
@@ -244,9 +244,9 @@
return resultValue;
}
-Value ObjcInstance::invokeDefaultMethod (KJS::ExecState *exec, const List &args)
+ValueImp *ObjcInstance::invokeDefaultMethod (ExecState *exec, const List &args)
{
- Value resultValue;
+ ValueImp *resultValue;
NS_DURING
@@ -281,9 +281,9 @@
const char *type = [signature methodReturnType];
ObjcValueType objcValueType = objcValueTypeForType (type);
- // Get the return value and convert it to a KJS::Value. Length
+ // Get the return value and convert it to a JavaScript value. Length
// of return value will never exceed the size of a pointer, so we're
- // OK we 32 here.
+ // OK with 32 here.
char buffer[32];
[invocation getReturnValue:buffer];
resultValue = convertObjcValueToValue (exec, buffer, objcValueType);
@@ -297,7 +297,7 @@
return resultValue;
}
-void ObjcInstance::setValueOfField (KJS::ExecState *exec, const Field *aField, const KJS::Value &aValue) const
+void ObjcInstance::setValueOfField (ExecState *exec, const Field *aField, ValueImp *aValue) const
{
aField->setValueToInstance (exec, this, aValue);
}
@@ -312,7 +312,7 @@
return false;
}
-void ObjcInstance::setValueOfUndefinedField (KJS::ExecState *exec, const KJS::Identifier &property, const KJS::Value &aValue)
+void ObjcInstance::setValueOfUndefinedField (ExecState *exec, const Identifier &property, ValueImp *aValue)
{
id targetObject = getObject();
@@ -335,13 +335,13 @@
}
}
-Value ObjcInstance::getValueOfField (KJS::ExecState *exec, const Field *aField) const {
+ValueImp *ObjcInstance::getValueOfField (ExecState *exec, const Field *aField) const {
return aField->valueFromInstance (exec, this);
}
-KJS::Value ObjcInstance::getValueOfUndefinedField (KJS::ExecState *exec, const KJS::Identifier &property, KJS::Type hint) const
+ValueImp *ObjcInstance::getValueOfUndefinedField (ExecState *exec, const Identifier &property, Type hint) const
{
- Value result = Undefined();
+ ValueImp *volatile result = Undefined();
id targetObject = getObject();
@@ -367,18 +367,18 @@
return result;
}
-KJS::Value ObjcInstance::defaultValue (KJS::Type hint) const
+ValueImp *ObjcInstance::defaultValue (Type hint) const
{
- if (hint == KJS::StringType) {
+ if (hint == StringType) {
return stringValue();
}
- else if (hint == KJS::NumberType) {
+ else if (hint == NumberType) {
return numberValue();
}
- else if (hint == KJS::BooleanType) {
+ else if (hint == BooleanType) {
return booleanValue();
}
- else if (hint == KJS::UnspecifiedType) {
+ else if (hint == UnspecifiedType) {
if ([_instance isKindOfClass:[NSString class]]) {
return stringValue();
}
@@ -393,26 +393,24 @@
return valueOf();
}
-KJS::Value ObjcInstance::stringValue() const
+ValueImp *ObjcInstance::stringValue() const
{
return convertNSStringToString ([getObject() description]);
}
-KJS::Value ObjcInstance::numberValue() const
+ValueImp *ObjcInstance::numberValue() const
{
// FIXME: Implement something sensible
- KJS::Number v(0);
- return v;
+ return jsNumber(0);
}
-KJS::Value ObjcInstance::booleanValue() const
+ValueImp *ObjcInstance::booleanValue() const
{
// FIXME: Implement something sensible
- KJS::Boolean v((bool)0);
- return v;
+ return jsBoolean(false);
}
-KJS::Value ObjcInstance::valueOf() const
+ValueImp *ObjcInstance::valueOf() const
{
return stringValue();
}
1.13 +11 -12 JavaScriptCore/bindings/objc/objc_runtime.h
Index: objc_runtime.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/bindings/objc/objc_runtime.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- objc_runtime.h 7 Aug 2005 06:17:34 -0000 1.12
+++ objc_runtime.h 8 Aug 2005 04:07:26 -0000 1.13
@@ -34,7 +34,6 @@
namespace KJS
{
-class Value;
namespace Bindings
{
@@ -84,8 +83,8 @@
return *this;
};
- virtual KJS::Value valueFromInstance(KJS::ExecState *exec, const Instance *instance) const;
- virtual void setValueToInstance(KJS::ExecState *exec, const Instance *instance, const KJS::Value &aValue) const;
+ virtual ValueImp *valueFromInstance(ExecState *exec, const Instance *instance) const;
+ virtual void setValueToInstance(ExecState *exec, const Instance *instance, ValueImp *aValue) const;
virtual const char *name() const;
virtual RuntimeType type() const;
@@ -147,41 +146,41 @@
ObjcArray &operator=(const ObjcArray &other);
- virtual void setValueAt(KJS::ExecState *exec, unsigned int index, const KJS::Value &aValue) const;
- virtual KJS::Value valueAt(KJS::ExecState *exec, unsigned int index) const;
+ virtual void setValueAt(ExecState *exec, unsigned int index, ValueImp *aValue) const;
+ virtual ValueImp *valueAt(ExecState *exec, unsigned int index) const;
virtual unsigned int getLength() const;
virtual ~ObjcArray();
ObjectStructPtr getObjcArray() const { return _array; }
- static KJS::Value convertObjcArrayToArray (KJS::ExecState *exec, ObjectStructPtr anObject);
+ static ValueImp *convertObjcArrayToArray (ExecState *exec, ObjectStructPtr anObject);
private:
ObjectStructPtr _array;
};
-class ObjcFallbackObjectImp : public KJS::ObjectImp {
+class ObjcFallbackObjectImp : public ObjectImp {
public:
ObjcFallbackObjectImp(ObjectImp *proto);
- ObjcFallbackObjectImp(ObjcInstance *i, const KJS::Identifier propertyName);
+ ObjcFallbackObjectImp(ObjcInstance *i, const Identifier propertyName);
const ClassInfo *classInfo() const { return &info; }
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
virtual void put(ExecState *exec, const Identifier &propertyName,
- const Value &value, int attr = None);
+ ValueImp *value, int attr = None);
virtual bool canPut(ExecState *exec, const Identifier &propertyName) const;
virtual bool implementsCall() const;
- virtual Value call(ExecState *exec, Object &thisObj, const List &args);
+ virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args);
virtual bool deleteProperty(ExecState *exec, const Identifier &propertyName);
- virtual Value defaultValue(ExecState *exec, Type hint) const;
+ virtual ValueImp *defaultValue(ExecState *exec, Type hint) const;
virtual Type type() const;
virtual bool toBoolean(ExecState *exec) const;
@@ -190,7 +189,7 @@
static const ClassInfo info;
ObjcInstance *_instance;
- KJS::Identifier _item;
+ Identifier _item;
};
} // namespace Bindings
1.19 +23 -23 JavaScriptCore/bindings/objc/objc_runtime.mm
Index: objc_runtime.mm
===================================================================
RCS file: /cvs/root/JavaScriptCore/bindings/objc/objc_runtime.mm,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- objc_runtime.mm 7 Aug 2005 06:17:34 -0000 1.18
+++ objc_runtime.mm 8 Aug 2005 04:07:26 -0000 1.19
@@ -102,9 +102,9 @@
return "";
}
-Value ObjcField::valueFromInstance(KJS::ExecState *exec, const Instance *instance) const
+ValueImp *ObjcField::valueFromInstance(ExecState *exec, const Instance *instance) const
{
- Value aValue;
+ ValueImp *aValue;
id targetObject = (static_cast<const ObjcInstance*>(instance))->getObject();
id objcValue = nil;
@@ -115,7 +115,7 @@
NS_HANDLER
- Value exceptionValue = Error::create(exec, GeneralError, [[localException reason] lossyCString]);
+ ValueImp *exceptionValue = Error::create(exec, GeneralError, [[localException reason] lossyCString]);
exec->setException(exceptionValue);
NS_ENDHANDLER
@@ -128,11 +128,11 @@
return aValue;
}
-static id convertValueToObjcObject (KJS::ExecState *exec, const KJS::Value &value)
+static id convertValueToObjcObject (ExecState *exec, ValueImp *value)
{
const Bindings::RootObject *root = rootForInterpreter(exec->interpreter());
if (!root) {
- Bindings::RootObject *newRoot = new KJS::Bindings::RootObject(0);
+ Bindings::RootObject *newRoot = new Bindings::RootObject(0);
newRoot->setInterpreter (exec->interpreter());
root = newRoot;
}
@@ -140,7 +140,7 @@
}
-void ObjcField::setValueToInstance(KJS::ExecState *exec, const Instance *instance, const KJS::Value &aValue) const
+void ObjcField::setValueToInstance(ExecState *exec, const Instance *instance, ValueImp *aValue) const
{
id targetObject = (static_cast<const ObjcInstance*>(instance))->getObject();
id value = convertValueToObjcObject(exec, aValue);
@@ -152,7 +152,7 @@
NS_HANDLER
- Value aValue = Error::create(exec, GeneralError, [[localException reason] lossyCString]);
+ ValueImp *aValue = Error::create(exec, GeneralError, [[localException reason] lossyCString]);
exec->setException(aValue);
NS_ENDHANDLER
@@ -186,16 +186,16 @@
return *this;
}
-void ObjcArray::setValueAt(KJS::ExecState *exec, unsigned int index, const KJS::Value &aValue) const
+void ObjcArray::setValueAt(ExecState *exec, unsigned int index, ValueImp *aValue) const
{
if (![_array respondsToSelector:@selector(insertObject:atIndex:)]) {
- Object error = Error::create(exec, TypeError, "Array is not mutable.");
+ ObjectImp *error = Error::create(exec, TypeError, "Array is not mutable.");
exec->setException(error);
return;
}
if (index > [_array count]) {
- Object error = Error::create(exec, RangeError, "Index exceeds array size.");
+ ObjectImp *error = Error::create(exec, RangeError, "Index exceeds array size.");
exec->setException(error);
return;
}
@@ -210,32 +210,32 @@
NS_HANDLER
- Object error = Error::create(exec, GeneralError, "ObjectiveC exception.");
+ ObjectImp *error = Error::create(exec, GeneralError, "ObjectiveC exception.");
exec->setException(error);
NS_ENDHANDLER
}
-KJS::Value ObjcArray::valueAt(KJS::ExecState *exec, unsigned int index) const
+ValueImp *ObjcArray::valueAt(ExecState *exec, unsigned int index) const
{
- ObjectStructPtr obj = 0;
- Object error;
- volatile bool haveError = false;
-
if (index > [_array count]) {
- Object error = Error::create(exec, RangeError, "Index exceeds array size.");
+ ObjectImp *error = Error::create(exec, RangeError, "Index exceeds array size.");
exec->setException(error);
return error;
}
+ ObjectStructPtr obj = 0;
+ ObjectImp * volatile error;
+ volatile bool haveError = false;
+
NS_DURING
obj = [_array objectAtIndex:index];
NS_HANDLER
- Object error = Error::create(exec, GeneralError, "ObjectiveC exception.");
+ error = Error::create(exec, GeneralError, "ObjectiveC exception.");
exec->setException(error);
haveError = true;
@@ -275,7 +275,7 @@
}
void ObjcFallbackObjectImp::put(ExecState *exec, const Identifier &propertyName,
- const Value &value, int attr)
+ ValueImp *value, int attr)
{
}
@@ -305,11 +305,11 @@
return false;
}
-Value ObjcFallbackObjectImp::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *ObjcFallbackObjectImp::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- Value result = Undefined();
+ ValueImp *result = Undefined();
- RuntimeObjectImp *imp = static_cast<RuntimeObjectImp*>(thisObj.imp());
+ RuntimeObjectImp *imp = static_cast<RuntimeObjectImp*>(thisObj);
if (imp) {
Instance *instance = imp->getInternalInstance();
@@ -340,7 +340,7 @@
return false;
}
-Value ObjcFallbackObjectImp::defaultValue(ExecState *exec, Type hint) const
+ValueImp *ObjcFallbackObjectImp::defaultValue(ExecState *exec, Type hint) const
{
return _instance->getValueOfUndefinedField(exec, _item, hint);
}
1.5 +5 -5 JavaScriptCore/bindings/objc/objc_utility.h
Index: objc_utility.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/bindings/objc/objc_utility.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- objc_utility.h 12 Feb 2005 00:58:13 -0000 1.4
+++ objc_utility.h 8 Aug 2005 04:07:26 -0000 1.5
@@ -68,14 +68,14 @@
class RootObject;
-ObjcValue convertValueToObjcValue (KJS::ExecState *exec, const KJS::Value &value, ObjcValueType type);
-Value convertNSStringToString(NSString *nsstring);
-Value convertObjcValueToValue (KJS::ExecState *exec, void *buffer, ObjcValueType type);
-ObjcValueType objcValueTypeForType (const char *type);
+ObjcValue convertValueToObjcValue(ExecState *exec, ValueImp *value, ObjcValueType type);
+ValueImp *convertNSStringToString(NSString *nsstring);
+ValueImp *convertObjcValueToValue(ExecState *exec, void *buffer, ObjcValueType type);
+ObjcValueType objcValueTypeForType(const char *type);
void JSMethodNameToObjCMethodName(const char *name, char *name, unsigned int length);
-void *createObjcInstanceForValue (const Object &value, const RootObject *origin, const RootObject *current);
+void *createObjcInstanceForValue(ObjectImp *value, const RootObject *origin, const RootObject *current);
} // namespace Bindings
1.19 +20 -20 JavaScriptCore/bindings/objc/objc_utility.mm
Index: objc_utility.mm
===================================================================
RCS file: /cvs/root/JavaScriptCore/bindings/objc/objc_utility.mm,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- objc_utility.mm 29 Apr 2005 00:22:55 -0000 1.18
+++ objc_utility.mm 8 Aug 2005 04:07:26 -0000 1.19
@@ -50,7 +50,7 @@
moveTo$_ moveTo$$$_
@result Returns the name to be used to represent the specificed selector in the
*/
-void KJS::Bindings::JSMethodNameToObjCMethodName(const char *name, char *buffer, unsigned int len)
+void Bindings::JSMethodNameToObjCMethodName(const char *name, char *buffer, unsigned int len)
{
const char *np = name;
char *bp;
@@ -87,22 +87,22 @@
[], other exception
*/
-ObjcValue KJS::Bindings::convertValueToObjcValue (KJS::ExecState *exec, const KJS::Value &value, ObjcValueType type)
+ObjcValue Bindings::convertValueToObjcValue (ExecState *exec, ValueImp *value, ObjcValueType type)
{
ObjcValue result;
double d = 0;
-
- if (value.type() == NumberType || value.type() == StringType || value.type() == BooleanType)
- d = value.toNumber(exec);
+
+ if (value->isNumber() || value->isString() || value->isBoolean())
+ d = value->toNumber(exec);
switch (type){
case ObjcObjectType: {
- KJS::Interpreter *originInterpreter = exec->interpreter();
+ Interpreter *originInterpreter = exec->interpreter();
const Bindings::RootObject *originExecutionContext = rootForInterpreter(originInterpreter);
- KJS::Interpreter *interpreter = 0;
+ Interpreter *interpreter = 0;
if (originInterpreter->isGlobalObject(value)) {
- interpreter = originInterpreter->interpreterForGlobalObject (value.imp());
+ interpreter = originInterpreter->interpreterForGlobalObject (value);
}
if (!interpreter)
@@ -110,7 +110,7 @@
const Bindings::RootObject *executionContext = rootForInterpreter(interpreter);
if (!executionContext) {
- Bindings::RootObject *newExecutionContext = new KJS::Bindings::RootObject(0);
+ Bindings::RootObject *newExecutionContext = new Bindings::RootObject(0);
newExecutionContext->setInterpreter (interpreter);
executionContext = newExecutionContext;
}
@@ -164,14 +164,14 @@
return result;
}
-Value KJS::Bindings::convertNSStringToString(NSString *nsstring)
+ValueImp *Bindings::convertNSStringToString(NSString *nsstring)
{
unichar *chars;
unsigned int length = [nsstring length];
chars = (unichar *)malloc(sizeof(unichar)*length);
[nsstring getCharacters:chars];
- UString u((const KJS::UChar*)chars, length);
- Value aValue = String (u);
+ UString u((const UChar*)chars, length);
+ ValueImp *aValue = String (u);
free((void *)chars);
return aValue;
}
@@ -192,9 +192,9 @@
other should not happen
*/
-Value KJS::Bindings::convertObjcValueToValue (KJS::ExecState *exec, void *buffer, ObjcValueType type)
+ValueImp *Bindings::convertObjcValueToValue (ExecState *exec, void *buffer, ObjcValueType type)
{
- Value aValue;
+ ValueImp *aValue = NULL;
switch (type) {
case ObjcObjectType:
@@ -224,11 +224,11 @@
aValue = Number([*obj doubleValue]);
}
else if ([*obj isKindOfClass:[NSArray class]]) {
- aValue = Object(new RuntimeArrayImp(exec, new ObjcArray (*obj)));
+ aValue = new RuntimeArrayImp(exec, new ObjcArray (*obj));
}
else if ([*obj isKindOfClass:[WebScriptObject class]]) {
WebScriptObject *jsobject = (WebScriptObject *)*obj;
- aValue = Object([jsobject _imp]);
+ aValue = [jsobject _imp];
}
else if (*obj == 0) {
return Undefined();
@@ -286,7 +286,7 @@
}
-ObjcValueType KJS::Bindings::objcValueTypeForType (const char *type)
+ObjcValueType Bindings::objcValueTypeForType (const char *type)
{
int typeLength = strlen(type);
ObjcValueType objcValueType = ObjcInvalidType;
@@ -332,12 +332,12 @@
}
-void *KJS::Bindings::createObjcInstanceForValue (const Object &value, const RootObject *origin, const RootObject *current)
+void *Bindings::createObjcInstanceForValue (ObjectImp *value, const RootObject *origin, const RootObject *current)
{
- if (value.type() != ObjectType)
+ if (!value->isObject())
return 0;
- ObjectImp *imp = static_cast<ObjectImp*>(value.imp());
+ ObjectImp *imp = static_cast<ObjectImp*>(value);
return [[[WebScriptObject alloc] _initWithObjectImp:imp originExecutionContext:origin executionContext:current] autorelease];
}
1.16 +4 -4 JavaScriptCore/kjs/array_instance.h
Index: array_instance.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/array_instance.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- array_instance.h 7 Aug 2005 06:17:34 -0000 1.15
+++ array_instance.h 8 Aug 2005 04:07:27 -0000 1.16
@@ -35,8 +35,8 @@
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
virtual bool getOwnPropertySlot(ExecState *, unsigned, PropertySlot&);
- virtual void put(ExecState *exec, const Identifier &propertyName, const Value &value, int attr = None);
- virtual void put(ExecState *exec, unsigned propertyName, const Value &value, int attr = None);
+ virtual void put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr = None);
+ virtual void put(ExecState *exec, unsigned propertyName, ValueImp *value, int attr = None);
virtual bool deleteProperty(ExecState *exec, const Identifier &propertyName);
virtual bool deleteProperty(ExecState *exec, unsigned propertyName);
virtual ReferenceList propList(ExecState *exec, bool recursive);
@@ -49,10 +49,10 @@
unsigned getLength() const { return length; }
void sort(ExecState *exec);
- void sort(ExecState *exec, Object &compareFunction);
+ void sort(ExecState *exec, ObjectImp *compareFunction);
private:
- static Value lengthGetter(ExecState *, const Identifier&, const PropertySlot&);
+ static ValueImp *lengthGetter(ExecState *, const Identifier&, const PropertySlot&);
void setLength(unsigned newLength, ExecState *exec);
1.49 +159 -169 JavaScriptCore/kjs/array_object.cpp
Index: array_object.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/array_object.cpp,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- array_object.cpp 7 Aug 2005 06:17:35 -0000 1.48
+++ array_object.cpp 8 Aug 2005 04:07:27 -0000 1.49
@@ -20,14 +20,16 @@
*
*/
-#include "value.h"
-#include "object.h"
-#include "types.h"
-#include "interpreter.h"
-#include "operations.h"
#include "array_object.h"
-#include "internal.h"
+
#include "error_object.h"
+#include "internal.h"
+#include "interpreter.h"
+#include "object.h"
+#include "operations.h"
+#include "reference_list.h"
+#include "types.h"
+#include "value.h"
#include "array_object.lut.h"
@@ -61,7 +63,7 @@
ListIterator it = list.begin();
unsigned l = length;
for (unsigned i = 0; i < l; ++i) {
- storage[i] = (it++).imp();
+ storage[i] = it++;
}
}
@@ -70,7 +72,7 @@
free(storage);
}
-Value ArrayInstanceImp::lengthGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *ArrayInstanceImp::lengthGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
return Number(static_cast<ArrayInstanceImp *>(slot.slotBase())->length);
}
@@ -89,9 +91,8 @@
return false;
if (index < storageLength) {
ValueImp *v = storage[index];
- if (!v || v == UndefinedImp::staticUndefined)
- return false;
-
+ if (!v || v->isUndefined())
+ return false;
slot.setValueSlot(this, &storage[index]);
return true;
}
@@ -106,9 +107,8 @@
return false;
if (index < storageLength) {
ValueImp *v = storage[index];
- if (!v || v == UndefinedImp::staticUndefined)
+ if (!v || v->isUndefined())
return false;
-
slot.setValueSlot(this, &storage[index]);
return true;
}
@@ -117,10 +117,10 @@
}
// Special implementation of [[Put]] - see ECMA 15.4.5.1
-void ArrayInstanceImp::put(ExecState *exec, const Identifier &propertyName, const Value &value, int attr)
+void ArrayInstanceImp::put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr)
{
if (propertyName == lengthPropertyName) {
- setLength(value.toUInt32(exec), exec);
+ setLength(value->toUInt32(exec), exec);
return;
}
@@ -134,7 +134,7 @@
ObjectImp::put(exec, propertyName, value, attr);
}
-void ArrayInstanceImp::put(ExecState *exec, unsigned index, const Value &value, int attr)
+void ArrayInstanceImp::put(ExecState *exec, unsigned index, ValueImp *value, int attr)
{
if (index < sparseArrayCutoff && index >= storageLength) {
resizeStorage(index + 1);
@@ -145,7 +145,7 @@
}
if (index < storageLength) {
- storage[index] = value.imp();
+ storage[index] = value;
return;
}
@@ -189,7 +189,7 @@
ReferenceList properties = ObjectImp::propList(exec,recursive);
// avoid fetching this every time through the loop
- ValueImp *undefined = UndefinedImp::staticUndefined;
+ ValueImp *undefined = jsUndefined();
for (unsigned i = 0; i < storageLength; ++i) {
ValueImp *imp = storage[i];
@@ -231,7 +231,7 @@
if (newLength < length) {
ReferenceList sparseProperties;
- _prop.addSparseArrayPropertiesToReferenceList(sparseProperties, Object(this));
+ _prop.addSparseArrayPropertiesToReferenceList(sparseProperties, this);
ReferenceListIterator it = sparseProperties.begin();
while (it != sparseProperties.end()) {
@@ -265,13 +265,13 @@
ExecState *exec = execForCompareByStringForQSort;
ValueImp *va = *(ValueImp **)a;
ValueImp *vb = *(ValueImp **)b;
- if (va->dispatchType() == UndefinedType) {
- return vb->dispatchType() == UndefinedType ? 0 : 1;
+ if (va->isUndefined()) {
+ return vb->isUndefined() ? 0 : 1;
}
- if (vb->dispatchType() == UndefinedType) {
+ if (vb->isUndefined()) {
return -1;
}
- return compare(va->dispatchToString(exec), vb->dispatchToString(exec));
+ return compare(va->toString(exec), vb->toString(exec));
}
void ArrayInstanceImp::sort(ExecState *exec)
@@ -296,7 +296,7 @@
ExecState *exec;
ObjectImp *compareFunction;
List arguments;
- Object globalObject;
+ ObjectImp *globalObject;
};
static CompareWithCompareFunctionArguments *compareWithCompareFunctionArguments;
@@ -307,10 +307,10 @@
ValueImp *va = *(ValueImp **)a;
ValueImp *vb = *(ValueImp **)b;
- if (va->dispatchType() == UndefinedType) {
- return vb->dispatchType() == UndefinedType ? 0 : 1;
+ if (va->isUndefined()) {
+ return vb->isUndefined() ? 0 : 1;
}
- if (vb->dispatchType() == UndefinedType) {
+ if (vb->isUndefined()) {
return -1;
}
@@ -318,15 +318,15 @@
args->arguments.append(va);
args->arguments.append(vb);
double compareResult = args->compareFunction->call
- (args->exec, args->globalObject, args->arguments).toNumber(args->exec);
+ (args->exec, args->globalObject, args->arguments)->toNumber(args->exec);
return compareResult < 0 ? -1 : compareResult > 0 ? 1 : 0;
}
-void ArrayInstanceImp::sort(ExecState *exec, Object &compareFunction)
+void ArrayInstanceImp::sort(ExecState *exec, ObjectImp *compareFunction)
{
int lengthNotIncludingUndefined = pushUndefinedObjectsToEnd(exec);
- CompareWithCompareFunctionArguments args(exec, compareFunction.imp());
+ CompareWithCompareFunctionArguments args(exec, compareFunction);
compareWithCompareFunctionArguments = &args;
qsort(storage, lengthNotIncludingUndefined, sizeof(ValueImp *), compareWithCompareFunctionForQSort);
compareWithCompareFunctionArguments = 0;
@@ -334,7 +334,7 @@
unsigned ArrayInstanceImp::pushUndefinedObjectsToEnd(ExecState *exec)
{
- ValueImp *undefined = UndefinedImp::staticUndefined;
+ ValueImp *undefined = jsUndefined();
unsigned o = 0;
@@ -348,7 +348,7 @@
}
ReferenceList sparseProperties;
- _prop.addSparseArrayPropertiesToReferenceList(sparseProperties, Object(this));
+ _prop.addSparseArrayPropertiesToReferenceList(sparseProperties, this);
unsigned newLength = o + sparseProperties.length();
if (newLength > storageLength) {
@@ -358,7 +358,7 @@
ReferenceListIterator it = sparseProperties.begin();
while (it != sparseProperties.end()) {
Reference ref = it++;
- storage[o] = ref.getValue(exec).imp();
+ storage[o] = ref.getValue(exec);
ObjectImp::deleteProperty(exec, ref.getPropertyName(exec));
o++;
}
@@ -398,7 +398,6 @@
ObjectPrototypeImp *objProto)
: ArrayInstanceImp(objProto, 0)
{
- Value protect(this);
setInternalValue(Null());
}
@@ -411,10 +410,9 @@
ArrayProtoFuncImp::ArrayProtoFuncImp(ExecState *exec, int i, int len)
: InternalFunctionImp(
- static_cast<FunctionPrototypeImp*>(exec->lexicalInterpreter()->builtinFunctionPrototype().imp())
+ static_cast<FunctionPrototypeImp*>(exec->lexicalInterpreter()->builtinFunctionPrototype())
), id(i)
{
- Value protect(this);
put(exec,lengthPropertyName,Number(len),DontDelete|ReadOnly|DontEnum);
}
@@ -424,19 +422,18 @@
}
// ECMA 15.4.4
-Value ArrayProtoFuncImp::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *ArrayProtoFuncImp::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- unsigned int length = thisObj.get(exec,lengthPropertyName).toUInt32(exec);
- ObjectImp *thisImp = thisObj.imp();
+ unsigned length = thisObj->get(exec,lengthPropertyName)->toUInt32(exec);
- Value result;
+ ValueImp *result;
switch (id) {
case ToLocaleString:
case ToString:
- if (!thisObj.inherits(&ArrayInstanceImp::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&ArrayInstanceImp::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
@@ -446,24 +443,22 @@
UString separator = ",";
UString str = "";
- if (args[0].type() != UndefinedType)
- separator = args[0].toString(exec);
+ if (!args[0]->isUndefined())
+ separator = args[0]->toString(exec);
for (unsigned int k = 0; k < length; k++) {
if (k >= 1)
str += separator;
- Value element = thisObj.get(exec, k);
- if (element.type() == UndefinedType || element.type() == NullType)
+ ValueImp *element = thisObj->get(exec, k);
+ if (element->isUndefinedOrNull())
continue;
bool fallback = false;
if (id == ToLocaleString) {
- Object o = element.toObject(exec);
- Object conversionFunction =
- Object::dynamicCast(o.get(exec, toLocaleStringPropertyName));
- if (conversionFunction.isValid() &&
- conversionFunction.implementsCall()) {
- str += conversionFunction.call(exec, o, List()).toString(exec);
+ ObjectImp *o = element->toObject(exec);
+ ValueImp *conversionFunction = o->get(exec, toLocaleStringPropertyName);
+ if (conversionFunction->isObject() && static_cast<ObjectImp *>(conversionFunction)->implementsCall()) {
+ str += static_cast<ObjectImp *>(conversionFunction)->call(exec, o, List())->toString(exec);
} else {
// try toString() fallback
fallback = true;
@@ -471,23 +466,19 @@
}
if (id == ToString || id == Join || fallback) {
- if (element.type() == ObjectType) {
- Object o = Object::dynamicCast(element);
- Object conversionFunction =
- Object::dynamicCast(o.get(exec, toStringPropertyName));
- if (conversionFunction.isValid() &&
- conversionFunction.implementsCall()) {
- str += conversionFunction.call(exec, o, List()).toString(exec);
+ if (element->isObject()) {
+ ObjectImp *o = static_cast<ObjectImp *>(element);
+ ValueImp *conversionFunction = o->get(exec, toStringPropertyName);
+ if (conversionFunction->isObject() && static_cast<ObjectImp *>(conversionFunction)->implementsCall()) {
+ str += static_cast<ObjectImp *>(conversionFunction)->call(exec, o, List())->toString(exec);
} else {
- UString msg = "Can't convert " + o.className() +
- " object to string";
- Object error = Error::create(exec, RangeError,
- msg.cstring().c_str());
+ UString msg = "Can't convert " + o->className() + " object to string";
+ ObjectImp *error = Error::create(exec, RangeError, msg.cstring().c_str());
exec->setException(error);
return error;
}
} else {
- str += element.toString(exec);
+ str += element->toString(exec);
}
}
@@ -498,54 +489,54 @@
break;
}
case Concat: {
- Object arr = Object::dynamicCast(exec->lexicalInterpreter()->builtinArray().construct(exec,List::empty()));
+ ObjectImp *arr = static_cast<ObjectImp *>(exec->lexicalInterpreter()->builtinArray()->construct(exec,List::empty()));
int n = 0;
- Value curArg = thisObj;
- Object curObj = Object::dynamicCast(thisObj);
+ ValueImp *curArg = thisObj;
+ ObjectImp *curObj = static_cast<ObjectImp *>(thisObj);
ListIterator it = args.begin();
for (;;) {
- if (curArg.type() == ObjectType &&
- curObj.inherits(&ArrayInstanceImp::info)) {
+ if (curArg->isObject() &&
+ curObj->inherits(&ArrayInstanceImp::info)) {
unsigned int k = 0;
// Older versions tried to optimize out getting the length of thisObj
// by checking for n != 0, but that doesn't work if thisObj is an empty array.
- length = curObj.get(exec,lengthPropertyName).toUInt32(exec);
+ length = curObj->get(exec,lengthPropertyName)->toUInt32(exec);
while (k < length) {
- Value v;
- if (curObj.imp()->getProperty(exec, k, v))
- arr.put(exec, n, v);
+ ValueImp *v;
+ if (curObj->getProperty(exec, k, v))
+ arr->put(exec, n, v);
n++;
k++;
}
} else {
- arr.put(exec, n, curArg);
+ arr->put(exec, n, curArg);
n++;
}
if (it == args.end())
break;
curArg = *it;
- curObj = Object::dynamicCast(it++); // may be 0
+ curObj = static_cast<ObjectImp *>(it++); // may be 0
}
- arr.put(exec,lengthPropertyName, Number(n), DontEnum | DontDelete);
+ arr->put(exec,lengthPropertyName, Number(n), DontEnum | DontDelete);
result = arr;
break;
}
case Pop:{
if (length == 0) {
- thisObj.put(exec, lengthPropertyName, Number(length), DontEnum | DontDelete);
+ thisObj->put(exec, lengthPropertyName, Number(length), DontEnum | DontDelete);
result = Undefined();
} else {
- result = thisObj.get(exec, length - 1);
- thisObj.put(exec, lengthPropertyName, Number(length - 1), DontEnum | DontDelete);
+ result = thisObj->get(exec, length - 1);
+ thisObj->put(exec, lengthPropertyName, Number(length - 1), DontEnum | DontDelete);
}
break;
}
case Push: {
for (int n = 0; n < args.size(); n++)
- thisObj.put(exec, length + n, args[n]);
+ thisObj->put(exec, length + n, args[n]);
length += args.size();
- thisObj.put(exec,lengthPropertyName, Number(length), DontEnum | DontDelete);
+ thisObj->put(exec,lengthPropertyName, Number(length), DontEnum | DontDelete);
result = Number(length);
break;
}
@@ -555,39 +546,39 @@
for (unsigned int k = 0; k < middle; k++) {
unsigned lk1 = length - k - 1;
- Value obj;
- Value obj2;
- bool has2 = thisImp->getProperty(exec, lk1, obj2);
- bool has1 = thisImp->getProperty(exec, k, obj);
+ ValueImp *obj;
+ ValueImp *obj2;
+ bool has2 = thisObj->getProperty(exec, lk1, obj2);
+ bool has1 = thisObj->getProperty(exec, k, obj);
if (has2)
- thisObj.put(exec, k, obj2);
+ thisObj->put(exec, k, obj2);
else
- thisObj.deleteProperty(exec, k);
+ thisObj->deleteProperty(exec, k);
if (has1)
- thisObj.put(exec, lk1, obj);
+ thisObj->put(exec, lk1, obj);
else
- thisObj.deleteProperty(exec, lk1);
+ thisObj->deleteProperty(exec, lk1);
}
result = thisObj;
break;
}
case Shift: {
if (length == 0) {
- thisObj.put(exec, lengthPropertyName, Number(length), DontEnum | DontDelete);
+ thisObj->put(exec, lengthPropertyName, Number(length), DontEnum | DontDelete);
result = Undefined();
} else {
- result = thisObj.get(exec, 0);
+ result = thisObj->get(exec, 0);
for(unsigned int k = 1; k < length; k++) {
- Value obj;
- if (thisImp->getProperty(exec, k, obj))
- thisObj.put(exec, k-1, obj);
+ ValueImp *obj;
+ if (thisObj->getProperty(exec, k, obj))
+ thisObj->put(exec, k-1, obj);
else
- thisObj.deleteProperty(exec, k-1);
+ thisObj->deleteProperty(exec, k-1);
}
- thisObj.deleteProperty(exec, length - 1);
- thisObj.put(exec, lengthPropertyName, Number(length - 1), DontEnum | DontDelete);
+ thisObj->deleteProperty(exec, length - 1);
+ thisObj->put(exec, lengthPropertyName, Number(length - 1), DontEnum | DontDelete);
}
break;
}
@@ -595,11 +586,11 @@
// http://developer.netscape.com/docs/manuals/js/client/jsref/array.htm#1193713 or 15.4.4.10
// We return a new array
- Object resObj = Object::dynamicCast(exec->lexicalInterpreter()->builtinArray().construct(exec,List::empty()));
+ ObjectImp *resObj = static_cast<ObjectImp *>(exec->lexicalInterpreter()->builtinArray()->construct(exec,List::empty()));
result = resObj;
double begin = 0;
- if (args[0].type() != UndefinedType) {
- begin = args[0].toInteger(exec);
+ if (!args[0]->isUndefined()) {
+ begin = args[0]->toInteger(exec);
if (begin >= 0) { // false for NaN
if (begin > length)
begin = length;
@@ -610,8 +601,8 @@
}
}
double end = length;
- if (args[1].type() != UndefinedType) {
- end = args[1].toInteger(exec);
+ if (!args[1]->isUndefined()) {
+ end = args[1]->toInteger(exec);
if (end < 0) { // false for NaN
end += length;
if (end < 0)
@@ -627,39 +618,38 @@
int b = static_cast<int>(begin);
int e = static_cast<int>(end);
for(int k = b; k < e; k++, n++) {
- Value obj;
- if (thisImp->getProperty(exec, k, obj))
- resObj.put(exec, n, obj);
+ ValueImp *obj;
+ if (thisObj->getProperty(exec, k, obj))
+ resObj->put(exec, n, obj);
}
- resObj.put(exec, lengthPropertyName, Number(n), DontEnum | DontDelete);
+ resObj->put(exec, lengthPropertyName, Number(n), DontEnum | DontDelete);
break;
}
case Sort:{
#if 0
printf("KJS Array::Sort length=%d\n", length);
for ( unsigned int i = 0 ; i<length ; ++i )
- printf("KJS Array::Sort: %d: %s\n", i, thisObj.get(exec, i).toString(exec).ascii() );
+ printf("KJS Array::Sort: %d: %s\n", i, thisObj->get(exec, i)->toString(exec).ascii() );
#endif
- Object sortFunction;
- bool useSortFunction = (args[0].type() != UndefinedType);
- if (useSortFunction)
+ ObjectImp *sortFunction = NULL;
+ if (!args[0]->isUndefined())
{
- sortFunction = args[0].toObject(exec);
- if (!sortFunction.implementsCall())
- useSortFunction = false;
+ sortFunction = args[0]->toObject(exec);
+ if (!sortFunction->implementsCall())
+ sortFunction = NULL;
}
- if (thisImp->classInfo() == &ArrayInstanceImp::info) {
- if (useSortFunction)
- ((ArrayInstanceImp *)thisImp)->sort(exec, sortFunction);
+ if (thisObj->classInfo() == &ArrayInstanceImp::info) {
+ if (sortFunction)
+ ((ArrayInstanceImp *)thisObj)->sort(exec, sortFunction);
else
- ((ArrayInstanceImp *)thisImp)->sort(exec);
+ ((ArrayInstanceImp *)thisObj)->sort(exec);
result = thisObj;
break;
}
if (length == 0) {
- thisObj.put(exec, lengthPropertyName, Number(0), DontEnum | DontDelete);
+ thisObj->put(exec, lengthPropertyName, Number(0), DontEnum | DontDelete);
result = thisObj;
break;
}
@@ -668,24 +658,24 @@
// or quicksort, and much less swapping than bubblesort/insertionsort.
for ( unsigned int i = 0 ; i<length-1 ; ++i )
{
- Value iObj = thisObj.get(exec,i);
+ ValueImp *iObj = thisObj->get(exec,i);
unsigned int themin = i;
- Value minObj = iObj;
+ ValueImp *minObj = iObj;
for ( unsigned int j = i+1 ; j<length ; ++j )
{
- Value jObj = thisObj.get(exec,j);
+ ValueImp *jObj = thisObj->get(exec,j);
double cmp;
- if (jObj.type() == UndefinedType) {
+ if (jObj->isUndefined()) {
cmp = 1; // don't check minObj because there's no need to differentiate == (0) from > (1)
- } else if (minObj.type() == UndefinedType) {
+ } else if (minObj->isUndefined()) {
cmp = -1;
- } else if (useSortFunction) {
+ } else if (sortFunction) {
List l;
l.append(jObj);
l.append(minObj);
- cmp = sortFunction.call(exec, exec->dynamicInterpreter()->globalObject(), l).toNumber(exec);
+ cmp = sortFunction->call(exec, exec->dynamicInterpreter()->globalObject(), l)->toNumber(exec);
} else {
- cmp = (jObj.toString(exec) < minObj.toString(exec)) ? -1 : 1;
+ cmp = (jObj->toString(exec) < minObj->toString(exec)) ? -1 : 1;
}
if ( cmp < 0 )
{
@@ -697,36 +687,36 @@
if ( themin > i )
{
//printf("KJS Array::Sort: swapping %d and %d\n", i, themin );
- thisObj.put( exec, i, minObj );
- thisObj.put( exec, themin, iObj );
+ thisObj->put( exec, i, minObj );
+ thisObj->put( exec, themin, iObj );
}
}
#if 0
printf("KJS Array::Sort -- Resulting array:\n");
for ( unsigned int i = 0 ; i<length ; ++i )
- printf("KJS Array::Sort: %d: %s\n", i, thisObj.get(exec, i).toString(exec).ascii() );
+ printf("KJS Array::Sort: %d: %s\n", i, thisObj->get(exec, i)->toString(exec).ascii() );
#endif
result = thisObj;
break;
}
case Splice: {
// 15.4.4.12 - oh boy this is huge
- Object resObj = Object::dynamicCast(exec->lexicalInterpreter()->builtinArray().construct(exec,List::empty()));
+ ObjectImp *resObj = static_cast<ObjectImp *>(exec->lexicalInterpreter()->builtinArray()->construct(exec,List::empty()));
result = resObj;
- int begin = args[0].toUInt32(exec);
+ int begin = args[0]->toUInt32(exec);
if ( begin < 0 )
begin = maxInt( begin + length, 0 );
else
begin = minInt( begin, length );
- unsigned int deleteCount = minInt( maxInt( args[1].toUInt32(exec), 0 ), length - begin );
+ unsigned int deleteCount = minInt( maxInt( args[1]->toUInt32(exec), 0 ), length - begin );
//printf( "Splicing from %d, deleteCount=%d \n", begin, deleteCount );
for(unsigned int k = 0; k < deleteCount; k++) {
- Value obj;
- if (thisImp->getProperty(exec, k+begin, obj))
- resObj.put(exec, k, obj);
+ ValueImp *obj;
+ if (thisObj->getProperty(exec, k+begin, obj))
+ resObj->put(exec, k, obj);
}
- resObj.put(exec, lengthPropertyName, Number(deleteCount), DontEnum | DontDelete);
+ resObj->put(exec, lengthPropertyName, Number(deleteCount), DontEnum | DontDelete);
unsigned int additionalArgs = maxInt( args.size() - 2, 0 );
if ( additionalArgs != deleteCount )
@@ -735,48 +725,48 @@
{
for ( unsigned int k = begin; k < length - deleteCount; ++k )
{
- Value obj;
- if (thisImp->getProperty(exec, k+deleteCount, obj))
- thisObj.put(exec, k+additionalArgs, obj);
+ ValueImp *obj;
+ if (thisObj->getProperty(exec, k+deleteCount, obj))
+ thisObj->put(exec, k+additionalArgs, obj);
else
- thisObj.deleteProperty(exec, k+additionalArgs);
+ thisObj->deleteProperty(exec, k+additionalArgs);
}
for ( unsigned int k = length ; k > length - deleteCount + additionalArgs; --k )
- thisObj.deleteProperty(exec, k-1);
+ thisObj->deleteProperty(exec, k-1);
}
else
{
for ( unsigned int k = length - deleteCount; (int)k > begin; --k )
{
- Value obj;
- if (thisImp->getProperty(exec, k + deleteCount - 1, obj))
- thisObj.put(exec, k + additionalArgs - 1, obj);
+ ValueImp *obj;
+ if (thisObj->getProperty(exec, k + deleteCount - 1, obj))
+ thisObj->put(exec, k + additionalArgs - 1, obj);
else
- thisObj.deleteProperty(exec, k+additionalArgs-1);
+ thisObj->deleteProperty(exec, k+additionalArgs-1);
}
}
}
for ( unsigned int k = 0; k < additionalArgs; ++k )
{
- thisObj.put(exec, k+begin, args[k+2]);
+ thisObj->put(exec, k+begin, args[k+2]);
}
- thisObj.put(exec, lengthPropertyName, Number(length - deleteCount + additionalArgs), DontEnum | DontDelete);
+ thisObj->put(exec, lengthPropertyName, Number(length - deleteCount + additionalArgs), DontEnum | DontDelete);
break;
}
case UnShift: { // 15.4.4.13
unsigned int nrArgs = args.size();
for ( unsigned int k = length; k > 0; --k )
{
- Value obj;
- if (thisImp->getProperty(exec, k - 1, obj))
- thisObj.put(exec, k+nrArgs-1, obj);
+ ValueImp *obj;
+ if (thisObj->getProperty(exec, k - 1, obj))
+ thisObj->put(exec, k+nrArgs-1, obj);
else
- thisObj.deleteProperty(exec, k+nrArgs-1);
+ thisObj->deleteProperty(exec, k+nrArgs-1);
}
for ( unsigned int k = 0; k < nrArgs; ++k )
- thisObj.put(exec, k, args[k]);
+ thisObj->put(exec, k, args[k]);
result = Number(length + nrArgs);
- thisObj.put(exec, lengthPropertyName, result, DontEnum | DontDelete);
+ thisObj->put(exec, lengthPropertyName, result, DontEnum | DontDelete);
break;
}
case Every:
@@ -787,15 +777,15 @@
//http://developer-test.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Objects:Array:forEach
//http://developer-test.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Objects:Array:some
- Object eachFunction = args[0].toObject(exec);
+ ObjectImp *eachFunction = args[0]->toObject(exec);
- if (!eachFunction.implementsCall()) {
- Object err = Error::create(exec,TypeError);
+ if (!eachFunction->implementsCall()) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
- Object applyThis = args[1].imp()->isUndefinedOrNull() ? exec->dynamicInterpreter()->globalObject() : args[1].toObject(exec);
+ ObjectImp *applyThis = args[1]->isUndefinedOrNull() ? exec->dynamicInterpreter()->globalObject() : args[1]->toObject(exec);
if (id == Some || id == Every)
result = Boolean(id == Every);
@@ -806,11 +796,11 @@
List eachArguments;
- eachArguments.append(thisObj.get(exec, k));
+ eachArguments.append(thisObj->get(exec, k));
eachArguments.append(Number(k));
eachArguments.append(thisObj);
- bool predicateResult = eachFunction.call(exec, applyThis, eachArguments).toBoolean(exec);
+ bool predicateResult = eachFunction->call(exec, applyThis, eachArguments)->toBoolean(exec);
if (id == Every && !predicateResult) {
result = Boolean(false);
@@ -826,6 +816,7 @@
default:
assert(0);
+ result = 0;
break;
}
return result;
@@ -838,9 +829,8 @@
ArrayPrototypeImp *arrayProto)
: InternalFunctionImp(funcProto)
{
- Value protect(this);
// ECMA 15.4.3.1 Array.prototype
- put(exec,prototypePropertyName, Object(arrayProto), DontEnum|DontDelete|ReadOnly);
+ put(exec,prototypePropertyName, arrayProto, DontEnum|DontDelete|ReadOnly);
// no. of arguments for constructor
put(exec,lengthPropertyName, Number(1), ReadOnly|DontDelete|DontEnum);
@@ -852,21 +842,21 @@
}
// ECMA 15.4.2
-Object ArrayObjectImp::construct(ExecState *exec, const List &args)
+ObjectImp *ArrayObjectImp::construct(ExecState *exec, const List &args)
{
// a single numeric argument denotes the array size (!)
- if (args.size() == 1 && args[0].type() == NumberType) {
- uint32_t n = args[0].toUInt32(exec);
- if (n != args[0].toNumber(exec)) {
- Object error = Error::create(exec, RangeError, "Array size is not a small enough positive integer.");
+ if (args.size() == 1 && args[0]->isNumber()) {
+ uint32_t n = args[0]->toUInt32(exec);
+ if (n != args[0]->toNumber(exec)) {
+ ObjectImp *error = Error::create(exec, RangeError, "Array size is not a small enough positive integer.");
exec->setException(error);
return error;
}
- return Object(new ArrayInstanceImp(exec->lexicalInterpreter()->builtinArrayPrototype().imp(), n));
+ return new ArrayInstanceImp(exec->lexicalInterpreter()->builtinArrayPrototype(), n);
}
// otherwise the array is constructed with the arguments in it
- return Object(new ArrayInstanceImp(exec->lexicalInterpreter()->builtinArrayPrototype().imp(), args));
+ return new ArrayInstanceImp(exec->lexicalInterpreter()->builtinArrayPrototype(), args);
}
bool ArrayObjectImp::implementsCall() const
@@ -875,7 +865,7 @@
}
// ECMA 15.6.1
-Value ArrayObjectImp::call(ExecState *exec, Object &/*thisObj*/, const List &args)
+ValueImp *ArrayObjectImp::callAsFunction(ExecState *exec, ObjectImp */*thisObj*/, const List &args)
{
// equivalent to 'new Array(....)'
return construct(exec,args);
1.16 +3 -3 JavaScriptCore/kjs/array_object.h
Index: array_object.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/array_object.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- array_object.h 7 Aug 2005 06:17:35 -0000 1.15
+++ array_object.h 8 Aug 2005 04:07:27 -0000 1.16
@@ -41,7 +41,7 @@
ArrayProtoFuncImp(ExecState *exec, int i, int len);
virtual bool implementsCall() const;
- virtual Value call(ExecState *exec, Object &thisObj, const List &args);
+ virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args);
enum { ToString, ToLocaleString, Concat, Join, Pop, Push,
Reverse, Shift, Slice, Sort, Splice, UnShift,
@@ -57,9 +57,9 @@
ArrayPrototypeImp *arrayProto);
virtual bool implementsConstruct() const;
- virtual Object construct(ExecState *exec, const List &args);
+ virtual ObjectImp *construct(ExecState *exec, const List &args);
virtual bool implementsCall() const;
- virtual Value call(ExecState *exec, Object &thisObj, const List &args);
+ virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args);
};
1.12 +16 -19 JavaScriptCore/kjs/bool_object.cpp
Index: bool_object.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/bool_object.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- bool_object.cpp 14 Jul 2005 18:27:01 -0000 1.11
+++ bool_object.cpp 8 Aug 2005 04:07:27 -0000 1.12
@@ -50,7 +50,6 @@
FunctionPrototypeImp *funcProto)
: BooleanInstanceImp(objectProto)
{
- Value protect(this);
// The constructor will be added later by InterpreterImp::InterpreterImp()
putDirect(toStringPropertyName, new BooleanProtoFuncImp(exec,funcProto,BooleanProtoFuncImp::ToString,0), DontEnum);
@@ -65,7 +64,6 @@
FunctionPrototypeImp *funcProto, int i, int len)
: InternalFunctionImp(funcProto), id(i)
{
- Value protect(this);
putDirect(lengthPropertyName, len, DontDelete|ReadOnly|DontEnum);
}
@@ -77,23 +75,23 @@
// ECMA 15.6.4.2 + 15.6.4.3
-Value BooleanProtoFuncImp::call(ExecState *exec, Object &thisObj, const List &/*args*/)
+ValueImp *BooleanProtoFuncImp::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &/*args*/)
{
// no generic function. "this" has to be a Boolean object
- if (!thisObj.inherits(&BooleanInstanceImp::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&BooleanInstanceImp::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
// execute "toString()" or "valueOf()", respectively
- Value v = thisObj.internalValue();
- assert(!v.isNull());
+ ValueImp *v = thisObj->internalValue();
+ assert(v);
if (id == ToString)
- return String(v.toString(exec));
- return Boolean(v.toBoolean(exec)); /* TODO: optimize for bool case */
+ return String(v->toString(exec));
+ return Boolean(v->toBoolean(exec)); /* TODO: optimize for bool case */
}
// ------------------------------ BooleanObjectImp -----------------------------
@@ -103,11 +101,10 @@
BooleanPrototypeImp *booleanProto)
: InternalFunctionImp(funcProto)
{
- Value protect(this);
putDirect(prototypePropertyName, booleanProto, DontEnum|DontDelete|ReadOnly);
// no. of arguments for constructor
- putDirect(lengthPropertyName, NumberImp::one(), ReadOnly|DontDelete|DontEnum);
+ putDirect(lengthPropertyName, jsOne(), ReadOnly|DontDelete|DontEnum);
}
@@ -117,17 +114,17 @@
}
// ECMA 15.6.2
-Object BooleanObjectImp::construct(ExecState *exec, const List &args)
+ObjectImp *BooleanObjectImp::construct(ExecState *exec, const List &args)
{
- Object obj(new BooleanInstanceImp(exec->lexicalInterpreter()->builtinBooleanPrototype().imp()));
+ ObjectImp *obj(new BooleanInstanceImp(exec->lexicalInterpreter()->builtinBooleanPrototype()));
- Boolean b;
+ bool b;
if (args.size() > 0)
- b = args.begin()->dispatchToBoolean(exec);
+ b = args.begin()->toBoolean(exec);
else
- b = Boolean(false);
+ b = false;
- obj.setInternalValue(b);
+ obj->setInternalValue(jsBoolean(b));
return obj;
}
@@ -138,11 +135,11 @@
}
// ECMA 15.6.1
-Value BooleanObjectImp::call(ExecState *exec, Object &/*thisObj*/, const List &args)
+ValueImp *BooleanObjectImp::callAsFunction(ExecState *exec, ObjectImp */*thisObj*/, const List &args)
{
if (args.isEmpty())
return Boolean(false);
else
- return Boolean(args[0].toBoolean(exec)); /* TODO: optimize for bool case */
+ return Boolean(args[0]->toBoolean(exec)); /* TODO: optimize for bool case */
}
1.6 +3 -3 JavaScriptCore/kjs/bool_object.h
Index: bool_object.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/bool_object.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- bool_object.h 14 Jul 2005 18:27:01 -0000 1.5
+++ bool_object.h 8 Aug 2005 04:07:27 -0000 1.6
@@ -60,7 +60,7 @@
FunctionPrototypeImp *funcProto, int i, int len);
virtual bool implementsCall() const;
- virtual Value call(ExecState *exec, Object &thisObj, const List &args);
+ virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args);
enum { ToString, ValueOf };
private:
@@ -79,10 +79,10 @@
BooleanPrototypeImp *booleanProto);
virtual bool implementsConstruct() const;
- virtual Object construct(ExecState *exec, const List &args);
+ virtual ObjectImp *construct(ExecState *exec, const List &args);
virtual bool implementsCall() const;
- virtual Value call(ExecState *exec, Object &thisObj, const List &args);
+ virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args);
};
} // namespace
1.41 +11 -11 JavaScriptCore/kjs/collector.cpp
Index: collector.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/collector.cpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- collector.cpp 1 Aug 2005 05:02:12 -0000 1.40
+++ collector.cpp 8 Aug 2005 04:07:27 -0000 1.41
@@ -251,7 +251,7 @@
}
if (good && ((CollectorCell *)x)->u.freeCell.zeroIfFree != 0) {
- ValueImp *imp = (ValueImp *)x;
+ AllocatedValueImp *imp = (AllocatedValueImp *)x;
if (!imp->marked())
imp->mark();
}
@@ -370,14 +370,14 @@
}
CollectorCell *cell = curBlock->cells + i;
- ValueImp *imp = reinterpret_cast<ValueImp *>(cell);
+ AllocatedValueImp *imp = reinterpret_cast<AllocatedValueImp *>(cell);
if (cell->u.freeCell.zeroIfFree != 0) {
- if (!imp->_marked)
+ if (!imp->m_marked)
{
- //fprintf(stderr, "Collector::deleting ValueImp %p (%s)\n", imp, className(imp));
+ //fprintf(stderr, "Collector::deleting AllocatedValueImp %p (%s)\n", imp, className(imp));
// emulate destructing part of 'operator delete()'
- imp->~ValueImp();
+ imp->~AllocatedValueImp();
curBlock->usedCells--;
numLiveObjects--;
deleted = true;
@@ -388,7 +388,7 @@
curBlock->freeList = cell;
} else {
- imp->_marked = false;
+ imp->m_marked = false;
}
} else {
minimumCellsToProcess++;
@@ -422,10 +422,10 @@
int cell = 0;
while (cell < heap.usedOversizeCells) {
- ValueImp *imp = (ValueImp *)heap.oversizeCells[cell];
+ AllocatedValueImp *imp = (AllocatedValueImp *)heap.oversizeCells[cell];
- if (!imp->_marked) {
- imp->~ValueImp();
+ if (!imp->m_marked) {
+ imp->~AllocatedValueImp();
#if DEBUG_COLLECTOR
heap.oversizeCells[cell]->u.freeCell.zeroIfFree = 0;
#else
@@ -445,7 +445,7 @@
}
} else {
- imp->_marked = false;
+ imp->m_marked = false;
cell++;
}
}
@@ -508,7 +508,7 @@
static const char *className(ValueImp *val)
{
const char *name = "???";
- switch (val->dispatchType()) {
+ switch (val->type()) {
case UnspecifiedType:
break;
case UndefinedType:
1.11 +4 -5 JavaScriptCore/kjs/completion.h
Index: completion.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/completion.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- completion.h 14 Jul 2005 18:27:01 -0000 1.10
+++ completion.h 8 Aug 2005 04:07:27 -0000 1.11
@@ -47,17 +47,16 @@
*/
class Completion {
public:
- Completion(ComplType c = Normal, const Value& v = Value(),
- const Identifier &t = Identifier::null())
+ Completion(ComplType c = Normal, ValueImp *v = NULL, const Identifier &t = Identifier::null())
: comp(c), val(v), tar(t) { }
ComplType complType() const { return comp; }
- Value value() const { return val; }
+ ValueImp *value() const { return val; }
Identifier target() const { return tar; }
- bool isValueCompletion() const { return !val.isNull(); }
+ bool isValueCompletion() const { return val; }
private:
ComplType comp;
- Value val;
+ ValueImp *val;
Identifier tar;
};
1.12 +9 -9 JavaScriptCore/kjs/context.h
Index: context.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/context.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- context.h 14 Jul 2005 18:27:01 -0000 1.11
+++ context.h 8 Aug 2005 04:07:27 -0000 1.12
@@ -35,21 +35,21 @@
*/
class ContextImp {
public:
- ContextImp(Object &glob, InterpreterImp *, Object &thisV, CodeType type = GlobalCode,
+ ContextImp(ObjectImp *glob, InterpreterImp *, ObjectImp *thisV, CodeType type = GlobalCode,
ContextImp *callingContext = 0, FunctionImp *functiion = 0, const List *args = 0);
~ContextImp();
const ScopeChain &scopeChain() const { return scope; }
CodeType codeType() { return m_codeType; }
- Object variableObject() const { return variable; }
- void setVariableObject(const Object &v) { variable = v; }
- Object thisValue() const { return thisVal; }
+ ObjectImp *variableObject() const { return variable; }
+ void setVariableObject(ObjectImp *v) { variable = v; }
+ ObjectImp *thisValue() const { return thisVal; }
ContextImp *callingContext() { return _callingContext; }
- ObjectImp *activationObject() { return activation.imp(); }
+ ObjectImp *activationObject() { return activation; }
FunctionImp *function() const { return _function; }
const List *arguments() const { return _arguments; }
- void pushScope(const Object &s) { scope.push(s.imp()); }
+ void pushScope(ObjectImp *s) { scope.push(s); }
void popScope() { scope.pop(); }
LabelStack *seenLabels() { return &ls; }
@@ -63,11 +63,11 @@
// because ContextImp is always allocated on the stack,
// there is no need to protect various pointers from conservative
// GC since they will be caught by the conservative sweep anyway!
- Object activation;
+ ObjectImp *activation;
ScopeChain scope;
- Object variable;
- Object thisVal;
+ ObjectImp *variable;
+ ObjectImp *thisVal;
LabelStack ls;
CodeType m_codeType;
1.49 +65 -72 JavaScriptCore/kjs/date_object.cpp
Index: date_object.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/date_object.cpp,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- date_object.cpp 7 Aug 2005 06:17:35 -0000 1.48
+++ date_object.cpp 8 Aug 2005 04:07:27 -0000 1.49
@@ -269,12 +269,12 @@
UString arg1String;
bool useCustomFormat = false;
UString customFormatString;
- arg0String = args[0].toString(exec);
+ arg0String = args[0]->toString(exec);
if ((arg0String == "custom") && (argCount >= 2)) {
useCustomFormat = true;
- customFormatString = args[1].toString(exec);
+ customFormatString = args[1]->toString(exec);
} else if (includeDate && includeTime && (argCount >= 2)) {
- arg1String = args[1].toString(exec);
+ arg1String = args[1]->toString(exec);
dateStyle = styleFromArgString(arg0String,dateStyle);
timeStyle = styleFromArgString(arg1String,timeStyle);
} else if (includeDate && (argCount >= 1)) {
@@ -308,7 +308,7 @@
#endif // APPLE_CHANGES
-using namespace KJS;
+namespace KJS {
static int day(double t)
{
@@ -399,17 +399,17 @@
// hours
if (maxArgs >= 4 && idx < numArgs) {
t->tm_hour = 0;
- result = args[idx++].toInt32(exec) * msPerHour;
+ result = args[idx++]->toInt32(exec) * msPerHour;
}
// minutes
if (maxArgs >= 3 && idx < numArgs) {
t->tm_min = 0;
- result += args[idx++].toInt32(exec) * msPerMinute;
+ result += args[idx++]->toInt32(exec) * msPerMinute;
}
// seconds
if (maxArgs >= 2 && idx < numArgs) {
t->tm_sec = 0;
- result += args[idx++].toInt32(exec) * msPerSecond;
+ result += args[idx++]->toInt32(exec) * msPerSecond;
}
// read ms from args if present or add the old value
result += idx < numArgs ? roundValue(exec, args[idx]) : ms;
@@ -485,8 +485,7 @@
ObjectPrototypeImp *objectProto)
: DateInstanceImp(objectProto)
{
- Value protect(this);
- setInternalValue(NumberImp::create(NaN));
+ setInternalValue(jsNaN());
// The constructor will be added later, after DateObjectImp has been built
}
@@ -499,11 +498,10 @@
DateProtoFuncImp::DateProtoFuncImp(ExecState *exec, int i, int len)
: InternalFunctionImp(
- static_cast<FunctionPrototypeImp*>(exec->lexicalInterpreter()->builtinFunctionPrototype().imp())
+ static_cast<FunctionPrototypeImp*>(exec->lexicalInterpreter()->builtinFunctionPrototype())
), id(abs(i)), utc(i<0)
// We use a negative ID to denote the "UTC" variant.
{
- Value protect(this);
putDirect(lengthPropertyName, len, DontDelete|ReadOnly|DontEnum);
}
@@ -512,21 +510,21 @@
return true;
}
-Value DateProtoFuncImp::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *DateProtoFuncImp::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
if ((id == ToString || id == ValueOf || id == GetTime || id == SetTime) &&
- !thisObj.inherits(&DateInstanceImp::info)) {
+ !thisObj->inherits(&DateInstanceImp::info)) {
// non-generic function called on non-date object
// ToString and ValueOf are generic according to the spec, but the mozilla
// tests suggest otherwise...
- Object err = Error::create(exec,TypeError);
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
- Value result;
+ ValueImp *result = NULL;
UString s;
#if !APPLE_CHANGES
const int bufsize=100;
@@ -535,8 +533,8 @@
if (!oldlocale.c_str())
oldlocale = setlocale(LC_ALL, NULL);
#endif
- Value v = thisObj.internalValue();
- double milli = v.toNumber(exec);
+ ValueImp *v = thisObj->internalValue();
+ double milli = v->toNumber(exec);
if (isNaN(milli)) {
switch (id) {
@@ -561,7 +559,7 @@
case GetSeconds:
case GetMilliSeconds:
case GetTimezoneOffset:
- return Number(NaN);
+ return jsNaN();
}
}
@@ -707,7 +705,7 @@
case SetTime:
milli = roundValue(exec, args[0]);
result = Number(milli);
- thisObj.setInternalValue(result);
+ thisObj->setInternalValue(result);
break;
case SetMilliSeconds:
ms = roundValue(exec, args[0]);
@@ -723,22 +721,22 @@
break;
case SetDate:
t->tm_mday = 0;
- ms += args[0].toInt32(exec) * msPerDay;
+ ms += args[0]->toInt32(exec) * msPerDay;
break;
case SetMonth:
- t->tm_mon = args[0].toInt32(exec);
+ t->tm_mon = args[0]->toInt32(exec);
if (args.size() >= 2)
- t->tm_mday = args[1].toInt32(exec);
+ t->tm_mday = args[1]->toInt32(exec);
break;
case SetFullYear:
- t->tm_year = args[0].toInt32(exec) - 1900;
+ t->tm_year = args[0]->toInt32(exec) - 1900;
if (args.size() >= 2)
- t->tm_mon = args[1].toInt32(exec);
+ t->tm_mon = args[1]->toInt32(exec);
if (args.size() >= 3)
- t->tm_mday = args[2].toInt32(exec);
+ t->tm_mday = args[2]->toInt32(exec);
break;
case SetYear:
- t->tm_year = args[0].toInt32(exec) >= 1900 ? args[0].toInt32(exec) - 1900 : args[0].toInt32(exec);
+ t->tm_year = args[0]->toInt32(exec) >= 1900 ? args[0]->toInt32(exec) - 1900 : args[0]->toInt32(exec);
break;
}
@@ -746,7 +744,7 @@
id == SetMinutes || id == SetHours || id == SetDate ||
id == SetMonth || id == SetFullYear ) {
result = Number(makeTime(t, ms, utc));
- thisObj.setInternalValue(result);
+ thisObj->setInternalValue(result);
}
return result;
@@ -761,8 +759,6 @@
DatePrototypeImp *dateProto)
: InternalFunctionImp(funcProto)
{
- Value protect(this);
-
// ECMA 15.9.4.1 Date.prototype
putDirect(prototypePropertyName, dateProto, DontEnum|DontDelete|ReadOnly);
@@ -781,7 +777,7 @@
}
// ECMA 15.9.3
-Object DateObjectImp::construct(ExecState *exec, const List &args)
+ObjectImp *DateObjectImp::construct(ExecState *exec, const List &args)
{
int numArgs = args.size();
@@ -807,38 +803,37 @@
#endif
value = utc;
} else if (numArgs == 1) {
- if (args[0].type() == StringType)
- value = parseDate(args[0].toString(exec));
+ if (args[0]->isString())
+ value = parseDate(args[0]->toString(exec));
else
- value = args[0].toPrimitive(exec).toNumber(exec);
+ value = args[0]->toPrimitive(exec)->toNumber(exec);
} else {
struct tm t;
memset(&t, 0, sizeof(t));
- if (isNaN(args[0].toNumber(exec))
- || isNaN(args[1].toNumber(exec))
- || (numArgs >= 3 && isNaN(args[2].toNumber(exec)))
- || (numArgs >= 4 && isNaN(args[3].toNumber(exec)))
- || (numArgs >= 5 && isNaN(args[4].toNumber(exec)))
- || (numArgs >= 6 && isNaN(args[5].toNumber(exec)))
- || (numArgs >= 7 && isNaN(args[6].toNumber(exec)))) {
+ if (isNaN(args[0]->toNumber(exec))
+ || isNaN(args[1]->toNumber(exec))
+ || (numArgs >= 3 && isNaN(args[2]->toNumber(exec)))
+ || (numArgs >= 4 && isNaN(args[3]->toNumber(exec)))
+ || (numArgs >= 5 && isNaN(args[4]->toNumber(exec)))
+ || (numArgs >= 6 && isNaN(args[5]->toNumber(exec)))
+ || (numArgs >= 7 && isNaN(args[6]->toNumber(exec)))) {
value = NaN;
} else {
- int year = args[0].toInt32(exec);
+ int year = args[0]->toInt32(exec);
t.tm_year = (year >= 0 && year <= 99) ? year : year - 1900;
- t.tm_mon = args[1].toInt32(exec);
- t.tm_mday = (numArgs >= 3) ? args[2].toInt32(exec) : 1;
- t.tm_hour = (numArgs >= 4) ? args[3].toInt32(exec) : 0;
- t.tm_min = (numArgs >= 5) ? args[4].toInt32(exec) : 0;
- t.tm_sec = (numArgs >= 6) ? args[5].toInt32(exec) : 0;
+ t.tm_mon = args[1]->toInt32(exec);
+ t.tm_mday = (numArgs >= 3) ? args[2]->toInt32(exec) : 1;
+ t.tm_hour = (numArgs >= 4) ? args[3]->toInt32(exec) : 0;
+ t.tm_min = (numArgs >= 5) ? args[4]->toInt32(exec) : 0;
+ t.tm_sec = (numArgs >= 6) ? args[5]->toInt32(exec) : 0;
t.tm_isdst = -1;
double ms = (numArgs >= 7) ? roundValue(exec, args[6]) : 0;
value = makeTime(&t, ms, false);
}
}
- Object proto = exec->lexicalInterpreter()->builtinDatePrototype();
- Object ret(new DateInstanceImp(proto.imp()));
- ret.setInternalValue(Number(timeClip(value)));
+ DateInstanceImp *ret = new DateInstanceImp(exec->lexicalInterpreter()->builtinDatePrototype());
+ ret->setInternalValue(Number(timeClip(value)));
return ret;
}
@@ -848,11 +843,8 @@
}
// ECMA 15.9.2
-Value DateObjectImp::call(ExecState */*exec*/, Object &/*thisObj*/, const List &/*args*/)
+ValueImp *DateObjectImp::callAsFunction(ExecState */*exec*/, ObjectImp */*thisObj*/, const List &/*args*/)
{
-#ifdef KJS_VERBOSE
- fprintf(stderr,"DateObjectImp::call - current time\n");
-#endif
time_t t = time(0L);
#if APPLE_CHANGES
struct tm *tm = localtime(&t);
@@ -871,7 +863,6 @@
int i, int len)
: InternalFunctionImp(funcProto), id(i)
{
- Value protect(this);
putDirect(lengthPropertyName, len, DontDelete|ReadOnly|DontEnum);
}
@@ -881,31 +872,31 @@
}
// ECMA 15.9.4.2 - 3
-Value DateObjectFuncImp::call(ExecState *exec, Object &/*thisObj*/, const List &args)
+ValueImp *DateObjectFuncImp::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
if (id == Parse) {
- return Number(parseDate(args[0].toString(exec)));
+ return Number(parseDate(args[0]->toString(exec)));
}
else { // UTC
struct tm t;
memset(&t, 0, sizeof(t));
int n = args.size();
- if (isNaN(args[0].toNumber(exec))
- || isNaN(args[1].toNumber(exec))
- || (n >= 3 && isNaN(args[2].toNumber(exec)))
- || (n >= 4 && isNaN(args[3].toNumber(exec)))
- || (n >= 5 && isNaN(args[4].toNumber(exec)))
- || (n >= 6 && isNaN(args[5].toNumber(exec)))
- || (n >= 7 && isNaN(args[6].toNumber(exec)))) {
+ if (isNaN(args[0]->toNumber(exec))
+ || isNaN(args[1]->toNumber(exec))
+ || (n >= 3 && isNaN(args[2]->toNumber(exec)))
+ || (n >= 4 && isNaN(args[3]->toNumber(exec)))
+ || (n >= 5 && isNaN(args[4]->toNumber(exec)))
+ || (n >= 6 && isNaN(args[5]->toNumber(exec)))
+ || (n >= 7 && isNaN(args[6]->toNumber(exec)))) {
return Number(NaN);
}
- int year = args[0].toInt32(exec);
+ int year = args[0]->toInt32(exec);
t.tm_year = (year >= 0 && year <= 99) ? year : year - 1900;
- t.tm_mon = args[1].toInt32(exec);
- t.tm_mday = (n >= 3) ? args[2].toInt32(exec) : 1;
- t.tm_hour = (n >= 4) ? args[3].toInt32(exec) : 0;
- t.tm_min = (n >= 5) ? args[4].toInt32(exec) : 0;
- t.tm_sec = (n >= 6) ? args[5].toInt32(exec) : 0;
+ t.tm_mon = args[1]->toInt32(exec);
+ t.tm_mday = (n >= 3) ? args[2]->toInt32(exec) : 1;
+ t.tm_hour = (n >= 4) ? args[3]->toInt32(exec) : 0;
+ t.tm_min = (n >= 5) ? args[4]->toInt32(exec) : 0;
+ t.tm_sec = (n >= 6) ? args[5]->toInt32(exec) : 0;
double ms = (n >= 7) ? roundValue(exec, args[6]) : 0;
return Number(makeTime(&t, ms, true));
}
@@ -914,7 +905,7 @@
// -----------------------------------------------------------------------------
-double KJS::parseDate(const UString &u)
+double parseDate(const UString &u)
{
#ifdef KJS_VERBOSE
fprintf(stderr,"KJS::parseDate %s\n",u.ascii());
@@ -1027,7 +1018,7 @@
return -1;
}
-double KJS::KRFCDate_parseDate(const UString &_date)
+double KRFCDate_parseDate(const UString &_date)
{
// This parse a date in the form:
// Tuesday, 09-Nov-99 23:12:40 GMT
@@ -1344,7 +1335,7 @@
}
-double KJS::timeClip(double t)
+double timeClip(double t)
{
if (!isfinite(t))
return NaN;
@@ -1353,3 +1344,5 @@
return NaN;
return copysign(floor(at), t);
}
+
+}
1.15 +5 -5 JavaScriptCore/kjs/date_object.h
Index: date_object.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/date_object.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- date_object.h 7 Aug 2005 06:17:35 -0000 1.14
+++ date_object.h 8 Aug 2005 04:07:27 -0000 1.15
@@ -62,7 +62,7 @@
DateProtoFuncImp(ExecState *exec, int i, int len);
virtual bool implementsCall() const;
- virtual Value call(ExecState *exec, Object &thisObj, const List &args);
+ virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args);
Completion execute(const List &);
@@ -91,12 +91,12 @@
DatePrototypeImp *dateProto);
virtual bool implementsConstruct() const;
- virtual Object construct(ExecState *exec, const List &args);
+ virtual ObjectImp *construct(ExecState *exec, const List &args);
virtual bool implementsCall() const;
- virtual Value call(ExecState *exec, Object &thisObj, const List &args);
+ virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args);
Completion execute(const List &);
- Object construct(const List &);
+ ObjectImp *construct(const List &);
};
/**
@@ -111,7 +111,7 @@
int i, int len);
virtual bool implementsCall() const;
- virtual Value call(ExecState *exec, Object &thisObj, const List &args);
+ virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args);
enum { Parse, UTC };
private:
1.6 +3 -3 JavaScriptCore/kjs/debugger.cpp
Index: debugger.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/debugger.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- debugger.cpp 27 Jul 2005 23:10:49 -0000 1.5
+++ debugger.cpp 8 Aug 2005 04:07:27 -0000 1.6
@@ -99,7 +99,7 @@
}
bool Debugger::exception(ExecState */*exec*/, int /*sourceId*/, int /*lineno*/,
- Object &/*exceptionObj*/)
+ ObjectImp */*exceptionObj*/)
{
return true;
}
@@ -111,13 +111,13 @@
}
bool Debugger::callEvent(ExecState */*exec*/, int /*sourceId*/, int /*lineno*/,
- Object &/*function*/, const List &/*args*/)
+ ObjectImp */*function*/, const List &/*args*/)
{
return true;
}
bool Debugger::returnEvent(ExecState */*exec*/, int /*sourceId*/, int /*lineno*/,
- Object &/*function*/)
+ ObjectImp */*function*/)
{
return true;
}
1.6 +4 -4 JavaScriptCore/kjs/debugger.h
Index: debugger.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/debugger.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- debugger.h 27 Jul 2005 23:10:49 -0000 1.5
+++ debugger.h 8 Aug 2005 04:07:28 -0000 1.6
@@ -28,7 +28,7 @@
class DebuggerImp;
class Interpreter;
class ExecState;
- class Object;
+ class ObjectImp;
class UString;
class List;
@@ -141,7 +141,7 @@
* be aborted
*/
virtual bool exception(ExecState *exec, int sourceId, int lineno,
- Object &exceptionObj);
+ ObjectImp *exceptionObj);
/**
* Called when a line of the script is reached (before it is executed)
@@ -181,7 +181,7 @@
* be aborted
*/
virtual bool callEvent(ExecState *exec, int sourceId, int lineno,
- Object &function, const List &args);
+ ObjectImp *function, const List &args);
/**
* Called on each function exit. The function being returned from is that
@@ -202,7 +202,7 @@
* be aborted
*/
virtual bool returnEvent(ExecState *exec, int sourceId, int lineno,
- Object &function);
+ ObjectImp *function);
private:
DebuggerImp *rep;
1.17 +26 -32 JavaScriptCore/kjs/error_object.cpp
Index: error_object.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/error_object.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- error_object.cpp 18 Jul 2005 17:40:54 -0000 1.16
+++ error_object.cpp 8 Aug 2005 04:07:28 -0000 1.17
@@ -47,7 +47,6 @@
FunctionPrototypeImp *funcProto)
: ObjectImp(objectProto)
{
- Value protect(this);
setInternalValue(Undefined());
// The constructor will be added later in ErrorObjectImp's constructor
@@ -61,8 +60,7 @@
ErrorProtoFuncImp::ErrorProtoFuncImp(ExecState *exec, FunctionPrototypeImp *funcProto)
: InternalFunctionImp(funcProto)
{
- Value protect(this);
- putDirect(lengthPropertyName, NumberImp::zero(), DontDelete|ReadOnly|DontEnum);
+ putDirect(lengthPropertyName, jsZero(), DontDelete|ReadOnly|DontEnum);
}
bool ErrorProtoFuncImp::implementsCall() const
@@ -70,19 +68,19 @@
return true;
}
-Value ErrorProtoFuncImp::call(ExecState *exec, Object &thisObj, const List &/*args*/)
+ValueImp *ErrorProtoFuncImp::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &/*args*/)
{
// toString()
UString s = "Error";
- Value v = thisObj.get(exec, namePropertyName);
- if (v.type() != UndefinedType) {
- s = v.toString(exec);
+ ValueImp *v = thisObj->get(exec, namePropertyName);
+ if (!v->isUndefined()) {
+ s = v->toString(exec);
}
- v = thisObj.get(exec, messagePropertyName);
- if (v.type() != UndefinedType) {
- s += ": " + v.toString(exec); // Mozilla compatible format
+ v = thisObj->get(exec, messagePropertyName);
+ if (!v->isUndefined()) {
+ s += ": " + v->toString(exec); // Mozilla compatible format
}
return String(s);
@@ -94,10 +92,9 @@
ErrorPrototypeImp *errorProto)
: InternalFunctionImp(funcProto)
{
- Value protect(this);
// ECMA 15.11.3.1 Error.prototype
putDirect(prototypePropertyName, errorProto, DontEnum|DontDelete|ReadOnly);
- putDirect(lengthPropertyName, NumberImp::one(), DontDelete|ReadOnly|DontEnum);
+ putDirect(lengthPropertyName, jsOne(), DontDelete|ReadOnly|DontEnum);
//putDirect(namePropertyName, String(n));
}
@@ -107,15 +104,14 @@
}
// ECMA 15.9.3
-Object ErrorObjectImp::construct(ExecState *exec, const List &args)
+ObjectImp *ErrorObjectImp::construct(ExecState *exec, const List &args)
{
- Object proto = Object::dynamicCast(exec->lexicalInterpreter()->builtinErrorPrototype());
- ObjectImp *imp = new ErrorInstanceImp(proto.imp());
- Object obj(imp);
+ ObjectImp *proto = static_cast<ObjectImp *>(exec->lexicalInterpreter()->builtinErrorPrototype());
+ ObjectImp *imp = new ErrorInstanceImp(proto);
+ ObjectImp *obj(imp);
- if (!args.isEmpty() && args[0].type() != UndefinedType) {
- imp->putDirect(messagePropertyName, new StringImp(args[0].toString(exec)));
- }
+ if (!args[0]->isUndefined())
+ imp->putDirect(messagePropertyName, jsString(args[0]->toString(exec)));
return obj;
}
@@ -126,7 +122,7 @@
}
// ECMA 15.9.2
-Value ErrorObjectImp::call(ExecState *exec, Object &/*thisObj*/, const List &args)
+ValueImp *ErrorObjectImp::callAsFunction(ExecState *exec, ObjectImp */*thisObj*/, const List &args)
{
// "Error()" gives the sames result as "new Error()"
return construct(exec,args);
@@ -138,10 +134,9 @@
ErrorType et, UString name, UString message)
: ObjectImp(errorProto)
{
- Value protect(this);
errType = et;
- putDirect(namePropertyName, new StringImp(name), 0);
- putDirect(messagePropertyName, new StringImp(message), 0);
+ putDirect(namePropertyName, jsString(name), 0);
+ putDirect(messagePropertyName, jsString(message), 0);
}
// ------------------------------ NativeErrorImp -------------------------------
@@ -149,13 +144,12 @@
const ClassInfo NativeErrorImp::info = {"Function", &InternalFunctionImp::info, 0, 0};
NativeErrorImp::NativeErrorImp(ExecState *exec, FunctionPrototypeImp *funcProto,
- const Object &prot)
+ ObjectImp *prot)
: InternalFunctionImp(funcProto), proto(0)
{
- Value protect(this);
- proto = static_cast<ObjectImp*>(prot.imp());
+ proto = static_cast<ObjectImp*>(prot);
- putDirect(lengthPropertyName, NumberImp::one(), DontDelete|ReadOnly|DontEnum); // ECMA 15.11.7.5
+ putDirect(lengthPropertyName, jsOne(), DontDelete|ReadOnly|DontEnum); // ECMA 15.11.7.5
putDirect(prototypePropertyName, proto, DontDelete|ReadOnly|DontEnum);
}
@@ -164,12 +158,12 @@
return true;
}
-Object NativeErrorImp::construct(ExecState *exec, const List &args)
+ObjectImp *NativeErrorImp::construct(ExecState *exec, const List &args)
{
ObjectImp *imp = new ErrorInstanceImp(proto);
- Object obj(imp);
- if (args[0].type() != UndefinedType)
- imp->putDirect(messagePropertyName, new StringImp(args[0].toString(exec)));
+ ObjectImp *obj(imp);
+ if (!args[0]->isUndefined())
+ imp->putDirect(messagePropertyName, jsString(args[0]->toString(exec)));
return obj;
}
@@ -178,7 +172,7 @@
return true;
}
-Value NativeErrorImp::call(ExecState *exec, Object &/*thisObj*/, const List &args)
+ValueImp *NativeErrorImp::callAsFunction(ExecState *exec, ObjectImp */*thisObj*/, const List &args)
{
return construct(exec,args);
}
1.6 +6 -6 JavaScriptCore/kjs/error_object.h
Index: error_object.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/error_object.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- error_object.h 15 Jul 2005 16:58:56 -0000 1.5
+++ error_object.h 8 Aug 2005 04:07:28 -0000 1.6
@@ -46,7 +46,7 @@
public:
ErrorProtoFuncImp(ExecState *exec, FunctionPrototypeImp *funcProto);
virtual bool implementsCall() const;
- virtual Value call(ExecState *exec, Object &thisObj, const List &args);
+ virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args);
};
class ErrorObjectImp : public InternalFunctionImp {
@@ -55,10 +55,10 @@
ErrorPrototypeImp *errorProto);
virtual bool implementsConstruct() const;
- virtual Object construct(ExecState *exec, const List &args);
+ virtual ObjectImp *construct(ExecState *exec, const List &args);
virtual bool implementsCall() const;
- virtual Value call(ExecState *exec, Object &thisObj, const List &args);
+ virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args);
};
class NativeErrorPrototypeImp : public ObjectImp {
@@ -72,12 +72,12 @@
class NativeErrorImp : public InternalFunctionImp {
public:
NativeErrorImp(ExecState *exec, FunctionPrototypeImp *funcProto,
- const Object &prot);
+ ObjectImp *prot);
virtual bool implementsConstruct() const;
- virtual Object construct(ExecState *exec, const List &args);
+ virtual ObjectImp *construct(ExecState *exec, const List &args);
virtual bool implementsCall() const;
- virtual Value call(ExecState *exec, Object &thisObj, const List &args);
+ virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args);
virtual void mark();
1.52 +44 -49 JavaScriptCore/kjs/function.cpp
Index: function.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/function.cpp,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- function.cpp 7 Aug 2005 06:17:35 -0000 1.51
+++ function.cpp 8 Aug 2005 04:07:28 -0000 1.52
@@ -58,7 +58,7 @@
FunctionImp::FunctionImp(ExecState *exec, const Identifier &n)
: InternalFunctionImp(
- static_cast<FunctionPrototypeImp*>(exec->lexicalInterpreter()->builtinFunctionPrototype().imp())
+ static_cast<FunctionPrototypeImp*>(exec->lexicalInterpreter()->builtinFunctionPrototype())
), param(0L), ident(n)
{
}
@@ -73,9 +73,9 @@
return true;
}
-Value FunctionImp::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *FunctionImp::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- Object &globalObj = exec->dynamicInterpreter()->globalObject();
+ ObjectImp *globalObj = exec->dynamicInterpreter()->globalObject();
// enter a new execution context
ContextImp ctx(globalObj, exec->dynamicInterpreter()->imp(), thisObj, codeType(),
@@ -97,8 +97,7 @@
lineno = static_cast<DeclaredFunctionImp*>(this)->body->firstLine();
}
- Object func(this);
- bool cont = dbg->callEvent(&newExec,sid,lineno,func,args);
+ bool cont = dbg->callEvent(&newExec,sid,lineno,this,args);
if (!cont) {
dbg->imp()->abort();
return Undefined();
@@ -127,8 +126,7 @@
if (comp.complType() == Throw)
newExec.setException(comp.value());
- Object func(this);
- int cont = dbg->returnEvent(&newExec,sid,lineno,func);
+ int cont = dbg->returnEvent(&newExec,sid,lineno,this);
if (!cont) {
dbg->imp()->abort();
return Undefined();
@@ -172,7 +170,7 @@
// ECMA 10.1.3q
void FunctionImp::processParameters(ExecState *exec, const List &args)
{
- Object variable = exec->context().imp()->variableObject();
+ ObjectImp *variable = exec->context().imp()->variableObject();
#ifdef KJS_VERBOSE
fprintf(stderr, "---------------------------------------------------\n"
@@ -189,10 +187,10 @@
fprintf(stderr, "setting parameter %s ", p->name.ascii());
printInfo(exec,"to", *it);
#endif
- variable.put(exec, p->name, *it);
+ variable->put(exec, p->name, *it);
it++;
} else
- variable.put(exec, p->name, Undefined());
+ variable->put(exec, p->name, Undefined());
p = p->next;
}
}
@@ -208,7 +206,7 @@
{
}
-Value FunctionImp::argumentsGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *FunctionImp::argumentsGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
FunctionImp *thisObj = static_cast<FunctionImp *>(slot.slotBase());
ContextImp *context = exec->_context;
@@ -221,7 +219,7 @@
return Null();
}
-Value FunctionImp::lengthGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *FunctionImp::lengthGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
FunctionImp *thisObj = static_cast<FunctionImp *>(slot.slotBase());
const Parameter *p = thisObj->param;
@@ -250,7 +248,7 @@
return InternalFunctionImp::getOwnPropertySlot(exec, propertyName, slot);
}
-void FunctionImp::put(ExecState *exec, const Identifier &propertyName, const Value &value, int attr)
+void FunctionImp::put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr)
{
if (propertyName == exec->dynamicInterpreter()->argumentsIdentifier() || propertyName == lengthPropertyName)
return;
@@ -305,7 +303,6 @@
FunctionBodyNode *b, const ScopeChain &sc)
: FunctionImp(exec,n), body(b)
{
- Value protect(this);
body->ref();
setScope(sc);
}
@@ -322,21 +319,21 @@
}
// ECMA 13.2.2 [[Construct]]
-Object DeclaredFunctionImp::construct(ExecState *exec, const List &args)
+ObjectImp *DeclaredFunctionImp::construct(ExecState *exec, const List &args)
{
- Object proto;
- Value p = get(exec,prototypePropertyName);
- if (p.type() == ObjectType)
- proto = Object(static_cast<ObjectImp*>(p.imp()));
+ ObjectImp *proto;
+ ValueImp *p = get(exec,prototypePropertyName);
+ if (p->isObject())
+ proto = static_cast<ObjectImp*>(p);
else
proto = exec->lexicalInterpreter()->builtinObjectPrototype();
- Object obj(new ObjectImp(proto));
+ ObjectImp *obj(new ObjectImp(proto));
- Value res = call(exec,obj,args);
+ ValueImp *res = call(exec,obj,args);
- if (res.type() == ObjectType)
- return Object::dynamicCast(res);
+ if (res->isObject())
+ return static_cast<ObjectImp *>(res);
else
return obj;
}
@@ -433,7 +430,6 @@
_activationObject(act),
indexToNameMap(func, args)
{
- Value protect(this);
putDirect(calleePropertyName, func, DontEnum);
putDirect(lengthPropertyName, args.size(), DontEnum);
@@ -453,7 +449,7 @@
_activationObject->mark();
}
-Value ArgumentsImp::mappedIndexGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *ArgumentsImp::mappedIndexGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
ArgumentsImp *thisObj = static_cast<ArgumentsImp *>(slot.slotBase());
return thisObj->_activationObject->get(exec, thisObj->indexToNameMap[propertyName]);
@@ -469,7 +465,7 @@
return ObjectImp::getOwnPropertySlot(exec, propertyName, slot);
}
-void ArgumentsImp::put(ExecState *exec, const Identifier &propertyName, const Value &value, int attr)
+void ArgumentsImp::put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr)
{
if (indexToNameMap.isMapped(propertyName)) {
_activationObject->put(exec, indexToNameMap[propertyName], value, attr);
@@ -500,7 +496,7 @@
// FIXME: Do we need to support enumerating the arguments property?
}
-Value ActivationImp::argumentsGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *ActivationImp::argumentsGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
ActivationImp *thisObj = static_cast<ActivationImp *>(slot.slotBase());
@@ -508,7 +504,7 @@
if (!thisObj->_argumentsObject)
thisObj->createArgumentsObject(exec);
- return Value(thisObj->_argumentsObject);
+ return thisObj->_argumentsObject;
}
PropertySlot::GetValueFunc ActivationImp::getArgumentsGetter()
@@ -558,7 +554,6 @@
GlobalFuncImp::GlobalFuncImp(ExecState *exec, FunctionPrototypeImp *funcProto, int i, int len)
: InternalFunctionImp(funcProto), id(i)
{
- Value protect(this);
putDirect(lengthPropertyName, len, DontDelete|ReadOnly|DontEnum);
}
@@ -572,9 +567,9 @@
return true;
}
-static Value encode(ExecState *exec, const List &args, const char *do_not_escape)
+static ValueImp *encode(ExecState *exec, const List &args, const char *do_not_escape)
{
- UString r = "", s, str = args[0].toString(exec);
+ UString r = "", s, str = args[0]->toString(exec);
CString cstr = str.UTF8String();
const char *p = cstr.c_str();
for (int k = 0; k < cstr.size(); k++, p++) {
@@ -590,9 +585,9 @@
return String(r);
}
-static Value decode(ExecState *exec, const List &args, const char *do_not_unescape, bool strict)
+static ValueImp *decode(ExecState *exec, const List &args, const char *do_not_unescape, bool strict)
{
- UString s = "", str = args[0].toString(exec);
+ UString s = "", str = args[0]->toString(exec);
int k = 0, len = str.size();
const UChar *d = str.data();
UChar u;
@@ -634,7 +629,7 @@
}
if (charLen == 0) {
if (strict) {
- Object error = Error::create(exec, URIError);
+ ObjectImp *error = Error::create(exec, URIError);
exec->setException(error);
return error;
}
@@ -767,9 +762,9 @@
return s.toDouble( true /*tolerant*/, false /* NaN for empty string */ );
}
-Value GlobalFuncImp::call(ExecState *exec, Object &/*thisObj*/, const List &args)
+ValueImp *GlobalFuncImp::callAsFunction(ExecState *exec, ObjectImp */*thisObj*/, const List &args)
{
- Value res;
+ ValueImp *res = jsUndefined();
static const char do_not_escape[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
@@ -792,11 +787,11 @@
switch (id) {
case Eval: { // eval()
- Value x = args[0];
- if (x.type() != StringType)
+ ValueImp *x = args[0];
+ if (!x->isString())
return x;
else {
- UString s = x.toString(exec);
+ UString s = x->toString(exec);
int sid;
int errLine;
@@ -812,8 +807,8 @@
// no program node means a syntax occurred
if (!progNode) {
- Object err = Error::create(exec,SyntaxError,errMsg.ascii(),errLine);
- err.put(exec,"sid",Number(sid));
+ ObjectImp *err = Error::create(exec,SyntaxError,errMsg.ascii(),errLine);
+ err->put(exec,"sid",Number(sid));
exec->setException(err);
return err;
}
@@ -821,7 +816,7 @@
progNode->ref();
// enter a new execution context
- Object thisVal(Object::dynamicCast(exec->context().thisValue()));
+ ObjectImp *thisVal = static_cast<ObjectImp *>(exec->context().thisValue());
ContextImp ctx(exec->dynamicInterpreter()->globalObject(),
exec->dynamicInterpreter()->imp(),
thisVal,
@@ -851,16 +846,16 @@
break;
}
case ParseInt:
- res = Number(parseInt(args[0].toString(exec), args[1].toInt32(exec)));
+ res = Number(parseInt(args[0]->toString(exec), args[1]->toInt32(exec)));
break;
case ParseFloat:
- res = Number(parseFloat(args[0].toString(exec)));
+ res = Number(parseFloat(args[0]->toString(exec)));
break;
case IsNaN:
- res = Boolean(isNaN(args[0].toNumber(exec)));
+ res = Boolean(isNaN(args[0]->toNumber(exec)));
break;
case IsFinite: {
- double n = args[0].toNumber(exec);
+ double n = args[0]->toNumber(exec);
res = Boolean(!isNaN(n) && !isInf(n));
break;
}
@@ -878,7 +873,7 @@
break;
case Escape:
{
- UString r = "", s, str = args[0].toString(exec);
+ UString r = "", s, str = args[0]->toString(exec);
const UChar *c = str.data();
for (int k = 0; k < str.size(); k++, c++) {
int u = c->uc;
@@ -900,7 +895,7 @@
}
case UnEscape:
{
- UString s = "", str = args[0].toString(exec);
+ UString s = "", str = args[0]->toString(exec);
int k = 0, len = str.size();
while (k < len) {
const UChar *c = str.data() + k;
@@ -927,7 +922,7 @@
}
#ifndef NDEBUG
case KJSPrint:
- puts(args[0].toString(exec).ascii());
+ puts(args[0]->toString(exec).ascii());
break;
#endif
}
1.30 +9 -10 JavaScriptCore/kjs/function.h
Index: function.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/function.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- function.h 7 Aug 2005 06:17:35 -0000 1.29
+++ function.h 8 Aug 2005 04:07:28 -0000 1.30
@@ -43,11 +43,11 @@
virtual ~FunctionImp();
virtual bool getOwnPropertySlot(ExecState *, const Identifier &, PropertySlot&);
- virtual void put(ExecState *exec, const Identifier &propertyName, const Value &value, int attr = None);
+ virtual void put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr = None);
virtual bool deleteProperty(ExecState *exec, const Identifier &propertyName);
virtual bool implementsCall() const;
- virtual Value call(ExecState *exec, Object &thisObj, const List &args);
+ virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args);
void addParameter(const Identifier &n);
Identifier getParameterName(int index);
@@ -65,8 +65,8 @@
Identifier ident;
private:
- static Value argumentsGetter(ExecState *, const Identifier &, const PropertySlot&);
- static Value lengthGetter(ExecState *, const Identifier &, const PropertySlot&);
+ static ValueImp *argumentsGetter(ExecState *, const Identifier &, const PropertySlot&);
+ static ValueImp *lengthGetter(ExecState *, const Identifier &, const PropertySlot&);
void processParameters(ExecState *exec, const List &);
virtual void processVarDecls(ExecState *exec);
@@ -79,7 +79,7 @@
~DeclaredFunctionImp();
bool implementsConstruct() const;
- Object construct(ExecState *exec, const List &args);
+ ObjectImp *construct(ExecState *exec, const List &args);
virtual Completion execute(ExecState *exec);
CodeType codeType() const { return FunctionCode; }
@@ -112,13 +112,12 @@
ArgumentsImp(ExecState *exec, FunctionImp *func, const List &args, ActivationImp *act);
virtual void mark();
virtual bool getOwnPropertySlot(ExecState *, const Identifier &, PropertySlot&);
- virtual void put(ExecState *exec, const Identifier &propertyName,
- const Value &value, int attr = None);
+ virtual void put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr = None);
virtual bool deleteProperty(ExecState *exec, const Identifier &propertyName);
virtual const ClassInfo *classInfo() const { return &info; }
static const ClassInfo info;
private:
- static Value mappedIndexGetter(ExecState *exec, const Identifier &, const PropertySlot& slot);
+ static ValueImp *mappedIndexGetter(ExecState *exec, const Identifier &, const PropertySlot& slot);
ActivationImp *_activationObject;
mutable IndexToNameMap indexToNameMap;
@@ -138,7 +137,7 @@
private:
static PropertySlot::GetValueFunc getArgumentsGetter();
- static Value argumentsGetter(ExecState *exec, const Identifier &, const PropertySlot& slot);
+ static ValueImp *argumentsGetter(ExecState *exec, const Identifier &, const PropertySlot& slot);
void createArgumentsObject(ExecState *exec) const;
FunctionImp *_function;
@@ -150,7 +149,7 @@
public:
GlobalFuncImp(ExecState *exec, FunctionPrototypeImp *funcProto, int i, int len);
virtual bool implementsCall() const;
- virtual Value call(ExecState *exec, Object &thisObj, const List &args);
+ virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args);
virtual CodeType codeType() const;
enum { Eval, ParseInt, ParseFloat, IsNaN, IsFinite, Escape, UnEscape,
DecodeURI, DecodeURIComponent, EncodeURI, EncodeURIComponent
1.27 +52 -56 JavaScriptCore/kjs/function_object.cpp
Index: function_object.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/function_object.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- function_object.cpp 27 Jul 2005 23:10:49 -0000 1.26
+++ function_object.cpp 8 Aug 2005 04:07:28 -0000 1.27
@@ -40,8 +40,7 @@
FunctionPrototypeImp::FunctionPrototypeImp(ExecState *exec)
: InternalFunctionImp(0)
{
- Value protect(this);
- putDirect(lengthPropertyName, NumberImp::zero(), DontDelete|ReadOnly|DontEnum);
+ putDirect(lengthPropertyName, jsZero(), DontDelete|ReadOnly|DontEnum);
putDirect(toStringPropertyName, new FunctionProtoFuncImp(exec, this, FunctionProtoFuncImp::ToString, 0), DontEnum);
static const Identifier applyPropertyName("apply");
putDirect(applyPropertyName, new FunctionProtoFuncImp(exec, this, FunctionProtoFuncImp::Apply, 2), DontEnum);
@@ -59,7 +58,7 @@
}
// ECMA 15.3.4
-Value FunctionPrototypeImp::call(ExecState */*exec*/, Object &/*thisObj*/, const List &/*args*/)
+ValueImp *FunctionPrototypeImp::callAsFunction(ExecState */*exec*/, ObjectImp */*thisObj*/, const List &/*args*/)
{
return Undefined();
}
@@ -70,7 +69,6 @@
FunctionPrototypeImp *funcProto, int i, int len)
: InternalFunctionImp(funcProto), id(i)
{
- Value protect(this);
putDirect(lengthPropertyName, len, DontDelete|ReadOnly|DontEnum);
}
@@ -80,29 +78,29 @@
return true;
}
-Value FunctionProtoFuncImp::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *FunctionProtoFuncImp::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- Value result;
+ ValueImp *result = NULL;
switch (id) {
case ToString: {
// ### also make this work for internal functions
- if (thisObj.isNull() || !thisObj.inherits(&InternalFunctionImp::info)) {
+ if (!thisObj || !thisObj->inherits(&InternalFunctionImp::info)) {
#ifndef NDEBUG
fprintf(stderr,"attempted toString() call on null or non-function object\n");
#endif
- Object err = Error::create(exec,TypeError);
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
- if (thisObj.inherits(&DeclaredFunctionImp::info)) {
+ if (thisObj->inherits(&DeclaredFunctionImp::info)) {
DeclaredFunctionImp *fi = static_cast<DeclaredFunctionImp*>
- (thisObj.imp());
+ (thisObj);
return String("function " + fi->name().ustring() + "(" +
fi->parameterString() + ") " + fi->body->toString());
- } else if (thisObj.inherits(&FunctionImp::info) &&
- !static_cast<FunctionImp*>(thisObj.imp())->name().isNull()) {
- result = String("function " + static_cast<FunctionImp*>(thisObj.imp())->name().ustring() + "()");
+ } else if (thisObj->inherits(&FunctionImp::info) &&
+ !static_cast<FunctionImp*>(thisObj)->name().isNull()) {
+ result = String("function " + static_cast<FunctionImp*>(thisObj)->name().ustring() + "()");
}
else {
result = String("(Internal Function)");
@@ -110,59 +108,59 @@
}
break;
case Apply: {
- Value thisArg = args[0];
- Value argArray = args[1];
- Object func = thisObj;
+ ValueImp *thisArg = args[0];
+ ValueImp *argArray = args[1];
+ ObjectImp *func = thisObj;
- if (!func.implementsCall()) {
- Object err = Error::create(exec,TypeError);
+ if (!func->implementsCall()) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
- Object applyThis;
- if (thisArg.isA(NullType) || thisArg.isA(UndefinedType))
+ ObjectImp *applyThis;
+ if (thisArg->isUndefinedOrNull())
applyThis = exec->dynamicInterpreter()->globalObject();
else
- applyThis = thisArg.toObject(exec);
+ applyThis = thisArg->toObject(exec);
List applyArgs;
- if (!argArray.isA(NullType) && !argArray.isA(UndefinedType)) {
- if (argArray.isA(ObjectType) &&
- (Object::dynamicCast(argArray).inherits(&ArrayInstanceImp::info) ||
- Object::dynamicCast(argArray).inherits(&ArgumentsImp::info))) {
+ if (!argArray->isUndefinedOrNull()) {
+ if (argArray->isObject() &&
+ (static_cast<ObjectImp *>(argArray)->inherits(&ArrayInstanceImp::info) ||
+ static_cast<ObjectImp *>(argArray)->inherits(&ArgumentsImp::info))) {
- Object argArrayObj = Object::dynamicCast(argArray);
- unsigned int length = argArrayObj.get(exec,lengthPropertyName).toUInt32(exec);
+ ObjectImp *argArrayObj = static_cast<ObjectImp *>(argArray);
+ unsigned int length = argArrayObj->get(exec,lengthPropertyName)->toUInt32(exec);
for (unsigned int i = 0; i < length; i++)
- applyArgs.append(argArrayObj.get(exec,i));
+ applyArgs.append(argArrayObj->get(exec,i));
}
else {
- Object err = Error::create(exec,TypeError);
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
}
- result = func.call(exec,applyThis,applyArgs);
+ result = func->call(exec,applyThis,applyArgs);
}
break;
case Call: {
- Value thisArg = args[0];
- Object func = thisObj;
+ ValueImp *thisArg = args[0];
+ ObjectImp *func = thisObj;
- if (!func.implementsCall()) {
- Object err = Error::create(exec,TypeError);
+ if (!func->implementsCall()) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
- Object callThis;
- if (thisArg.isA(NullType) || thisArg.isA(UndefinedType))
+ ObjectImp *callThis;
+ if (thisArg->isUndefinedOrNull())
callThis = exec->dynamicInterpreter()->globalObject();
else
- callThis = thisArg.toObject(exec);
+ callThis = thisArg->toObject(exec);
- result = func.call(exec,callThis,args.copyTail());
+ result = func->call(exec,callThis,args.copyTail());
}
break;
}
@@ -175,11 +173,10 @@
FunctionObjectImp::FunctionObjectImp(ExecState *exec, FunctionPrototypeImp *funcProto)
: InternalFunctionImp(funcProto)
{
- Value protect(this);
putDirect(prototypePropertyName, funcProto, DontEnum|DontDelete|ReadOnly);
// no. of arguments for constructor
- putDirect(lengthPropertyName, NumberImp::one(), ReadOnly|DontDelete|DontEnum);
+ putDirect(lengthPropertyName, jsOne(), ReadOnly|DontDelete|DontEnum);
}
FunctionObjectImp::~FunctionObjectImp()
@@ -192,7 +189,7 @@
}
// ECMA 15.3.2 The Function Constructor
-Object FunctionObjectImp::construct(ExecState *exec, const List &args, const UString &sourceURL, int lineNumber)
+ObjectImp *FunctionObjectImp::construct(ExecState *exec, const List &args, const UString &sourceURL, int lineNumber)
{
UString p("");
UString body;
@@ -200,12 +197,12 @@
if (argsSize == 0) {
body = "";
} else if (argsSize == 1) {
- body = args[0].toString(exec);
+ body = args[0]->toString(exec);
} else {
- p = args[0].toString(exec);
+ p = args[0]->toString(exec);
for (int k = 1; k < argsSize - 1; k++)
- p += "," + args[k].toString(exec);
- body = args[argsSize-1].toString(exec);
+ p += "," + args[k]->toString(exec);
+ body = args[argsSize-1]->toString(exec);
}
// parse the source code
@@ -221,13 +218,13 @@
bool cont = dbg->sourceParsed(exec,sid,UString(),body,errLine);
if (!cont) {
dbg->imp()->abort();
- return Object(new ObjectImp());
+ return new ObjectImp();
}
}
// no program node == syntax error - throw a syntax error
if (!progNode) {
- Object err = Error::create(exec,SyntaxError,errMsg.ascii(),errLine);
+ ObjectImp *err = Error::create(exec,SyntaxError,errMsg.ascii(),errLine);
// we can't return a Completion(Throw) here, so just set the exception
// and return it
exec->setException(err);
@@ -235,12 +232,11 @@
}
ScopeChain scopeChain;
- scopeChain.push(exec->dynamicInterpreter()->globalObject().imp());
+ scopeChain.push(exec->dynamicInterpreter()->globalObject());
FunctionBodyNode *bodyNode = progNode;
FunctionImp *fimp = new DeclaredFunctionImp(exec, Identifier::null(), bodyNode,
scopeChain);
- Object ret(fimp); // protect from GC
// parse parameter list. throw syntax error on illegal identifiers
int len = p.size();
@@ -271,7 +267,7 @@
continue;
} // else error
}
- Object err = Error::create(exec,SyntaxError,
+ ObjectImp *err = Error::create(exec,SyntaxError,
I18N_NOOP("Syntax error in parameter list"),
-1);
exec->setException(err);
@@ -280,15 +276,15 @@
List consArgs;
- Object objCons = exec->lexicalInterpreter()->builtinObject();
- Object prototype = objCons.construct(exec,List::empty());
- prototype.put(exec, constructorPropertyName, Value(fimp), DontEnum|DontDelete|ReadOnly);
+ ObjectImp *objCons = exec->lexicalInterpreter()->builtinObject();
+ ObjectImp *prototype = objCons->construct(exec,List::empty());
+ prototype->put(exec, constructorPropertyName, fimp, DontEnum|DontDelete|ReadOnly);
fimp->put(exec, prototypePropertyName, prototype, DontEnum|DontDelete|ReadOnly);
- return ret;
+ return fimp;
}
// ECMA 15.3.2 The Function Constructor
-Object FunctionObjectImp::construct(ExecState *exec, const List &args)
+ObjectImp *FunctionObjectImp::construct(ExecState *exec, const List &args)
{
return FunctionObjectImp::construct(exec, args, UString(), 0);
}
@@ -300,7 +296,7 @@
}
// ECMA 15.3.1 The Function Constructor Called as a Function
-Value FunctionObjectImp::call(ExecState *exec, Object &/*thisObj*/, const List &args)
+ValueImp *FunctionObjectImp::callAsFunction(ExecState *exec, ObjectImp */*thisObj*/, const List &args)
{
return construct(exec,args);
}
1.6 +5 -5 JavaScriptCore/kjs/function_object.h
Index: function_object.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/function_object.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- function_object.h 14 Jul 2005 18:27:02 -0000 1.5
+++ function_object.h 8 Aug 2005 04:07:28 -0000 1.6
@@ -40,7 +40,7 @@
virtual ~FunctionPrototypeImp();
virtual bool implementsCall() const;
- virtual Value call(ExecState *exec, Object &thisObj, const List &args);
+ virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args);
};
/**
@@ -55,7 +55,7 @@
FunctionPrototypeImp *funcProto, int i, int len);
virtual bool implementsCall() const;
- virtual Value call(ExecState *exec, Object &thisObj, const List &args);
+ virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args);
enum { ToString, Apply, Call };
private:
@@ -73,10 +73,10 @@
virtual ~FunctionObjectImp();
virtual bool implementsConstruct() const;
- virtual Object construct(ExecState *exec, const List &args, const UString &sourceURL, int lineNumber);
- virtual Object construct(ExecState *exec, const List &args);
+ virtual ObjectImp *construct(ExecState *exec, const List &args, const UString &sourceURL, int lineNumber);
+ virtual ObjectImp *construct(ExecState *exec, const List &args);
virtual bool implementsCall() const;
- virtual Value call(ExecState *exec, Object &thisObj, const List &args);
+ virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args);
};
} // namespace
1.61 +140 -196 JavaScriptCore/kjs/internal.cpp
Index: internal.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/internal.cpp,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -r1.60 -r1.61
--- internal.cpp 7 Aug 2005 06:17:35 -0000 1.60
+++ internal.cpp 8 Aug 2005 04:07:28 -0000 1.61
@@ -53,11 +53,10 @@
extern int kjsyyparse();
-using namespace KJS;
+namespace KJS {
#if !APPLE_CHANGES
-namespace KJS {
#ifdef WORDS_BIGENDIAN
const unsigned char NaN_Bytes[] = { 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 };
const unsigned char Inf_Bytes[] = { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 };
@@ -71,7 +70,6 @@
const double NaN = *(const double*) NaN_Bytes;
const double Inf = *(const double*) Inf_Bytes;
-};
#endif // APPLE_CHANGES
@@ -107,11 +105,9 @@
// ------------------------------ UndefinedImp ---------------------------------
-UndefinedImp *UndefinedImp::staticUndefined = 0;
-
-Value UndefinedImp::toPrimitive(ExecState */*exec*/, Type) const
+ValueImp *UndefinedImp::toPrimitive(ExecState */*exec*/, Type) const
{
- return Value((ValueImp*)this);
+ return const_cast<UndefinedImp *>(this);
}
bool UndefinedImp::toBoolean(ExecState */*exec*/) const
@@ -129,20 +125,18 @@
return "undefined";
}
-Object UndefinedImp::toObject(ExecState *exec) const
+ObjectImp *UndefinedImp::toObject(ExecState *exec) const
{
- Object err = Error::create(exec, TypeError, I18N_NOOP("Undefined value"));
+ ObjectImp *err = Error::create(exec, TypeError, I18N_NOOP("Undefined value"));
exec->setException(err);
return err;
}
// ------------------------------ NullImp --------------------------------------
-NullImp *NullImp::staticNull = 0;
-
-Value NullImp::toPrimitive(ExecState */*exec*/, Type) const
+ValueImp *NullImp::toPrimitive(ExecState */*exec*/, Type) const
{
- return Value((ValueImp*)this);
+ return const_cast<NullImp *>(this);
}
bool NullImp::toBoolean(ExecState */*exec*/) const
@@ -160,21 +154,18 @@
return "null";
}
-Object NullImp::toObject(ExecState *exec) const
+ObjectImp *NullImp::toObject(ExecState *exec) const
{
- Object err = Error::create(exec, TypeError, I18N_NOOP("Null value"));
+ ObjectImp *err = Error::create(exec, TypeError, I18N_NOOP("Null value"));
exec->setException(err);
return err;
}
// ------------------------------ BooleanImp -----------------------------------
-BooleanImp* BooleanImp::staticTrue = 0;
-BooleanImp* BooleanImp::staticFalse = 0;
-
-Value BooleanImp::toPrimitive(ExecState */*exec*/, Type) const
+ValueImp *BooleanImp::toPrimitive(ExecState */*exec*/, Type) const
{
- return Value((ValueImp*)this);
+ return const_cast<BooleanImp *>(this);
}
bool BooleanImp::toBoolean(ExecState */*exec*/) const
@@ -192,18 +183,18 @@
return val ? "true" : "false";
}
-Object BooleanImp::toObject(ExecState *exec) const
+ObjectImp *BooleanImp::toObject(ExecState *exec) const
{
List args;
args.append(const_cast<BooleanImp*>(this));
- return Object::dynamicCast(exec->lexicalInterpreter()->builtinBoolean().construct(exec,args));
+ return static_cast<ObjectImp *>(exec->lexicalInterpreter()->builtinBoolean()->construct(exec,args));
}
// ------------------------------ StringImp ------------------------------------
-Value StringImp::toPrimitive(ExecState */*exec*/, Type) const
+ValueImp *StringImp::toPrimitive(ExecState */*exec*/, Type) const
{
- return Value((ValueImp*)this);
+ return const_cast<StringImp *>(this);
}
bool StringImp::toBoolean(ExecState */*exec*/) const
@@ -221,36 +212,18 @@
return val;
}
-Object StringImp::toObject(ExecState *exec) const
+ObjectImp *StringImp::toObject(ExecState *exec) const
{
List args;
args.append(const_cast<StringImp*>(this));
- return Object(static_cast<ObjectImp *>(exec->lexicalInterpreter()->builtinString().construct(exec, args).imp()));
+ return static_cast<ObjectImp *>(exec->lexicalInterpreter()->builtinString()->construct(exec, args));
}
// ------------------------------ NumberImp ------------------------------------
-NumberImp *NumberImp::staticNaN;
-
-ValueImp *NumberImp::create(int i)
-{
- if (SimpleNumber::fits(i))
- return SimpleNumber::make(i);
- return new NumberImp(static_cast<double>(i));
-}
-
-ValueImp *NumberImp::create(double d)
+ValueImp *NumberImp::toPrimitive(ExecState *, Type) const
{
- if (SimpleNumber::fits(d))
- return SimpleNumber::make((int)d);
- if (isNaN(d))
- return staticNaN;
- return new NumberImp(d);
-}
-
-Value NumberImp::toPrimitive(ExecState *, Type) const
-{
- return Number((NumberImp*)this);
+ return const_cast<NumberImp *>(this);
}
bool NumberImp::toBoolean(ExecState *) const
@@ -270,16 +243,16 @@
return UString::from(val);
}
-Object NumberImp::toObject(ExecState *exec) const
+ObjectImp *NumberImp::toObject(ExecState *exec) const
{
List args;
args.append(const_cast<NumberImp*>(this));
- return Object::dynamicCast(exec->lexicalInterpreter()->builtinNumber().construct(exec,args));
+ return static_cast<ObjectImp *>(exec->lexicalInterpreter()->builtinNumber()->construct(exec,args));
}
-bool NumberImp::toUInt32(unsigned& uint32) const
+bool NumberImp::getUInt32(uint32_t& uint32) const
{
- uint32 = (unsigned)val;
+ uint32 = (uint32_t)val;
return (double)uint32 == val;
}
@@ -315,7 +288,7 @@
bool LabelStack::push(const Identifier &id)
{
- if (id.isEmpty() || contains(id))
+ if (contains(id))
return false;
StackElem *newtos = new StackElem;
@@ -365,7 +338,7 @@
// ------------------------------ ContextImp -----------------------------------
// ECMA 10.2
-ContextImp::ContextImp(Object &glob, InterpreterImp *interpreter, Object &thisV, CodeType type,
+ContextImp::ContextImp(ObjectImp *glob, InterpreterImp *interpreter, ObjectImp *thisV, CodeType type,
ContextImp *callingCon, FunctionImp *func, const List *args)
: _interpreter(interpreter), _function(func), _arguments(args)
{
@@ -374,10 +347,10 @@
// create and initialize activation object (ECMA 10.1.6)
if (type == FunctionCode || type == AnonymousCode ) {
- activation = Object(new ActivationImp(func, *args));
+ activation = new ActivationImp(func, *args);
variable = activation;
} else {
- activation = Object();
+ activation = NULL;
variable = glob;
}
@@ -392,18 +365,18 @@
} // else same as GlobalCode
case GlobalCode:
scope.clear();
- scope.push(glob.imp());
- thisVal = Object(static_cast<ObjectImp*>(glob.imp()));
+ scope.push(glob);
+ thisVal = static_cast<ObjectImp*>(glob);
break;
case FunctionCode:
case AnonymousCode:
if (type == FunctionCode) {
scope = func->scope();
- scope.push(activation.imp());
+ scope.push(activation);
} else {
scope.clear();
- scope.push(glob.imp());
- scope.push(activation.imp());
+ scope.push(glob);
+ scope.push(activation);
}
variable = activation; // TODO: DontDelete ? (ECMA 10.2.3)
thisVal = thisV;
@@ -478,27 +451,17 @@
void InterpreterImp::globalInit()
{
- //fprintf( stderr, "InterpreterImp::globalInit()\n" );
- UndefinedImp::staticUndefined = new UndefinedImp();
- NullImp::staticNull = new NullImp();
- BooleanImp::staticTrue = new BooleanImp(true);
- BooleanImp::staticFalse = new BooleanImp(false);
- NumberImp::staticNaN = new NumberImp(NaN);
+ ConstantValues::init();
}
void InterpreterImp::globalClear()
{
- //fprintf( stderr, "InterpreterImp::globalClear()\n" );
- UndefinedImp::staticUndefined = 0;
- NullImp::staticNull = 0;
- BooleanImp::staticTrue = 0;
- BooleanImp::staticFalse = 0;
- NumberImp::staticNaN = 0;
+ ConstantValues::clear();
}
-InterpreterImp::InterpreterImp(Interpreter *interp, const Object &glob)
- : globExec(interp, 0)
- , _context(0)
+InterpreterImp::InterpreterImp(Interpreter *interp, ObjectImp *glob)
+ : globExec(interp, 0)
+ , _context(0)
{
// add this interpreter to the global chain
// as a root set for garbage collection
@@ -515,7 +478,7 @@
globalInit();
}
- InterpreterMap::setInterpreterForGlobalObject(this, glob.imp());
+ InterpreterMap::setInterpreterForGlobalObject(this, glob);
global = glob;
dbg = 0;
@@ -550,81 +513,75 @@
// Contructor prototype objects (Object.prototype, Array.prototype etc)
FunctionPrototypeImp *funcProto = new FunctionPrototypeImp(&globExec);
- b_FunctionPrototype = Object(funcProto);
+ b_FunctionPrototype = funcProto;
ObjectPrototypeImp *objProto = new ObjectPrototypeImp(&globExec, funcProto);
- b_ObjectPrototype = Object(objProto);
+ b_ObjectPrototype = objProto;
funcProto->setPrototype(b_ObjectPrototype);
ArrayPrototypeImp *arrayProto = new ArrayPrototypeImp(&globExec, objProto);
- b_ArrayPrototype = Object(arrayProto);
+ b_ArrayPrototype = arrayProto;
StringPrototypeImp *stringProto = new StringPrototypeImp(&globExec, objProto);
- b_StringPrototype = Object(stringProto);
+ b_StringPrototype = stringProto;
BooleanPrototypeImp *booleanProto = new BooleanPrototypeImp(&globExec, objProto, funcProto);
- b_BooleanPrototype = Object(booleanProto);
+ b_BooleanPrototype = booleanProto;
NumberPrototypeImp *numberProto = new NumberPrototypeImp(&globExec, objProto, funcProto);
- b_NumberPrototype = Object(numberProto);
+ b_NumberPrototype = numberProto;
DatePrototypeImp *dateProto = new DatePrototypeImp(&globExec, objProto);
- b_DatePrototype = Object(dateProto);
+ b_DatePrototype = dateProto;
RegExpPrototypeImp *regexpProto = new RegExpPrototypeImp(&globExec, objProto, funcProto);
- b_RegExpPrototype = Object(regexpProto);
+ b_RegExpPrototype = regexpProto;
ErrorPrototypeImp *errorProto = new ErrorPrototypeImp(&globExec, objProto, funcProto);
- b_ErrorPrototype = Object(errorProto);
+ b_ErrorPrototype = errorProto;
- static_cast<ObjectImp*>(global.imp())->setPrototype(b_ObjectPrototype);
+ static_cast<ObjectImp*>(global)->setPrototype(b_ObjectPrototype);
// Constructors (Object, Array, etc.)
- b_Object = Object(new ObjectObjectImp(&globExec, objProto, funcProto));
- b_Function = Object(new FunctionObjectImp(&globExec, funcProto));
- b_Array = Object(new ArrayObjectImp(&globExec, funcProto, arrayProto));
- b_String = Object(new StringObjectImp(&globExec, funcProto, stringProto));
- b_Boolean = Object(new BooleanObjectImp(&globExec, funcProto, booleanProto));
- b_Number = Object(new NumberObjectImp(&globExec, funcProto, numberProto));
- b_Date = Object(new DateObjectImp(&globExec, funcProto, dateProto));
- b_RegExp = Object(new RegExpObjectImp(&globExec, funcProto, regexpProto));
- b_Error = Object(new ErrorObjectImp(&globExec, funcProto, errorProto));
+ b_Object = new ObjectObjectImp(&globExec, objProto, funcProto);
+ b_Function = new FunctionObjectImp(&globExec, funcProto);
+ b_Array = new ArrayObjectImp(&globExec, funcProto, arrayProto);
+ b_String = new StringObjectImp(&globExec, funcProto, stringProto);
+ b_Boolean = new BooleanObjectImp(&globExec, funcProto, booleanProto);
+ b_Number = new NumberObjectImp(&globExec, funcProto, numberProto);
+ b_Date = new DateObjectImp(&globExec, funcProto, dateProto);
+ b_RegExp = new RegExpObjectImp(&globExec, funcProto, regexpProto);
+ b_Error = new ErrorObjectImp(&globExec, funcProto, errorProto);
// Error object prototypes
- b_evalErrorPrototype = Object(new NativeErrorPrototypeImp(&globExec, errorProto, EvalError,
- "EvalError", "EvalError"));
- b_rangeErrorPrototype = Object(new NativeErrorPrototypeImp(&globExec, errorProto, RangeError,
- "RangeError", "RangeError"));
- b_referenceErrorPrototype = Object(new NativeErrorPrototypeImp(&globExec, errorProto, ReferenceError,
- "ReferenceError", "ReferenceError"));
- b_syntaxErrorPrototype = Object(new NativeErrorPrototypeImp(&globExec, errorProto, SyntaxError,
- "SyntaxError", "SyntaxError"));
- b_typeErrorPrototype = Object(new NativeErrorPrototypeImp(&globExec, errorProto, TypeError,
- "TypeError", "TypeError"));
- b_uriErrorPrototype = Object(new NativeErrorPrototypeImp(&globExec, errorProto, URIError,
- "URIError", "URIError"));
+ b_evalErrorPrototype = new NativeErrorPrototypeImp(&globExec, errorProto, EvalError, "EvalError", "EvalError");
+ b_rangeErrorPrototype = new NativeErrorPrototypeImp(&globExec, errorProto, RangeError, "RangeError", "RangeError");
+ b_referenceErrorPrototype = new NativeErrorPrototypeImp(&globExec, errorProto, ReferenceError, "ReferenceError", "ReferenceError");
+ b_syntaxErrorPrototype = new NativeErrorPrototypeImp(&globExec, errorProto, SyntaxError, "SyntaxError", "SyntaxError");
+ b_typeErrorPrototype = new NativeErrorPrototypeImp(&globExec, errorProto, TypeError, "TypeError", "TypeError");
+ b_uriErrorPrototype = new NativeErrorPrototypeImp(&globExec, errorProto, URIError, "URIError", "URIError");
// Error objects
- b_evalError = Object(new NativeErrorImp(&globExec, funcProto, b_evalErrorPrototype));
- b_rangeError = Object(new NativeErrorImp(&globExec, funcProto, b_rangeErrorPrototype));
- b_referenceError = Object(new NativeErrorImp(&globExec, funcProto, b_referenceErrorPrototype));
- b_syntaxError = Object(new NativeErrorImp(&globExec, funcProto, b_syntaxErrorPrototype));
- b_typeError = Object(new NativeErrorImp(&globExec, funcProto, b_typeErrorPrototype));
- b_uriError = Object(new NativeErrorImp(&globExec, funcProto, b_uriErrorPrototype));
+ b_evalError = new NativeErrorImp(&globExec, funcProto, b_evalErrorPrototype);
+ b_rangeError = new NativeErrorImp(&globExec, funcProto, b_rangeErrorPrototype);
+ b_referenceError = new NativeErrorImp(&globExec, funcProto, b_referenceErrorPrototype);
+ b_syntaxError = new NativeErrorImp(&globExec, funcProto, b_syntaxErrorPrototype);
+ b_typeError = new NativeErrorImp(&globExec, funcProto, b_typeErrorPrototype);
+ b_uriError = new NativeErrorImp(&globExec, funcProto, b_uriErrorPrototype);
// ECMA 15.3.4.1
funcProto->put(&globExec, "constructor", b_Function, DontEnum);
- global.put(&globExec, "Object", b_Object, DontEnum);
- global.put(&globExec, "Function", b_Function, DontEnum);
- global.put(&globExec, "Array", b_Array, DontEnum);
- global.put(&globExec, "Boolean", b_Boolean, DontEnum);
- global.put(&globExec, "String", b_String, DontEnum);
- global.put(&globExec, "Number", b_Number, DontEnum);
- global.put(&globExec, "Date", b_Date, DontEnum);
- global.put(&globExec, "RegExp", b_RegExp, DontEnum);
- global.put(&globExec, "Error", b_Error, DontEnum);
+ global->put(&globExec, "Object", b_Object, DontEnum);
+ global->put(&globExec, "Function", b_Function, DontEnum);
+ global->put(&globExec, "Array", b_Array, DontEnum);
+ global->put(&globExec, "Boolean", b_Boolean, DontEnum);
+ global->put(&globExec, "String", b_String, DontEnum);
+ global->put(&globExec, "Number", b_Number, DontEnum);
+ global->put(&globExec, "Date", b_Date, DontEnum);
+ global->put(&globExec, "RegExp", b_RegExp, DontEnum);
+ global->put(&globExec, "Error", b_Error, DontEnum);
// Using Internal for those to have something != 0
// (see kjs_window). Maybe DontEnum would be ok too ?
- global.put(&globExec, "EvalError",b_evalError, Internal);
- global.put(&globExec, "RangeError",b_rangeError, Internal);
- global.put(&globExec, "ReferenceError",b_referenceError, Internal);
- global.put(&globExec, "SyntaxError",b_syntaxError, Internal);
- global.put(&globExec, "TypeError",b_typeError, Internal);
- global.put(&globExec, "URIError",b_uriError, Internal);
+ global->put(&globExec, "EvalError",b_evalError, Internal);
+ global->put(&globExec, "RangeError",b_rangeError, Internal);
+ global->put(&globExec, "ReferenceError",b_referenceError, Internal);
+ global->put(&globExec, "SyntaxError",b_syntaxError, Internal);
+ global->put(&globExec, "TypeError",b_typeError, Internal);
+ global->put(&globExec, "URIError",b_uriError, Internal);
// Set the "constructor" property of all builtin constructors
objProto->put(&globExec, "constructor", b_Object, DontEnum | DontDelete | ReadOnly);
@@ -636,36 +593,36 @@
dateProto->put(&globExec, "constructor", b_Date, DontEnum | DontDelete | ReadOnly);
regexpProto->put(&globExec, "constructor", b_RegExp, DontEnum | DontDelete | ReadOnly);
errorProto->put(&globExec, "constructor", b_Error, DontEnum | DontDelete | ReadOnly);
- b_evalErrorPrototype.put(&globExec, "constructor", b_evalError, DontEnum | DontDelete | ReadOnly);
- b_rangeErrorPrototype.put(&globExec, "constructor", b_rangeError, DontEnum | DontDelete | ReadOnly);
- b_referenceErrorPrototype.put(&globExec, "constructor", b_referenceError, DontEnum | DontDelete | ReadOnly);
- b_syntaxErrorPrototype.put(&globExec, "constructor", b_syntaxError, DontEnum | DontDelete | ReadOnly);
- b_typeErrorPrototype.put(&globExec, "constructor", b_typeError, DontEnum | DontDelete | ReadOnly);
- b_uriErrorPrototype.put(&globExec, "constructor", b_uriError, DontEnum | DontDelete | ReadOnly);
+ b_evalErrorPrototype->put(&globExec, "constructor", b_evalError, DontEnum | DontDelete | ReadOnly);
+ b_rangeErrorPrototype->put(&globExec, "constructor", b_rangeError, DontEnum | DontDelete | ReadOnly);
+ b_referenceErrorPrototype->put(&globExec, "constructor", b_referenceError, DontEnum | DontDelete | ReadOnly);
+ b_syntaxErrorPrototype->put(&globExec, "constructor", b_syntaxError, DontEnum | DontDelete | ReadOnly);
+ b_typeErrorPrototype->put(&globExec, "constructor", b_typeError, DontEnum | DontDelete | ReadOnly);
+ b_uriErrorPrototype->put(&globExec, "constructor", b_uriError, DontEnum | DontDelete | ReadOnly);
// built-in values
- global.put(&globExec, "NaN", Number(NaN), DontEnum|DontDelete);
- global.put(&globExec, "Infinity", Number(Inf), DontEnum|DontDelete);
- global.put(&globExec, "undefined", Undefined(), DontEnum|DontDelete);
+ global->put(&globExec, "NaN", jsNaN(), DontEnum|DontDelete);
+ global->put(&globExec, "Infinity", Number(Inf), DontEnum|DontDelete);
+ global->put(&globExec, "undefined", Undefined(), DontEnum|DontDelete);
// built-in functions
- global.put(&globExec, "eval", Object(new GlobalFuncImp(&globExec, funcProto, GlobalFuncImp::Eval, 1)), DontEnum);
- global.put(&globExec, "parseInt", Object(new GlobalFuncImp(&globExec, funcProto, GlobalFuncImp::ParseInt, 2)), DontEnum);
- global.put(&globExec, "parseFloat", Object(new GlobalFuncImp(&globExec, funcProto, GlobalFuncImp::ParseFloat, 1)), DontEnum);
- global.put(&globExec, "isNaN", Object(new GlobalFuncImp(&globExec, funcProto, GlobalFuncImp::IsNaN, 1)), DontEnum);
- global.put(&globExec, "isFinite", Object(new GlobalFuncImp(&globExec, funcProto, GlobalFuncImp::IsFinite, 1)), DontEnum);
- global.put(&globExec, "escape", Object(new GlobalFuncImp(&globExec, funcProto, GlobalFuncImp::Escape, 1)), DontEnum);
- global.put(&globExec, "unescape", Object(new GlobalFuncImp(&globExec, funcProto, GlobalFuncImp::UnEscape, 1)), DontEnum);
- global.put(&globExec, "decodeURI", Object(new GlobalFuncImp(&globExec, funcProto, GlobalFuncImp::DecodeURI, 1)), DontEnum);
- global.put(&globExec, "decodeURIComponent", Object(new GlobalFuncImp(&globExec, funcProto, GlobalFuncImp::DecodeURIComponent, 1)), DontEnum);
- global.put(&globExec, "encodeURI", Object(new GlobalFuncImp(&globExec, funcProto, GlobalFuncImp::EncodeURI, 1)), DontEnum);
- global.put(&globExec, "encodeURIComponent", Object(new GlobalFuncImp(&globExec, funcProto, GlobalFuncImp::EncodeURIComponent, 1)), DontEnum);
+ global->put(&globExec, "eval", new GlobalFuncImp(&globExec, funcProto, GlobalFuncImp::Eval, 1), DontEnum);
+ global->put(&globExec, "parseInt", new GlobalFuncImp(&globExec, funcProto, GlobalFuncImp::ParseInt, 2), DontEnum);
+ global->put(&globExec, "parseFloat", new GlobalFuncImp(&globExec, funcProto, GlobalFuncImp::ParseFloat, 1), DontEnum);
+ global->put(&globExec, "isNaN", new GlobalFuncImp(&globExec, funcProto, GlobalFuncImp::IsNaN, 1), DontEnum);
+ global->put(&globExec, "isFinite", new GlobalFuncImp(&globExec, funcProto, GlobalFuncImp::IsFinite, 1), DontEnum);
+ global->put(&globExec, "escape", new GlobalFuncImp(&globExec, funcProto, GlobalFuncImp::Escape, 1), DontEnum);
+ global->put(&globExec, "unescape", new GlobalFuncImp(&globExec, funcProto, GlobalFuncImp::UnEscape, 1), DontEnum);
+ global->put(&globExec, "decodeURI", new GlobalFuncImp(&globExec, funcProto, GlobalFuncImp::DecodeURI, 1), DontEnum);
+ global->put(&globExec, "decodeURIComponent", new GlobalFuncImp(&globExec, funcProto, GlobalFuncImp::DecodeURIComponent, 1), DontEnum);
+ global->put(&globExec, "encodeURI", new GlobalFuncImp(&globExec, funcProto, GlobalFuncImp::EncodeURI, 1), DontEnum);
+ global->put(&globExec, "encodeURIComponent", new GlobalFuncImp(&globExec, funcProto, GlobalFuncImp::EncodeURIComponent, 1), DontEnum);
#ifndef NDEBUG
- global.put(&globExec, "kjsprint", Object(new GlobalFuncImp(&globExec, funcProto, GlobalFuncImp::KJSPrint, 1)), DontEnum);
+ global->put(&globExec, "kjsprint", new GlobalFuncImp(&globExec, funcProto, GlobalFuncImp::KJSPrint, 1), DontEnum);
#endif
// built-in objects
- global.put(&globExec, "Math", Object(new MathObjectImp(&globExec, objProto)), DontEnum);
+ global->put(&globExec, "Math", new MathObjectImp(&globExec, objProto), DontEnum);
}
InterpreterImp::~InterpreterImp()
@@ -691,7 +648,7 @@
s_hook = 0L;
globalClear();
}
- InterpreterMap::removeInterpreterForGlobalObject(global.imp());
+ InterpreterMap::removeInterpreterForGlobalObject(global);
#if APPLE_CHANGES
unlockInterpreter();
@@ -700,21 +657,7 @@
void InterpreterImp::mark()
{
- //if (exVal && !exVal->marked())
- // exVal->mark();
- //if (retVal && !retVal->marked())
- // retVal->mark();
- if (UndefinedImp::staticUndefined && !UndefinedImp::staticUndefined->marked())
- UndefinedImp::staticUndefined->mark();
- if (NullImp::staticNull && !NullImp::staticNull->marked())
- NullImp::staticNull->mark();
- if (NumberImp::staticNaN && !NumberImp::staticNaN->marked())
- NumberImp::staticNaN->mark();
- if (BooleanImp::staticTrue && !BooleanImp::staticTrue->marked())
- BooleanImp::staticTrue->mark();
- if (BooleanImp::staticFalse && !BooleanImp::staticFalse->marked())
- BooleanImp::staticFalse->mark();
- //fprintf( stderr, "InterpreterImp::mark this=%p global.imp()=%p\n", this, global.imp() );
+ ConstantValues::mark();
if (m_interpreter)
m_interpreter->mark();
if (_context)
@@ -735,7 +678,7 @@
return ok;
}
-Completion InterpreterImp::evaluate(const UString &code, const Value &thisV, const UString &sourceURL, int startingLineNumber)
+Completion InterpreterImp::evaluate(const UString &code, ValueImp *thisV, const UString &sourceURL, int startingLineNumber)
{
#if APPLE_CHANGES
lockInterpreter();
@@ -773,8 +716,8 @@
// no program node means a syntax error occurred
if (!progNode) {
- Object err = Error::create(&globExec, SyntaxError, errMsg.ascii(), errLine, -1, &sourceURL);
- err.put(&globExec, "sid", Number(sid));
+ ObjectImp *err = Error::create(&globExec, SyntaxError, errMsg.ascii(), errLine, -1, &sourceURL);
+ err->put(&globExec, "sid", Number(sid));
#if APPLE_CHANGES
unlockInterpreter();
#endif
@@ -786,21 +729,21 @@
recursion++;
progNode->ref();
- Object &globalObj = globalObject();
- Object thisObj = globalObject();
+ ObjectImp *globalObj = globalObject();
+ ObjectImp *thisObj = globalObject();
- if (!thisV.isNull()) {
+ if (thisV) {
// "this" must be an object... use same rules as Function.prototype.apply()
- if (thisV.isA(NullType) || thisV.isA(UndefinedType))
+ if (thisV->isUndefinedOrNull())
thisObj = globalObject();
else {
- thisObj = thisV.toObject(&globExec);
+ thisObj = thisV->toObject(&globExec);
}
}
Completion res;
if (globExec.hadException()) {
- // the thisArg.toObject() conversion above might have thrown an exception - if so,
+ // the thisArg->toObject() conversion above might have thrown an exception - if so,
// propagate it back
res = Completion(Throw, globExec.exception());
}
@@ -924,33 +867,32 @@
return true;
}
-Boolean InternalFunctionImp::hasInstance(ExecState *exec, const Value &value)
+bool InternalFunctionImp::hasInstance(ExecState *exec, ValueImp *value)
{
- if (value.type() != ObjectType)
- return Boolean(false);
+ if (!value->isObject())
+ return false;
- Value prot = get(exec,prototypePropertyName);
- if (prot.type() != ObjectType && prot.type() != NullType) {
- Object err = Error::create(exec, TypeError, "Invalid prototype encountered "
+ ValueImp *prot = get(exec,prototypePropertyName);
+ if (!prot->isObject() && !prot->isNull()) {
+ ObjectImp *err = Error::create(exec, TypeError, "Invalid prototype encountered "
"in instanceof operation.");
exec->setException(err);
- return Boolean(false);
+ return false;
}
- Object v = Object(static_cast<ObjectImp*>(value.imp()));
- while ((v = Object::dynamicCast(v.prototype())).imp()) {
- if (v.imp() == prot.imp())
- return Boolean(true);
+ ObjectImp *v = static_cast<ObjectImp *>(value);
+ while ((v = v->prototype()->getObject())) {
+ if (v == prot)
+ return true;
}
- return Boolean(false);
+ return false;
}
// ------------------------------ global functions -----------------------------
-double KJS::roundValue(ExecState *exec, const Value &v)
+double roundValue(ExecState *exec, ValueImp *v)
{
- Number n = v.toNumber(exec);
- double d = n.value();
+ double d = v->toNumber(exec);
double ad = fabs(d);
if (ad == 0 || isNaN(d) || isInf(d))
return d;
@@ -959,15 +901,15 @@
#ifndef NDEBUG
#include <stdio.h>
-void KJS::printInfo(ExecState *exec, const char *s, const Value &o, int lineno)
+void printInfo(ExecState *exec, const char *s, ValueImp *o, int lineno)
{
- if (o.isNull())
+ if (!o)
fprintf(stderr, "KJS: %s: (null)", s);
else {
- Value v = o;
+ ValueImp *v = o;
UString name;
- switch ( v.type() ) {
+ switch (v->type()) {
case UnspecifiedType:
name = "Unspecified";
break;
@@ -987,19 +929,19 @@
name = "Number";
break;
case ObjectType:
- name = Object::dynamicCast(v).className();
+ name = static_cast<ObjectImp *>(v)->className();
if (name.isNull())
name = "(unknown class)";
break;
}
- UString vString = v.toString(exec);
+ UString vString = v->toString(exec);
if ( vString.size() > 50 )
vString = vString.substr( 0, 50 ) + "...";
// Can't use two UString::ascii() in the same fprintf call
CString tempString( vString.cstring() );
fprintf(stderr, "KJS: %s: %s : %s (%p)",
- s, tempString.c_str(), name.ascii(), (void*)v.imp());
+ s, tempString.c_str(), name.ascii(), (void*)v);
if (lineno >= 0)
fprintf(stderr, ", line %d\n",lineno);
@@ -1008,3 +950,5 @@
}
}
#endif
+
+}
1.32 +65 -94 JavaScriptCore/kjs/internal.h
Index: internal.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/internal.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- internal.h 7 Aug 2005 06:17:35 -0000 1.31
+++ internal.h 8 Aug 2005 04:07:28 -0000 1.32
@@ -22,8 +22,8 @@
*
*/
-#ifndef _INTERNAL_H_
-#define _INTERNAL_H_
+#ifndef INTERNAL_H
+#define INTERNAL_H
#include "ustring.h"
#include "value.h"
@@ -37,9 +37,6 @@
namespace KJS {
- static const double D16 = 65536.0;
- static const double D32 = 4294967296.0;
-
class ProgramNode;
class FunctionBodyNode;
class FunctionPrototypeImp;
@@ -50,115 +47,90 @@
// Primitive impls
// ---------------------------------------------------------------------------
- class UndefinedImp : public ValueImp {
+ class UndefinedImp : public AllocatedValueImp {
public:
Type type() const { return UndefinedType; }
- Value toPrimitive(ExecState *exec, Type preferred = UnspecifiedType) const;
+ ValueImp *toPrimitive(ExecState *exec, Type preferred = UnspecifiedType) const;
bool toBoolean(ExecState *exec) const;
double toNumber(ExecState *exec) const;
UString toString(ExecState *exec) const;
- Object toObject(ExecState *exec) const;
-
- static UndefinedImp *staticUndefined;
+ ObjectImp *toObject(ExecState *exec) const;
};
- inline Undefined::Undefined(UndefinedImp *imp) : Value(imp) { }
-
- class NullImp : public ValueImp {
+ class NullImp : public AllocatedValueImp {
public:
Type type() const { return NullType; }
- Value toPrimitive(ExecState *exec, Type preferred = UnspecifiedType) const;
+ ValueImp *toPrimitive(ExecState *exec, Type preferred = UnspecifiedType) const;
bool toBoolean(ExecState *exec) const;
double toNumber(ExecState *exec) const;
UString toString(ExecState *exec) const;
- Object toObject(ExecState *exec) const;
-
- static NullImp *staticNull;
+ ObjectImp *toObject(ExecState *exec) const;
};
- inline Null::Null(NullImp *imp) : Value(imp) { }
-
- class BooleanImp : public ValueImp {
+ class BooleanImp : public AllocatedValueImp {
public:
BooleanImp(bool v = false) : val(v) { }
bool value() const { return val; }
Type type() const { return BooleanType; }
- Value toPrimitive(ExecState *exec, Type preferred = UnspecifiedType) const;
+ ValueImp *toPrimitive(ExecState *exec, Type preferred = UnspecifiedType) const;
bool toBoolean(ExecState *exec) const;
double toNumber(ExecState *exec) const;
UString toString(ExecState *exec) const;
- Object toObject(ExecState *exec) const;
+ ObjectImp *toObject(ExecState *exec) const;
- static BooleanImp *staticTrue;
- static BooleanImp *staticFalse;
private:
bool val;
};
- inline Boolean::Boolean(BooleanImp *imp) : Value(imp) { }
-
- class StringImp : public ValueImp {
+ class StringImp : public AllocatedValueImp {
public:
StringImp(const UString& v) : val(v) { }
UString value() const { return val; }
Type type() const { return StringType; }
- Value toPrimitive(ExecState *exec, Type preferred = UnspecifiedType) const;
+ ValueImp *toPrimitive(ExecState *exec, Type preferred = UnspecifiedType) const;
bool toBoolean(ExecState *exec) const;
double toNumber(ExecState *exec) const;
UString toString(ExecState *exec) const;
- Object toObject(ExecState *exec) const;
+ ObjectImp *toObject(ExecState *exec) const;
private:
UString val;
};
- inline String::String(StringImp *imp) : Value(imp) { }
-
- class NumberImp : public ValueImp {
- friend class Value;
- friend class Number;
+ class NumberImp : public AllocatedValueImp {
+ friend class ConstantValues;
friend class InterpreterImp;
- friend ValueImp *number(int);
- friend ValueImp *number(unsigned);
- friend ValueImp *number(long);
- friend ValueImp *number(unsigned long);
- friend ValueImp *number(double);
- friend ValueImp *number(double, bool);
+ friend ValueImp *jsNumber(int);
+ friend ValueImp *jsNumber(unsigned);
+ friend ValueImp *jsNumber(long);
+ friend ValueImp *jsNumber(unsigned long);
+ friend ValueImp *jsNumber(double);
+ friend ValueImp *jsNumber(double, bool);
public:
- static ValueImp *create(int);
- static ValueImp *create(double);
- static ValueImp *zero() { return SimpleNumber::make(0); }
- static ValueImp *one() { return SimpleNumber::make(1); }
- static ValueImp *two() { return SimpleNumber::make(2); }
-
double value() const { return val; }
Type type() const { return NumberType; }
- Value toPrimitive(ExecState *exec, Type preferred = UnspecifiedType) const;
+ ValueImp *toPrimitive(ExecState *exec, Type preferred = UnspecifiedType) const;
bool toBoolean(ExecState *exec) const;
double toNumber(ExecState *exec) const;
UString toString(ExecState *exec) const;
- Object toObject(ExecState *exec) const;
-
- static NumberImp *staticNaN;
+ ObjectImp *toObject(ExecState *exec) const;
private:
NumberImp(double v) : val(v) { }
- virtual bool toUInt32(unsigned&) const;
+ virtual bool getUInt32(uint32_t&) const;
double val;
};
- inline Number::Number(NumberImp *imp) : Value(imp) { }
-
/**
* @short The "label set" in Ecma-262 spec
*/
@@ -206,7 +178,7 @@
// ---------------------------------------------------------------------------
- // Parsing & evaluateion
+ // Parsing & evaluation
// ---------------------------------------------------------------------------
enum CodeType { GlobalCode,
@@ -275,7 +247,7 @@
static void globalInit();
static void globalClear();
- InterpreterImp(Interpreter *interp, const Object &glob);
+ InterpreterImp(Interpreter *interp, ObjectImp *glob);
~InterpreterImp();
ProtectedObject &globalObject() const { return const_cast<ProtectedObject &>(global); }
@@ -290,43 +262,43 @@
ExecState *globalExec() { return &globExec; }
bool checkSyntax(const UString &code);
- Completion evaluate(const UString &code, const Value &thisV, const UString &sourceURL, int startingLineNumber);
+ Completion evaluate(const UString &code, ValueImp *thisV, const UString &sourceURL, int startingLineNumber);
Debugger *debugger() const { return dbg; }
void setDebugger(Debugger *d) { dbg = d; }
- Object builtinObject() const { return b_Object; }
- Object builtinFunction() const { return b_Function; }
- Object builtinArray() const { return b_Array; }
- Object builtinBoolean() const { return b_Boolean; }
- Object builtinString() const { return b_String; }
- Object builtinNumber() const { return b_Number; }
- Object builtinDate() const { return b_Date; }
- Object builtinRegExp() const { return b_RegExp; }
- Object builtinError() const { return b_Error; }
-
- Object builtinObjectPrototype() const { return b_ObjectPrototype; }
- Object builtinFunctionPrototype() const { return b_FunctionPrototype; }
- Object builtinArrayPrototype() const { return b_ArrayPrototype; }
- Object builtinBooleanPrototype() const { return b_BooleanPrototype; }
- Object builtinStringPrototype() const { return b_StringPrototype; }
- Object builtinNumberPrototype() const { return b_NumberPrototype; }
- Object builtinDatePrototype() const { return b_DatePrototype; }
- Object builtinRegExpPrototype() const { return b_RegExpPrototype; }
- Object builtinErrorPrototype() const { return b_ErrorPrototype; }
-
- Object builtinEvalError() const { return b_evalError; }
- Object builtinRangeError() const { return b_rangeError; }
- Object builtinReferenceError() const { return b_referenceError; }
- Object builtinSyntaxError() const { return b_syntaxError; }
- Object builtinTypeError() const { return b_typeError; }
- Object builtinURIError() const { return b_uriError; }
-
- Object builtinEvalErrorPrototype() const { return b_evalErrorPrototype; }
- Object builtinRangeErrorPrototype() const { return b_rangeErrorPrototype; }
- Object builtinReferenceErrorPrototype() const { return b_referenceErrorPrototype; }
- Object builtinSyntaxErrorPrototype() const { return b_syntaxErrorPrototype; }
- Object builtinTypeErrorPrototype() const { return b_typeErrorPrototype; }
- Object builtinURIErrorPrototype() const { return b_uriErrorPrototype; }
+ ObjectImp *builtinObject() const { return b_Object; }
+ ObjectImp *builtinFunction() const { return b_Function; }
+ ObjectImp *builtinArray() const { return b_Array; }
+ ObjectImp *builtinBoolean() const { return b_Boolean; }
+ ObjectImp *builtinString() const { return b_String; }
+ ObjectImp *builtinNumber() const { return b_Number; }
+ ObjectImp *builtinDate() const { return b_Date; }
+ ObjectImp *builtinRegExp() const { return b_RegExp; }
+ ObjectImp *builtinError() const { return b_Error; }
+
+ ObjectImp *builtinObjectPrototype() const { return b_ObjectPrototype; }
+ ObjectImp *builtinFunctionPrototype() const { return b_FunctionPrototype; }
+ ObjectImp *builtinArrayPrototype() const { return b_ArrayPrototype; }
+ ObjectImp *builtinBooleanPrototype() const { return b_BooleanPrototype; }
+ ObjectImp *builtinStringPrototype() const { return b_StringPrototype; }
+ ObjectImp *builtinNumberPrototype() const { return b_NumberPrototype; }
+ ObjectImp *builtinDatePrototype() const { return b_DatePrototype; }
+ ObjectImp *builtinRegExpPrototype() const { return b_RegExpPrototype; }
+ ObjectImp *builtinErrorPrototype() const { return b_ErrorPrototype; }
+
+ ObjectImp *builtinEvalError() const { return b_evalError; }
+ ObjectImp *builtinRangeError() const { return b_rangeError; }
+ ObjectImp *builtinReferenceError() const { return b_referenceError; }
+ ObjectImp *builtinSyntaxError() const { return b_syntaxError; }
+ ObjectImp *builtinTypeError() const { return b_typeError; }
+ ObjectImp *builtinURIError() const { return b_uriError; }
+
+ ObjectImp *builtinEvalErrorPrototype() const { return b_evalErrorPrototype; }
+ ObjectImp *builtinRangeErrorPrototype() const { return b_rangeErrorPrototype; }
+ ObjectImp *builtinReferenceErrorPrototype() const { return b_referenceErrorPrototype; }
+ ObjectImp *builtinSyntaxErrorPrototype() const { return b_syntaxErrorPrototype; }
+ ObjectImp *builtinTypeErrorPrototype() const { return b_typeErrorPrototype; }
+ ObjectImp *builtinURIErrorPrototype() const { return b_uriErrorPrototype; }
void setCompatMode(Interpreter::CompatMode mode) { m_compatMode = mode; }
Interpreter::CompatMode compatMode() const { return m_compatMode; }
@@ -422,20 +394,19 @@
public:
InternalFunctionImp(FunctionPrototypeImp *funcProto);
bool implementsHasInstance() const;
- Boolean hasInstance(ExecState *exec, const Value &value);
+ bool hasInstance(ExecState *exec, ValueImp *value);
virtual const ClassInfo *classInfo() const { return &info; }
static const ClassInfo info;
};
// helper function for toInteger, toInt32, toUInt32 and toUInt16
- double roundValue(ExecState *exec, const Value &v);
+ double roundValue(ExecState *, ValueImp *);
#ifndef NDEBUG
- void printInfo(ExecState *exec, const char *s, const Value &o, int lineno = -1);
+ void printInfo(ExecState *exec, const char *s, ValueImp *, int lineno = -1);
#endif
} // namespace
-
-#endif // _INTERNAL_H_
+#endif // INTERNAL_H
1.29 +40 -41 JavaScriptCore/kjs/interpreter.cpp
Index: interpreter.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/interpreter.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- interpreter.cpp 7 Aug 2005 06:17:35 -0000 1.28
+++ interpreter.cpp 8 Aug 2005 04:07:28 -0000 1.29
@@ -50,12 +50,12 @@
return rep->scopeChain();
}
-Object Context::variableObject() const
+ObjectImp *Context::variableObject() const
{
return rep->variableObject();
}
-Object Context::thisValue() const
+ObjectImp *Context::thisValue() const
{
return rep->thisValue();
}
@@ -67,12 +67,12 @@
// ------------------------------ Interpreter ----------------------------------
-Interpreter::Interpreter(const Object &global)
+Interpreter::Interpreter(ObjectImp *global)
: rep(0)
, m_argumentsPropertyName(&argumentsPropertyName)
, m_specialPrototypePropertyName(&specialPrototypePropertyName)
{
- rep = new InterpreterImp(this,global);
+ rep = new InterpreterImp(this, global);
}
Interpreter::Interpreter()
@@ -80,8 +80,7 @@
, m_argumentsPropertyName(&argumentsPropertyName)
, m_specialPrototypePropertyName(&specialPrototypePropertyName)
{
- Object global(new ObjectImp());
- rep = new InterpreterImp(this,global);
+ rep = new InterpreterImp(this, new ObjectImp);
}
Interpreter::~Interpreter()
@@ -89,7 +88,7 @@
delete rep;
}
-Object &Interpreter::globalObject() const
+ObjectImp *Interpreter::globalObject() const
{
return rep->globalObject();
}
@@ -124,12 +123,12 @@
return rep->checkSyntax(code);
}
-Completion Interpreter::evaluate(const UString &code, const Value &thisV, const UString &)
+Completion Interpreter::evaluate(const UString &code, ValueImp *thisV, const UString &)
{
return evaluate(UString(), 0, code, thisV);
}
-Completion Interpreter::evaluate(const UString &sourceURL, int startingLineNumber, const UString &code, const Value &thisV)
+Completion Interpreter::evaluate(const UString &sourceURL, int startingLineNumber, const UString &code, ValueImp *thisV)
{
Completion comp = rep->evaluate(code,thisV, sourceURL, startingLineNumber);
@@ -138,7 +137,7 @@
lock();
ExecState *exec = rep->globalExec();
char *f = strdup(sourceURL.ascii());
- const char *message = comp.value().toObject(exec).toString(exec).ascii();
+ const char *message = comp.value()->toObject(exec)->toString(exec).ascii();
printf("[%d] %s:%s\n", getpid(), f, message);
free(f);
@@ -149,152 +148,152 @@
return comp;
}
-Object Interpreter::builtinObject() const
+ObjectImp *Interpreter::builtinObject() const
{
return rep->builtinObject();
}
-Object Interpreter::builtinFunction() const
+ObjectImp *Interpreter::builtinFunction() const
{
return rep->builtinFunction();
}
-Object Interpreter::builtinArray() const
+ObjectImp *Interpreter::builtinArray() const
{
return rep->builtinArray();
}
-Object Interpreter::builtinBoolean() const
+ObjectImp *Interpreter::builtinBoolean() const
{
return rep->builtinBoolean();
}
-Object Interpreter::builtinString() const
+ObjectImp *Interpreter::builtinString() const
{
return rep->builtinString();
}
-Object Interpreter::builtinNumber() const
+ObjectImp *Interpreter::builtinNumber() const
{
return rep->builtinNumber();
}
-Object Interpreter::builtinDate() const
+ObjectImp *Interpreter::builtinDate() const
{
return rep->builtinDate();
}
-Object Interpreter::builtinRegExp() const
+ObjectImp *Interpreter::builtinRegExp() const
{
return rep->builtinRegExp();
}
-Object Interpreter::builtinError() const
+ObjectImp *Interpreter::builtinError() const
{
return rep->builtinError();
}
-Object Interpreter::builtinObjectPrototype() const
+ObjectImp *Interpreter::builtinObjectPrototype() const
{
return rep->builtinObjectPrototype();
}
-Object Interpreter::builtinFunctionPrototype() const
+ObjectImp *Interpreter::builtinFunctionPrototype() const
{
return rep->builtinFunctionPrototype();
}
-Object Interpreter::builtinArrayPrototype() const
+ObjectImp *Interpreter::builtinArrayPrototype() const
{
return rep->builtinArrayPrototype();
}
-Object Interpreter::builtinBooleanPrototype() const
+ObjectImp *Interpreter::builtinBooleanPrototype() const
{
return rep->builtinBooleanPrototype();
}
-Object Interpreter::builtinStringPrototype() const
+ObjectImp *Interpreter::builtinStringPrototype() const
{
return rep->builtinStringPrototype();
}
-Object Interpreter::builtinNumberPrototype() const
+ObjectImp *Interpreter::builtinNumberPrototype() const
{
return rep->builtinNumberPrototype();
}
-Object Interpreter::builtinDatePrototype() const
+ObjectImp *Interpreter::builtinDatePrototype() const
{
return rep->builtinDatePrototype();
}
-Object Interpreter::builtinRegExpPrototype() const
+ObjectImp *Interpreter::builtinRegExpPrototype() const
{
return rep->builtinRegExpPrototype();
}
-Object Interpreter::builtinErrorPrototype() const
+ObjectImp *Interpreter::builtinErrorPrototype() const
{
return rep->builtinErrorPrototype();
}
-Object Interpreter::builtinEvalError() const
+ObjectImp *Interpreter::builtinEvalError() const
{
return rep->builtinEvalError();
}
-Object Interpreter::builtinRangeError() const
+ObjectImp *Interpreter::builtinRangeError() const
{
return rep->builtinRangeError();
}
-Object Interpreter::builtinReferenceError() const
+ObjectImp *Interpreter::builtinReferenceError() const
{
return rep->builtinReferenceError();
}
-Object Interpreter::builtinSyntaxError() const
+ObjectImp *Interpreter::builtinSyntaxError() const
{
return rep->builtinSyntaxError();
}
-Object Interpreter::builtinTypeError() const
+ObjectImp *Interpreter::builtinTypeError() const
{
return rep->builtinTypeError();
}
-Object Interpreter::builtinURIError() const
+ObjectImp *Interpreter::builtinURIError() const
{
return rep->builtinURIError();
}
-Object Interpreter::builtinEvalErrorPrototype() const
+ObjectImp *Interpreter::builtinEvalErrorPrototype() const
{
return rep->builtinEvalErrorPrototype();
}
-Object Interpreter::builtinRangeErrorPrototype() const
+ObjectImp *Interpreter::builtinRangeErrorPrototype() const
{
return rep->builtinRangeErrorPrototype();
}
-Object Interpreter::builtinReferenceErrorPrototype() const
+ObjectImp *Interpreter::builtinReferenceErrorPrototype() const
{
return rep->builtinReferenceErrorPrototype();
}
-Object Interpreter::builtinSyntaxErrorPrototype() const
+ObjectImp *Interpreter::builtinSyntaxErrorPrototype() const
{
return rep->builtinSyntaxErrorPrototype();
}
-Object Interpreter::builtinTypeErrorPrototype() const
+ObjectImp *Interpreter::builtinTypeErrorPrototype() const
{
return rep->builtinTypeErrorPrototype();
}
-Object Interpreter::builtinURIErrorPrototype() const
+ObjectImp *Interpreter::builtinURIErrorPrototype() const
{
return rep->builtinURIErrorPrototype();
}
@@ -337,7 +336,7 @@
}
-void *Interpreter::createLanguageInstanceForValue (ExecState *exec, int language, const Object &value, const Bindings::RootObject *origin, const Bindings::RootObject *current)
+void *Interpreter::createLanguageInstanceForValue(ExecState *exec, int language, ObjectImp *value, const Bindings::RootObject *origin, const Bindings::RootObject *current)
{
return Bindings::Instance::createLanguageInstanceForValue (exec, (Bindings::Instance::BindingLanguage)language, value, origin, current);
}
1.27 +46 -46 JavaScriptCore/kjs/interpreter.h
Index: interpreter.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/interpreter.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- interpreter.h 7 Aug 2005 06:17:35 -0000 1.26
+++ interpreter.h 8 Aug 2005 04:07:28 -0000 1.27
@@ -25,7 +25,6 @@
#ifndef _KJS_INTERPRETER_H_
#define _KJS_INTERPRETER_H_
-#include "object_wrapper.h"
#include "value.h"
#include "types.h"
@@ -34,6 +33,7 @@
class ContextImp;
class InterpreterImp;
class RuntimeMethodImp;
+ class ScopeChain;
namespace Bindings {
class RootObject;
@@ -78,7 +78,7 @@
*
* @return The execution context's variable object
*/
- Object variableObject() const;
+ ObjectImp *variableObject() const;
/**
* Returns the "this" value for the execution context. This is the value
@@ -95,7 +95,7 @@
*
* @return The execution context's "this" value
*/
- Object thisValue() const;
+ ObjectImp *thisValue() const;
/**
* Returns the context from which the current context was invoked. For
@@ -152,7 +152,7 @@
*
* @param global The object to use as the global object for this interpreter
*/
- Interpreter(const Object &global);
+ Interpreter(ObjectImp *global);
/**
* Creates a new interpreter. A global object will be created and
* initialized with the standard global properties.
@@ -164,7 +164,7 @@
* Returns the object that is used as the global object during all script
* execution performed by this interpreter
*/
- Object &globalObject() const;
+ ObjectImp *globalObject() const;
void initGlobalObject();
@@ -208,10 +208,10 @@
* execution. This should either be Null() or an Object.
* @return A completion object representing the result of the execution.
*/
- Completion evaluate(const UString &sourceURL, int startingLineNumber, const UString &code, const Value &thisV = Value());
+ Completion evaluate(const UString &sourceURL, int startingLineNumber, const UString &code, ValueImp *thisV = NULL);
// Overload of evaluate to keep JavaScriptGlue both source and binary compatible.
- Completion evaluate(const UString &code, const Value &thisV = Value(), const UString &sourceFilename = UString());
+ Completion evaluate(const UString &code, ValueImp *thisV = NULL, const UString &sourceFilename = UString());
/**
* @internal
@@ -229,109 +229,109 @@
*
* @return The builtin "Object" object
*/
- Object builtinObject() const;
+ ObjectImp *builtinObject() const;
/**
* Returns the builtin "Function" object.
*/
- Object builtinFunction() const;
+ ObjectImp *builtinFunction() const;
/**
* Returns the builtin "Array" object.
*/
- Object builtinArray() const;
+ ObjectImp *builtinArray() const;
/**
* Returns the builtin "Boolean" object.
*/
- Object builtinBoolean() const;
+ ObjectImp *builtinBoolean() const;
/**
* Returns the builtin "String" object.
*/
- Object builtinString() const;
+ ObjectImp *builtinString() const;
/**
* Returns the builtin "Number" object.
*/
- Object builtinNumber() const;
+ ObjectImp *builtinNumber() const;
/**
* Returns the builtin "Date" object.
*/
- Object builtinDate() const;
+ ObjectImp *builtinDate() const;
/**
* Returns the builtin "RegExp" object.
*/
- Object builtinRegExp() const;
+ ObjectImp *builtinRegExp() const;
/**
* Returns the builtin "Error" object.
*/
- Object builtinError() const;
+ ObjectImp *builtinError() const;
/**
* Returns the builtin "Object.prototype" object.
*/
- Object builtinObjectPrototype() const;
+ ObjectImp *builtinObjectPrototype() const;
/**
* Returns the builtin "Function.prototype" object.
*/
- Object builtinFunctionPrototype() const;
+ ObjectImp *builtinFunctionPrototype() const;
/**
* Returns the builtin "Array.prototype" object.
*/
- Object builtinArrayPrototype() const;
+ ObjectImp *builtinArrayPrototype() const;
/**
* Returns the builtin "Boolean.prototype" object.
*/
- Object builtinBooleanPrototype() const;
+ ObjectImp *builtinBooleanPrototype() const;
/**
* Returns the builtin "String.prototype" object.
*/
- Object builtinStringPrototype() const;
+ ObjectImp *builtinStringPrototype() const;
/**
* Returns the builtin "Number.prototype" object.
*/
- Object builtinNumberPrototype() const;
+ ObjectImp *builtinNumberPrototype() const;
/**
* Returns the builtin "Date.prototype" object.
*/
- Object builtinDatePrototype() const;
+ ObjectImp *builtinDatePrototype() const;
/**
* Returns the builtin "RegExp.prototype" object.
*/
- Object builtinRegExpPrototype() const;
+ ObjectImp *builtinRegExpPrototype() const;
/**
* Returns the builtin "Error.prototype" object.
*/
- Object builtinErrorPrototype() const;
+ ObjectImp *builtinErrorPrototype() const;
/**
* The initial value of "Error" global property
*/
- Object builtinEvalError() const;
- Object builtinRangeError() const;
- Object builtinReferenceError() const;
- Object builtinSyntaxError() const;
- Object builtinTypeError() const;
- Object builtinURIError() const;
-
- Object builtinEvalErrorPrototype() const;
- Object builtinRangeErrorPrototype() const;
- Object builtinReferenceErrorPrototype() const;
- Object builtinSyntaxErrorPrototype() const;
- Object builtinTypeErrorPrototype() const;
- Object builtinURIErrorPrototype() const;
+ ObjectImp *builtinEvalError() const;
+ ObjectImp *builtinRangeError() const;
+ ObjectImp *builtinReferenceError() const;
+ ObjectImp *builtinSyntaxError() const;
+ ObjectImp *builtinTypeError() const;
+ ObjectImp *builtinURIError() const;
+
+ ObjectImp *builtinEvalErrorPrototype() const;
+ ObjectImp *builtinRangeErrorPrototype() const;
+ ObjectImp *builtinReferenceErrorPrototype() const;
+ ObjectImp *builtinSyntaxErrorPrototype() const;
+ ObjectImp *builtinTypeErrorPrototype() const;
+ ObjectImp *builtinURIErrorPrototype() const;
enum CompatMode { NativeMode, IECompat, NetscapeCompat };
/**
@@ -380,7 +380,7 @@
* is used to determine if an object is the Window object so we can perform
* security checks.
*/
- virtual bool isGlobalObject(const Value &v) { return false; }
+ virtual bool isGlobalObject(ValueImp *v) { return false; }
/**
* Find the interpreter for a particular global object. This should really
@@ -399,7 +399,7 @@
*/
virtual bool isSafeScript (const Interpreter *target) { return true; }
- virtual void *createLanguageInstanceForValue (ExecState *exec, int language, const Object &value, const Bindings::RootObject *origin, const Bindings::RootObject *current);
+ virtual void *createLanguageInstanceForValue (ExecState *exec, int language, ObjectImp *value, const Bindings::RootObject *origin, const Bindings::RootObject *current);
#endif
// This is a workaround to avoid accessing the global variables for these identifiers in
@@ -470,17 +470,17 @@
*/
Context context() const { return _context; }
- void setException(const Value &e) { _exception = e; }
- void clearException() { _exception = Value(); }
- Value exception() const { return _exception; }
- bool hadException() const { return !_exception.isNull(); }
+ void setException(ValueImp *e) { _exception = e; }
+ void clearException() { _exception = NULL; }
+ ValueImp *exception() const { return _exception; }
+ bool hadException() const { return _exception; }
private:
ExecState(Interpreter *interp, ContextImp *con)
- : _interpreter(interp), _context(con) { }
+ : _interpreter(interp), _context(con), _exception(NULL) { }
Interpreter *_interpreter;
ContextImp *_context;
- Value _exception;
+ ValueImp *_exception;
};
} // namespace
1.14 +2 -2 JavaScriptCore/kjs/list.cpp
Index: list.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/list.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- list.cpp 14 Jul 2005 18:27:02 -0000 1.13
+++ list.cpp 8 Aug 2005 04:07:28 -0000 1.14
@@ -233,11 +233,11 @@
deallocateListImp(imp);
}
-ValueImp *List::impAt(int i) const
+ValueImp *List::at(int i) const
{
ListImp *imp = static_cast<ListImp *>(_impBase);
if ((unsigned)i >= (unsigned)imp->size)
- return UndefinedImp::staticUndefined;
+ return jsUndefined();
if (i < inlineValuesSize)
return imp->values[i];
return imp->overflow[i - inlineValuesSize];
1.10 +8 -11 JavaScriptCore/kjs/list.h
Index: list.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/list.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- list.h 14 Jul 2005 18:27:02 -0000 1.9
+++ list.h 8 Aug 2005 04:07:28 -0000 1.10
@@ -62,7 +62,6 @@
*
* @param val Pointer to object.
*/
- void append(const Value& val) { append(val.imp()); }
void append(ValueImp *val);
/**
* Remove all elements from the list.
@@ -104,13 +103,11 @@
* @return Return the element at position i. KJS::Undefined if the
* index is out of range.
*/
- Value at(int i) const { return Value(impAt(i)); }
+ ValueImp *at(int i) const;
/**
* Equivalent to at.
*/
- Value operator[](int i) const { return Value(impAt(i)); }
-
- ValueImp *impAt(int i) const;
+ ValueImp *operator[](int i) const { return at(i); }
/**
* Returns a pointer to a static instance of an empty list. Useful if a
@@ -146,25 +143,25 @@
* Dereference the iterator.
* @return A pointer to the element the iterator operates on.
*/
- ValueImp *operator->() const { return _list->impAt(_i); }
- Value operator*() const { return Value(_list->impAt(_i)); }
+ ValueImp *operator->() const { return _list->at(_i); }
+ ValueImp *operator*() const { return _list->at(_i); }
/**
* Prefix increment operator.
* @return The element after the increment.
*/
- Value operator++() { return Value(_list->impAt(++_i)); }
+ ValueImp *operator++() { return _list->at(++_i); }
/**
* Postfix increment operator.
*/
- Value operator++(int) { return Value(_list->impAt(_i++)); }
+ ValueImp *operator++(int) { return _list->at(_i++); }
/**
* Prefix decrement operator.
*/
- Value operator--() { return Value(_list->impAt(--_i)); }
+ ValueImp *operator--() { return _list->at(--_i); }
/**
* Postfix decrement operator.
*/
- Value operator--(int) { return Value(_list->impAt(_i--)); }
+ ValueImp *operator--(int) { return _list->at(_i--); }
/**
* Compare the iterator with another one.
* @return True if the two iterators operate on the same list element.
1.18 +11 -11 JavaScriptCore/kjs/lookup.h
Index: lookup.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/lookup.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- lookup.h 7 Aug 2005 06:17:35 -0000 1.17
+++ lookup.h 8 Aug 2005 04:07:28 -0000 1.18
@@ -127,17 +127,17 @@
* Helper for getStaticFunctionSlot and getStaticPropertySlot
*/
template <class FuncImp>
- inline Value staticFunctionGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ inline ValueImp *staticFunctionGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
// Look for cached value in dynamic map of properties (in ObjectImp)
ObjectImp *thisObj = slot.slotBase();
ValueImp *cachedVal = thisObj->getDirect(propertyName);
if (cachedVal)
- return Value(cachedVal);
+ return cachedVal;
const HashEntry *entry = slot.staticEntry();
- Value val = Value(new FuncImp(exec, entry->value, entry->params));
- thisObj->putDirect(propertyName, val.imp(), entry->attr);
+ ValueImp *val = new FuncImp(exec, entry->value, entry->params);
+ thisObj->putDirect(propertyName, val, entry->attr);
return val;
}
@@ -146,7 +146,7 @@
* Helper for getStaticValueSlot and getStaticPropertySlot
*/
template <class ThisImp>
- inline Value staticValueGetter(ExecState *exec, const Identifier&, const PropertySlot& slot)
+ inline ValueImp *staticValueGetter(ExecState *exec, const Identifier&, const PropertySlot& slot)
{
ThisImp *thisObj = static_cast<ThisImp *>(slot.slotBase());
const HashEntry *entry = slot.staticEntry();
@@ -235,7 +235,7 @@
*/
template <class ThisImp, class ParentImp>
inline void lookupPut(ExecState *exec, const Identifier &propertyName,
- const Value& value, int attr,
+ ValueImp *value, int attr,
const HashTable* table, ThisImp* thisObj)
{
const HashEntry* entry = Lookup::findEntry(table, propertyName);
@@ -264,14 +264,14 @@
template <class ClassCtor>
inline ObjectImp *cacheGlobalObject(ExecState *exec, const Identifier &propertyName)
{
- ObjectImp *globalObject = static_cast<ObjectImp *>(exec->lexicalInterpreter()->globalObject().imp());
+ ObjectImp *globalObject = static_cast<ObjectImp *>(exec->lexicalInterpreter()->globalObject());
ValueImp *obj = globalObject->getDirect(propertyName);
if (obj) {
assert(obj->isObject());
return static_cast<ObjectImp *>(obj);
}
ObjectImp *newObject = new ClassCtor(exec);
- globalObject->put(exec, propertyName, Value(newObject), Internal);
+ globalObject->put(exec, propertyName, newObject, Internal);
return newObject;
}
@@ -297,7 +297,7 @@
public: \
static ObjectImp *self(ExecState *exec) \
{ \
- return cacheGlobalObject<ClassProto>( exec, "[[" ClassName ".prototype]]" ); \
+ return cacheGlobalObject<ClassProto>(exec, "[[" ClassName ".prototype]]"); \
} \
protected: \
ClassProto( ExecState *exec ) \
@@ -331,8 +331,8 @@
{ \
put(exec, lengthPropertyName, Number(len), DontDelete|ReadOnly|DontEnum); \
} \
- /* Macro user needs to implement the call function. */ \
- virtual Value call(ExecState *exec, Object &thisObj, const List &args); \
+ /* Macro user needs to implement the callAsFunction function. */ \
+ virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args); \
private: \
int id; \
};
1.17 +7 -8 JavaScriptCore/kjs/math_object.cpp
Index: math_object.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/math_object.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- math_object.cpp 7 Aug 2005 06:17:35 -0000 1.16
+++ math_object.cpp 8 Aug 2005 04:07:28 -0000 1.17
@@ -86,7 +86,7 @@
return getStaticPropertySlot<MathFuncImp, MathObjectImp, ObjectImp>(exec, &mathTable, this, propertyName, slot);
}
-Value MathObjectImp::getValueProperty(ExecState *, int token) const
+ValueImp *MathObjectImp::getValueProperty(ExecState *, int token) const
{
double d = -42; // ;)
switch (token) {
@@ -125,10 +125,9 @@
MathFuncImp::MathFuncImp(ExecState *exec, int i, int l)
: InternalFunctionImp(
- static_cast<FunctionPrototypeImp*>(exec->lexicalInterpreter()->builtinFunctionPrototype().imp())
+ static_cast<FunctionPrototypeImp*>(exec->lexicalInterpreter()->builtinFunctionPrototype())
), id(i)
{
- Value protect(this);
putDirect(lengthPropertyName, l, DontDelete|ReadOnly|DontEnum);
}
@@ -137,10 +136,10 @@
return true;
}
-Value MathFuncImp::call(ExecState *exec, Object &/*thisObj*/, const List &args)
+ValueImp *MathFuncImp::callAsFunction(ExecState *exec, ObjectImp */*thisObj*/, const List &args)
{
- double arg = args[0].toNumber(exec);
- double arg2 = args[1].toNumber(exec);
+ double arg = args[0]->toNumber(exec);
+ double arg2 = args[1]->toNumber(exec);
double result;
switch (id) {
@@ -178,7 +177,7 @@
unsigned int argsCount = args.size();
result = -Inf;
for ( unsigned int k = 0 ; k < argsCount ; ++k ) {
- double val = args[k].toNumber(exec);
+ double val = args[k]->toNumber(exec);
if ( isNaN( val ) )
{
result = NaN;
@@ -193,7 +192,7 @@
unsigned int argsCount = args.size();
result = +Inf;
for ( unsigned int k = 0 ; k < argsCount ; ++k ) {
- double val = args[k].toNumber(exec);
+ double val = args[k]->toNumber(exec);
if ( isNaN( val ) )
{
result = NaN;
1.8 +2 -2 JavaScriptCore/kjs/math_object.h
Index: math_object.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/math_object.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- math_object.h 7 Aug 2005 06:17:35 -0000 1.7
+++ math_object.h 8 Aug 2005 04:07:28 -0000 1.8
@@ -32,7 +32,7 @@
MathObjectImp(ExecState *exec,
ObjectPrototypeImp *objProto);
bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
virtual const ClassInfo *classInfo() const { return &info; }
static const ClassInfo info;
enum { Euler, Ln2, Ln10, Log2E, Log10E, Pi, Sqrt1_2, Sqrt2,
@@ -44,7 +44,7 @@
public:
MathFuncImp(ExecState *exec, int i, int l);
virtual bool implementsCall() const;
- virtual Value call(ExecState *exec, Object &thisObj, const List &args);
+ virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args);
private:
int id;
};
1.70 +269 -287 JavaScriptCore/kjs/nodes.cpp
Index: nodes.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/nodes.cpp,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -r1.69 -r1.70
--- nodes.cpp 7 Aug 2005 06:17:35 -0000 1.69
+++ nodes.cpp 8 Aug 2005 04:07:28 -0000 1.70
@@ -24,7 +24,6 @@
#include "nodes.h"
-//#include <iostream>
#include <math.h>
#include <assert.h>
#ifdef KJS_DEBUG_MEM
@@ -44,6 +43,7 @@
#include "lexer.h"
#include "operations.h"
#include "ustring.h"
+#include "reference_list.h"
using namespace KJS;
@@ -116,7 +116,7 @@
Reference Node::evaluateReference(ExecState *exec)
{
- Value v = evaluate(exec);
+ ValueImp *v = evaluate(exec);
KJS_CHECKEXCEPTIONREFERENCE
return Reference::makeValueReference(v);
}
@@ -133,16 +133,16 @@
}
#endif
-Value Node::throwError(ExecState *exec, ErrorType e, const char *msg)
+ValueImp *Node::throwError(ExecState *exec, ErrorType e, const char *msg)
{
- Object err = Error::create(exec, e, msg, lineNo(), sourceId(), &sourceURL);
+ ObjectImp *err = Error::create(exec, e, msg, lineNo(), sourceId(), &sourceURL);
exec->setException(err);
return err;
}
-Value Node::throwError(ExecState *exec, ErrorType e, const char *msg, Value v, Node *expr)
+ValueImp *Node::throwError(ExecState *exec, ErrorType e, const char *msg, ValueImp *v, Node *expr)
{
- char *vStr = strdup(v.toString(exec).ascii());
+ char *vStr = strdup(v->toString(exec).ascii());
char *exprStr = strdup(expr->toString().ascii());
int length = strlen(msg) - 4 /* two %s */ + strlen(vStr) + strlen(exprStr) + 1 /* null terminator */;
@@ -151,21 +151,21 @@
free(vStr);
free(exprStr);
- Value result = throwError(exec, e, str);
+ ValueImp *result = throwError(exec, e, str);
delete [] str;
return result;
}
-Value Node::throwError(ExecState *exec, ErrorType e, const char *msg, Identifier label)
+ValueImp *Node::throwError(ExecState *exec, ErrorType e, const char *msg, Identifier label)
{
const char *l = label.ascii();
int length = strlen(msg) - 2 /* %s */ + strlen(l) + 1 /* null terminator */;
char *message = new char[length];
sprintf(message, msg, l);
- Value result = throwError(exec, e, message);
+ ValueImp *result = throwError(exec, e, message);
delete [] message;
return result;
@@ -174,11 +174,11 @@
void Node::setExceptionDetailsIfNeeded(ExecState *exec)
{
if (exec->hadException()) {
- Object exception = exec->exception().toObject(exec);
- if (!exception.hasProperty(exec, "line") &&
- !exception.hasProperty(exec, "sourceURL")) {
- exception.put(exec, "line", Number(line));
- exception.put(exec, "sourceURL", String(sourceURL));
+ ObjectImp *exception = exec->exception()->toObject(exec);
+ if (!exception->hasProperty(exec, "line") &&
+ !exception->hasProperty(exec, "sourceURL")) {
+ exception->put(exec, "line", Number(line));
+ exception->put(exec, "sourceURL", String(sourceURL));
}
}
}
@@ -222,50 +222,48 @@
// ------------------------------ NullNode -------------------------------------
-Value NullNode::evaluate(ExecState */*exec*/)
+ValueImp *NullNode::evaluate(ExecState */*exec*/)
{
return Null();
}
// ------------------------------ BooleanNode ----------------------------------
-Value BooleanNode::evaluate(ExecState */*exec*/)
+ValueImp *BooleanNode::evaluate(ExecState */*exec*/)
{
- return Value(value);
+ return jsBoolean(value);
}
// ------------------------------ NumberNode -----------------------------------
-Value NumberNode::evaluate(ExecState */*exec*/)
+ValueImp *NumberNode::evaluate(ExecState */*exec*/)
{
- return Value(value);
+ return jsNumber(value);
}
// ------------------------------ StringNode -----------------------------------
-Value StringNode::evaluate(ExecState */*exec*/)
+ValueImp *StringNode::evaluate(ExecState */*exec*/)
{
- return value;
+ return jsString(value);
}
// ------------------------------ RegExpNode -----------------------------------
-Value RegExpNode::evaluate(ExecState *exec)
+ValueImp *RegExpNode::evaluate(ExecState *exec)
{
List list;
- String p(pattern);
- String f(flags);
- list.append(p);
- list.append(f);
+ list.append(jsString(pattern));
+ list.append(jsString(flags));
- Object reg = exec->lexicalInterpreter()->imp()->builtinRegExp();
- return reg.construct(exec,list);
+ ObjectImp *reg = exec->lexicalInterpreter()->imp()->builtinRegExp();
+ return reg->construct(exec,list);
}
// ------------------------------ ThisNode -------------------------------------
// ECMA 11.1.1
-Value ThisNode::evaluate(ExecState *exec)
+ValueImp *ThisNode::evaluate(ExecState *exec)
{
return exec->context().imp()->thisValue();
}
@@ -273,7 +271,7 @@
// ------------------------------ ResolveNode ----------------------------------
// ECMA 11.1.2 & 10.1.4
-Value ResolveNode::evaluate(ExecState *exec)
+ValueImp *ResolveNode::evaluate(ExecState *exec)
{
ScopeChain chain = exec->context().imp()->scopeChain();
@@ -282,13 +280,14 @@
PropertySlot slot;
do {
ObjectImp *o = chain.top();
+
if (o->getPropertySlot(exec, ident, slot))
return slot.getValue(exec, ident);
chain.pop();
} while (!chain.isEmpty());
- return Reference(Null(), ident).getValue(exec);
+ return Reference(ident).getValue(exec);
}
Reference ResolveNode::evaluateReference(ExecState *exec)
@@ -306,10 +305,9 @@
chain.pop();
} while (!chain.isEmpty());
- return Reference(Null(), ident);
+ return Reference(ident);
}
-
// ------------------------------ GroupNode ------------------------------------
void GroupNode::ref()
@@ -327,7 +325,7 @@
}
// ECMA 11.1.6
-Value GroupNode::evaluate(ExecState *exec)
+ValueImp *GroupNode::evaluate(ExecState *exec)
{
return group->evaluate(exec);
}
@@ -362,15 +360,15 @@
}
// ECMA 11.1.4
-Value ElementNode::evaluate(ExecState *exec)
+ValueImp *ElementNode::evaluate(ExecState *exec)
{
- Object array = exec->lexicalInterpreter()->builtinArray().construct(exec, List::empty());
+ ObjectImp *array = exec->lexicalInterpreter()->builtinArray()->construct(exec, List::empty());
int length = 0;
for (ElementNode *n = this; n; n = n->list) {
- Value val = n->node->evaluate(exec);
+ ValueImp *val = n->node->evaluate(exec);
KJS_CHECKEXCEPTIONVALUE
length += n->elision;
- array.put(exec, length++, val);
+ array->put(exec, length++, val);
}
return array;
}
@@ -392,23 +390,23 @@
}
// ECMA 11.1.4
-Value ArrayNode::evaluate(ExecState *exec)
+ValueImp *ArrayNode::evaluate(ExecState *exec)
{
- Object array;
+ ObjectImp *array;
int length;
if (element) {
- array = Object(static_cast<ObjectImp*>(element->evaluate(exec).imp()));
+ array = static_cast<ObjectImp*>(element->evaluate(exec));
KJS_CHECKEXCEPTIONVALUE
- length = opt ? array.get(exec,lengthPropertyName).toInt32(exec) : 0;
+ length = opt ? array->get(exec,lengthPropertyName)->toInt32(exec) : 0;
} else {
- Value newArr = exec->lexicalInterpreter()->builtinArray().construct(exec,List::empty());
- array = Object(static_cast<ObjectImp*>(newArr.imp()));
+ ValueImp *newArr = exec->lexicalInterpreter()->builtinArray()->construct(exec,List::empty());
+ array = static_cast<ObjectImp*>(newArr);
length = 0;
}
if (opt)
- array.put(exec,lengthPropertyName, Value(elision + length), DontEnum | DontDelete);
+ array->put(exec,lengthPropertyName, jsNumber(elision + length), DontEnum | DontDelete);
return array;
}
@@ -430,12 +428,12 @@
}
// ECMA 11.1.5
-Value ObjectLiteralNode::evaluate(ExecState *exec)
+ValueImp *ObjectLiteralNode::evaluate(ExecState *exec)
{
if (list)
return list->evaluate(exec);
- return exec->lexicalInterpreter()->builtinObject().construct(exec,List::empty());
+ return exec->lexicalInterpreter()->builtinObject()->construct(exec,List::empty());
}
// ------------------------------ PropertyValueNode ----------------------------
@@ -467,17 +465,17 @@
}
// ECMA 11.1.5
-Value PropertyValueNode::evaluate(ExecState *exec)
+ValueImp *PropertyValueNode::evaluate(ExecState *exec)
{
- Object obj = exec->lexicalInterpreter()->builtinObject().construct(exec, List::empty());
+ ObjectImp *obj = exec->lexicalInterpreter()->builtinObject()->construct(exec, List::empty());
for (PropertyValueNode *p = this; p; p = p->list) {
- Value n = p->name->evaluate(exec);
+ ValueImp *n = p->name->evaluate(exec);
KJS_CHECKEXCEPTIONVALUE
- Value v = p->assign->evaluate(exec);
+ ValueImp *v = p->assign->evaluate(exec);
KJS_CHECKEXCEPTIONVALUE
- obj.put(exec, Identifier(n.toString(exec)), v);
+ obj->put(exec, Identifier(n->toString(exec)), v);
}
return obj;
@@ -486,9 +484,9 @@
// ------------------------------ PropertyNode ---------------------------------
// ECMA 11.1.5
-Value PropertyNode::evaluate(ExecState */*exec*/)
+ValueImp *PropertyNode::evaluate(ExecState */*exec*/)
{
- Value s;
+ ValueImp *s;
if (str.isNull()) {
s = String(UString::from(numeric));
@@ -520,36 +518,32 @@
}
// ECMA 11.2.1a
-Value AccessorNode1::evaluate(ExecState *exec)
+ValueImp *AccessorNode1::evaluate(ExecState *exec)
{
- Value v1 = expr1->evaluate(exec);
+ ValueImp *v1 = expr1->evaluate(exec);
KJS_CHECKEXCEPTIONVALUE
- Value v2 = expr2->evaluate(exec);
+ ValueImp *v2 = expr2->evaluate(exec);
KJS_CHECKEXCEPTIONVALUE
- Object o = v1.toObject(exec);
- unsigned i;
- if (v2.toUInt32(i))
- return o.get(exec, i);
-
- String s = v2.toString(exec);
- return o.get(exec, Identifier(s.value()));
+ ObjectImp *o = v1->toObject(exec);
+ uint32_t i;
+ if (v2->getUInt32(i))
+ return o->get(exec, i);
+ return o->get(exec, Identifier(v2->toString(exec)));
}
Reference AccessorNode1::evaluateReference(ExecState *exec)
{
- Value v1 = expr1->evaluate(exec);
+ ValueImp *v1 = expr1->evaluate(exec);
KJS_CHECKEXCEPTIONREFERENCE
- Value v2 = expr2->evaluate(exec);
+ ValueImp *v2 = expr2->evaluate(exec);
KJS_CHECKEXCEPTIONREFERENCE
- Object o = v1.toObject(exec);
- unsigned i;
- if (v2.toUInt32(i))
+ ObjectImp *o = v1->toObject(exec);
+ uint32_t i;
+ if (v2->getUInt32(i))
return Reference(o, i);
- String s = v2.toString(exec);
- return Reference(o, Identifier(s.value()));
+ return Reference(o, Identifier(v2->toString(exec)));
}
-
// ------------------------------ AccessorNode2 --------------------------------
void AccessorNode2::ref()
@@ -567,20 +561,19 @@
}
// ECMA 11.2.1b
-Value AccessorNode2::evaluate(ExecState *exec)
+ValueImp *AccessorNode2::evaluate(ExecState *exec)
{
- Value v = expr->evaluate(exec);
+ ValueImp *v = expr->evaluate(exec);
KJS_CHECKEXCEPTIONVALUE
- Object o = v.toObject(exec);
- return o.get(exec, ident);
+ return v->toObject(exec)->get(exec, ident);
}
Reference AccessorNode2::evaluateReference(ExecState *exec)
{
- Value v = expr->evaluate(exec);
+ ValueImp *v = expr->evaluate(exec);
KJS_CHECKEXCEPTIONREFERENCE
- Object o = v.toObject(exec);
+ ObjectImp *o = v->toObject(exec);
return Reference(o, ident);
}
@@ -608,10 +601,10 @@
return Node::deref();
}
-Value ArgumentListNode::evaluate(ExecState */*exec*/)
+ValueImp *ArgumentListNode::evaluate(ExecState */*exec*/)
{
assert(0);
- return Value(); // dummy, see evaluateList()
+ return NULL; // dummy, see evaluateList()
}
// ECMA 11.2.4
@@ -620,7 +613,7 @@
List l;
for (ArgumentListNode *n = this; n; n = n->list) {
- Value v = n->expr->evaluate(exec);
+ ValueImp *v = n->expr->evaluate(exec);
KJS_CHECKEXCEPTIONLIST
l.append(v);
}
@@ -644,10 +637,10 @@
return Node::deref();
}
-Value ArgumentsNode::evaluate(ExecState */*exec*/)
+ValueImp *ArgumentsNode::evaluate(ExecState */*exec*/)
{
assert(0);
- return Value(); // dummy, see evaluateList()
+ return NULL; // dummy, see evaluateList()
}
// ECMA 11.2.4
@@ -681,9 +674,9 @@
return Node::deref();
}
-Value NewExprNode::evaluate(ExecState *exec)
+ValueImp *NewExprNode::evaluate(ExecState *exec)
{
- Value v = expr->evaluate(exec);
+ ValueImp *v = expr->evaluate(exec);
KJS_CHECKEXCEPTIONVALUE
List argList;
@@ -692,18 +685,16 @@
KJS_CHECKEXCEPTIONVALUE
}
- if (v.type() != ObjectType) {
+ if (!v->isObject()) {
return throwError(exec, TypeError, "Value %s (result of expression %s) is not an object. Cannot be used with new.", v, expr);
}
- Object constr = Object(static_cast<ObjectImp*>(v.imp()));
- if (!constr.implementsConstruct()) {
+ ObjectImp *constr = static_cast<ObjectImp*>(v);
+ if (!constr->implementsConstruct()) {
return throwError(exec, TypeError, "Value %s (result of expression %s) is not a constructor. Cannot be used with new.", v, expr);
}
- Value res = constr.construct(exec,argList);
-
- return res;
+ return constr->construct(exec, argList);
}
// ------------------------------ FunctionCallNode -----------------------------
@@ -727,7 +718,7 @@
}
// ECMA 11.2.3
-Value FunctionCallNode::evaluate(ExecState *exec)
+ValueImp *FunctionCallNode::evaluate(ExecState *exec)
{
Reference ref = expr->evaluateReference(exec);
KJS_CHECKEXCEPTIONVALUE
@@ -735,14 +726,14 @@
List argList = args->evaluateList(exec);
KJS_CHECKEXCEPTIONVALUE
- Value v = ref.getValue(exec);
+ ValueImp *v = ref.getValue(exec);
KJS_CHECKEXCEPTIONVALUE
-
- if (v.type() != ObjectType) {
+
+ if (!v->isObject()) {
return throwError(exec, TypeError, "Value %s (result of expression %s) is not object.", v, expr);
}
-
- ObjectImp *func = static_cast<ObjectImp*>(v.imp());
+
+ ObjectImp *func = static_cast<ObjectImp*>(v);
if (!func->implementsCall()) {
return throwError(exec, TypeError, "Object %s (result of expression %s) does not allow calls.", v, expr);
@@ -750,7 +741,7 @@
ObjectImp *thisObjImp = 0;
ValueImp *thisValImp = ref.baseIfMutable();
- if (thisValImp && thisValImp->type() == ObjectType && !static_cast<ObjectImp *>(thisValImp)->inherits(&ActivationImp::info))
+ if (thisValImp && thisValImp->isObject() && !static_cast<ObjectImp *>(thisValImp)->inherits(&ActivationImp::info))
thisObjImp = static_cast<ObjectImp *>(thisValImp);
if (!thisObjImp) {
@@ -760,10 +751,10 @@
// that the section does not apply to interal functions, but for simplicity
// of implementation we use the global object anyway here. This guarantees
// that in host objects you always get a valid object for this.
- thisObjImp = exec->dynamicInterpreter()->globalObject().imp();
+ thisObjImp = exec->dynamicInterpreter()->globalObject();
}
- Object thisObj(thisObjImp);
+ ObjectImp *thisObj(thisObjImp);
return func->call(exec, thisObj, argList);
}
@@ -784,19 +775,19 @@
}
// ECMA 11.3
-Value PostfixNode::evaluate(ExecState *exec)
+ValueImp *PostfixNode::evaluate(ExecState *exec)
{
Reference ref = expr->evaluateReference(exec);
KJS_CHECKEXCEPTIONVALUE
- Value v = ref.getValue(exec);
+ ValueImp *v = ref.getValue(exec);
bool knownToBeInteger;
- double n = v.toNumber(exec, knownToBeInteger);
+ double n = v->toNumber(exec, knownToBeInteger);
double newValue = (oper == OpPlusPlus) ? n + 1 : n - 1;
- ref.putValue(exec, Value(newValue, knownToBeInteger));
+ ref.putValue(exec, jsNumber(newValue, knownToBeInteger));
- return Value(n, knownToBeInteger);
+ return jsNumber(n, knownToBeInteger);
}
// ------------------------------ DeleteNode -----------------------------------
@@ -816,11 +807,11 @@
}
// ECMA 11.4.1
-Value DeleteNode::evaluate(ExecState *exec)
+ValueImp *DeleteNode::evaluate(ExecState *exec)
{
Reference ref = expr->evaluateReference(exec);
KJS_CHECKEXCEPTIONVALUE
- return Value(ref.deleteValue(exec));
+ return jsBoolean(ref.deleteValue(exec));
}
// ------------------------------ VoidNode -------------------------------------
@@ -840,9 +831,9 @@
}
// ECMA 11.4.2
-Value VoidNode::evaluate(ExecState *exec)
+ValueImp *VoidNode::evaluate(ExecState *exec)
{
- Value dummy1 = expr->evaluate(exec);
+ expr->evaluate(exec);
KJS_CHECKEXCEPTIONVALUE
return Undefined();
@@ -865,16 +856,16 @@
}
// ECMA 11.4.3
-Value TypeOfNode::evaluate(ExecState *exec)
+ValueImp *TypeOfNode::evaluate(ExecState *exec)
{
const char *s = 0L;
Reference ref = expr->evaluateReference(exec);
KJS_CHECKEXCEPTIONVALUE
ValueImp *b = ref.baseIfMutable();
- if (b && b->dispatchType() == NullType)
- return Value("undefined");
- Value v = ref.getValue(exec);
- switch (v.type())
+ if (b && b->isNull())
+ return jsString("undefined");
+ ValueImp *v = ref.getValue(exec);
+ switch (v->type())
{
case UndefinedType:
s = "undefined";
@@ -892,14 +883,14 @@
s = "string";
break;
default:
- if (v.type() == ObjectType && static_cast<ObjectImp*>(v.imp())->implementsCall())
+ if (v->isObject() && static_cast<ObjectImp*>(v)->implementsCall())
s = "function";
else
s = "object";
break;
}
- return Value(s);
+ return jsString(s);
}
// ------------------------------ PrefixNode -----------------------------------
@@ -919,17 +910,17 @@
}
// ECMA 11.4.4 and 11.4.5
-Value PrefixNode::evaluate(ExecState *exec)
+ValueImp *PrefixNode::evaluate(ExecState *exec)
{
Reference ref = expr->evaluateReference(exec);
KJS_CHECKEXCEPTIONVALUE
- Value v = ref.getValue(exec);
+ ValueImp *v = ref.getValue(exec);
bool knownToBeInteger;
- double n = v.toNumber(exec, knownToBeInteger);
+ double n = v->toNumber(exec, knownToBeInteger);
double newValue = (oper == OpPlusPlus) ? n + 1 : n - 1;
- Value n2(newValue, knownToBeInteger);
+ ValueImp *n2 = jsNumber(newValue, knownToBeInteger);
ref.putValue(exec, n2);
@@ -953,12 +944,12 @@
}
// ECMA 11.4.6
-Value UnaryPlusNode::evaluate(ExecState *exec)
+ValueImp *UnaryPlusNode::evaluate(ExecState *exec)
{
- Value v = expr->evaluate(exec);
+ ValueImp *v = expr->evaluate(exec);
KJS_CHECKEXCEPTIONVALUE
- return Value(v.toNumber(exec)); /* TODO: optimize */
+ return jsNumber(v->toNumber(exec)); /* TODO: optimize */
}
// ------------------------------ NegateNode -----------------------------------
@@ -978,14 +969,14 @@
}
// ECMA 11.4.7
-Value NegateNode::evaluate(ExecState *exec)
+ValueImp *NegateNode::evaluate(ExecState *exec)
{
- Value v = expr->evaluate(exec);
+ ValueImp *v = expr->evaluate(exec);
KJS_CHECKEXCEPTIONVALUE
bool knownToBeInteger;
- double n = v.toNumber(exec, knownToBeInteger);
- return Value(-n, knownToBeInteger && n != 0);
+ double n = v->toNumber(exec, knownToBeInteger);
+ return jsNumber(-n, knownToBeInteger && n != 0);
}
// ------------------------------ BitwiseNotNode -------------------------------
@@ -1005,11 +996,11 @@
}
// ECMA 11.4.8
-Value BitwiseNotNode::evaluate(ExecState *exec)
+ValueImp *BitwiseNotNode::evaluate(ExecState *exec)
{
- Value v = expr->evaluate(exec);
+ ValueImp *v = expr->evaluate(exec);
KJS_CHECKEXCEPTIONVALUE
- return Value(~v.toInt32(exec));
+ return jsNumber(~v->toInt32(exec));
}
// ------------------------------ LogicalNotNode -------------------------------
@@ -1029,11 +1020,11 @@
}
// ECMA 11.4.9
-Value LogicalNotNode::evaluate(ExecState *exec)
+ValueImp *LogicalNotNode::evaluate(ExecState *exec)
{
- Value v = expr->evaluate(exec);
+ ValueImp *v = expr->evaluate(exec);
KJS_CHECKEXCEPTIONVALUE
- return Value(!v.toBoolean(exec));
+ return jsBoolean(!v->toBoolean(exec));
}
// ------------------------------ MultNode -------------------------------------
@@ -1057,12 +1048,12 @@
}
// ECMA 11.5
-Value MultNode::evaluate(ExecState *exec)
+ValueImp *MultNode::evaluate(ExecState *exec)
{
- Value v1 = term1->evaluate(exec);
+ ValueImp *v1 = term1->evaluate(exec);
KJS_CHECKEXCEPTIONVALUE
- Value v2 = term2->evaluate(exec);
+ ValueImp *v2 = term2->evaluate(exec);
KJS_CHECKEXCEPTIONVALUE
return mult(exec, v1, v2, oper);
@@ -1089,12 +1080,12 @@
}
// ECMA 11.6
-Value AddNode::evaluate(ExecState *exec)
+ValueImp *AddNode::evaluate(ExecState *exec)
{
- Value v1 = term1->evaluate(exec);
+ ValueImp *v1 = term1->evaluate(exec);
KJS_CHECKEXCEPTIONVALUE
- Value v2 = term2->evaluate(exec);
+ ValueImp *v2 = term2->evaluate(exec);
KJS_CHECKEXCEPTIONVALUE
return add(exec, v1, v2, oper);
@@ -1121,22 +1112,22 @@
}
// ECMA 11.7
-Value ShiftNode::evaluate(ExecState *exec)
+ValueImp *ShiftNode::evaluate(ExecState *exec)
{
- Value v1 = term1->evaluate(exec);
+ ValueImp *v1 = term1->evaluate(exec);
KJS_CHECKEXCEPTIONVALUE
- Value v2 = term2->evaluate(exec);
+ ValueImp *v2 = term2->evaluate(exec);
KJS_CHECKEXCEPTIONVALUE
- unsigned int i2 = v2.toUInt32(exec);
+ unsigned int i2 = v2->toUInt32(exec);
i2 &= 0x1f;
switch (oper) {
case OpLShift:
- return Value(v1.toInt32(exec) << i2);
+ return jsNumber(v1->toInt32(exec) << i2);
case OpRShift:
- return Value(v1.toInt32(exec) >> i2);
+ return jsNumber(v1->toInt32(exec) >> i2);
case OpURShift:
- return Value(v1.toUInt32(exec) >> i2);
+ return jsNumber(v1->toUInt32(exec) >> i2);
default:
assert(!"ShiftNode: unhandled switch case");
return Undefined();
@@ -1164,11 +1155,11 @@
}
// ECMA 11.8
-Value RelationalNode::evaluate(ExecState *exec)
+ValueImp *RelationalNode::evaluate(ExecState *exec)
{
- Value v1 = expr1->evaluate(exec);
+ ValueImp *v1 = expr1->evaluate(exec);
KJS_CHECKEXCEPTIONVALUE
- Value v2 = expr2->evaluate(exec);
+ ValueImp *v2 = expr2->evaluate(exec);
KJS_CHECKEXCEPTIONVALUE
bool b;
@@ -1186,30 +1177,30 @@
b = (oper == OpGreater) ? (r == 1) : (r == 0);
} else if (oper == OpIn) {
// Is all of this OK for host objects?
- if (v2.type() != ObjectType)
+ if (!v2->isObject())
return throwError(exec, TypeError,
"Value %s (result of expression %s) is not an object. Cannot be used with IN expression.", v2, expr2);
- Object o2(static_cast<ObjectImp*>(v2.imp()));
- b = o2.hasProperty(exec, Identifier(v1.toString(exec)));
+ ObjectImp *o2(static_cast<ObjectImp*>(v2));
+ b = o2->hasProperty(exec, Identifier(v1->toString(exec)));
} else {
- if (v2.type() != ObjectType)
+ if (!v2->isObject())
return throwError(exec, TypeError,
"Value %s (result of expression %s) is not an object. Cannot be used with instanceof operator.", v2, expr2);
- Object o2(static_cast<ObjectImp*>(v2.imp()));
- if (!o2.implementsHasInstance()) {
- // According to the spec, only some types of objects "imlement" the [[HasInstance]] property.
+ ObjectImp *o2(static_cast<ObjectImp*>(v2));
+ if (!o2->implementsHasInstance()) {
+ // According to the spec, only some types of objects "implement" the [[HasInstance]] property.
// But we are supposed to throw an exception where the object does not "have" the [[HasInstance]]
// property. It seems that all object have the property, but not all implement it, so in this
// case we return false (consistent with mozilla)
- return Value(false);
+ return jsBoolean(false);
// return throwError(exec, TypeError,
// "Object does not implement the [[HasInstance]] method." );
}
- return o2.hasInstance(exec, v1);
+ return jsBoolean(o2->hasInstance(exec, v1));
}
- return Value(b);
+ return jsBoolean(b);
}
// ------------------------------ EqualNode ------------------------------------
@@ -1233,11 +1224,11 @@
}
// ECMA 11.9
-Value EqualNode::evaluate(ExecState *exec)
+ValueImp *EqualNode::evaluate(ExecState *exec)
{
- Value v1 = expr1->evaluate(exec);
+ ValueImp *v1 = expr1->evaluate(exec);
KJS_CHECKEXCEPTIONVALUE
- Value v2 = expr2->evaluate(exec);
+ ValueImp *v2 = expr2->evaluate(exec);
KJS_CHECKEXCEPTIONVALUE
bool result;
@@ -1250,7 +1241,7 @@
bool eq = strictEqual(exec,v1, v2);
result = oper == OpStrEq ? eq : !eq;
}
- return Value(result);
+ return jsBoolean(result);
}
// ------------------------------ BitOperNode ----------------------------------
@@ -1274,14 +1265,14 @@
}
// ECMA 11.10
-Value BitOperNode::evaluate(ExecState *exec)
+ValueImp *BitOperNode::evaluate(ExecState *exec)
{
- Value v1 = expr1->evaluate(exec);
+ ValueImp *v1 = expr1->evaluate(exec);
KJS_CHECKEXCEPTIONVALUE
- Value v2 = expr2->evaluate(exec);
+ ValueImp *v2 = expr2->evaluate(exec);
KJS_CHECKEXCEPTIONVALUE
- int i1 = v1.toInt32(exec);
- int i2 = v2.toInt32(exec);
+ int i1 = v1->toInt32(exec);
+ int i2 = v2->toInt32(exec);
int result;
if (oper == OpBitAnd)
result = i1 & i2;
@@ -1290,7 +1281,7 @@
else
result = i1 | i2;
- return Value(result);
+ return jsNumber(result);
}
// ------------------------------ BinaryLogicalNode ----------------------------
@@ -1314,15 +1305,15 @@
}
// ECMA 11.11
-Value BinaryLogicalNode::evaluate(ExecState *exec)
+ValueImp *BinaryLogicalNode::evaluate(ExecState *exec)
{
- Value v1 = expr1->evaluate(exec);
+ ValueImp *v1 = expr1->evaluate(exec);
KJS_CHECKEXCEPTIONVALUE
- bool b1 = v1.toBoolean(exec);
+ bool b1 = v1->toBoolean(exec);
if ((!b1 && oper == OpAnd) || (b1 && oper == OpOr))
return v1;
- Value v2 = expr2->evaluate(exec);
+ ValueImp *v2 = expr2->evaluate(exec);
KJS_CHECKEXCEPTIONVALUE
return v2;
@@ -1353,11 +1344,11 @@
}
// ECMA 11.12
-Value ConditionalNode::evaluate(ExecState *exec)
+ValueImp *ConditionalNode::evaluate(ExecState *exec)
{
- Value v = logical->evaluate(exec);
+ ValueImp *v = logical->evaluate(exec);
KJS_CHECKEXCEPTIONVALUE
- bool b = v.toBoolean(exec);
+ bool b = v->toBoolean(exec);
if (b)
v = expr1->evaluate(exec);
@@ -1389,17 +1380,17 @@
}
// ECMA 11.13
-Value AssignNode::evaluate(ExecState *exec)
+ValueImp *AssignNode::evaluate(ExecState *exec)
{
Reference l = left->evaluateReference(exec);
KJS_CHECKEXCEPTIONVALUE
- Value e, v;
+ ValueImp *v;
if (oper == OpEqual) {
v = expr->evaluate(exec);
KJS_CHECKEXCEPTIONVALUE
} else {
- Value v1 = l.getValue(exec);
- Value v2 = expr->evaluate(exec);
+ ValueImp *v1 = l.getValue(exec);
+ ValueImp *v2 = expr->evaluate(exec);
KJS_CHECKEXCEPTIONVALUE
int i1;
int i2;
@@ -1418,41 +1409,41 @@
v = add(exec, v1, v2, '-');
break;
case OpLShift:
- i1 = v1.toInt32(exec);
- i2 = v2.toInt32(exec);
- v = Value(i1 << i2);
+ i1 = v1->toInt32(exec);
+ i2 = v2->toInt32(exec);
+ v = jsNumber(i1 << i2);
break;
case OpRShift:
- i1 = v1.toInt32(exec);
- i2 = v2.toInt32(exec);
- v = Value(i1 >> i2);
+ i1 = v1->toInt32(exec);
+ i2 = v2->toInt32(exec);
+ v = jsNumber(i1 >> i2);
break;
case OpURShift:
- ui = v1.toUInt32(exec);
- i2 = v2.toInt32(exec);
- v = Value(ui >> i2);
+ ui = v1->toUInt32(exec);
+ i2 = v2->toInt32(exec);
+ v = jsNumber(ui >> i2);
break;
case OpAndEq:
- i1 = v1.toInt32(exec);
- i2 = v2.toInt32(exec);
- v = Value(i1 & i2);
+ i1 = v1->toInt32(exec);
+ i2 = v2->toInt32(exec);
+ v = jsNumber(i1 & i2);
break;
case OpXOrEq:
- i1 = v1.toInt32(exec);
- i2 = v2.toInt32(exec);
- v = Value(i1 ^ i2);
+ i1 = v1->toInt32(exec);
+ i2 = v2->toInt32(exec);
+ v = jsNumber(i1 ^ i2);
break;
case OpOrEq:
- i1 = v1.toInt32(exec);
- i2 = v2.toInt32(exec);
- v = Value(i1 | i2);
+ i1 = v1->toInt32(exec);
+ i2 = v2->toInt32(exec);
+ v = jsNumber(i1 | i2);
break;
case OpModEq: {
bool d1KnownToBeInteger;
- double d1 = v1.toNumber(exec, d1KnownToBeInteger);
+ double d1 = v1->toNumber(exec, d1KnownToBeInteger);
bool d2KnownToBeInteger;
- double d2 = v2.toNumber(exec, d2KnownToBeInteger);
- v = Value(fmod(d1, d2), d1KnownToBeInteger && d2KnownToBeInteger && d2 != 0);
+ double d2 = v2->toNumber(exec, d2KnownToBeInteger);
+ v = jsNumber(fmod(d1, d2), d1KnownToBeInteger && d2KnownToBeInteger && d2 != 0);
}
break;
default:
@@ -1487,11 +1478,11 @@
}
// ECMA 11.14
-Value CommaNode::evaluate(ExecState *exec)
+ValueImp *CommaNode::evaluate(ExecState *exec)
{
- Value dummy = expr1->evaluate(exec);
+ expr1->evaluate(exec);
KJS_CHECKEXCEPTIONVALUE
- Value v = expr2->evaluate(exec);
+ ValueImp *v = expr2->evaluate(exec);
KJS_CHECKEXCEPTIONVALUE
return v;
@@ -1540,7 +1531,7 @@
Completion c = statement->execute(exec);
KJS_ABORTPOINT
if (exec->hadException()) {
- Value ex = exec->exception();
+ ValueImp *ex = exec->exception();
exec->clearException();
return Completion(Throw, ex);
}
@@ -1548,7 +1539,7 @@
if (c.complType() != Normal)
return c;
- Value v = c.value();
+ ValueImp *v = c.value();
for (StatListNode *n = list; n; n = n->list) {
Completion c2 = n->statement->execute(exec);
@@ -1557,7 +1548,7 @@
return c2;
if (exec->hadException()) {
- Value ex = exec->exception();
+ ValueImp *ex = exec->exception();
exec->clearException();
return Completion(Throw, ex);
}
@@ -1593,7 +1584,7 @@
}
// ECMA 12.2
-Value AssignExprNode::evaluate(ExecState *exec)
+ValueImp *AssignExprNode::evaluate(ExecState *exec)
{
return expr->evaluate(exec);
}
@@ -1621,19 +1612,19 @@
}
// ECMA 12.2
-Value VarDeclNode::evaluate(ExecState *exec)
+ValueImp *VarDeclNode::evaluate(ExecState *exec)
{
- Object variable = exec->context().imp()->variableObject();
+ ObjectImp *variable = exec->context().imp()->variableObject();
- Value val;
+ ValueImp *val;
if (init) {
val = init->evaluate(exec);
KJS_CHECKEXCEPTIONVALUE
} else {
// already declared? - check with getDirect so you can override
// built-in properties of the global object with var declarations.
- if ( variable.imp()->getDirect(ident) )
- return Value();
+ if (variable->getDirect(ident))
+ return NULL;
val = Undefined();
}
@@ -1647,24 +1638,24 @@
flags |= DontDelete;
if (varType == VarDeclNode::Constant)
flags |= ReadOnly;
- variable.put(exec, ident, val, flags);
+ variable->put(exec, ident, val, flags);
- return ident.ustring();
+ return jsString(ident.ustring());
}
void VarDeclNode::processVarDecls(ExecState *exec)
{
- Object variable = exec->context().imp()->variableObject();
+ ObjectImp *variable = exec->context().imp()->variableObject();
// If a variable by this name already exists, don't clobber it -
// it might be a function parameter
- if (!variable.hasProperty(exec, ident)) {
+ if (!variable->hasProperty(exec, ident)) {
int flags = Internal;
if (exec->context().imp()->codeType() != EvalCode)
flags |= DontDelete;
if (varType == VarDeclNode::Constant)
flags |= ReadOnly;
- variable.put(exec, ident, Undefined(), flags);
+ variable->put(exec, ident, Undefined(), flags);
}
}
@@ -1694,7 +1685,7 @@
// ECMA 12.2
-Value VarDeclListNode::evaluate(ExecState *exec)
+ValueImp *VarDeclListNode::evaluate(ExecState *exec)
{
for (VarDeclListNode *n = this; n; n = n->list) {
n->var->evaluate(exec);
@@ -1814,7 +1805,7 @@
{
KJS_BREAKPOINT;
- Value v = expr->evaluate(exec);
+ ValueImp *v = expr->evaluate(exec);
KJS_CHECKEXCEPTION
return Completion(Normal, v);
@@ -1849,9 +1840,9 @@
{
KJS_BREAKPOINT;
- Value v = expr->evaluate(exec);
+ ValueImp *v = expr->evaluate(exec);
KJS_CHECKEXCEPTION
- bool b = v.toBoolean(exec);
+ bool b = v->toBoolean(exec);
// if ... then
if (b)
@@ -1898,9 +1889,8 @@
{
KJS_BREAKPOINT;
- Value be, bv;
+ ValueImp *bv;
Completion c;
- Value value;
do {
// bail out on error
@@ -1911,15 +1901,15 @@
exec->context().imp()->seenLabels()->popIteration();
if (!((c.complType() == Continue) && ls.contains(c.target()))) {
if ((c.complType() == Break) && ls.contains(c.target()))
- return Completion(Normal, value);
+ return Completion(Normal, NULL);
if (c.complType() != Normal)
return c;
}
bv = expr->evaluate(exec);
KJS_CHECKEXCEPTION
- } while (bv.toBoolean(exec));
+ } while (bv->toBoolean(exec));
- return Completion(Normal, value);
+ return Completion(Normal, NULL);
}
void DoWhileNode::processVarDecls(ExecState *exec)
@@ -1952,15 +1942,15 @@
{
KJS_BREAKPOINT;
- Value be, bv;
+ ValueImp *bv;
Completion c;
bool b(false);
- Value value;
+ ValueImp *value = NULL;
while (1) {
bv = expr->evaluate(exec);
KJS_CHECKEXCEPTION
- b = bv.toBoolean(exec);
+ b = bv->toBoolean(exec);
// bail out on error
KJS_CHECKEXCEPTION
@@ -2021,7 +2011,7 @@
// ECMA 12.6.3
Completion ForNode::execute(ExecState *exec)
{
- Value v, cval;
+ ValueImp *v, *cval = NULL;
if (expr1) {
v = expr1->evaluate(exec);
@@ -2031,7 +2021,7 @@
if (expr2) {
v = expr2->evaluate(exec);
KJS_CHECKEXCEPTION
- if (!v.toBoolean(exec))
+ if (!v->toBoolean(exec))
return Completion(Normal, cval);
}
// bail out on error
@@ -2113,8 +2103,9 @@
// ECMA 12.6.4
Completion ForInNode::execute(ExecState *exec)
{
- Value e, retval;
- Object v;
+ ValueImp *e;
+ ValueImp *retval = NULL;
+ ObjectImp *v;
Completion c;
ReferenceList propList;
@@ -2129,19 +2120,19 @@
// the loop at all, because their object wrappers will have a
// property list but will throw an exception if you attempt to
// access any property.
- if (e.type() == UndefinedType || e.type() == NullType) {
- return Completion(Normal, retval);
+ if (e->isUndefinedOrNull()) {
+ return Completion(Normal, NULL);
}
KJS_CHECKEXCEPTION
- v = e.toObject(exec);
- propList = v.propList(exec);
+ v = e->toObject(exec);
+ propList = v->propList(exec);
ReferenceListIterator propIt = propList.begin();
while (propIt != propList.end()) {
Identifier name = propIt->getPropertyName(exec);
- if (!v.hasProperty(exec,name)) {
+ if (!v->hasProperty(exec,name)) {
propIt++;
continue;
}
@@ -2185,8 +2176,6 @@
{
KJS_BREAKPOINT;
- Value dummy;
-
if (ident.isEmpty() && !exec->context().imp()->seenLabels()->inIteration())
return Completion(Throw,
throwError(exec, SyntaxError, "Invalid continue statement."));
@@ -2194,7 +2183,7 @@
return Completion(Throw,
throwError(exec, SyntaxError, "Label %s not found.", ident));
else
- return Completion(Continue, dummy, ident);
+ return Completion(Continue, NULL, ident);
}
// ------------------------------ BreakNode ------------------------------------
@@ -2204,8 +2193,6 @@
{
KJS_BREAKPOINT;
- Value dummy;
-
if (ident.isEmpty() && !exec->context().imp()->seenLabels()->inIteration() &&
!exec->context().imp()->seenLabels()->inSwitch())
return Completion(Throw,
@@ -2214,7 +2201,7 @@
return Completion(Throw,
throwError(exec, SyntaxError, "Label %s not found.", ident));
else
- return Completion(Break, dummy, ident);
+ return Completion(Break, NULL, ident);
}
// ------------------------------ ReturnNode -----------------------------------
@@ -2246,7 +2233,7 @@
if (!value)
return Completion(ReturnValue, Undefined());
- Value v = value->evaluate(exec);
+ ValueImp *v = value->evaluate(exec);
KJS_CHECKEXCEPTION
return Completion(ReturnValue, v);
@@ -2277,9 +2264,9 @@
{
KJS_BREAKPOINT;
- Value v = expr->evaluate(exec);
+ ValueImp *v = expr->evaluate(exec);
KJS_CHECKEXCEPTION
- Object o = v.toObject(exec);
+ ObjectImp *o = v->toObject(exec);
KJS_CHECKEXCEPTION
exec->context().imp()->pushScope(o);
Completion res = statement->execute(exec);
@@ -2314,9 +2301,9 @@
}
// ECMA 12.11
-Value CaseClauseNode::evaluate(ExecState *exec)
+ValueImp *CaseClauseNode::evaluate(ExecState *exec)
{
- Value v = expr->evaluate(exec);
+ ValueImp *v = expr->evaluate(exec);
KJS_CHECKEXCEPTIONVALUE
return v;
@@ -2361,11 +2348,11 @@
return Node::deref();
}
-Value ClauseListNode::evaluate(ExecState */*exec*/)
+ValueImp *ClauseListNode::evaluate(ExecState */*exec*/)
{
/* should never be called */
assert(false);
- return Value();
+ return NULL;
}
// ECMA 12.11
@@ -2420,17 +2407,17 @@
return Node::deref();
}
-Value CaseBlockNode::evaluate(ExecState */*exec*/)
+ValueImp *CaseBlockNode::evaluate(ExecState */*exec*/)
{
/* should never be called */
assert(false);
- return Value();
+ return NULL;
}
// ECMA 12.11
-Completion CaseBlockNode::evalBlock(ExecState *exec, const Value& input)
+Completion CaseBlockNode::evalBlock(ExecState *exec, ValueImp *input)
{
- Value v;
+ ValueImp *v;
Completion res;
ClauseListNode *a = list1, *b = list2;
CaseClauseNode *clause;
@@ -2524,7 +2511,7 @@
{
KJS_BREAKPOINT;
- Value v = expr->evaluate(exec);
+ ValueImp *v = expr->evaluate(exec);
KJS_CHECKEXCEPTION
exec->context().imp()->seenLabels()->pushSwitch();
@@ -2600,7 +2587,7 @@
{
KJS_BREAKPOINT;
- Value v = expr->evaluate(exec);
+ ValueImp *v = expr->evaluate(exec);
KJS_CHECKEXCEPTION
return Completion(Throw, v);
@@ -2630,14 +2617,14 @@
}
// ECMA 12.14
-Completion CatchNode::execute(ExecState *exec, const Value &arg)
+Completion CatchNode::execute(ExecState *exec, ValueImp *arg)
{
/* TODO: correct ? Not part of the spec */
exec->clearException();
- Object obj(new ObjectImp());
- obj.put(exec, ident, arg, DontDelete);
+ ObjectImp *obj(new ObjectImp());
+ obj->put(exec, ident, arg, DontDelete);
exec->context().imp()->pushScope(obj);
Completion c = block->execute(exec);
exec->context().imp()->popScope();
@@ -2717,7 +2704,7 @@
}
if (!_catch) {
- Value lastException = exec->exception();
+ ValueImp *lastException = exec->exception();
exec->clearException();
c2 = _final->execute(exec);
@@ -2764,7 +2751,7 @@
}
// ECMA 13
-Value ParameterNode::evaluate(ExecState */*exec*/)
+ValueImp *ParameterNode::evaluate(ExecState */*exec*/)
{
return Undefined();
}
@@ -2807,38 +2794,34 @@
// ECMA 13
void FuncDeclNode::processFuncDecl(ExecState *exec)
{
+ ContextImp *context = exec->context().imp();
+
// TODO: let this be an object with [[Class]] property "Function"
- FunctionImp *fimp = new DeclaredFunctionImp(exec, ident, body, exec->context().imp()->scopeChain());
- Object func(fimp); // protect from GC
+ FunctionImp *fimp = new DeclaredFunctionImp(exec, ident, body, context->scopeChain());
+ ObjectImp *func(fimp); // protect from GC
- // Value proto = exec->lexicalInterpreter()->builtinObject().construct(exec,List::empty());
- List empty;
- Object proto = exec->lexicalInterpreter()->builtinObject().construct(exec,empty);
- proto.put(exec, constructorPropertyName, func, ReadOnly|DontDelete|DontEnum);
- func.put(exec, prototypePropertyName, proto, Internal|DontDelete);
+ ObjectImp *proto = exec->lexicalInterpreter()->builtinObject()->construct(exec, List::empty());
+ proto->put(exec, constructorPropertyName, func, ReadOnly|DontDelete|DontEnum);
+ func->put(exec, prototypePropertyName, proto, Internal|DontDelete);
int plen = 0;
for(ParameterNode *p = param; p != 0L; p = p->nextParam(), plen++)
fimp->addParameter(p->ident());
- func.put(exec, lengthPropertyName, Number(plen), ReadOnly|DontDelete|DontEnum);
+ func->put(exec, lengthPropertyName, Number(plen), ReadOnly|DontDelete|DontEnum);
- if (exec->context().imp()->codeType() == EvalCode) {
- // ECMA 10.2.2
- exec->context().imp()->variableObject().put(exec, ident, func, Internal);
- } else {
- exec->context().imp()->variableObject().put(exec, ident, func, Internal | DontDelete);
- }
+ // ECMA 10.2.2
+ context->variableObject()->put(exec, ident, func, Internal | (context->codeType() == EvalCode ? 0 : DontDelete));
if (body) {
// hack the scope so that the function gets put as a property of func, and it's scope
// contains the func as well as our current scope
- Object oldVar = exec->context().imp()->variableObject();
- exec->context().imp()->setVariableObject(func);
- exec->context().imp()->pushScope(func);
+ ObjectImp *oldVar = context->variableObject();
+ context->setVariableObject(func);
+ context->pushScope(func);
body->processFuncDecl(exec);
- exec->context().imp()->popScope();
- exec->context().imp()->setVariableObject(oldVar);
+ context->popScope();
+ context->setVariableObject(oldVar);
}
}
@@ -2864,12 +2847,11 @@
// ECMA 13
-Value FuncExprNode::evaluate(ExecState *exec)
+ValueImp *FuncExprNode::evaluate(ExecState *exec)
{
FunctionImp *fimp = new DeclaredFunctionImp(exec, Identifier::null(), body, exec->context().imp()->scopeChain());
- Value ret(fimp);
- List empty;
- Value proto = exec->lexicalInterpreter()->builtinObject().construct(exec,empty);
+ ValueImp *ret(fimp);
+ ValueImp *proto = exec->lexicalInterpreter()->builtinObject()->construct(exec, List::empty());
fimp->put(exec, prototypePropertyName, proto, Internal|DontDelete);
int plen = 0;
@@ -2932,7 +2914,7 @@
return c2;
// The spec says to return c2 here, but it seems that mozilla returns c1 if
// c2 doesn't have a value
- if (!c2.value().isNull())
+ if (c2.value())
c1 = c2;
}
1.24 +53 -53 JavaScriptCore/kjs/nodes.h
Index: nodes.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/nodes.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- nodes.h 14 Jul 2005 18:27:03 -0000 1.23
+++ nodes.h 8 Aug 2005 04:07:28 -0000 1.24
@@ -82,7 +82,7 @@
KJS_FAST_ALLOCATED;
- virtual Value evaluate(ExecState *exec) = 0;
+ virtual ValueImp *evaluate(ExecState *exec) = 0;
virtual Reference evaluateReference(ExecState *exec);
UString toString() const;
virtual void streamTo(SourceStream &s) const = 0;
@@ -103,9 +103,9 @@
static void finalCheck();
#endif
protected:
- Value throwError(ExecState *exec, ErrorType e, const char *msg);
- Value throwError(ExecState *exec, ErrorType e, const char *msg, Value v, Node *expr);
- Value throwError(ExecState *exec, ErrorType e, const char *msg, Identifier label);
+ ValueImp *throwError(ExecState *exec, ErrorType e, const char *msg);
+ ValueImp *throwError(ExecState *exec, ErrorType e, const char *msg, ValueImp *v, Node *expr);
+ ValueImp *throwError(ExecState *exec, ErrorType e, const char *msg, Identifier label);
void setExceptionDetailsIfNeeded(ExecState *exec);
int line;
UString sourceURL;
@@ -136,7 +136,7 @@
protected:
LabelStack ls;
private:
- Value evaluate(ExecState */*exec*/) { return Undefined(); }
+ ValueImp *evaluate(ExecState */*exec*/) { return Undefined(); }
int l0, l1;
int sid;
bool breakPoint;
@@ -145,14 +145,14 @@
class NullNode : public Node {
public:
NullNode() {}
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
};
class BooleanNode : public Node {
public:
BooleanNode(bool v) : value(v) {}
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
bool value;
@@ -161,7 +161,7 @@
class NumberNode : public Node {
public:
NumberNode(double v) : value(v) { }
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
double value;
@@ -170,7 +170,7 @@
class StringNode : public Node {
public:
StringNode(const UString *v) { value = *v; }
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
UString value;
@@ -180,7 +180,7 @@
public:
RegExpNode(const UString &p, const UString &f)
: pattern(p), flags(f) { }
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
UString pattern, flags;
@@ -189,14 +189,14 @@
class ThisNode : public Node {
public:
ThisNode() {}
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
};
class ResolveNode : public Node {
public:
ResolveNode(const Identifier &s) : ident(s) { }
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual Reference evaluateReference(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
@@ -208,7 +208,7 @@
GroupNode(Node *g) : group(g) { }
virtual void ref();
virtual bool deref();
- virtual Value evaluate(ExecState *exec);
+ virtual ValueImp *evaluate(ExecState *exec);
virtual Reference evaluateReference(ExecState *exec);
virtual void streamTo(SourceStream &s) const { group->streamTo(s); }
private:
@@ -223,7 +223,7 @@
: list(l->list), elision(e), node(n) { l->list = this; }
virtual void ref();
virtual bool deref();
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
friend class ArrayNode;
@@ -241,7 +241,7 @@
: element(ele->list), elision(eli), opt(true) { ele->list = 0; }
virtual void ref();
virtual bool deref();
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
ElementNode *element;
@@ -258,7 +258,7 @@
: name(n), assign(a), list(l->list) { l->list = this; }
virtual void ref();
virtual bool deref();
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
friend class ObjectLiteralNode;
@@ -273,7 +273,7 @@
ObjectLiteralNode(PropertyValueNode *l) : list(l->list) { l->list = 0; }
virtual void ref();
virtual bool deref();
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
PropertyValueNode *list;
@@ -283,7 +283,7 @@
public:
PropertyNode(double d) : numeric(d) { }
PropertyNode(const Identifier &s) : str(s) { }
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
double numeric;
@@ -295,7 +295,7 @@
AccessorNode1(Node *e1, Node *e2) : expr1(e1), expr2(e2) {}
virtual void ref();
virtual bool deref();
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual Reference evaluateReference(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
@@ -308,7 +308,7 @@
AccessorNode2(Node *e, const Identifier &s) : expr(e), ident(s) { }
virtual void ref();
virtual bool deref();
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual Reference evaluateReference(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
@@ -324,7 +324,7 @@
: list(l->list), expr(e) { l->list = this; }
virtual void ref();
virtual bool deref();
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
List evaluateList(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
@@ -340,7 +340,7 @@
: list(l->list) { l->list = 0; }
virtual void ref();
virtual bool deref();
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
List evaluateList(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
@@ -353,7 +353,7 @@
NewExprNode(Node *e, ArgumentsNode *a) : expr(e), args(a) {}
virtual void ref();
virtual bool deref();
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
Node *expr;
@@ -365,7 +365,7 @@
FunctionCallNode(Node *e, ArgumentsNode *a) : expr(e), args(a) {}
virtual void ref();
virtual bool deref();
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
Node *expr;
@@ -377,7 +377,7 @@
PostfixNode(Node *e, Operator o) : expr(e), oper(o) {}
virtual void ref();
virtual bool deref();
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
Node *expr;
@@ -389,7 +389,7 @@
DeleteNode(Node *e) : expr(e) {}
virtual void ref();
virtual bool deref();
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
Node *expr;
@@ -400,7 +400,7 @@
VoidNode(Node *e) : expr(e) {}
virtual void ref();
virtual bool deref();
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
Node *expr;
@@ -411,7 +411,7 @@
TypeOfNode(Node *e) : expr(e) {}
virtual void ref();
virtual bool deref();
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
Node *expr;
@@ -422,7 +422,7 @@
PrefixNode(Operator o, Node *e) : oper(o), expr(e) {}
virtual void ref();
virtual bool deref();
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
Operator oper;
@@ -434,7 +434,7 @@
UnaryPlusNode(Node *e) : expr(e) {}
virtual void ref();
virtual bool deref();
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
Node *expr;
@@ -445,7 +445,7 @@
NegateNode(Node *e) : expr(e) {}
virtual void ref();
virtual bool deref();
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
Node *expr;
@@ -456,7 +456,7 @@
BitwiseNotNode(Node *e) : expr(e) {}
virtual void ref();
virtual bool deref();
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
Node *expr;
@@ -467,7 +467,7 @@
LogicalNotNode(Node *e) : expr(e) {}
virtual void ref();
virtual bool deref();
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
Node *expr;
@@ -478,7 +478,7 @@
MultNode(Node *t1, Node *t2, char op) : term1(t1), term2(t2), oper(op) {}
virtual void ref();
virtual bool deref();
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
Node *term1, *term2;
@@ -490,7 +490,7 @@
AddNode(Node *t1, Node *t2, char op) : term1(t1), term2(t2), oper(op) {}
virtual void ref();
virtual bool deref();
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
Node *term1, *term2;
@@ -503,7 +503,7 @@
: term1(t1), term2(t2), oper(o) {}
virtual void ref();
virtual bool deref();
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
Node *term1, *term2;
@@ -516,7 +516,7 @@
expr1(e1), expr2(e2), oper(o) {}
virtual void ref();
virtual bool deref();
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
Node *expr1, *expr2;
@@ -529,7 +529,7 @@
: expr1(e1), expr2(e2), oper(o) {}
virtual void ref();
virtual bool deref();
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
Node *expr1, *expr2;
@@ -542,7 +542,7 @@
expr1(e1), expr2(e2), oper(o) {}
virtual void ref();
virtual bool deref();
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
Node *expr1, *expr2;
@@ -558,7 +558,7 @@
expr1(e1), expr2(e2), oper(o) {}
virtual void ref();
virtual bool deref();
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
Node *expr1, *expr2;
@@ -574,7 +574,7 @@
logical(l), expr1(e1), expr2(e2) {}
virtual void ref();
virtual bool deref();
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
Node *logical, *expr1, *expr2;
@@ -585,7 +585,7 @@
AssignNode(Node *l, Operator o, Node *e) : left(l), oper(o), expr(e) {}
virtual void ref();
virtual bool deref();
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
Node *left;
@@ -598,7 +598,7 @@
CommaNode(Node *e1, Node *e2) : expr1(e1), expr2(e2) {}
virtual void ref();
virtual bool deref();
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
Node *expr1, *expr2;
@@ -625,7 +625,7 @@
AssignExprNode(Node *e) : expr(e) {}
virtual void ref();
virtual bool deref();
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
Node *expr;
@@ -637,7 +637,7 @@
VarDeclNode(const Identifier &id, AssignExprNode *in, Type t);
virtual void ref();
virtual bool deref();
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual void processVarDecls(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
@@ -654,7 +654,7 @@
: list(l->list), var(v) { l->list = this; }
virtual void ref();
virtual bool deref();
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual void processVarDecls(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
@@ -830,7 +830,7 @@
: expr(e), list(l->list) { l->list = 0; }
virtual void ref();
virtual bool deref();
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
Completion evalStatements(ExecState *exec);
virtual void processVarDecls(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
@@ -847,7 +847,7 @@
: cl(c), nx(n->nx) { n->nx = this; }
virtual void ref();
virtual bool deref();
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
CaseClauseNode *clause() const { return cl; }
ClauseListNode *next() const { return nx; }
virtual void processVarDecls(ExecState *exec);
@@ -863,8 +863,8 @@
CaseBlockNode(ClauseListNode *l1, CaseClauseNode *d, ClauseListNode *l2);
virtual void ref();
virtual bool deref();
- Value evaluate(ExecState *exec);
- Completion evalBlock(ExecState *exec, const Value& input);
+ ValueImp *evaluate(ExecState *exec);
+ Completion evalBlock(ExecState *exec, ValueImp *input);
virtual void processVarDecls(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
@@ -916,7 +916,7 @@
virtual void ref();
virtual bool deref();
virtual Completion execute(ExecState *exec);
- Completion execute(ExecState *exec, const Value &arg);
+ Completion execute(ExecState *exec, ValueImp *arg);
virtual void processVarDecls(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
@@ -963,7 +963,7 @@
: id(i), next(list->next) { list->next = this; }
virtual void ref();
virtual bool deref();
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
Identifier ident() { return id; }
ParameterNode *nextParam() { return next; }
virtual void streamTo(SourceStream &s) const;
@@ -1006,7 +1006,7 @@
: param(p->next), body(b) { p->next = 0; }
virtual void ref();
virtual bool deref();
- Value evaluate(ExecState *exec);
+ ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
ParameterNode *param;
1.20 +38 -46 JavaScriptCore/kjs/number_object.cpp
Index: number_object.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/number_object.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- number_object.cpp 7 Aug 2005 06:17:35 -0000 1.19
+++ number_object.cpp 8 Aug 2005 04:07:28 -0000 1.20
@@ -52,8 +52,7 @@
FunctionPrototypeImp *funcProto)
: NumberInstanceImp(objProto)
{
- Value protect(this);
- setInternalValue(NumberImp::zero());
+ setInternalValue(jsZero());
// The constructor will be added later, after NumberObjectImp has been constructed
@@ -72,7 +71,6 @@
FunctionPrototypeImp *funcProto, int i, int len)
: InternalFunctionImp(funcProto), id(i)
{
- Value protect(this);
putDirect(lengthPropertyName, len, DontDelete|ReadOnly|DontEnum);
}
@@ -127,26 +125,24 @@
}
// ECMA 15.7.4.2 - 15.7.4.7
-Value NumberProtoFuncImp::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *NumberProtoFuncImp::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- Value result;
-
// no generic function. "this" has to be a Number object
- if (!thisObj.inherits(&NumberInstanceImp::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&NumberInstanceImp::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
- Value v = thisObj.internalValue();
+ ValueImp *v = thisObj->internalValue();
switch (id) {
case ToString: {
double dradix = 10;
if (!args.isEmpty())
- dradix = args[0].toInteger(exec);
+ dradix = args[0]->toInteger(exec);
if (dradix >= 2 && dradix <= 36 && dradix != 10) { // false for NaN
int radix = static_cast<int>(dradix);
- unsigned i = v.toUInt32(exec);
+ unsigned i = v->toUInt32(exec);
char s[33];
char *p = s + sizeof(s);
*--p = '\0';
@@ -154,23 +150,20 @@
*--p = "0123456789abcdefghijklmnopqrstuvwxyz"[i % radix];
i /= radix;
} while (i);
- result = String(p);
+ return String(p);
} else
- result = String(v.toString(exec));
- break;
+ return String(v->toString(exec));
}
case ToLocaleString: /* TODO */
- result = String(v.toString(exec));
- break;
+ return String(v->toString(exec));
case ValueOf:
- result = Number(v.toNumber(exec));
- break;
+ return Number(v->toNumber(exec));
case ToFixed:
{
- Value fractionDigits = args[0];
- double df = fractionDigits.toInteger(exec);
+ ValueImp *fractionDigits = args[0];
+ double df = fractionDigits->toInteger(exec);
if (!(df >= 0 && df <= 20)) { // true for NaN
- Object err = Error::create(exec, RangeError,
+ ObjectImp *err = Error::create(exec, RangeError,
"toFixed() digits argument must be between 0 and 20");
exec->setException(err);
@@ -178,7 +171,7 @@
}
int f = (int)df;
- double x = v.toNumber(exec);
+ double x = v->toNumber(exec);
if (isNaN(x))
return String("NaN");
@@ -212,15 +205,15 @@
return String(s+m.substr(0,k-f));
}
case ToExponential: {
- double x = v.toNumber(exec);
+ double x = v->toNumber(exec);
if (isNaN(x) || isInf(x))
return String(UString::from(x));
- Value fractionDigits = args[0];
- double df = fractionDigits.toInteger(exec);
+ ValueImp *fractionDigits = args[0];
+ double df = fractionDigits->toInteger(exec);
if (!(df >= 0 && df <= 20)) { // true for NaN
- Object err = Error::create(exec, RangeError,
+ ObjectImp *err = Error::create(exec, RangeError,
"toExponential() argument must between 0 and 20");
exec->setException(err);
return err;
@@ -228,7 +221,7 @@
int f = (int)df;
int decimalAdjust = 0;
- if (!fractionDigits.isA(UndefinedType)) {
+ if (!fractionDigits->isUndefined()) {
double logx = floor(log10(x));
x /= pow(10,logx);
double fx = floor(x*pow(10,f))/pow(10,f);
@@ -263,7 +256,7 @@
} else {
buf[i++] = result[0];
- if (fractionDigits.isA(UndefinedType))
+ if (fractionDigits->isUndefined())
f = length-1;
if (length > 1 && f > 0) {
@@ -310,10 +303,10 @@
int e = 0;
UString m;
- double dp = args[0].toInteger(exec);
- double x = v.toNumber(exec);
+ double dp = args[0]->toInteger(exec);
+ double x = v->toNumber(exec);
if (isNaN(dp) || isNaN(x) || isInf(x))
- return String(v.toString(exec));
+ return String(v->toString(exec));
UString s = "";
if (x < 0) {
@@ -322,7 +315,7 @@
}
if (dp < 1 || dp > 21) {
- Object err = Error::create(exec, RangeError,
+ ObjectImp *err = Error::create(exec, RangeError,
"toPrecision() argument must be between 1 and 21");
exec->setException(err);
return err;
@@ -372,7 +365,7 @@
}
}
- return result;
+ return NULL;
}
// ------------------------------ NumberObjectImp ------------------------------
@@ -394,12 +387,11 @@
NumberPrototypeImp *numberProto)
: InternalFunctionImp(funcProto)
{
- Value protect(this);
// Number.Prototype
putDirect(prototypePropertyName, numberProto,DontEnum|DontDelete|ReadOnly);
// no. of arguments for constructor
- putDirect(lengthPropertyName, NumberImp::one(), ReadOnly|DontDelete|DontEnum);
+ putDirect(lengthPropertyName, jsOne(), ReadOnly|DontDelete|DontEnum);
}
bool NumberObjectImp::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
@@ -407,12 +399,12 @@
return getStaticValueSlot<NumberObjectImp, InternalFunctionImp>(exec, &numberTable, this, propertyName, slot);
}
-Value NumberObjectImp::getValueProperty(ExecState *, int token) const
+ValueImp *NumberObjectImp::getValueProperty(ExecState *, int token) const
{
// ECMA 15.7.3
switch(token) {
case NaNValue:
- return Number(NaN);
+ return jsNaN();
case NegInfinity:
return Number(-Inf);
case PosInfinity:
@@ -432,18 +424,18 @@
// ECMA 15.7.1
-Object NumberObjectImp::construct(ExecState *exec, const List &args)
+ObjectImp *NumberObjectImp::construct(ExecState *exec, const List &args)
{
- ObjectImp *proto = exec->lexicalInterpreter()->builtinNumberPrototype().imp();
- Object obj(new NumberInstanceImp(proto));
+ ObjectImp *proto = exec->lexicalInterpreter()->builtinNumberPrototype();
+ ObjectImp *obj(new NumberInstanceImp(proto));
- Number n;
+ double n;
if (args.isEmpty())
- n = Number(0);
+ n = 0;
else
- n = args[0].toNumber(exec);
+ n = args[0]->toNumber(exec);
- obj.setInternalValue(n);
+ obj->setInternalValue(jsNumber(n));
return obj;
}
@@ -454,10 +446,10 @@
}
// ECMA 15.7.2
-Value NumberObjectImp::call(ExecState *exec, Object &/*thisObj*/, const List &args)
+ValueImp *NumberObjectImp::callAsFunction(ExecState *exec, ObjectImp */*thisObj*/, const List &args)
{
if (args.isEmpty())
return Number(0);
else
- return Number(args[0].toNumber(exec));
+ return Number(args[0]->toNumber(exec));
}
1.10 +6 -5 JavaScriptCore/kjs/number_object.h
Index: number_object.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/number_object.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- number_object.h 7 Aug 2005 06:17:35 -0000 1.9
+++ number_object.h 8 Aug 2005 04:07:28 -0000 1.10
@@ -60,7 +60,7 @@
int i, int len);
virtual bool implementsCall() const;
- virtual Value call(ExecState *exec, Object &thisObj, const List &args);
+ virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args);
enum { ToString, ToLocaleString, ValueOf, ToFixed, ToExponential, ToPrecision };
private:
@@ -79,19 +79,20 @@
NumberPrototypeImp *numberProto);
virtual bool implementsConstruct() const;
- virtual Object construct(ExecState *exec, const List &args);
+ virtual ObjectImp *construct(ExecState *exec, const List &args);
virtual bool implementsCall() const;
- virtual Value call(ExecState *exec, Object &thisObj, const List &args);
+ virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args);
bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
+
virtual const ClassInfo *classInfo() const { return &info; }
static const ClassInfo info;
enum { NaNValue, NegInfinity, PosInfinity, MaxValue, MinValue };
Completion execute(const List &);
- Object construct(const List &);
+ ObjectImp *construct(const List &);
};
} // namespace
1.50 +77 -146 JavaScriptCore/kjs/object.cpp
Index: object.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/object.cpp,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- object.cpp 7 Aug 2005 06:17:35 -0000 1.49
+++ object.cpp 8 Aug 2005 04:07:28 -0000 1.50
@@ -40,10 +40,10 @@
#include "nodes.h"
#ifndef NDEBUG
-#define JAVASCRIPT_CALL_TRACING Yes
+//#define JAVASCRIPT_CALL_TRACING 1
#endif
-#ifdef JAVASCRIPT_CALL_TRACING
+#if JAVASCRIPT_CALL_TRACING
static bool _traceJavaScript = false;
extern "C" {
@@ -63,21 +63,14 @@
// ------------------------------ Object ---------------------------------------
-Object Object::dynamicCast(const Value &v)
+ValueImp *ObjectImp::call(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (v.isNull() || v.type() != ObjectType)
- return Object(0);
+ assert(implementsCall());
- return Object(static_cast<ObjectImp*>(v.imp()));
-}
-
-
-Value Object::call(ExecState *exec, Object &thisObj, const List &args)
-{
#if KJS_MAX_STACK > 0
static int depth = 0; // sum of all concurrent interpreters
-#ifdef JAVASCRIPT_CALL_TRACING
+#if JAVASCRIPT_CALL_TRACING
static bool tracing = false;
if (traceJavaScript() && !tracing) {
tracing = true;
@@ -87,7 +80,7 @@
for (int j = 0; j < args.size(); j++) {
for (int i = 0; i < depth; i++)
putchar (' ');
- printf ("*** arg[%d] = %s\n", j, args[j].toString(exec).ascii());
+ printf ("*** arg[%d] = %s\n", j, args[j]->toString(exec).ascii());
}
tracing = false;
}
@@ -95,25 +88,25 @@
if (++depth > KJS_MAX_STACK) {
--depth;
- Object err = Error::create(exec, RangeError,
+ ObjectImp *err = Error::create(exec, RangeError,
"Maximum call stack size exceeded.");
exec->setException(err);
return err;
}
#endif
- Value ret = imp()->call(exec,thisObj,args);
+ ValueImp *ret = callAsFunction(exec,thisObj,args);
#if KJS_MAX_STACK > 0
--depth;
#endif
-#ifdef JAVASCRIPT_CALL_TRACING
+#if JAVASCRIPT_CALL_TRACING
if (traceJavaScript() && !tracing) {
tracing = true;
for (int i = 0; i < depth; i++)
putchar (' ');
- printf ("*** returning: %s\n", ret.toString(exec).ascii());
+ printf ("*** returning: %s\n", ret->toString(exec).ascii());
tracing = false;
}
#endif
@@ -123,37 +116,13 @@
// ------------------------------ ObjectImp ------------------------------------
-ObjectImp::ObjectImp(const Object &proto)
- : _proto(static_cast<ObjectImp*>(proto.imp())), _internalValue(0L)
-{
- //fprintf(stderr,"ObjectImp::ObjectImp %p\n",(void*)this);
-}
-
-ObjectImp::ObjectImp(ObjectImp *proto)
- : _proto(proto), _internalValue(0L)
-{
- //fprintf(stderr,"ObjectImp::ObjectImp %p\n",(void*)this);
-}
-
-ObjectImp::ObjectImp()
-{
- //fprintf(stderr,"ObjectImp::ObjectImp %p\n",(void*)this);
- _proto = NullImp::staticNull;
- _internalValue = 0L;
-}
-
-ObjectImp::~ObjectImp()
-{
- //fprintf(stderr,"ObjectImp::~ObjectImp %p\n",(void*)this);
-}
-
void ObjectImp::mark()
{
- //fprintf(stderr,"ObjectImp::mark() %p\n",(void*)this);
- ValueImp::mark();
+ AllocatedValueImp::mark();
- if (_proto && !_proto->marked())
- _proto->mark();
+ ValueImp *proto = _proto;
+ if (!proto->marked())
+ proto->mark();
_prop.mark();
@@ -163,39 +132,14 @@
_scope.mark();
}
-const ClassInfo *ObjectImp::classInfo() const
-{
- return 0;
-}
-
-bool ObjectImp::inherits(const ClassInfo *info) const
-{
- if (!info)
- return false;
-
- const ClassInfo *ci = classInfo();
- if (!ci)
- return false;
-
- while (ci && ci != info)
- ci = ci->parentClass;
-
- return (ci == info);
-}
-
Type ObjectImp::type() const
{
return ObjectType;
}
-Value ObjectImp::prototype() const
-{
- return Value(_proto);
-}
-
-void ObjectImp::setPrototype(const Value &proto)
+const ClassInfo *ObjectImp::classInfo() const
{
- _proto = proto.imp();
+ return 0;
}
UString ObjectImp::className() const
@@ -206,7 +150,7 @@
return "Object";
}
-Value ObjectImp::get(ExecState *exec, const Identifier &propertyName) const
+ValueImp *ObjectImp::get(ExecState *exec, const Identifier &propertyName) const
{
PropertySlot slot;
@@ -216,7 +160,7 @@
return Undefined();
}
-Value ObjectImp::get(ExecState *exec, unsigned propertyName) const
+ValueImp *ObjectImp::get(ExecState *exec, unsigned propertyName) const
{
PropertySlot slot;
if (const_cast<ObjectImp *>(this)->getPropertySlot(exec, propertyName, slot))
@@ -225,7 +169,7 @@
return Undefined();
}
-bool ObjectImp::getProperty(ExecState *exec, const Identifier& propertyName, Value& result) const
+bool ObjectImp::getProperty(ExecState *exec, const Identifier& propertyName, ValueImp*& result) const
{
PropertySlot slot;
if (const_cast<ObjectImp *>(this)->getPropertySlot(exec, propertyName, slot)) {
@@ -236,7 +180,7 @@
return false;
}
-bool ObjectImp::getProperty(ExecState *exec, unsigned propertyName, Value& result) const
+bool ObjectImp::getProperty(ExecState *exec, unsigned propertyName, ValueImp*& result) const
{
PropertySlot slot;
if (const_cast<ObjectImp *>(this)->getPropertySlot(exec, propertyName, slot)) {
@@ -256,7 +200,7 @@
return true;
ValueImp *proto = imp->_proto;
- if (proto->dispatchType() != ObjectType)
+ if (!proto->isObject())
break;
imp = static_cast<ObjectImp *>(proto);
@@ -271,10 +215,9 @@
}
// ECMA 8.6.2.2
-void ObjectImp::put(ExecState *exec, const Identifier &propertyName,
- const Value &value, int attr)
+void ObjectImp::put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr)
{
- assert(!value.isNull());
+ assert(value);
// non-standard netscape extension
if (propertyName == exec->dynamicInterpreter()->specialPrototypeIdentifier()) {
@@ -294,11 +237,11 @@
return;
}
- _prop.put(propertyName,value.imp(),attr);
+ _prop.put(propertyName,value,attr);
}
void ObjectImp::put(ExecState *exec, unsigned propertyName,
- const Value &value, int attr)
+ ValueImp *value, int attr)
{
put(exec, Identifier::from(propertyName), value, attr);
}
@@ -340,6 +283,12 @@
return const_cast<ObjectImp *>(this)->getOwnPropertySlot(exec, propertyName, slot);
}
+bool ObjectImp::hasOwnProperty(ExecState *exec, unsigned propertyName) const
+{
+ PropertySlot slot;
+ return const_cast<ObjectImp *>(this)->getOwnPropertySlot(exec, propertyName, slot);
+}
+
// ECMA 8.6.2.5
bool ObjectImp::deleteProperty(ExecState */*exec*/, const Identifier &propertyName)
{
@@ -370,28 +319,28 @@
}
// ECMA 8.6.2.6
-Value ObjectImp::defaultValue(ExecState *exec, Type hint) const
+ValueImp *ObjectImp::defaultValue(ExecState *exec, Type hint) const
{
if (hint != StringType && hint != NumberType) {
/* Prefer String for Date objects */
- if (_proto == exec->lexicalInterpreter()->builtinDatePrototype().imp())
+ if (_proto == exec->lexicalInterpreter()->builtinDatePrototype())
hint = StringType;
else
hint = NumberType;
}
- Value v;
+ ValueImp *v;
if (hint == StringType)
v = get(exec,toStringPropertyName);
else
v = get(exec,valueOfPropertyName);
- if (v.type() == ObjectType) {
- Object o = Object(static_cast<ObjectImp*>(v.imp()));
- if (o.implementsCall()) { // spec says "not primitive type" but ...
- Object thisObj = Object(const_cast<ObjectImp*>(this));
- Value def = o.call(exec,thisObj,List::empty());
- Type defType = def.type();
+ if (v->isObject()) {
+ ObjectImp *o = static_cast<ObjectImp*>(v);
+ if (o->implementsCall()) { // spec says "not primitive type" but ...
+ ObjectImp *thisObj = const_cast<ObjectImp*>(this);
+ ValueImp *def = o->call(exec,thisObj,List::empty());
+ Type defType = def->type();
if (defType == UnspecifiedType || defType == UndefinedType ||
defType == NullType || defType == BooleanType ||
defType == StringType || defType == NumberType) {
@@ -405,12 +354,12 @@
else
v = get(exec,toStringPropertyName);
- if (v.type() == ObjectType) {
- Object o = Object(static_cast<ObjectImp*>(v.imp()));
- if (o.implementsCall()) { // spec says "not primitive type" but ...
- Object thisObj = Object(const_cast<ObjectImp*>(this));
- Value def = o.call(exec,thisObj,List::empty());
- Type defType = def.type();
+ if (v->isObject()) {
+ ObjectImp *o = static_cast<ObjectImp*>(v);
+ if (o->implementsCall()) { // spec says "not primitive type" but ...
+ ObjectImp *thisObj = const_cast<ObjectImp*>(this);
+ ValueImp *def = o->call(exec,thisObj,List::empty());
+ Type defType = def->type();
if (defType == UnspecifiedType || defType == UndefinedType ||
defType == NullType || defType == BooleanType ||
defType == StringType || defType == NumberType) {
@@ -422,23 +371,20 @@
if (exec->hadException())
return exec->exception();
- Object err = Error::create(exec, TypeError, I18N_NOOP("No default value"));
+ ObjectImp *err = Error::create(exec, TypeError, I18N_NOOP("No default value"));
exec->setException(err);
return err;
}
-const HashEntry* ObjectImp::findPropertyHashEntry( const Identifier& propertyName ) const
+const HashEntry* ObjectImp::findPropertyHashEntry(const Identifier& propertyName) const
{
- const ClassInfo *info = classInfo();
- while (info) {
- if (info->propHashTable) {
- const HashEntry *e = Lookup::findEntry(info->propHashTable, propertyName);
- if (e)
+ for (const ClassInfo *info = classInfo(); info; info = info->parentClass) {
+ if (const HashTable *propHashTable = info->propHashTable) {
+ if (const HashEntry *e = Lookup::findEntry(propHashTable, propertyName))
return e;
}
- info = info->parentClass;
}
- return 0L;
+ return 0;
}
bool ObjectImp::implementsConstruct() const
@@ -446,13 +392,13 @@
return false;
}
-Object ObjectImp::construct(ExecState */*exec*/, const List &/*args*/)
+ObjectImp *ObjectImp::construct(ExecState */*exec*/, const List &/*args*/)
{
assert(false);
- return Object(0);
+ return NULL;
}
-Object ObjectImp::construct(ExecState *exec, const List &args, const UString &/*sourceURL*/, int /*lineNumber*/)
+ObjectImp *ObjectImp::construct(ExecState *exec, const List &args, const UString &/*sourceURL*/, int /*lineNumber*/)
{
return construct(exec, args);
}
@@ -462,10 +408,10 @@
return false;
}
-Value ObjectImp::call(ExecState */*exec*/, Object &/*thisObj*/, const List &/*args*/)
+ValueImp *ObjectImp::callAsFunction(ExecState */*exec*/, ObjectImp */*thisObj*/, const List &/*args*/)
{
assert(false);
- return Object(0);
+ return NULL;
}
bool ObjectImp::implementsHasInstance() const
@@ -473,19 +419,19 @@
return false;
}
-Boolean ObjectImp::hasInstance(ExecState */*exec*/, const Value &/*value*/)
+bool ObjectImp::hasInstance(ExecState */*exec*/, ValueImp */*value*/)
{
assert(false);
- return Boolean(false);
+ return false;
}
ReferenceList ObjectImp::propList(ExecState *exec, bool recursive)
{
ReferenceList list;
- if (_proto && _proto->dispatchType() == ObjectType && recursive)
+ if (_proto->isObject() && recursive)
list = static_cast<ObjectImp*>(_proto)->propList(exec,recursive);
- _prop.addEnumerablesToReferenceList(list, Object(this));
+ _prop.addEnumerablesToReferenceList(list, this);
// Add properties from the static hashtable of properties
const ClassInfo *info = classInfo();
@@ -504,22 +450,7 @@
return list;
}
-Value ObjectImp::internalValue() const
-{
- return Value(_internalValue);
-}
-
-void ObjectImp::setInternalValue(const Value &v)
-{
- _internalValue = v.imp();
-}
-
-void ObjectImp::setInternalValue(ValueImp *v)
-{
- _internalValue = v;
-}
-
-Value ObjectImp::toPrimitive(ExecState *exec, Type preferredType) const
+ValueImp *ObjectImp::toPrimitive(ExecState *exec, Type preferredType) const
{
return defaultValue(exec,preferredType);
}
@@ -531,23 +462,23 @@
double ObjectImp::toNumber(ExecState *exec) const
{
- Value prim = toPrimitive(exec,NumberType);
+ ValueImp *prim = toPrimitive(exec,NumberType);
if (exec->hadException()) // should be picked up soon in nodes.cpp
return 0.0;
- return prim.toNumber(exec);
+ return prim->toNumber(exec);
}
UString ObjectImp::toString(ExecState *exec) const
{
- Value prim = toPrimitive(exec,StringType);
+ ValueImp *prim = toPrimitive(exec,StringType);
if (exec->hadException()) // should be picked up soon in nodes.cpp
return "";
- return prim.toString(exec);
+ return prim->toString(exec);
}
-Object ObjectImp::toObject(ExecState */*exec*/) const
+ObjectImp *ObjectImp::toObject(ExecState */*exec*/) const
{
- return Object(const_cast<ObjectImp*>(this));
+ return const_cast<ObjectImp*>(this);
}
void ObjectImp::putDirect(const Identifier &propertyName, ValueImp *value, int attr)
@@ -557,7 +488,7 @@
void ObjectImp::putDirect(const Identifier &propertyName, int value, int attr)
{
- _prop.put(propertyName, NumberImp::create(value), attr);
+ _prop.put(propertyName, jsNumber(value), attr);
}
// ------------------------------ Error ----------------------------------------
@@ -574,10 +505,10 @@
const char * const * const Error::errorNames = errorNamesArr;
-Object Error::create(ExecState *exec, ErrorType errtype, const char *message,
+ObjectImp *Error::create(ExecState *exec, ErrorType errtype, const char *message,
int lineno, int sourceId, const UString *sourceURL)
{
- Object cons;
+ ObjectImp *cons;
switch (errtype) {
case EvalError:
cons = exec->lexicalInterpreter()->builtinEvalError();
@@ -606,21 +537,21 @@
message = errorNames[errtype];
List args;
args.append(String(message));
- Object err = Object::dynamicCast(cons.construct(exec,args));
+ ObjectImp *err = static_cast<ObjectImp *>(cons->construct(exec,args));
if (lineno != -1)
- err.put(exec, "line", Number(lineno));
+ err->put(exec, "line", Number(lineno));
if (sourceId != -1)
- err.put(exec, "sourceId", Number(sourceId));
+ err->put(exec, "sourceId", Number(sourceId));
if(sourceURL)
- err.put(exec,"sourceURL", String(*sourceURL));
+ err->put(exec,"sourceURL", String(*sourceURL));
return err;
/*
#ifndef NDEBUG
- const char *msg = err.get("message").toString().value().ascii();
+ const char *msg = err->get("message")->toString().value().ascii();
if (l >= 0)
fprintf(stderr, "KJS: %s at line %d. %s\n", estr, l, msg);
else
@@ -633,7 +564,7 @@
ObjectImp *error(ExecState *exec, ErrorType type, const char *message, int line, int sourceId, const UString *sourceURL)
{
- return Error::create(exec, type, message, line, sourceId, sourceURL).imp();
+ return Error::create(exec, type, message, line, sourceId, sourceURL);
}
} // namespace KJS
1.41 +303 -150 JavaScriptCore/kjs/object.h
Index: object.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/object.h,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- object.h 7 Aug 2005 06:17:35 -0000 1.40
+++ object.h 8 Aug 2005 04:07:29 -0000 1.41
@@ -22,9 +22,8 @@
*
*/
-
-#ifndef _KJS_OBJECT_H_
-#define _KJS_OBJECT_H_
+#ifndef KJS_OBJECT_H
+#define KJS_OBJECT_H
// Objects
@@ -38,9 +37,7 @@
#define KJS_MAX_STACK 1000
#endif
-#include "types.h"
#include "interpreter.h"
-#include "reference_list.h"
#include "property_map.h"
#include "property_slot.h"
#include "scope_chain.h"
@@ -51,6 +48,15 @@
class HashEntry;
class ListImp;
+ // ECMA 262-3 8.6.1
+ // Property attributes
+ enum Attribute { None = 0,
+ ReadOnly = 1 << 1, // property can be only read, not written
+ DontEnum = 1 << 2, // property doesn't appear in (for .. in ..)
+ DontDelete = 1 << 3, // property can't be deleted
+ Internal = 1 << 4, // an internal property, set to bypass checks
+ Function = 1 << 5 }; // property is a function - only used by static hashtables
+
/**
* Class Information
*/
@@ -74,27 +80,22 @@
void *dummy;
};
- inline Object Value::toObject(ExecState *exec) const { return rep->dispatchToObject(exec); }
-
- class ObjectImp : public ValueImp {
+ class ObjectImp : public AllocatedValueImp {
public:
/**
* Creates a new ObjectImp with the specified prototype
*
* @param proto The prototype
*/
- ObjectImp(const Object &proto);
ObjectImp(ObjectImp *proto);
/**
* Creates a new ObjectImp with a prototype of Null()
- * (that is, the ECMAScript "null" value, not a null Object).
+ * (that is, the ECMAScript "null" value, not a null object pointer).
*
*/
ObjectImp();
- virtual ~ObjectImp();
-
virtual void mark();
Type type() const;
@@ -169,15 +170,28 @@
// internal properties (ECMA 262-3 8.6.2)
/**
+ * Returns the prototype of this object. Note that this is not the same as
+ * the "prototype" property.
+ *
+ * See ECMA 8.6.2
+ *
+ * @return The object's prototype
+ */
+ /**
* Implementation of the [[Prototype]] internal property (implemented by
* all Objects)
- *
- * @see Object::prototype()
*/
- Value prototype() const;
- void setPrototype(const Value &proto);
+ ValueImp *prototype() const;
+ void setPrototype(ValueImp *proto);
/**
+ * Returns the class name of the object
+ *
+ * See ECMA 8.6.2
+ *
+ * @return The object's class name
+ */
+ /**
* Implementation of the [[Class]] internal property (implemented by all
* Objects)
*
@@ -185,64 +199,116 @@
* You should either implement classInfo(), or
* if you simply need a classname, you can reimplement className()
* instead.
- *
- * @see Object::className()
*/
virtual UString className() const;
/**
+ * Retrieves the specified property from the object. If neither the object
+ * or any other object in it's prototype chain have the property, this
+ * function will return Undefined.
+ *
+ * See ECMA 8.6.2.1
+ *
+ * @param exec The current execution state
+ * @param propertyName The name of the property to retrieve
+ *
+ * @return The specified property, or Undefined
+ */
+ /**
* Implementation of the [[Get]] internal property (implemented by all
* Objects)
- *
- * @see Object::get()
*/
// [[Get]] - must be implemented by all Objects
- Value get(ExecState *exec, const Identifier &propertyName) const;
- Value get(ExecState *exec, unsigned propertyName) const;
+ ValueImp *get(ExecState *exec, const Identifier &propertyName) const;
+ ValueImp *get(ExecState *exec, unsigned propertyName) const;
- bool getProperty(ExecState *exec, const Identifier& propertyName, Value& result) const;
- bool getProperty(ExecState *exec, unsigned propertyName, Value& result) const;
+ bool getProperty(ExecState *exec, const Identifier& propertyName, ValueImp*& result) const;
+ bool getProperty(ExecState *exec, unsigned propertyName, ValueImp*& result) const;
bool getPropertySlot(ExecState *, const Identifier&, PropertySlot&);
bool getPropertySlot(ExecState *, unsigned, PropertySlot&);
+
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
virtual bool getOwnPropertySlot(ExecState *, unsigned index, PropertySlot&);
/**
+ * Sets the specified property.
+ *
+ * See ECMA 8.6.2.2
+ *
+ * @param exec The current execution state
+ * @param propertyName The name of the property to set
+ * @param propertyValue The value to set
+ */
+ /**
* Implementation of the [[Put]] internal property (implemented by all
* Objects)
- *
- * @see Object::put()
*/
virtual void put(ExecState *exec, const Identifier &propertyName,
- const Value &value, int attr = None);
+ ValueImp *value, int attr = None);
virtual void put(ExecState *exec, unsigned propertyName,
- const Value &value, int attr = None);
+ ValueImp *value, int attr = None);
/**
+ * Used to check whether or not a particular property is allowed to be set
+ * on an object
+ *
+ * See ECMA 8.6.2.3
+ *
+ * @param exec The current execution state
+ * @param propertyName The name of the property
+ * @return true if the property can be set, otherwise false
+ */
+ /**
* Implementation of the [[CanPut]] internal property (implemented by all
* Objects)
- *
- * @see Object::canPut()
*/
virtual bool canPut(ExecState *exec, const Identifier &propertyName) const;
/**
+ * Checks to see whether the object (or any object in it's prototype chain)
+ * has a property with the specified name.
+ *
+ * See ECMA 8.6.2.4
+ *
+ * @param exec The current execution state
+ * @param propertyName The name of the property to check for
+ * @return true if the object has the property, otherwise false
+ */
+ /**
* Implementation of the [[HasProperty]] internal property (implemented by
* all Objects)
- *
- * @see Object::hasProperty()
*/
- bool hasProperty(ExecState *exec, const Identifier &propertyName) const;
+ bool hasProperty(ExecState *exec,
+ const Identifier &propertyName) const;
bool hasProperty(ExecState *exec, unsigned propertyName) const;
+ /**
+ * Checks to see whether the object has a property with the specified name.
+ *
+ * See ECMA 15.2.4.5
+ *
+ * @param exec The current execution state
+ * @param propertyName The name of the property to check for
+ * @return true if the object has the property, otherwise false
+ */
virtual bool hasOwnProperty(ExecState *exec, const Identifier &propertyName) const;
+ virtual bool hasOwnProperty(ExecState *exec, unsigned propertyName) const;
/**
+ * Removes the specified property from the object.
+ *
+ * See ECMA 8.6.2.5
+ *
+ * @param exec The current execution state
+ * @param propertyName The name of the property to delete
+ * @return true if the property was successfully deleted or did not
+ * exist on the object. false if deleting the specified property is not
+ * allowed.
+ */
+ /**
* Implementation of the [[Delete]] internal property (implemented by all
* Objects)
- *
- * @see Object::deleteProperty()
*/
virtual bool deleteProperty(ExecState *exec,
const Identifier &propertyName);
@@ -256,59 +322,196 @@
void deleteAllProperties(ExecState *);
/**
+ * Converts the object into a primitive value. The value return may differ
+ * depending on the supplied hint
+ *
+ * See ECMA 8.6.2.6
+ *
+ * @param exec The current execution state
+ * @param hint The desired primitive type to convert to
+ * @return A primitive value converted from the objetc. Note that the
+ * type of primitive value returned may not be the same as the requested
+ * hint.
+ */
+ /**
* Implementation of the [[DefaultValue]] internal property (implemented by
* all Objects)
- *
- * @see Object::defaultValue()
*/
- virtual Value defaultValue(ExecState *exec, Type hint) const;
+ virtual ValueImp *defaultValue(ExecState *exec, Type hint) const;
+ /**
+ * Whether or not the object implements the construct() method. If this
+ * returns false you should not call the construct() method on this
+ * object (typically, an assertion will fail to indicate this).
+ *
+ * @return true if this object implements the construct() method, otherwise
+ * false
+ */
virtual bool implementsConstruct() const;
+
/**
- * Implementation of the [[Construct]] internal property
+ * Creates a new object based on this object. Typically this means the
+ * following:
+ * 1. A new object is created
+ * 2. The prototype of the new object is set to the value of this object's
+ * "prototype" property
+ * 3. The call() method of this object is called, with the new object
+ * passed as the this value
+ * 4. The new object is returned
+ *
+ * In some cases, Host objects may differ from these semantics, although
+ * this is discouraged.
+ *
+ * If an error occurs during construction, the execution state's exception
+ * will be set. This can be tested for with ExecState::hadException().
+ * Under some circumstances, the exception object may also be returned.
*
- * @see Object::construct()
+ * Note: This function should not be called if implementsConstruct() returns
+ * false, in which case it will result in an assertion failure.
+ *
+ * @param exec The current execution state
+ * @param args The arguments to be passed to call() once the new object has
+ * been created
+ * @return The newly created & initialized object
+ */
+ /**
+ * Implementation of the [[Construct]] internal property
*/
- virtual Object construct(ExecState *exec, const List &args);
- virtual Object construct(ExecState *exec, const List &args, const UString &sourceURL, int lineNumber);
+ virtual ObjectImp *construct(ExecState *exec, const List &args);
+ virtual ObjectImp *construct(ExecState *exec, const List &args, const UString &sourceURL, int lineNumber);
+ /**
+ * Whether or not the object implements the call() method. If this returns
+ * false you should not call the call() method on this object (typically,
+ * an assertion will fail to indicate this).
+ *
+ * @return true if this object implements the call() method, otherwise
+ * false
+ */
virtual bool implementsCall() const;
+
/**
- * Implementation of the [[Call]] internal property
+ * Calls this object as if it is a function.
+ *
+ * Note: This function should not be called if implementsCall() returns
+ * false, in which case it will result in an assertion failure.
*
- * @see Object::call()
+ * See ECMA 8.6.2.3
+ *
+ * @param exec The current execution state
+ * @param thisObj The obj to be used as "this" within function execution.
+ * Note that in most cases this will be different from the C++ "this"
+ * object. For example, if the ECMAScript code "window.location->toString()"
+ * is executed, call() will be invoked on the C++ object which implements
+ * the toString method, with the thisObj being window.location
+ * @param args List of arguments to be passed to the function
+ * @return The return value from the function
*/
- virtual Value call(ExecState *exec, Object &thisObj,
- const List &args);
+ /**
+ * Implementation of the [[Call]] internal property
+ */
+ ValueImp *call(ExecState *exec, ObjectImp *thisObj, const List &args);
+ virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args);
+ /**
+ * Whether or not the object implements the hasInstance() method. If this
+ * returns false you should not call the hasInstance() method on this
+ * object (typically, an assertion will fail to indicate this).
+ *
+ * @return true if this object implements the hasInstance() method,
+ * otherwise false
+ */
virtual bool implementsHasInstance() const;
+
/**
- * Implementation of the [[HasInstance]] internal property
+ * Checks whether value delegates behavior to this object. Used by the
+ * instanceof operator.
*
- * @see Object::hasInstance()
+ * @param exec The current execution state
+ * @param value The value to check
+ * @return true if value delegates behavior to this object, otherwise
+ * false
*/
- virtual Boolean hasInstance(ExecState *exec, const Value &value);
+ /**
+ * Implementation of the [[HasInstance]] internal property
+ */
+ virtual bool hasInstance(ExecState *exec, ValueImp *value);
/**
- * Implementation of the [[Scope]] internal property
+ * Returns the scope of this object. This is used when execution declared
+ * functions - the execution context for the function is initialized with
+ * extra object in it's scope. An example of this is functions declared
+ * inside other functions:
*
- * @see Object::scope()
+ * \code
+ * function f() {
+ *
+ * function b() {
+ * return prototype;
+ * }
+ *
+ * var x = 4;
+ * // do some stuff
+ * }
+ * f.prototype = new String();
+ * \endcode
+ *
+ * When the function f.b is executed, its scope will include properties of
+ * f. So in the example above the return value of f.b() would be the new
+ * String object that was assigned to f.prototype.
+ *
+ * @param exec The current execution state
+ * @return The function's scope
+ */
+ /**
+ * Implementation of the [[Scope]] internal property
*/
const ScopeChain &scope() const { return _scope; }
void setScope(const ScopeChain &s) { _scope = s; }
+ /**
+ * Returns a List of References to all the properties of the object. Used
+ * in "for x in y" statements. The list is created new, so it can be freely
+ * modified without affecting the object's properties. It should be deleted
+ * by the caller.
+ *
+ * Subclasses can override this method in ObjectImpl to provide the
+ * appearance of
+ * having extra properties other than those set specifically with put().
+ *
+ * @param exec The current execution state
+ * @param recursive Whether or not properties in the object's prototype
+ * chain should be
+ * included in the list.
+ * @return A List of References to properties of the object.
+ **/
virtual ReferenceList propList(ExecState *exec, bool recursive = true);
- Value internalValue() const;
- void setInternalValue(const Value &v);
+ /**
+ * Returns the internal value of the object. This is used for objects such
+ * as String and Boolean which are wrappers for native types. The interal
+ * value is the actual value represented by the wrapper objects.
+ *
+ * @see ECMA 8.6.2
+ * @return The internal value of the object
+ */
+ ValueImp *internalValue() const;
+
+ /**
+ * Sets the internal value of the object
+ *
+ * @see internalValue()
+ *
+ * @param v The new internal value
+ */
+
void setInternalValue(ValueImp *v);
- Value toPrimitive(ExecState *exec,
- Type preferredType = UnspecifiedType) const;
+ ValueImp *toPrimitive(ExecState *exec, Type preferredType = UnspecifiedType) const;
bool toBoolean(ExecState *exec) const;
double toNumber(ExecState *exec) const;
UString toString(ExecState *exec) const;
- Object toObject(ExecState *exec) const;
+ ObjectImp *toObject(ExecState *exec) const;
// This get method only looks at the property map.
// A bit like hasProperty(recursive=false), this doesn't go to the prototype.
@@ -344,7 +547,7 @@
return true;
ValueImp *proto = imp->_proto;
- if (proto->dispatchType() != ObjectType)
+ if (!proto->isObject())
break;
imp = static_cast<ObjectImp *>(proto);
@@ -402,9 +605,9 @@
* @param lineno Optional line number.
* @param lineno Optional source id.
*/
- static Object create(ExecState *exec, ErrorType errtype = GeneralError,
- const char *message = 0, int lineno = -1,
- int sourceId = -1, const UString *sourceURL = 0);
+ static ObjectImp *create(ExecState *exec, ErrorType errtype = GeneralError,
+ const char *message = 0, int lineno = -1,
+ int sourceId = -1, const UString *sourceURL = 0);
/**
* Array of error names corresponding to ErrorType
@@ -412,97 +615,47 @@
static const char * const * const errorNames;
};
- inline bool ValueImp::isObject(const ClassInfo *info) const
- { return isObject() && static_cast<const ObjectImp *>(this)->inherits(info); }
-
- inline ObjectImp *ValueImp::asObject()
- { return isObject() ? static_cast<ObjectImp *>(this) : 0; }
-
- inline Object::Object(ObjectImp *o) : Value(o) { }
-
- inline ObjectImp *Object::imp() const
- { return static_cast<ObjectImp *>(Value::imp()); }
-
- inline const ClassInfo *Object::classInfo() const
- { return imp()->classInfo(); }
-
- inline bool Object::inherits(const ClassInfo *cinfo) const
- { return imp()->inherits(cinfo); }
-
- inline Value Object::prototype() const
- { return Value(imp()->prototype()); }
-
- inline UString Object::className() const
- { return imp()->className(); }
-
- inline Value Object::get(ExecState *exec, const Identifier &propertyName) const
- { return imp()->get(exec,propertyName); }
-
- inline Value Object::get(ExecState *exec, unsigned propertyName) const
- { return imp()->get(exec,propertyName); }
-
- inline void Object::put(ExecState *exec, const Identifier &propertyName, const Value &value, int attr)
- { imp()->put(exec,propertyName,value,attr); }
-
- inline void Object::put(ExecState *exec, unsigned propertyName, const Value &value, int attr)
- { imp()->put(exec,propertyName,value,attr); }
-
- inline bool Object::canPut(ExecState *exec, const Identifier &propertyName) const
- { return imp()->canPut(exec,propertyName); }
+ inline bool AllocatedValueImp::isObject(const ClassInfo *info) const
+ { return isObject() && static_cast<const ObjectImp *>(this)->inherits(info); }
- inline bool Object::hasProperty(ExecState *exec, const Identifier &propertyName) const
- { return imp()->hasProperty(exec, propertyName); }
-
- inline bool Object::hasOwnProperty(ExecState *exec, const Identifier &propertyName) const
- { return imp()->hasOwnProperty(exec, propertyName); }
-
- inline bool Object::deleteProperty(ExecState *exec, const Identifier &propertyName)
- { return imp()->deleteProperty(exec,propertyName); }
-
- inline bool Object::deleteProperty(ExecState *exec, unsigned propertyName)
- { return imp()->deleteProperty(exec,propertyName); }
-
- inline Value Object::defaultValue(ExecState *exec, Type hint) const
- { return imp()->defaultValue(exec,hint); }
-
- inline bool Object::implementsConstruct() const
- { return imp()->implementsConstruct(); }
-
- inline Object Object::construct(ExecState *exec, const List &args)
- { return imp()->construct(exec,args); }
-
- inline Object Object::construct(ExecState *exec, const List &args, const UString &sourceURL, int lineNumber)
- { return imp()->construct(exec,args,sourceURL,lineNumber); }
-
- inline bool Object::implementsCall() const
- { return imp()->implementsCall(); }
-
- inline bool Object::implementsHasInstance() const
- { return imp()->implementsHasInstance(); }
-
- inline Boolean Object::hasInstance(ExecState *exec, const Value &value)
- { return imp()->hasInstance(exec,value); }
-
- inline const ScopeChain &Object::scope() const
- { return imp()->scope(); }
-
- inline void Object::setScope(const ScopeChain &s)
- { imp()->setScope(s); }
-
- inline ReferenceList Object::propList(ExecState *exec, bool recursive)
- { return imp()->propList(exec,recursive); }
-
- inline Value Object::internalValue() const
- { return imp()->internalValue(); }
-
- inline void Object::setInternalValue(const Value &v)
- { imp()->setInternalValue(v); }
-
- inline void Object::saveProperties(SavedProperties &p) const
- { imp()->saveProperties(p); }
- inline void Object::restoreProperties(const SavedProperties &p)
- { imp()->restoreProperties(p); }
+inline ObjectImp::ObjectImp(ObjectImp *proto)
+ : _proto(proto), _internalValue(0)
+{
+}
+
+inline ObjectImp::ObjectImp()
+ : _proto(jsNull()), _internalValue(0)
+{
+}
+
+inline ValueImp *ObjectImp::internalValue() const
+{
+ return _internalValue;
+}
+
+inline void ObjectImp::setInternalValue(ValueImp *v)
+{
+ _internalValue = v;
+}
+
+inline ValueImp *ObjectImp::prototype() const
+{
+ return _proto;
+}
+
+inline void ObjectImp::setPrototype(ValueImp *proto)
+{
+ _proto = proto;
+}
+
+inline bool ObjectImp::inherits(const ClassInfo *info) const
+{
+ for (const ClassInfo *ci = classInfo(); ci; ci = ci->parentClass)
+ if (ci == info)
+ return true;
+ return false;
+}
} // namespace
-#endif // _KJS_OBJECT_H_
+#endif // KJS_OBJECT_H
1.13 +19 -28 JavaScriptCore/kjs/object_object.cpp
Index: object_object.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/object_object.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- object_object.cpp 25 Jul 2005 22:17:12 -0000 1.12
+++ object_object.cpp 8 Aug 2005 04:07:29 -0000 1.13
@@ -37,7 +37,6 @@
FunctionPrototypeImp *funcProto)
: ObjectImp() // [[Prototype]] is Null()
{
- Value protect(this);
putDirect(toStringPropertyName, new ObjectProtoFuncImp(exec,funcProto,ObjectProtoFuncImp::ToString, 0), DontEnum);
putDirect(toLocaleStringPropertyName, new ObjectProtoFuncImp(exec,funcProto,ObjectProtoFuncImp::ToLocaleString,0), DontEnum);
putDirect(valueOfPropertyName, new ObjectProtoFuncImp(exec,funcProto,ObjectProtoFuncImp::ValueOf, 0), DontEnum);
@@ -52,7 +51,6 @@
int i, int len)
: InternalFunctionImp(funcProto), id(i)
{
- Value protect(this);
putDirect(lengthPropertyName, len, DontDelete|ReadOnly|DontEnum);
}
@@ -64,22 +62,19 @@
// ECMA 15.2.4.2, 15.2.4.4, 15.2.4.5
-Value ObjectProtoFuncImp::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *ObjectProtoFuncImp::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
switch (id) {
case ValueOf:
return thisObj;
- case HasOwnProperty: {
+ case HasOwnProperty:
// Same as the in operator but without checking the prototype
- Identifier propertyName(args[0].toString(exec));
- bool exists = thisObj.hasOwnProperty(exec, propertyName);
- return Value(exists ? BooleanImp::staticTrue : BooleanImp::staticFalse);
- }
+ return jsBoolean(thisObj->hasOwnProperty(exec, Identifier(args[0]->toString(exec))));
case ToLocaleString:
- return thisObj.imp()->toString(exec);
+ return jsString(thisObj->toString(exec));
case ToString:
default:
- return String("[object " + thisObj.className() + "]");
+ return String("[object " + thisObj->className() + "]");
}
}
@@ -90,12 +85,11 @@
FunctionPrototypeImp *funcProto)
: InternalFunctionImp(funcProto)
{
- Value protect(this);
// ECMA 15.2.3.1
putDirect(prototypePropertyName, objProto, DontEnum|DontDelete|ReadOnly);
// no. of arguments for constructor
- putDirect(lengthPropertyName, NumberImp::one(), ReadOnly|DontDelete|DontEnum);
+ putDirect(lengthPropertyName, jsOne(), ReadOnly|DontDelete|DontEnum);
}
@@ -105,32 +99,29 @@
}
// ECMA 15.2.2
-Object ObjectObjectImp::construct(ExecState *exec, const List &args)
+ObjectImp *ObjectObjectImp::construct(ExecState *exec, const List &args)
{
// if no arguments have been passed ...
if (args.isEmpty()) {
- Object proto = exec->lexicalInterpreter()->builtinObjectPrototype();
- Object result(new ObjectImp(proto));
+ ObjectImp *proto = exec->lexicalInterpreter()->builtinObjectPrototype();
+ ObjectImp *result(new ObjectImp(proto));
return result;
}
- Value arg = *(args.begin());
- Object obj = Object::dynamicCast(arg);
- if (!obj.isNull()) {
+ ValueImp *arg = *(args.begin());
+ if (ObjectImp *obj = arg->getObject())
return obj;
- }
- switch (arg.type()) {
+ switch (arg->type()) {
case StringType:
case BooleanType:
case NumberType:
- return arg.toObject(exec);
+ return arg->toObject(exec);
default:
assert(!"unhandled switch case in ObjectConstructor");
case NullType:
case UndefinedType:
- Object proto = exec->lexicalInterpreter()->builtinObjectPrototype();
- return Object(new ObjectImp(proto));
+ return new ObjectImp(exec->lexicalInterpreter()->builtinObjectPrototype());
}
}
@@ -139,21 +130,21 @@
return true;
}
-Value ObjectObjectImp::call(ExecState *exec, Object &/*thisObj*/, const List &args)
+ValueImp *ObjectObjectImp::callAsFunction(ExecState *exec, ObjectImp */*thisObj*/, const List &args)
{
- Value result;
+ ValueImp *result;
List argList;
// Construct a new Object
if (args.isEmpty()) {
result = construct(exec,argList);
} else {
- Value arg = args[0];
- if (arg.type() == NullType || arg.type() == UndefinedType) {
+ ValueImp *arg = args[0];
+ if (arg->isUndefinedOrNull()) {
argList.append(arg);
result = construct(exec,argList);
} else
- result = arg.toObject(exec);
+ result = arg->toObject(exec);
}
return result;
}
1.9 +4 -5 JavaScriptCore/kjs/object_object.h
Index: object_object.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/object_object.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- object_object.h 14 Jul 2005 18:27:03 -0000 1.8
+++ object_object.h 8 Aug 2005 04:07:29 -0000 1.9
@@ -47,11 +47,10 @@
*/
class ObjectProtoFuncImp : public InternalFunctionImp {
public:
- ObjectProtoFuncImp(ExecState *exec, FunctionPrototypeImp *funcProto,
- int i, int len);
+ ObjectProtoFuncImp(ExecState *exec, FunctionPrototypeImp *funcProto, int i, int len);
virtual bool implementsCall() const;
- virtual Value call(ExecState *exec, Object &thisObj, const List &args);
+ virtual ValueImp *callAsFunction(ExecState *, ObjectImp *, const List &args);
enum { ToString, ToLocaleString, ValueOf, HasOwnProperty };
private:
@@ -71,9 +70,9 @@
FunctionPrototypeImp *funcProto);
virtual bool implementsConstruct() const;
- virtual Object construct(ExecState *exec, const List &args);
+ virtual ObjectImp *construct(ExecState *, const List &args);
virtual bool implementsCall() const;
- virtual Value call(ExecState *exec, Object &thisObj, const List &args);
+ virtual ValueImp *callAsFunction(ExecState *, ObjectImp *, const List &args);
};
} // namespace
1.8 +38 -38 JavaScriptCore/kjs/operations.cpp
Index: operations.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/operations.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- operations.cpp 14 Jul 2005 18:27:03 -0000 1.7
+++ operations.cpp 8 Aug 2005 04:07:29 -0000 1.8
@@ -111,10 +111,10 @@
#endif
// ECMA 11.9.3
-bool KJS::equal(ExecState *exec, const Value& v1, const Value& v2)
+bool KJS::equal(ExecState *exec, ValueImp *v1, ValueImp *v2)
{
- Type t1 = v1.type();
- Type t2 = v2.type();
+ Type t1 = v1->type();
+ Type t2 = v2->type();
if (t1 != t2) {
if (t1 == UndefinedType)
@@ -134,9 +134,9 @@
// use toNumber
} else {
if ((t1 == StringType || t1 == NumberType) && t2 >= ObjectType)
- return equal(exec, v1, v2.toPrimitive(exec));
+ return equal(exec, v1, v2->toPrimitive(exec));
if (t1 >= ObjectType && (t2 == StringType || t2 == NumberType))
- return equal(exec, v1.toPrimitive(exec), v2);
+ return equal(exec, v1->toPrimitive(exec), v2);
if (t1 != t2)
return false;
}
@@ -146,8 +146,8 @@
return true;
if (t1 == NumberType) {
- double d1 = v1.toNumber(exec);
- double d2 = v2.toNumber(exec);
+ double d1 = v1->toNumber(exec);
+ double d2 = v2->toNumber(exec);
// FIXME: Isn't this already how NaN behaves?
// Why the extra line of code?
if (isNaN(d1) || isNaN(d2))
@@ -156,27 +156,27 @@
}
if (t1 == StringType)
- return v1.toString(exec) == v2.toString(exec);
+ return v1->toString(exec) == v2->toString(exec);
if (t1 == BooleanType)
- return v1.toBoolean(exec) == v2.toBoolean(exec);
+ return v1->toBoolean(exec) == v2->toBoolean(exec);
// types are Object
- return v1.imp() == v2.imp();
+ return v1 == v2;
}
-bool KJS::strictEqual(ExecState *exec, const Value &v1, const Value &v2)
+bool KJS::strictEqual(ExecState *exec, ValueImp *v1, ValueImp *v2)
{
- Type t1 = v1.type();
- Type t2 = v2.type();
+ Type t1 = v1->type();
+ Type t2 = v2->type();
if (t1 != t2)
return false;
if (t1 == UndefinedType || t1 == NullType)
return true;
if (t1 == NumberType) {
- double n1 = v1.toNumber(exec);
- double n2 = v2.toNumber(exec);
+ double n1 = v1->toNumber(exec);
+ double n2 = v2->toNumber(exec);
// FIXME: Isn't this already how NaN behaves?
// Why the extra line of code?
if (isNaN(n1) || isNaN(n2))
@@ -186,27 +186,27 @@
/* TODO: +0 and -0 */
return false;
} else if (t1 == StringType) {
- return v1.toString(exec) == v2.toString(exec);
+ return v1->toString(exec) == v2->toString(exec);
} else if (t2 == BooleanType) {
- return v1.toBoolean(exec) == v2.toBoolean(exec);
+ return v1->toBoolean(exec) == v2->toBoolean(exec);
}
- if (v1.imp() == v2.imp())
+ if (v1 == v2)
return true;
/* TODO: joined objects */
return false;
}
-int KJS::relation(ExecState *exec, const Value& v1, const Value& v2)
+int KJS::relation(ExecState *exec, ValueImp *v1, ValueImp *v2)
{
- Value p1 = v1.toPrimitive(exec,NumberType);
- Value p2 = v2.toPrimitive(exec,NumberType);
+ ValueImp *p1 = v1->toPrimitive(exec,NumberType);
+ ValueImp *p2 = v2->toPrimitive(exec,NumberType);
- if (p1.type() == StringType && p2.type() == StringType)
- return p1.toString(exec) < p2.toString(exec) ? 1 : 0;
+ if (p1->isString() && p2->isString())
+ return p1->toString(exec) < p2->toString(exec) ? 1 : 0;
- double n1 = p1.toNumber(exec);
- double n2 = p2.toNumber(exec);
+ double n1 = p1->toNumber(exec);
+ double n2 = p2->toNumber(exec);
if (n1 < n2)
return 1;
if (n1 >= n2)
@@ -225,37 +225,37 @@
}
// ECMA 11.6
-Value KJS::add(ExecState *exec, const Value &v1, const Value &v2, char oper)
+ValueImp *KJS::add(ExecState *exec, ValueImp *v1, ValueImp *v2, char oper)
{
// exception for the Date exception in defaultValue()
Type preferred = oper == '+' ? UnspecifiedType : NumberType;
- Value p1 = v1.toPrimitive(exec, preferred);
- Value p2 = v2.toPrimitive(exec, preferred);
+ ValueImp *p1 = v1->toPrimitive(exec, preferred);
+ ValueImp *p2 = v2->toPrimitive(exec, preferred);
- if ((p1.type() == StringType || p2.type() == StringType) && oper == '+') {
- return p1.toString(exec) + p2.toString(exec);
+ if ((p1->isString() || p2->isString()) && oper == '+') {
+ return jsString(p1->toString(exec) + p2->toString(exec));
}
bool n1KnownToBeInteger;
- double n1 = p1.toNumber(exec, n1KnownToBeInteger);
+ double n1 = p1->toNumber(exec, n1KnownToBeInteger);
bool n2KnownToBeInteger;
- double n2 = p2.toNumber(exec, n2KnownToBeInteger);
+ double n2 = p2->toNumber(exec, n2KnownToBeInteger);
bool resultKnownToBeInteger = n1KnownToBeInteger && n2KnownToBeInteger;
if (oper == '+')
- return Value(n1 + n2, resultKnownToBeInteger);
+ return jsNumber(n1 + n2, resultKnownToBeInteger);
else
- return Value(n1 - n2, resultKnownToBeInteger);
+ return jsNumber(n1 - n2, resultKnownToBeInteger);
}
// ECMA 11.5
-Value KJS::mult(ExecState *exec, const Value &v1, const Value &v2, char oper)
+ValueImp *KJS::mult(ExecState *exec, ValueImp *v1, ValueImp *v2, char oper)
{
bool n1KnownToBeInteger;
- double n1 = v1.toNumber(exec, n1KnownToBeInteger);
+ double n1 = v1->toNumber(exec, n1KnownToBeInteger);
bool n2KnownToBeInteger;
- double n2 = v2.toNumber(exec, n2KnownToBeInteger);
+ double n2 = v2->toNumber(exec, n2KnownToBeInteger);
double result;
bool resultKnownToBeInteger;
@@ -271,5 +271,5 @@
resultKnownToBeInteger = n1KnownToBeInteger && n2KnownToBeInteger && n2 != 0;
}
- return Value(result, resultKnownToBeInteger);
+ return jsNumber(result, resultKnownToBeInteger);
}
1.6 +5 -5 JavaScriptCore/kjs/operations.h
Index: operations.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/operations.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- operations.h 14 Jul 2005 18:27:03 -0000 1.5
+++ operations.h 8 Aug 2005 04:07:29 -0000 1.6
@@ -47,8 +47,8 @@
bool isNegInf(double d);
#endif
- bool equal(ExecState *exec, const Value& v1, const Value& v2);
- bool strictEqual(ExecState *exec, const Value &v1, const Value &v2);
+ bool equal(ExecState *exec, ValueImp *v1, ValueImp *v2);
+ bool strictEqual(ExecState *exec, ValueImp *v1, ValueImp *v2);
/**
* This operator performs an abstract relational comparison of the two
* arguments that can be of arbitrary type. If possible, conversions to the
@@ -57,7 +57,7 @@
* @return 1 if v1 is "less-than" v2, 0 if the relation is "greater-than-or-
* equal". -1 if the result is undefined.
*/
- int relation(ExecState *exec, const Value& v1, const Value& v2);
+ int relation(ExecState *exec, ValueImp *v1, ValueImp *v2);
int maxInt(int d1, int d2);
int minInt(int d1, int d2);
/**
@@ -66,7 +66,7 @@
* @param oper '+' or '-' for an addition or substraction, respectively.
* @return The result of the operation.
*/
- Value add(ExecState *exec, const Value &v1, const Value &v2, char oper);
+ ValueImp *add(ExecState *exec, ValueImp *v1, ValueImp *v2, char oper);
/**
* Multiplicative operator. Either multiplies/divides v1 and v2 or
* calculates the remainder from an division.
@@ -74,7 +74,7 @@
* modulo operation.
* @return The result of the operation.
*/
- Value mult(ExecState *exec, const Value &v1, const Value &v2, char oper);
+ ValueImp *mult(ExecState *exec, ValueImp *v1, ValueImp *v2, char oper);
};
1.45 +7 -8 JavaScriptCore/kjs/property_map.cpp
Index: property_map.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/property_map.cpp,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- property_map.cpp 7 Aug 2005 06:17:35 -0000 1.44
+++ property_map.cpp 8 Aug 2005 04:07:29 -0000 1.45
@@ -545,7 +545,7 @@
int size = _table->size;
Entry *entries = _table->entries;
- for (int i = 0; i != size; ++i) {
+ for (int i = 0; i < size; i++) {
ValueImp *v = entries[i].value;
if (v && !v->marked())
v->mark();
@@ -563,7 +563,7 @@
return 0;
}
-void PropertyMap::addEnumerablesToReferenceList(ReferenceList &list, const Object &base) const
+void PropertyMap::addEnumerablesToReferenceList(ReferenceList &list, ObjectImp *base) const
{
if (!_table) {
#if USE_SINGLE_ENTRY
@@ -605,7 +605,7 @@
delete [] sortedEnumerables;
}
-void PropertyMap::addSparseArrayPropertiesToReferenceList(ReferenceList &list, const Object &base) const
+void PropertyMap::addSparseArrayPropertiesToReferenceList(ReferenceList &list, ObjectImp *base) const
{
if (!_table) {
#if USE_SINGLE_ENTRY
@@ -625,8 +625,7 @@
Entry *entries = _table->entries;
for (int i = 0; i != size; ++i) {
UString::Rep *key = entries[i].key;
- if (key && key != &UString::Rep::null)
- {
+ if (key && key != &UString::Rep::null) {
UString k(key);
bool fitsInUInt32;
k.toUInt32(&fitsInUInt32);
@@ -670,7 +669,7 @@
#if USE_SINGLE_ENTRY
if (_singleEntry.key && !(_singleEntry.attributes & (ReadOnly | Function))) {
prop->key = Identifier(_singleEntry.key);
- prop->value = Value(_singleEntry.value);
+ prop->value = _singleEntry.value;
prop->attributes = _singleEntry.attributes;
++prop;
}
@@ -706,7 +705,7 @@
while (q != p) {
Entry *e = *q++;
prop->key = Identifier(e->key);
- prop->value = Value(e->value);
+ prop->value = e->value;
prop->attributes = e->attributes;
++prop;
}
@@ -720,7 +719,7 @@
void PropertyMap::restore(const SavedProperties &p)
{
for (int i = 0; i != p._count; ++i)
- put(p._properties[i].key, p._properties[i].value.imp(), p._properties[i].attributes);
+ put(p._properties[i].key, p._properties[i].value, p._properties[i].attributes);
}
#if DO_CONSISTENCY_CHECK
1.23 +3 -3 JavaScriptCore/kjs/property_map.h
Index: property_map.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/property_map.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- property_map.h 7 Aug 2005 06:17:35 -0000 1.22
+++ property_map.h 8 Aug 2005 04:07:29 -0000 1.23
@@ -27,7 +27,7 @@
namespace KJS {
- class Object;
+ class ObjectImp;
class ReferenceList;
class ValueImp;
@@ -81,8 +81,8 @@
ValueImp **getLocation(const Identifier &name);
void mark() const;
- void addEnumerablesToReferenceList(ReferenceList &, const Object &) const;
- void addSparseArrayPropertiesToReferenceList(ReferenceList &, const Object &) const;
+ void addEnumerablesToReferenceList(ReferenceList &, ObjectImp *) const;
+ void addSparseArrayPropertiesToReferenceList(ReferenceList &, ObjectImp *) const;
void save(SavedProperties &) const;
void restore(const SavedProperties &p);
1.2 +1 -1 JavaScriptCore/kjs/property_slot.cpp
Index: property_slot.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/property_slot.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- property_slot.cpp 7 Aug 2005 06:17:35 -0000 1.1
+++ property_slot.cpp 8 Aug 2005 04:07:29 -0000 1.2
@@ -25,7 +25,7 @@
namespace KJS {
-Value PropertySlot::undefinedGetter(ExecState *, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *PropertySlot::undefinedGetter(ExecState *, const Identifier& propertyName, const PropertySlot& slot)
{
return Undefined();
}
1.2 +4 -4 JavaScriptCore/kjs/property_slot.h
Index: property_slot.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/property_slot.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- property_slot.h 7 Aug 2005 06:17:35 -0000 1.1
+++ property_slot.h 8 Aug 2005 04:07:29 -0000 1.2
@@ -36,17 +36,17 @@
class PropertySlot
{
public:
- typedef Value (*GetValueFunc)(ExecState *, const Identifier&, const PropertySlot&);
+ typedef ValueImp *(*GetValueFunc)(ExecState *, const Identifier&, const PropertySlot&);
bool isSet() { return m_getValue != 0; }
- Value getValue(ExecState *exec, const Identifier& propertyName) const
+ ValueImp *getValue(ExecState *exec, const Identifier& propertyName) const
{
if (m_getValue == VALUE_SLOT_MARKER)
return *m_data.valueSlot;
return m_getValue(exec, propertyName, *this);
}
- Value getValue(ExecState *exec, unsigned propertyName) const
+ ValueImp *getValue(ExecState *exec, unsigned propertyName) const
{
if (m_getValue == VALUE_SLOT_MARKER)
return *m_data.valueSlot;
@@ -92,7 +92,7 @@
unsigned long index() const { return m_data.index; }
private:
- static Value undefinedGetter(ExecState *, const Identifier&, const PropertySlot&);
+ static ValueImp *undefinedGetter(ExecState *, const Identifier&, const PropertySlot&);
GetValueFunc m_getValue;
1.7 +19 -26 JavaScriptCore/kjs/protect.h
Index: protect.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/protect.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- protect.h 7 Aug 2005 06:17:35 -0000 1.6
+++ protect.h 8 Aug 2005 04:07:29 -0000 1.7
@@ -48,33 +48,26 @@
{
if (val) gcUnprotect(val);
}
-
- class ProtectedValue : public Value {
- public:
- ProtectedValue() : Value() {}
- ProtectedValue(const Value&v) : Value(v) { gcProtectNullTolerant(v.imp()); };
- ProtectedValue(const ProtectedValue&v) : Value(v) { gcProtectNullTolerant(v.imp()); };
- ~ProtectedValue() { gcUnprotectNullTolerant(imp());}
- ProtectedValue& operator=(const Value &v)
- {
- ValueImp *old = imp();
- Value::operator=(v);
- gcProtectNullTolerant(v.imp());
- gcUnprotectNullTolerant(old);
- return *this;
- }
- ProtectedValue& operator=(const ProtectedValue &v)
- {
- ValueImp *old = imp();
- Value::operator=(v);
- gcProtectNullTolerant(v.imp());
- gcUnprotectNullTolerant(old);
- return *this;
- }
- private:
- explicit ProtectedValue(ValueImp *v);
- };
+class ProtectedValue {
+public:
+ ProtectedValue() : m_value(0) { }
+ ProtectedValue(ValueImp *v) : m_value(v) { gcProtectNullTolerant(v); }
+ ProtectedValue(const ProtectedValue& v) : m_value(v.m_value) { gcProtectNullTolerant(m_value); }
+ ~ProtectedValue() { gcUnprotectNullTolerant(m_value); }
+ ProtectedValue& operator=(ValueImp *v)
+ {
+ gcProtectNullTolerant(v);
+ gcUnprotectNullTolerant(m_value);
+ m_value = v;
+ return *this;
+ }
+ ProtectedValue& operator=(const ProtectedValue& v) { return *this = v.m_value; }
+ operator ValueImp *() const { return m_value; }
+ ValueImp *operator->() const { return m_value; }
+protected:
+ ValueImp *m_value;
+};
} // namespace
1.2 +19 -38 JavaScriptCore/kjs/protected_object.h
Index: protected_object.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/protected_object.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- protected_object.h 7 Aug 2005 06:17:35 -0000 1.1
+++ protected_object.h 8 Aug 2005 04:07:29 -0000 1.2
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 2004 Apple Computer, Inc.
@@ -20,9 +19,8 @@
*
*/
-
-#ifndef _KJS_PROTECTED_OBJECT_H_
-#define _KJS_PROTECTED_OBJECT_H_
+#ifndef KJS_PROTECTED_OBJECT_H
+#define KJS_PROTECTED_OBJECT_H
#include "protect.h"
#include "object.h"
@@ -30,53 +28,36 @@
namespace KJS {
- class ProtectedObject : public Object {
- public:
- ProtectedObject() : Object() {}
- ProtectedObject(const Object &o) : Object(o) { gcProtectNullTolerant(o.imp()); };
- ProtectedObject(const ProtectedObject &o) : Object(o) { gcProtectNullTolerant(o.imp()); };
- ~ProtectedObject() { gcUnprotectNullTolerant(imp());}
- ProtectedObject& operator=(const Object &o)
- {
- ValueImp *old = imp();
- Object::operator=(o);
- gcProtectNullTolerant(o.imp());
- gcUnprotectNullTolerant(old);
- return *this;
- }
- ProtectedObject& operator=(const ProtectedObject &o)
- {
- ValueImp *old = imp();
- Object::operator=(o);
- gcProtectNullTolerant(o.imp());
- gcUnprotectNullTolerant(old);
- return *this;
- }
- private:
- explicit ProtectedObject(ObjectImp *o);
- };
-
+class ProtectedObject : private ProtectedValue {
+public:
+ ProtectedObject() { }
+ ProtectedObject(ObjectImp *v) : ProtectedValue(v) { }
+ ProtectedObject(const ProtectedObject& v) : ProtectedValue(v) { }
+ ProtectedObject& operator=(ObjectImp *v) { ProtectedValue::operator=(v); return *this; }
+ ProtectedObject& operator=(const ProtectedObject& v) { ProtectedValue::operator=(v); return *this; }
+ operator ValueImp *() const { return m_value; }
+ operator ObjectImp *() const { return static_cast<ObjectImp *>(m_value); }
+ ObjectImp *operator->() const { return static_cast<ObjectImp *>(m_value); }
+};
class ProtectedReference : public Reference {
public:
- ProtectedReference(const Reference&r) : Reference(r) { gcProtectNullTolerant(r.base.imp()); };
- ~ProtectedReference() { gcUnprotectNullTolerant(base.imp());}
+ ProtectedReference(const Reference& r) : Reference(r) { gcProtectNullTolerant(r.base); };
+ ~ProtectedReference() { gcUnprotectNullTolerant(base);}
ProtectedReference& operator=(const Reference &r)
{
- ValueImp *old = base.imp();
+ ValueImp *old = base;
Reference::operator=(r);
- gcProtectNullTolerant(r.base.imp());
+ gcProtectNullTolerant(r.base);
gcUnprotectNullTolerant(old);
return *this;
}
private:
ProtectedReference();
- ProtectedReference(const Object& b, const Identifier& p);
- ProtectedReference(const Object& b, unsigned p);
ProtectedReference(ObjectImp *b, const Identifier& p);
ProtectedReference(ObjectImp *b, unsigned p);
- ProtectedReference(const Null& b, const Identifier& p);
- ProtectedReference(const Null& b, unsigned p);
+ ProtectedReference(const Identifier& p);
+ ProtectedReference(unsigned p);
};
} // namespace
1.5 +10 -14 JavaScriptCore/kjs/protected_values.cpp
Index: protected_values.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/protected_values.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- protected_values.cpp 28 Jun 2005 00:02:08 -0000 1.4
+++ protected_values.cpp 8 Aug 2005 04:07:29 -0000 1.5
@@ -25,6 +25,7 @@
#include "pointer_hash.h"
#include "simple_number.h"
#include <stdint.h>
+#include "value.h"
namespace KJS {
@@ -43,14 +44,14 @@
if (SimpleNumber::is(k))
return 0;
- unsigned hash = computeHash(k);
+ unsigned hash = pointerHash(k);
int i = hash & _tableSizeMask;
#if DUMP_STATISTICS
++numProbes;
numCollisions += _table[i].key && _table[i].key != k;
#endif
- while (ValueImp *key = _table[i].key) {
+ while (AllocatedValueImp *key = _table[i].key) {
if (key == k) {
return _table[i].value;
}
@@ -71,14 +72,14 @@
if (!_table)
expand();
- unsigned hash = computeHash(k);
+ unsigned hash = pointerHash(k);
int i = hash & _tableSizeMask;
#if DUMP_STATISTICS
++numProbes;
numCollisions += _table[i].key && _table[i].key != k;
#endif
- while (ValueImp *key = _table[i].key) {
+ while (AllocatedValueImp *key = _table[i].key) {
if (key == k) {
_table[i].value++;
return;
@@ -86,7 +87,7 @@
i = (i + 1) & _tableSizeMask;
}
- _table[i].key = k;
+ _table[i].key = k->downcast();
_table[i].value = 1;
++_keyCount;
@@ -94,9 +95,9 @@
expand();
}
-inline void ProtectedValues::insert(ValueImp *k, int v)
+inline void ProtectedValues::insert(AllocatedValueImp *k, int v)
{
- unsigned hash = computeHash(k);
+ unsigned hash = pointerHash(k);
int i = hash & _tableSizeMask;
#if DUMP_STATISTICS
@@ -117,9 +118,9 @@
if (SimpleNumber::is(k))
return;
- unsigned hash = computeHash(k);
+ unsigned hash = pointerHash(k);
- ValueImp *key;
+ AllocatedValueImp *key;
int i = hash & _tableSizeMask;
#if DUMP_STATISTICS
@@ -186,9 +187,4 @@
free(oldTable);
}
-unsigned ProtectedValues::computeHash(ValueImp *pointer)
-{
- return pointerHash(pointer);
-}
-
} // namespace
1.3 +9 -10 JavaScriptCore/kjs/protected_values.h
Index: protected_values.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/protected_values.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- protected_values.h 20 Apr 2005 10:14:35 -0000 1.2
+++ protected_values.h 8 Aug 2005 04:07:29 -0000 1.3
@@ -20,19 +20,14 @@
*
*/
-
-#ifndef _KJS_PROTECTED_VALUES_H_
-#define _KJS_PROTECTED_VALUES_H_
+#ifndef KJS_PROTECTED_VALUES_H
+#define KJS_PROTECTED_VALUES_H
namespace KJS {
class ValueImp;
+ class AllocatedValueImp;
class ProtectedValues {
- struct KeyValue {
- ValueImp *key;
- int value;
- };
-
public:
static void increaseProtectCount(ValueImp *key);
static void decreaseProtectCount(ValueImp *key);
@@ -40,15 +35,19 @@
static int getProtectCount(ValueImp *key);
private:
- static void insert(ValueImp *key, int value);
+ static void insert(AllocatedValueImp *key, int value);
static void expand();
static void shrink();
static void rehash(int newTableSize);
- static unsigned computeHash(ValueImp *pointer);
// let the collector scan the table directly for protected values
friend class Collector;
+ struct KeyValue {
+ AllocatedValueImp *key;
+ int value;
+ };
+
static KeyValue *_table;
static int _tableSize;
static int _tableSizeMask;
1.13 +20 -36 JavaScriptCore/kjs/reference.cpp
Index: reference.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/reference.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- reference.cpp 14 Jul 2005 18:27:03 -0000 1.12
+++ reference.cpp 8 Aug 2005 04:07:29 -0000 1.13
@@ -27,22 +27,6 @@
// ------------------------------ Reference ------------------------------------
-Reference::Reference(const Object& b, const Identifier& p)
- : base(b),
- baseIsValue(false),
- propertyNameIsNumber(false),
- prop(p)
-{
-}
-
-Reference::Reference(const Object& b, unsigned p)
- : base(b),
- propertyNameAsNumber(p),
- baseIsValue(false),
- propertyNameIsNumber(true)
-{
-}
-
Reference::Reference(ObjectImp *b, const Identifier& p)
: base(b),
baseIsValue(false),
@@ -59,23 +43,23 @@
{
}
-Reference::Reference(const Null& b, const Identifier& p)
- : base(b),
+Reference::Reference(const Identifier& p)
+ : base(jsNull()),
baseIsValue(false),
propertyNameIsNumber(false),
prop(p)
{
}
-Reference::Reference(const Null& b, unsigned p)
- : base(b),
+Reference::Reference(unsigned p)
+ : base(jsNull()),
propertyNameAsNumber(p),
baseIsValue(false),
propertyNameIsNumber(true)
{
}
-Reference Reference::makeValueReference(const Value& v)
+Reference Reference::makeValueReference(ValueImp *v)
{
Reference valueRef;
valueRef.base = v;
@@ -83,10 +67,10 @@
return valueRef;
}
-Value Reference::getBase(ExecState *exec) const
+ValueImp *Reference::getBase(ExecState *exec) const
{
if (baseIsValue) {
- Object err = Error::create(exec, ReferenceError, I18N_NOOP("Invalid reference base"));
+ ObjectImp *err = Error::create(exec, ReferenceError, I18N_NOOP("Invalid reference base"));
exec->setException(err);
return err;
}
@@ -108,25 +92,25 @@
return prop;
}
-Value Reference::getValue(ExecState *exec) const
+ValueImp *Reference::getValue(ExecState *exec) const
{
if (baseIsValue) {
return base;
}
- ValueImp *o = base.imp();
- Type t = o ? o->dispatchType() : NullType;
+ ValueImp *o = base;
+ Type t = o ? o->type() : NullType;
if (t == NullType) {
UString m = I18N_NOOP("Can't find variable: ") + getPropertyName(exec).ustring();
- Object err = Error::create(exec, ReferenceError, m.ascii());
+ ObjectImp *err = Error::create(exec, ReferenceError, m.ascii());
exec->setException(err);
return err;
}
if (t != ObjectType) {
UString m = I18N_NOOP("Base is not an object");
- Object err = Error::create(exec, ReferenceError, m.ascii());
+ ObjectImp *err = Error::create(exec, ReferenceError, m.ascii());
exec->setException(err);
return err;
}
@@ -136,10 +120,10 @@
return static_cast<ObjectImp*>(o)->get(exec, prop);
}
-void Reference::putValue(ExecState *exec, const Value &w)
+void Reference::putValue(ExecState *exec, ValueImp *w)
{
if (baseIsValue) {
- Object err = Error::create(exec, ReferenceError);
+ ObjectImp *err = Error::create(exec, ReferenceError);
exec->setException(err);
return;
}
@@ -148,11 +132,11 @@
printInfo(exec,(UString("setting property ")+getPropertyName(exec).ustring()).cstring().c_str(),w);
#endif
- ValueImp *o = base.imp();
- Type t = o ? o->dispatchType() : NullType;
+ ValueImp *o = base;
+ Type t = o ? o->type() : NullType;
if (t == NullType)
- o = exec->lexicalInterpreter()->globalObject().imp();
+ o = exec->lexicalInterpreter()->globalObject();
if (propertyNameIsNumber)
return static_cast<ObjectImp*>(o)->put(exec, propertyNameAsNumber, w);
@@ -162,13 +146,13 @@
bool Reference::deleteValue(ExecState *exec)
{
if (baseIsValue) {
- Object err = Error::create(exec,ReferenceError);
+ ObjectImp *err = Error::create(exec,ReferenceError);
exec->setException(err);
return false;
}
- ValueImp *o = base.imp();
- Type t = o ? o->dispatchType() : NullType;
+ ValueImp *o = base;
+ Type t = o ? o->type() : NullType;
// The spec doesn't mention what to do if the base is null... just return true
if (t != ObjectType) {
1.12 +10 -12 JavaScriptCore/kjs/reference.h
Index: reference.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/reference.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- reference.h 7 Aug 2005 06:17:35 -0000 1.11
+++ reference.h 8 Aug 2005 04:07:29 -0000 1.12
@@ -24,11 +24,10 @@
#define _KJS_REFERENCE_H_
#include "identifier.h"
-#include "value.h"
+#include "object.h"
namespace KJS {
- class Object;
class ObjectImp;
class Reference {
@@ -36,13 +35,11 @@
friend class ReferenceListIterator;
friend class ProtectedReference;
public:
- Reference(const Object& b, const Identifier& p);
- Reference(const Object& b, unsigned p);
Reference(ObjectImp *b, const Identifier& p);
Reference(ObjectImp *b, unsigned p);
- Reference(const Null& b, const Identifier& p);
- Reference(const Null& b, unsigned p);
- static Reference makeValueReference(const Value& v);
+ Reference(const Identifier& p);
+ Reference(unsigned p);
+ static Reference makeValueReference(ValueImp *);
/**
* Performs the GetBase type conversion operation on this value (ECMA 8.7)
@@ -50,7 +47,7 @@
* Since references are supposed to have an Object or null as their base,
* this method is guaranteed to return either Null() or an Object value.
*/
- Value getBase(ExecState *exec) const;
+ ValueImp *getBase(ExecState *exec) const;
/**
* Performs the GetPropertyName type conversion operation on this value
@@ -62,26 +59,27 @@
* Performs the GetValue type conversion operation on this value
* (ECMA 8.7.1)
*/
- Value getValue(ExecState *exec) const;
+ ValueImp *getValue(ExecState *exec) const;
/**
* Performs the PutValue type conversion operation on this value
* (ECMA 8.7.1)
*/
- void putValue(ExecState *exec, const Value &w);
+ void putValue(ExecState *exec, ValueImp *);
bool deleteValue(ExecState *exec);
- ValueImp *baseIfMutable() const { return baseIsValue ? 0 : base.imp(); }
+ ValueImp *baseIfMutable() const { return baseIsValue ? 0 : base; }
private:
Reference() { }
- Value base;
+ ValueImp *base;
unsigned propertyNameAsNumber;
bool baseIsValue;
bool propertyNameIsNumber;
mutable Identifier prop;
};
+
}
#endif
1.21 +44 -48 JavaScriptCore/kjs/regexp_object.cpp
Index: regexp_object.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/regexp_object.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- regexp_object.cpp 7 Aug 2005 06:17:35 -0000 1.20
+++ regexp_object.cpp 8 Aug 2005 04:07:29 -0000 1.21
@@ -45,7 +45,6 @@
FunctionPrototypeImp *funcProto)
: ObjectImp(objProto)
{
- Value protect(this);
setInternalValue(String(""));
// The constructor will be added later in RegExpObject's constructor (?)
@@ -63,7 +62,6 @@
FunctionPrototypeImp *funcProto, int i, int len)
: InternalFunctionImp(funcProto), id(i)
{
- Value protect(this);
putDirect(lengthPropertyName, len, DontDelete|ReadOnly|DontEnum);
}
@@ -72,45 +70,45 @@
return true;
}
-Value RegExpProtoFuncImp::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *RegExpProtoFuncImp::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (!thisObj.inherits(&RegExpImp::info)) {
- if (thisObj.inherits(&RegExpPrototypeImp::info)) {
+ if (!thisObj->inherits(&RegExpImp::info)) {
+ if (thisObj->inherits(&RegExpPrototypeImp::info)) {
switch (id) {
case ToString: return String("//");
}
}
- Object err = Error::create(exec,TypeError);
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
- RegExpImp *reimp = static_cast<RegExpImp*>(thisObj.imp());
+ RegExpImp *reimp = static_cast<RegExpImp*>(thisObj);
RegExp *re = reimp->regExp();
- String s;
+ UString s;
UString str;
switch (id) {
case Exec: // 15.10.6.2
case Test:
{
- s = args[0].toString(exec);
- int length = s.value().size();
- Value lastIndex = thisObj.get(exec,"lastIndex");
- int i = lastIndex.isNull() ? 0 : lastIndex.toInt32(exec);
- bool globalFlag = thisObj.get(exec,"global").toBoolean(exec);
+ s = args[0]->toString(exec);
+ int length = s.size();
+ ValueImp *lastIndex = thisObj->get(exec,"lastIndex");
+ int i = lastIndex->toInt32(exec);
+ bool globalFlag = thisObj->get(exec,"global")->toBoolean(exec);
if (!globalFlag)
i = 0;
if (i < 0 || i > length) {
- thisObj.put(exec,"lastIndex", Number(0), DontDelete | DontEnum);
+ thisObj->put(exec,"lastIndex", Number(0), DontDelete | DontEnum);
if (id == Test)
return Boolean(false);
else
return Null();
}
- RegExpObjectImp* regExpObj = static_cast<RegExpObjectImp*>(exec->lexicalInterpreter()->builtinRegExp().imp());
- int **ovector = regExpObj->registerRegexp( re, s.value() );
+ RegExpObjectImp* regExpObj = static_cast<RegExpObjectImp*>(exec->lexicalInterpreter()->builtinRegExp());
+ int **ovector = regExpObj->registerRegexp( re, s );
- str = re->match(s.value(), i, 0L, ovector);
+ str = re->match(s, i, 0L, ovector);
regExpObj->setSubPatterns(re->subPatterns());
if (id == Test)
@@ -119,29 +117,29 @@
if (str.isNull()) // no match
{
if (globalFlag)
- thisObj.put(exec,"lastIndex",Number(0), DontDelete | DontEnum);
+ thisObj->put(exec,"lastIndex",Number(0), DontDelete | DontEnum);
return Null();
}
else // success
{
if (globalFlag)
- thisObj.put(exec,"lastIndex",Number( (*ovector)[1] ), DontDelete | DontEnum);
+ thisObj->put(exec,"lastIndex",Number( (*ovector)[1] ), DontDelete | DontEnum);
return regExpObj->arrayOfMatches(exec,str);
}
}
break;
case ToString:
- s = thisObj.get(exec,"source").toString(exec);
+ s = thisObj->get(exec,"source")->toString(exec);
str = "/";
- str += s.value();
+ str += s;
str += "/";
- if (thisObj.get(exec,"global").toBoolean(exec)) {
+ if (thisObj->get(exec,"global")->toBoolean(exec)) {
str += "g";
}
- if (thisObj.get(exec,"ignoreCase").toBoolean(exec)) {
+ if (thisObj->get(exec,"ignoreCase")->toBoolean(exec)) {
str += "i";
}
- if (thisObj.get(exec,"multiline").toBoolean(exec)) {
+ if (thisObj->get(exec,"multiline")->toBoolean(exec)) {
str += "m";
}
return String(str);
@@ -172,12 +170,11 @@
: InternalFunctionImp(funcProto), lastOvector(0L), lastNrSubPatterns(0)
{
- Value protect(this);
// ECMA 15.10.5.1 RegExp.prototype
putDirect(prototypePropertyName, regProto, DontEnum|DontDelete|ReadOnly);
// no. of arguments for constructor
- putDirect(lengthPropertyName, NumberImp::two(), ReadOnly|DontDelete|DontEnum);
+ putDirect(lengthPropertyName, jsTwo(), ReadOnly|DontDelete|DontEnum);
}
RegExpObjectImp::~RegExpObjectImp()
@@ -194,7 +191,7 @@
return &lastOvector;
}
-Object RegExpObjectImp::arrayOfMatches(ExecState *exec, const UString &result) const
+ObjectImp *RegExpObjectImp::arrayOfMatches(ExecState *exec, const UString &result) const
{
List list;
// The returned array contains 'result' as first item, followed by the list of matches
@@ -204,19 +201,19 @@
{
int start = lastOvector[2*i];
if (start == -1)
- list.append(UndefinedImp::staticUndefined);
+ list.append(jsUndefined());
else {
UString substring = lastString.substr( start, lastOvector[2*i+1] - start );
list.append(String(substring));
}
}
- Object arr = exec->lexicalInterpreter()->builtinArray().construct(exec, list);
- arr.put(exec, "index", Number(lastOvector[0]));
- arr.put(exec, "input", String(lastString));
+ ObjectImp *arr = exec->lexicalInterpreter()->builtinArray()->construct(exec, list);
+ arr->put(exec, "index", Number(lastOvector[0]));
+ arr->put(exec, "input", String(lastString));
return arr;
}
-Value RegExpObjectImp::backrefGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *RegExpObjectImp::backrefGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
RegExpObjectImp *thisObj = static_cast<RegExpObjectImp *>(slot.slotBase());
unsigned long i = slot.index();
@@ -253,36 +250,35 @@
}
// ECMA 15.10.4
-Object RegExpObjectImp::construct(ExecState *exec, const List &args)
+ObjectImp *RegExpObjectImp::construct(ExecState *exec, const List &args)
{
- Object o = Object::dynamicCast(args[0]);
- if (!o.isNull() && o.inherits(&RegExpImp::info)) {
- if (args[1].type() != UndefinedType) {
- Object err = Error::create(exec,TypeError);
+ ObjectImp *o = args[0]->getObject();
+ if (o && o->inherits(&RegExpImp::info)) {
+ if (!args[1]->isUndefined()) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
return o;
}
- UString p = args[0].type() == UndefinedType ? UString("") : args[0].toString(exec);
- UString flags = args[1].type() == UndefinedType ? UString("") : args[1].toString(exec);
+ UString p = args[0]->isUndefined() ? UString("") : args[0]->toString(exec);
+ UString flags = args[1]->isUndefined() ? UString("") : args[1]->toString(exec);
- RegExpPrototypeImp *proto = static_cast<RegExpPrototypeImp*>(exec->lexicalInterpreter()->builtinRegExpPrototype().imp());
+ RegExpPrototypeImp *proto = static_cast<RegExpPrototypeImp*>(exec->lexicalInterpreter()->builtinRegExpPrototype());
RegExpImp *dat = new RegExpImp(proto);
- Object obj(dat); // protect from GC
bool global = (flags.find("g") >= 0);
bool ignoreCase = (flags.find("i") >= 0);
bool multiline = (flags.find("m") >= 0);
// TODO: throw a syntax error on invalid flags
- dat->putDirect("global", global ? BooleanImp::staticTrue : BooleanImp::staticFalse, DontDelete | ReadOnly | DontEnum);
- dat->putDirect("ignoreCase", ignoreCase ? BooleanImp::staticTrue : BooleanImp::staticFalse, DontDelete | ReadOnly | DontEnum);
- dat->putDirect("multiline", multiline ? BooleanImp::staticTrue : BooleanImp::staticFalse, DontDelete | ReadOnly | DontEnum);
+ dat->putDirect("global", jsBoolean(global), DontDelete | ReadOnly | DontEnum);
+ dat->putDirect("ignoreCase", jsBoolean(ignoreCase), DontDelete | ReadOnly | DontEnum);
+ dat->putDirect("multiline", jsBoolean(multiline), DontDelete | ReadOnly | DontEnum);
- dat->putDirect("source", new StringImp(p), DontDelete | ReadOnly | DontEnum);
- dat->putDirect("lastIndex", NumberImp::zero(), DontDelete | DontEnum);
+ dat->putDirect("source", jsString(p), DontDelete | ReadOnly | DontEnum);
+ dat->putDirect("lastIndex", jsZero(), DontDelete | DontEnum);
int reflags = RegExp::None;
if (global)
@@ -293,7 +289,7 @@
reflags |= RegExp::Multiline;
dat->setRegExp(new RegExp(p, reflags));
- return obj;
+ return dat;
}
bool RegExpObjectImp::implementsCall() const
@@ -302,7 +298,7 @@
}
// ECMA 15.10.3
-Value RegExpObjectImp::call(ExecState *exec, Object &/*thisObj*/,
+ValueImp *RegExpObjectImp::callAsFunction(ExecState *exec, ObjectImp */*thisObj*/,
const List &args)
{
// TODO: handle RegExp argument case (15.10.3.1)
1.11 +5 -5 JavaScriptCore/kjs/regexp_object.h
Index: regexp_object.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/regexp_object.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- regexp_object.h 7 Aug 2005 06:17:35 -0000 1.10
+++ regexp_object.h 8 Aug 2005 04:07:29 -0000 1.11
@@ -43,7 +43,7 @@
FunctionPrototypeImp *funcProto, int i, int len);
virtual bool implementsCall() const;
- virtual Value call(ExecState *exec, Object &thisObj, const List &args);
+ virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args);
enum { Exec, Test, ToString };
private:
@@ -70,16 +70,16 @@
RegExpPrototypeImp *regProto);
virtual ~RegExpObjectImp();
virtual bool implementsConstruct() const;
- virtual Object construct(ExecState *exec, const List &args);
+ virtual ObjectImp *construct(ExecState *exec, const List &args);
virtual bool implementsCall() const;
- virtual Value call(ExecState *exec, Object &thisObj, const List &args);
+ virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args);
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
int ** registerRegexp( const RegExp* re, const UString& s );
void setSubPatterns(int num) { lastNrSubPatterns = num; }
- Object arrayOfMatches(ExecState *exec, const UString &result) const;
+ ObjectImp *arrayOfMatches(ExecState *exec, const UString &result) const;
private:
- static Value backrefGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
+ static ValueImp *backrefGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
UString lastString;
int *lastOvector;
1.42 +88 -93 JavaScriptCore/kjs/string_object.cpp
Index: string_object.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/string_object.cpp,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- string_object.cpp 7 Aug 2005 06:17:35 -0000 1.41
+++ string_object.cpp 8 Aug 2005 04:07:29 -0000 1.42
@@ -50,15 +50,15 @@
setInternalValue(String(string));
}
-Value StringInstanceImp::lengthGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot &slot)
+ValueImp *StringInstanceImp::lengthGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot &slot)
{
- return Value(static_cast<StringInstanceImp *>(slot.slotBase())->internalValue().toString(exec).size());
+ return jsNumber(static_cast<StringInstanceImp *>(slot.slotBase())->internalValue()->toString(exec).size());
}
-Value StringInstanceImp::indexGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot &slot)
+ValueImp *StringInstanceImp::indexGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot &slot)
{
- const UChar c = static_cast<StringInstanceImp *>(slot.slotBase())->internalValue().toString(exec)[slot.index()];
- return Value(UString(&c, 1));
+ const UChar c = static_cast<StringInstanceImp *>(slot.slotBase())->internalValue()->toString(exec)[slot.index()];
+ return jsString(UString(&c, 1));
}
bool StringInstanceImp::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot &slot)
@@ -71,7 +71,7 @@
bool ok;
const unsigned index = propertyName.toArrayIndex(&ok);
if (ok) {
- const UString s = internalValue().toString(exec);
+ const UString s = internalValue()->toString(exec);
const unsigned length = s.size();
if (index >= length)
return false;
@@ -82,7 +82,7 @@
return ObjectImp::getOwnPropertySlot(exec, propertyName, slot);
}
-void StringInstanceImp::put(ExecState *exec, const Identifier &propertyName, const Value &value, int attr)
+void StringInstanceImp::put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr)
{
if (propertyName == lengthPropertyName)
return;
@@ -142,10 +142,8 @@
ObjectPrototypeImp *objProto)
: StringInstanceImp(objProto)
{
- Value protect(this);
// The constructor will be added later, after StringObjectImp has been built
- putDirect(lengthPropertyName, NumberImp::zero(), DontDelete|ReadOnly|DontEnum);
-
+ putDirect(lengthPropertyName, jsZero(), DontDelete|ReadOnly|DontEnum);
}
bool StringPrototypeImp::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot &slot)
@@ -157,10 +155,9 @@
StringProtoFuncImp::StringProtoFuncImp(ExecState *exec, int i, int len)
: InternalFunctionImp(
- static_cast<FunctionPrototypeImp*>(exec->lexicalInterpreter()->builtinFunctionPrototype().imp())
+ static_cast<FunctionPrototypeImp*>(exec->lexicalInterpreter()->builtinFunctionPrototype())
), id(i)
{
- Value protect(this);
putDirect(lengthPropertyName, len, DontDelete|ReadOnly|DontEnum);
}
@@ -171,8 +168,8 @@
static inline bool regExpIsGlobal(RegExpImp *regExp, ExecState *exec)
{
- Value globalProperty = regExp->get(exec,"global");
- return globalProperty.type() != UndefinedType && globalProperty.toBoolean(exec);
+ ValueImp *globalProperty = regExp->get(exec,"global");
+ return !globalProperty->isUndefined() && globalProperty->toBoolean(exec);
}
static inline void expandSourceRanges(UString::Range * & array, int& count, int& capacity)
@@ -259,22 +256,22 @@
return substitutedReplacement;
}
-static Value replace(ExecState *exec, const UString &source, const Value &pattern, const Value &replacement)
+static ValueImp *replace(ExecState *exec, const UString &source, ValueImp *pattern, ValueImp *replacement)
{
ObjectImp *replacementFunction = 0;
UString replacementString;
- if (replacement.type() == ObjectType && replacement.toObject(exec).implementsCall())
- replacementFunction = replacement.toObject(exec).imp();
+ if (replacement->isObject() && replacement->toObject(exec)->implementsCall())
+ replacementFunction = replacement->toObject(exec);
else
- replacementString = replacement.toString(exec);
+ replacementString = replacement->toString(exec);
- if (pattern.type() == ObjectType && pattern.toObject(exec).inherits(&RegExpImp::info)) {
- RegExpImp* imp = static_cast<RegExpImp *>( pattern.toObject(exec).imp() );
+ if (pattern->isObject() && pattern->toObject(exec)->inherits(&RegExpImp::info)) {
+ RegExpImp* imp = static_cast<RegExpImp *>( pattern->toObject(exec) );
RegExp *reg = imp->regExp();
bool global = regExpIsGlobal(imp, exec);
- RegExpObjectImp* regExpObj = static_cast<RegExpObjectImp*>(exec->lexicalInterpreter()->builtinRegExp().imp());
+ RegExpObjectImp* regExpObj = static_cast<RegExpObjectImp*>(exec->lexicalInterpreter()->builtinRegExp());
int matchIndex = 0;
int lastIndex = 0;
@@ -302,20 +299,20 @@
int completeMatchStart = (*ovector)[0];
List args;
- args.append(Value(matchString));
+ args.append(jsString(matchString));
for (unsigned i = 0; i < reg->subPatterns(); i++) {
int matchStart = (*ovector)[(i + 1) * 2];
int matchLen = (*ovector)[(i + 1) * 2 + 1] - matchStart;
- args.append(Value(source.substr(matchStart, matchLen)));
+ args.append(jsString(source.substr(matchStart, matchLen)));
}
- args.append(Value(completeMatchStart));
- args.append(Value(source));
+ args.append(jsNumber(completeMatchStart));
+ args.append(jsString(source));
replacementString = replacementFunction->call(exec, exec->dynamicInterpreter()->globalObject(),
- args).toString(exec);
+ args)->toString(exec);
}
UString substitutedReplacement = substituteBackreferences(replacementString, source, ovector, reg);
@@ -344,7 +341,7 @@
}
// First arg is a string
- UString patternString = pattern.toString(exec);
+ UString patternString = pattern->toString(exec);
int matchPos = source.find(patternString);
int matchLen = patternString.size();
// Do the replacement
@@ -354,31 +351,31 @@
if (replacementFunction) {
List args;
- args.append(Value(source.substr(matchPos, matchLen)));
- args.append(Value(matchPos));
- args.append(Value(source));
+ args.append(jsString(source.substr(matchPos, matchLen)));
+ args.append(jsNumber(matchPos));
+ args.append(jsString(source));
replacementString = replacementFunction->call(exec, exec->dynamicInterpreter()->globalObject(),
- args).toString(exec);
+ args)->toString(exec);
}
return String(source.substr(0, matchPos) + replacementString + source.substr(matchPos + matchLen));
}
// ECMA 15.5.4.2 - 15.5.4.20
-Value StringProtoFuncImp::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *StringProtoFuncImp::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- Value result;
+ ValueImp *result = NULL;
// toString and valueOf are no generic function.
if (id == ToString || id == ValueOf) {
- if (thisObj.isNull() || !thisObj.inherits(&StringInstanceImp::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj || !thisObj->inherits(&StringInstanceImp::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
- return String(thisObj.internalValue().toString(exec));
+ return String(thisObj->internalValue()->toString(exec));
}
UString u, u2, u3;
@@ -386,11 +383,11 @@
double dpos;
double d = 0.0;
- UString s = thisObj.toString(exec);
+ UString s = thisObj->toString(exec);
int len = s.size();
- Value a0 = args[0];
- Value a1 = args[1];
+ ValueImp *a0 = args[0];
+ ValueImp *a1 = args[1];
switch (id) {
case ToString:
@@ -400,7 +397,7 @@
case CharAt:
// Other browsers treat an omitted parameter as 0 rather than NaN.
// That doesn't match the ECMA standard, but is needed for site compatibility.
- dpos = a0.isA(UndefinedType) ? 0 : a0.toInteger(exec);
+ dpos = a0->isUndefined() ? 0 : a0->toInteger(exec);
if (dpos >= 0 && dpos < len) // false for NaN
u = s.substr(static_cast<int>(dpos), 1);
else
@@ -410,26 +407,26 @@
case CharCodeAt:
// Other browsers treat an omitted parameter as 0 rather than NaN.
// That doesn't match the ECMA standard, but is needed for site compatibility.
- dpos = a0.isA(UndefinedType) ? 0 : a0.toInteger(exec);
+ dpos = a0->isUndefined() ? 0 : a0->toInteger(exec);
if (dpos >= 0 && dpos < len) // false for NaN
result = Number(s[static_cast<int>(dpos)].unicode());
else
- result = Number(NaN);
+ result = jsNaN();
break;
case Concat: {
ListIterator it = args.begin();
for ( ; it != args.end() ; ++it) {
- s += it->dispatchToString(exec);
+ s += it->toString(exec);
}
result = String(s);
break;
}
case IndexOf:
- u2 = a0.toString(exec);
- if (a1.type() == UndefinedType)
+ u2 = a0->toString(exec);
+ if (a1->isUndefined())
dpos = 0;
else {
- dpos = a1.toInteger(exec);
+ dpos = a1->toInteger(exec);
if (dpos >= 0) { // false for NaN
if (dpos > len)
dpos = len;
@@ -439,12 +436,12 @@
result = Number(s.find(u2, static_cast<int>(dpos)));
break;
case LastIndexOf:
- u2 = a0.toString(exec);
- d = a1.toNumber(exec);
- if (a1.type() == UndefinedType || KJS::isNaN(d))
+ u2 = a0->toString(exec);
+ d = a1->toNumber(exec);
+ if (a1->isUndefined() || KJS::isNaN(d))
dpos = len;
else {
- dpos = a1.toInteger(exec);
+ dpos = a1->toInteger(exec);
if (dpos >= 0) { // false for NaN
if (dpos > len)
dpos = len;
@@ -458,9 +455,9 @@
u = s;
RegExp *reg, *tmpReg = 0;
RegExpImp *imp = 0;
- if (a0.isA(ObjectType) && a0.toObject(exec).inherits(&RegExpImp::info))
+ if (a0->isObject() && a0->getObject()->inherits(&RegExpImp::info))
{
- imp = static_cast<RegExpImp *>( a0.toObject(exec).imp() );
+ imp = static_cast<RegExpImp *>(a0);
reg = imp->regExp();
}
else
@@ -469,9 +466,9 @@
* If regexp is not an object whose [[Class]] property is "RegExp", it is
* replaced with the result of the expression new RegExp(regexp).
*/
- reg = tmpReg = new RegExp(a0.toString(exec), RegExp::None);
+ reg = tmpReg = new RegExp(a0->toString(exec), RegExp::None);
}
- RegExpObjectImp* regExpObj = static_cast<RegExpObjectImp*>(exec->lexicalInterpreter()->builtinRegExp().imp());
+ RegExpObjectImp* regExpObj = static_cast<RegExpObjectImp*>(exec->lexicalInterpreter()->builtinRegExp());
int **ovector = regExpObj->registerRegexp(reg, u);
UString mstr = reg->match(u, -1, &pos, ovector);
if (id == Search) {
@@ -492,7 +489,7 @@
int lastIndex = 0;
while (pos >= 0) {
if (mstr.isNull())
- list.append(UndefinedImp::staticUndefined);
+ list.append(jsUndefined());
else
list.append(String(mstr));
lastIndex = pos;
@@ -508,7 +505,7 @@
// other browsers and because Null is a false value.
result = Null();
} else {
- result = exec->lexicalInterpreter()->builtinArray().construct(exec, list);
+ result = exec->lexicalInterpreter()->builtinArray()->construct(exec, list);
}
}
}
@@ -521,7 +518,7 @@
case Slice: // http://developer.netscape.com/docs/manuals/js/client/jsref/string.htm#1194366
{
// The arg processing is very much like ArrayProtoFunc::Slice
- double begin = args[0].toInteger(exec);
+ double begin = args[0]->toInteger(exec);
if (begin >= 0) { // false for NaN
if (begin > len)
begin = len;
@@ -531,8 +528,8 @@
begin = 0;
}
double end = len;
- if (args[1].type() != UndefinedType) {
- end = args[1].toInteger(exec);
+ if (!args[1]->isUndefined()) {
+ end = args[1]->toInteger(exec);
if (end >= 0) { // false for NaN
if (end > len)
end = len;
@@ -547,18 +544,18 @@
break;
}
case Split: {
- Object constructor = exec->lexicalInterpreter()->builtinArray();
- Object res = Object::dynamicCast(constructor.construct(exec,List::empty()));
+ ObjectImp *constructor = exec->lexicalInterpreter()->builtinArray();
+ ObjectImp *res = static_cast<ObjectImp *>(constructor->construct(exec,List::empty()));
result = res;
u = s;
i = p0 = 0;
- uint32_t limit = a1.type() == UndefinedType ? 0xFFFFFFFFU : a1.toUInt32(exec);
- if (a0.type() == ObjectType && Object::dynamicCast(a0).inherits(&RegExpImp::info)) {
- Object obj0 = Object::dynamicCast(a0);
- RegExp reg(obj0.get(exec,"source").toString(exec));
+ uint32_t limit = a1->isUndefined() ? 0xFFFFFFFFU : a1->toUInt32(exec);
+ if (a0->isObject() && static_cast<ObjectImp *>(a0)->inherits(&RegExpImp::info)) {
+ ObjectImp *obj0 = static_cast<ObjectImp *>(a0);
+ RegExp reg(obj0->get(exec,"source")->toString(exec));
if (u.isEmpty() && !reg.match(u, 0).isNull()) {
// empty string matched by regexp -> empty array
- res.put(exec,lengthPropertyName, Number(0));
+ res->put(exec,lengthPropertyName, Number(0));
break;
}
pos = 0;
@@ -572,13 +569,13 @@
break;
pos = mpos + (mstr.isEmpty() ? 1 : mstr.size());
if (mpos != p0 || !mstr.isEmpty()) {
- res.put(exec,i, String(u.substr(p0, mpos-p0)));
+ res->put(exec,i, String(u.substr(p0, mpos-p0)));
p0 = mpos + mstr.size();
i++;
}
}
} else {
- u2 = a0.toString(exec);
+ u2 = a0->toString(exec);
if (u2.isEmpty()) {
if (u.isEmpty()) {
// empty separator matches empty string -> empty array
@@ -586,11 +583,11 @@
break;
} else {
while (static_cast<uint32_t>(i) != limit && i < u.size()-1)
- res.put(exec, i++, String(u.substr(p0++, 1)));
+ res->put(exec, i++, String(u.substr(p0++, 1)));
}
} else {
while (static_cast<uint32_t>(i) != limit && (pos = u.find(u2, p0)) >= 0) {
- res.put(exec, i, String(u.substr(p0, pos-p0)));
+ res->put(exec, i, String(u.substr(p0, pos-p0)));
p0 = pos + u2.size();
i++;
}
@@ -598,13 +595,13 @@
}
// add remaining string, if any
if (static_cast<uint32_t>(i) != limit)
- res.put(exec, i++, String(u.substr(p0)));
- res.put(exec,lengthPropertyName, Number(i));
+ res->put(exec, i++, String(u.substr(p0)));
+ res->put(exec,lengthPropertyName, Number(i));
}
break;
case Substr: {
- double d = a0.toInteger(exec);
- double d2 = a1.toInteger(exec);
+ double d = a0->toInteger(exec);
+ double d2 = a1->toInteger(exec);
if (!(d >= 0)) { // true for NaN
d += len;
if (!(d >= 0)) // true for NaN
@@ -622,8 +619,8 @@
break;
}
case Substring: {
- double start = a0.toNumber(exec);
- double end = a1.toNumber(exec);
+ double start = a0->toNumber(exec);
+ double end = a1->toNumber(exec);
if (KJS::isNaN(start))
start = 0;
if (KJS::isNaN(end))
@@ -636,7 +633,7 @@
start = len;
if (end > len)
end = len;
- if (a1.type() == UndefinedType)
+ if (a1->isUndefined())
end = len;
if (start > end) {
double temp = end;
@@ -689,16 +686,16 @@
result = String("<sup>" + s + "</sup>");
break;
case Fontcolor:
- result = String("<font color=\"" + a0.toString(exec) + "\">" + s + "</font>");
+ result = String("<font color=\"" + a0->toString(exec) + "\">" + s + "</font>");
break;
case Fontsize:
- result = String("<font size=\"" + a0.toString(exec) + "\">" + s + "</font>");
+ result = String("<font size=\"" + a0->toString(exec) + "\">" + s + "</font>");
break;
case Anchor:
- result = String("<a name=\"" + a0.toString(exec) + "\">" + s + "</a>");
+ result = String("<a name=\"" + a0->toString(exec) + "\">" + s + "</a>");
break;
case Link:
- result = String("<a href=\"" + a0.toString(exec) + "\">" + s + "</a>");
+ result = String("<a href=\"" + a0->toString(exec) + "\">" + s + "</a>");
break;
#endif
}
@@ -713,7 +710,6 @@
StringPrototypeImp *stringProto)
: InternalFunctionImp(funcProto)
{
- Value protect(this);
// ECMA 15.5.3.1 String.prototype
putDirect(prototypePropertyName, stringProto, DontEnum|DontDelete|ReadOnly);
@@ -721,7 +717,7 @@
putDirect(fromCharCode, new StringObjectFuncImp(exec,funcProto), DontEnum);
// no. of arguments for constructor
- putDirect(lengthPropertyName, NumberImp::one(), ReadOnly|DontDelete|DontEnum);
+ putDirect(lengthPropertyName, jsOne(), ReadOnly|DontDelete|DontEnum);
}
@@ -731,12 +727,12 @@
}
// ECMA 15.5.2
-Object StringObjectImp::construct(ExecState *exec, const List &args)
+ObjectImp *StringObjectImp::construct(ExecState *exec, const List &args)
{
- ObjectImp *proto = exec->lexicalInterpreter()->builtinStringPrototype().imp();
+ ObjectImp *proto = exec->lexicalInterpreter()->builtinStringPrototype();
if (args.size() == 0)
- return Object(new StringInstanceImp(proto));
- return Object(new StringInstanceImp(proto, args.begin()->dispatchToString(exec)));
+ return new StringInstanceImp(proto);
+ return new StringInstanceImp(proto, args.begin()->toString(exec));
}
bool StringObjectImp::implementsCall() const
@@ -745,13 +741,13 @@
}
// ECMA 15.5.1
-Value StringObjectImp::call(ExecState *exec, Object &/*thisObj*/, const List &args)
+ValueImp *StringObjectImp::callAsFunction(ExecState *exec, ObjectImp */*thisObj*/, const List &args)
{
if (args.isEmpty())
return String("");
else {
- Value v = args[0];
- return String(v.toString(exec));
+ ValueImp *v = args[0];
+ return String(v->toString(exec));
}
}
@@ -761,8 +757,7 @@
StringObjectFuncImp::StringObjectFuncImp(ExecState *exec, FunctionPrototypeImp *funcProto)
: InternalFunctionImp(funcProto)
{
- Value protect(this);
- putDirect(lengthPropertyName, NumberImp::one(), DontDelete|ReadOnly|DontEnum);
+ putDirect(lengthPropertyName, jsOne(), DontDelete|ReadOnly|DontEnum);
}
bool StringObjectFuncImp::implementsCall() const
@@ -770,7 +765,7 @@
return true;
}
-Value StringObjectFuncImp::call(ExecState *exec, Object &/*thisObj*/, const List &args)
+ValueImp *StringObjectFuncImp::callAsFunction(ExecState *exec, ObjectImp */*thisObj*/, const List &args)
{
UString s;
if (args.size()) {
1.14 +7 -7 JavaScriptCore/kjs/string_object.h
Index: string_object.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/string_object.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- string_object.h 7 Aug 2005 06:17:36 -0000 1.13
+++ string_object.h 8 Aug 2005 04:07:29 -0000 1.14
@@ -33,14 +33,14 @@
StringInstanceImp(ObjectImp *proto, const UString &string);
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- virtual void put(ExecState *exec, const Identifier &propertyName, const Value &value, int attr = None);
+ virtual void put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr = None);
virtual bool deleteProperty(ExecState *exec, const Identifier &propertyName);
virtual const ClassInfo *classInfo() const { return &info; }
static const ClassInfo info;
private:
- static Value lengthGetter(ExecState *exec, const Identifier&, const PropertySlot &slot);
- static Value indexGetter(ExecState *exec, const Identifier&, const PropertySlot &slot);
+ static ValueImp *lengthGetter(ExecState *exec, const Identifier&, const PropertySlot &slot);
+ static ValueImp *indexGetter(ExecState *exec, const Identifier&, const PropertySlot &slot);
};
/**
@@ -69,7 +69,7 @@
StringProtoFuncImp(ExecState *exec, int i, int len);
virtual bool implementsCall() const;
- virtual Value call(ExecState *exec, Object &thisObj, const List &args);
+ virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args);
enum { ToString, ValueOf, CharAt, CharCodeAt, Concat, IndexOf, LastIndexOf,
Match, Replace, Search, Slice, Split,
@@ -96,9 +96,9 @@
StringPrototypeImp *stringProto);
virtual bool implementsConstruct() const;
- virtual Object construct(ExecState *exec, const List &args);
+ virtual ObjectImp *construct(ExecState *exec, const List &args);
virtual bool implementsCall() const;
- virtual Value call(ExecState *exec, Object &thisObj, const List &args);
+ virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args);
};
/**
@@ -111,7 +111,7 @@
public:
StringObjectFuncImp(ExecState *exec, FunctionPrototypeImp *funcProto);
virtual bool implementsCall() const;
- virtual Value call(ExecState *exec, Object &thisObj, const List &args);
+ virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args);
};
} // namespace
1.14 +18 -18 JavaScriptCore/kjs/testkjs.cpp
Index: testkjs.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/testkjs.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- testkjs.cpp 14 Jul 2005 22:32:16 -0000 1.13
+++ testkjs.cpp 8 Aug 2005 04:07:29 -0000 1.14
@@ -37,7 +37,7 @@
public:
TestFunctionImp(int i, int length);
virtual bool implementsCall() const { return true; }
- virtual Value call(ExecState *exec, Object &thisObj, const List &args);
+ virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args);
enum { Print, Debug, Quit, GC };
@@ -50,12 +50,12 @@
putDirect(lengthPropertyName,length,DontDelete|ReadOnly|DontEnum);
}
-Value TestFunctionImp::call(ExecState *exec, Object &/*thisObj*/, const List &args)
+ValueImp *TestFunctionImp::callAsFunction(ExecState *exec, ObjectImp */*thisObj*/, const List &args)
{
switch (id) {
case Print:
case Debug:
- fprintf(stderr,"--> %s\n",args[0].toString(exec).ascii());
+ fprintf(stderr,"--> %s\n",args[0]->toString(exec).ascii());
return Undefined();
case Quit:
exit(0);
@@ -76,10 +76,10 @@
public:
VersionFunctionImp() : ObjectImp() {}
virtual bool implementsCall() const { return true; }
- virtual Value call(ExecState *exec, Object &thisObj, const List &args);
+ virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args);
};
-Value VersionFunctionImp::call(ExecState */*exec*/, Object &/*thisObj*/, const List &/*args*/)
+ValueImp *VersionFunctionImp::callAsFunction(ExecState */*exec*/, ObjectImp */*thisObj*/, const List &/*args*/)
{
// We need this function for compatibility with the Mozilla JS tests but for now
// we don't actually do any version-specific handling
@@ -103,20 +103,20 @@
{
Interpreter::lock();
- Object global(new GlobalImp());
+ ObjectImp *global(new GlobalImp());
// create interpreter
Interpreter interp(global);
// add debug() function
- global.put(interp.globalExec(), "debug", Object(new TestFunctionImp(TestFunctionImp::Debug,1)));
+ global->put(interp.globalExec(), "debug", new TestFunctionImp(TestFunctionImp::Debug, 1));
// add "print" for compatibility with the mozilla js shell
- global.put(interp.globalExec(), "print", Object(new TestFunctionImp(TestFunctionImp::Print,1)));
+ global->put(interp.globalExec(), "print", new TestFunctionImp(TestFunctionImp::Print, 1));
// add "quit" for compatibility with the mozilla js shell
- global.put(interp.globalExec(), "quit", Object(new TestFunctionImp(TestFunctionImp::Quit,0)));
+ global->put(interp.globalExec(), "quit", new TestFunctionImp(TestFunctionImp::Quit, 0));
// add "gc" for compatibility with the mozilla js shell
- global.put(interp.globalExec(), "gc", Object(new TestFunctionImp(TestFunctionImp::GC,0)));
+ global->put(interp.globalExec(), "gc", new TestFunctionImp(TestFunctionImp::GC, 0));
// add "version" for compatibility with the mozilla js shell
- global.put(interp.globalExec(), "version", Object(new VersionFunctionImp()));
+ global->put(interp.globalExec(), "version", new VersionFunctionImp());
for (int i = 1; i < argc; i++) {
int code_len = 0;
@@ -150,13 +150,13 @@
if (comp.complType() == Throw) {
ExecState *exec = interp.globalExec();
- Value exVal = comp.value();
- char *msg = exVal.toString(exec).ascii();
+ ValueImp *exVal = comp.value();
+ char *msg = exVal->toString(exec).ascii();
int lineno = -1;
- if (exVal.type() == ObjectType) {
- Value lineVal = Object::dynamicCast(exVal).get(exec,"line");
- if (lineVal.type() == NumberType)
- lineno = int(lineVal.toNumber(exec));
+ if (exVal->isObject()) {
+ ValueImp *lineVal = static_cast<ObjectImp *>(exVal)->get(exec,"line");
+ if (lineVal->isNumber())
+ lineno = int(lineVal->toNumber(exec));
}
if (lineno != -1)
fprintf(stderr,"Exception, line %d: %s\n",lineno,msg);
@@ -165,7 +165,7 @@
ret = false;
}
else if (comp.complType() == ReturnValue) {
- char *msg = comp.value().toString(interp.globalExec()).ascii();
+ char *msg = comp.value()->toString(interp.globalExec()).ascii();
fprintf(stderr,"Return value: %s\n",msg);
}
1.27 +121 -292 JavaScriptCore/kjs/value.cpp
Index: value.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/value.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- value.cpp 14 Jul 2005 18:27:03 -0000 1.26
+++ value.cpp 8 Aug 2005 04:07:29 -0000 1.27
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2001 Harri Porten (porten at kde.org)
@@ -23,11 +22,11 @@
*/
#include "value.h"
+
#include "object.h"
#include "types.h"
#include "interpreter.h"
-#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
@@ -37,120 +36,98 @@
#include "operations.h"
#include "error_object.h"
#include "nodes.h"
-#include "simple_number.h"
namespace KJS {
-// ----------------------------- ValueImp -------------------------------------
-
-void ValueImp::mark()
-{
- _marked = true;
-}
+AllocatedValueImp *ConstantValues::undefined = NULL;
+AllocatedValueImp *ConstantValues::null = NULL;
+AllocatedValueImp *ConstantValues::jsTrue = NULL;
+AllocatedValueImp *ConstantValues::jsFalse = NULL;
+AllocatedValueImp *ConstantValues::NaN = NULL;
-void* ValueImp::operator new(size_t s)
-{
- return Collector::allocate(s);
-}
+static const double D16 = 65536;
+static const double D32 = 4294967296.0;
-void ValueImp::operator delete(void*)
+void *AllocatedValueImp::operator new(size_t size)
{
- // Do nothing. So far.
+ return Collector::allocate(size);
}
-bool ValueImp::toUInt32(unsigned&) const
+bool AllocatedValueImp::getUInt32(unsigned&) const
{
- return false;
+ return false;
}
// ECMA 9.4
double ValueImp::toInteger(ExecState *exec) const
{
- uint32_t i;
- if (dispatchToUInt32(i))
- return i;
- return roundValue(exec, Value(const_cast<ValueImp*>(this)));
+ uint32_t i;
+ if (getUInt32(i))
+ return i;
+ return roundValue(exec, const_cast<ValueImp*>(this));
}
int32_t ValueImp::toInt32(ExecState *exec) const
{
- uint32_t i;
- if (dispatchToUInt32(i))
- return i;
-
- double d = roundValue(exec, Value(const_cast<ValueImp*>(this)));
- if (isNaN(d) || isInf(d))
- return 0;
- double d32 = fmod(d, D32);
-
- if (d32 >= D32 / 2.0)
- d32 -= D32;
- else if (d32 < -D32 / 2.0)
- d32 += D32;
+ uint32_t i;
+ if (getUInt32(i))
+ return i;
+
+ double d = roundValue(exec, const_cast<ValueImp*>(this));
+ if (isNaN(d) || isInf(d))
+ return 0;
+ double d32 = fmod(d, D32);
+
+ if (d32 >= D32 / 2)
+ d32 -= D32;
+ else if (d32 < -D32 / 2)
+ d32 += D32;
- return static_cast<int32_t>(d32);
+ return static_cast<int32_t>(d32);
}
uint32_t ValueImp::toUInt32(ExecState *exec) const
{
- uint32_t i;
- if (dispatchToUInt32(i))
- return i;
-
- double d = roundValue(exec, Value(const_cast<ValueImp*>(this)));
- if (isNaN(d) || isInf(d))
- return 0;
- double d32 = fmod(d, D32);
+ uint32_t i;
+ if (getUInt32(i))
+ return i;
+
+ double d = roundValue(exec, const_cast<ValueImp*>(this));
+ if (isNaN(d) || isInf(d))
+ return 0;
+ double d32 = fmod(d, D32);
- if (d32 < 0)
- d32 += D32;
+ if (d32 < 0)
+ d32 += D32;
- return static_cast<uint32_t>(d32);
+ return static_cast<uint32_t>(d32);
}
uint16_t ValueImp::toUInt16(ExecState *exec) const
{
- uint32_t i;
- if (dispatchToUInt32(i))
- return i;
-
- double d = roundValue(exec, Value(const_cast<ValueImp*>(this)));
- if (isNaN(d) || isInf(d))
- return 0;
- double d16 = fmod(d, D16);
-
- if (d16 < 0)
- d16 += D16;
-
- return static_cast<uint16_t>(d16);
-}
-
-Object ValueImp::dispatchToObject(ExecState *exec) const
-{
- if (SimpleNumber::is(this))
- return static_cast<const NumberImp *>(this)->NumberImp::toObject(exec);
- return toObject(exec);
-}
-
-bool ValueImp::isUndefinedOrNull() const
-{
- switch (dispatchType()) {
- case BooleanType:
- case NumberType:
- case ObjectType:
- case StringType:
- break;
- case NullType:
- case UndefinedType:
- return true;
- case UnspecifiedType:
- assert(false);
- break;
- }
- return false;
+ uint32_t i;
+ if (getUInt32(i))
+ return i;
+
+ double d = roundValue(exec, const_cast<ValueImp*>(this));
+ if (isNaN(d) || isInf(d))
+ return 0;
+ double d16 = fmod(d, D16);
+
+ if (d16 < 0)
+ d16 += D16;
+
+ return static_cast<uint16_t>(d16);
}
-bool ValueImp::isBoolean(bool &booleanValue) const
+ObjectImp *ValueImp::toObject(ExecState *exec) const
+{
+ if (SimpleNumber::is(this))
+ return static_cast<const NumberImp *>(this)->NumberImp::toObject(exec);
+ return downcast()->toObject(exec);
+}
+
+bool AllocatedValueImp::getBoolean(bool &booleanValue) const
{
if (!isBoolean())
return false;
@@ -158,7 +135,7 @@
return true;
}
-bool ValueImp::isNumber(double &numericValue) const
+bool AllocatedValueImp::getNumber(double &numericValue) const
{
if (!isNumber())
return false;
@@ -166,261 +143,113 @@
return true;
}
-bool ValueImp::isString(UString &stringValue) const
+double AllocatedValueImp::getNumber() const
{
- if (!isString())
- return false;
- stringValue = static_cast<const StringImp *>(this)->value();
- return true;
-}
-
-UString ValueImp::asString() const
-{
- return isString() ? static_cast<const StringImp *>(this)->value() : UString();
+ return isNumber() ? static_cast<const NumberImp *>(this)->value() : NaN;
}
-bool ValueImp::isObject(ObjectImp *&object)
+bool AllocatedValueImp::getString(UString &stringValue) const
{
- if (!isObject())
+ if (!isString())
return false;
- object = static_cast<ObjectImp *>(this);
+ stringValue = static_cast<const StringImp *>(this)->value();
return true;
}
-// ------------------------------ Value ----------------------------------------
-
-Value::Value(bool b) : rep(b ? BooleanImp::staticTrue : BooleanImp::staticFalse) { }
-
-Value::Value(int i)
- : rep(SimpleNumber::fits(i) ? SimpleNumber::make(i) : new NumberImp(static_cast<double>(i))) { }
-
-Value::Value(unsigned u)
- : rep(SimpleNumber::fits(u) ? SimpleNumber::make(u) : new NumberImp(static_cast<double>(u))) { }
-
-Value::Value(double d)
- : rep(SimpleNumber::fits(d)
- ? SimpleNumber::make(static_cast<long>(d))
- : (KJS::isNaN(d) ? NumberImp::staticNaN : new NumberImp(d)))
-{ }
-
-Value::Value(double d, bool knownToBeInteger)
- : rep((knownToBeInteger ? SimpleNumber::integerFits(d) : SimpleNumber::fits(d))
- ? SimpleNumber::make(static_cast<long>(d))
- : ((!knownToBeInteger && KJS::isNaN(d)) ? NumberImp::staticNaN : new NumberImp(d)))
-{ }
-
-Value::Value(long l)
- : rep(SimpleNumber::fits(l) ? SimpleNumber::make(l) : new NumberImp(static_cast<double>(l))) { }
-
-Value::Value(unsigned long l)
- : rep(SimpleNumber::fits(l) ? SimpleNumber::make(l) : new NumberImp(static_cast<double>(l))) { }
-
-Value::Value(const char *s) : rep(new StringImp(s)) { }
-
-Value::Value(const UString &s) : rep(new StringImp(s)) { }
-
-// ------------------------------ Undefined ------------------------------------
-
-Undefined::Undefined() : Value(UndefinedImp::staticUndefined)
-{
-}
-
-Undefined Undefined::dynamicCast(const Value &v)
-{
- if (v.isNull() || v.type() != UndefinedType)
- return Undefined(0);
-
- return Undefined();
-}
-
-// ------------------------------ Null -----------------------------------------
-
-Null::Null() : Value(NullImp::staticNull)
-{
-}
-
-Null Null::dynamicCast(const Value &v)
-{
- if (v.isNull() || v.type() != NullType)
- return Null(0);
-
- return Null();
-}
-
-// ------------------------------ Boolean --------------------------------------
-
-Boolean::Boolean(bool b)
- : Value(b ? BooleanImp::staticTrue : BooleanImp::staticFalse)
+UString AllocatedValueImp::getString() const
{
+ return isString() ? static_cast<const StringImp *>(this)->value() : UString();
}
-bool Boolean::value() const
-{
- assert(rep);
- return ((BooleanImp*)rep)->value();
-}
-
-Boolean Boolean::dynamicCast(const Value &v)
-{
- if (v.isNull() || v.type() != BooleanType)
- return static_cast<BooleanImp*>(0);
-
- return static_cast<BooleanImp*>(v.imp());
-}
-
-// ------------------------------ String ---------------------------------------
-
-String::String(const UString &s) : Value(new StringImp(s))
-{
-}
-
-UString String::value() const
-{
- assert(rep);
- return ((StringImp*)rep)->value();
-}
-
-String String::dynamicCast(const Value &v)
-{
- if (v.isNull() || v.type() != StringType)
- return String(0);
-
- return String(static_cast<StringImp*>(v.imp()));
-}
-
-// ------------------------------ Number ---------------------------------------
-
-Number::Number(int i)
- : Value(SimpleNumber::fits(i) ? SimpleNumber::make(i) : new NumberImp(static_cast<double>(i))) { }
-
-Number::Number(unsigned int u)
- : Value(SimpleNumber::fits(u) ? SimpleNumber::make(u) : new NumberImp(static_cast<double>(u))) { }
-
-Number::Number(double d)
- : Value(SimpleNumber::fits(d)
- ? SimpleNumber::make(static_cast<long>(d))
- : (KJS::isNaN(d) ? NumberImp::staticNaN : new NumberImp(d)))
-{ }
-
-Number::Number(double d, bool knownToBeInteger)
- : Value((knownToBeInteger ? SimpleNumber::integerFits(d) : SimpleNumber::fits(d))
- ? SimpleNumber::make(static_cast<long>(d))
- : ((!knownToBeInteger && KJS::isNaN(d)) ? NumberImp::staticNaN : new NumberImp(d)))
-{ }
-
-Number::Number(long int l)
- : Value(SimpleNumber::fits(l) ? SimpleNumber::make(l) : new NumberImp(static_cast<double>(l))) { }
-
-Number::Number(long unsigned int l)
- : Value(SimpleNumber::fits(l) ? SimpleNumber::make(l) : new NumberImp(static_cast<double>(l))) { }
-
-Number Number::dynamicCast(const Value &v)
-{
- if (v.isNull() || v.type() != NumberType)
- return Number((NumberImp*)0);
-
- return Number(static_cast<NumberImp*>(v.imp()));
-}
-
-double Number::value() const
-{
- if (SimpleNumber::is(rep))
- return (double)SimpleNumber::value(rep);
- assert(rep);
- return ((NumberImp*)rep)->value();
-}
-
-int Number::intValue() const
-{
- if (SimpleNumber::is(rep))
- return SimpleNumber::value(rep);
- return (int)((NumberImp*)rep)->value();
-}
-
-bool Number::isNaN() const
-{
- return rep == NumberImp::staticNaN;
-}
-
-bool Number::isInf() const
-{
- if (SimpleNumber::is(rep))
- return false;
- return KJS::isInf(((NumberImp*)rep)->value());
-}
-
-ValueImp *undefined()
-{
- return UndefinedImp::staticUndefined;
-}
-
-ValueImp *null()
+ObjectImp *AllocatedValueImp::getObject()
{
- return NullImp::staticNull;
+ return isObject() ? static_cast<ObjectImp *>(this) : 0;
}
-ValueImp *boolean(bool b)
+const ObjectImp *AllocatedValueImp::getObject() const
{
- return b ? BooleanImp::staticTrue : BooleanImp::staticFalse;
+ return isObject() ? static_cast<const ObjectImp *>(this) : 0;
}
-ValueImp *string(const char *s)
+AllocatedValueImp *jsString(const char *s)
{
return new StringImp(s ? s : "");
}
-ValueImp *string(const UString &s)
+AllocatedValueImp *jsString(const UString &s)
{
return s.isNull() ? new StringImp("") : new StringImp(s);
}
-ValueImp *zero()
-{
- return SimpleNumber::make(0);
-}
-
-ValueImp *one()
-{
- return SimpleNumber::make(1);
-}
-
-ValueImp *two()
-{
- return SimpleNumber::make(2);
-}
-
-ValueImp *number(int i)
+ValueImp *jsNumber(int i)
{
return SimpleNumber::fits(i) ? SimpleNumber::make(i) : new NumberImp(static_cast<double>(i));
}
-ValueImp *number(unsigned i)
+ValueImp *jsNumber(unsigned i)
{
return SimpleNumber::fits(i) ? SimpleNumber::make(i) : new NumberImp(static_cast<double>(i));
}
-ValueImp *number(long i)
+ValueImp *jsNumber(long i)
{
return SimpleNumber::fits(i) ? SimpleNumber::make(i) : new NumberImp(static_cast<double>(i));
}
-ValueImp *number(unsigned long i)
+ValueImp *jsNumber(unsigned long i)
{
return SimpleNumber::fits(i) ? SimpleNumber::make(i) : new NumberImp(static_cast<double>(i));
}
-ValueImp *number(double d)
+ValueImp *jsNumber(double d)
{
return SimpleNumber::fits(d)
? SimpleNumber::make(static_cast<long>(d))
- : (isNaN(d) ? NumberImp::staticNaN : new NumberImp(d));
+ : (isNaN(d) ? jsNaN() : new NumberImp(d));
}
-ValueImp *number(double d, bool knownToBeInteger)
+ValueImp *jsNumber(double d, bool knownToBeInteger)
{
return (knownToBeInteger ? SimpleNumber::integerFits(d) : SimpleNumber::fits(d))
? SimpleNumber::make(static_cast<long>(d))
- : ((!knownToBeInteger && isNaN(d)) ? NumberImp::staticNaN : new NumberImp(d));
+ : ((!knownToBeInteger && isNaN(d)) ? jsNaN() : new NumberImp(d));
+}
+
+void ConstantValues::init()
+{
+ undefined = new UndefinedImp();
+ null = new NullImp();
+ jsTrue = new BooleanImp(true);
+ jsFalse = new BooleanImp(false);
+ NaN = new NumberImp(::KJS::NaN);
+}
+
+void ConstantValues::clear()
+{
+ undefined = NULL;
+ null = NULL;
+ jsTrue = NULL;
+ jsFalse = NULL;
+ NaN = NULL;
+}
+
+void ConstantValues::mark()
+{
+ if (AllocatedValueImp *v = undefined)
+ if (!v->marked())
+ v->mark();
+ if (AllocatedValueImp *v = null)
+ if (!v->marked())
+ v->mark();
+ if (AllocatedValueImp *v = jsTrue)
+ if (!v->marked())
+ v->mark();
+ if (AllocatedValueImp *v = jsFalse)
+ if (!v->marked())
+ v->mark();
+ if (AllocatedValueImp *v = NaN)
+ if (!v->marked())
+ v->mark();
}
}
1.33 +353 -403 JavaScriptCore/kjs/value.h
Index: value.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/value.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- value.h 14 Jul 2005 18:27:04 -0000 1.32
+++ value.h 8 Aug 2005 04:07:29 -0000 1.33
@@ -1,9 +1,8 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2001 Harri Porten (porten at kde.org)
* Copyright (C) 2001 Peter Kelly (pmk at post.com)
- * Copyright (C) 2003 Apple Computer, Inc.
+ * Copyright (C) 2003-2005 Apple Computer, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -22,8 +21,8 @@
*
*/
-#ifndef _KJS_VALUE_H_
-#define _KJS_VALUE_H_
+#ifndef KJS_VALUE_H
+#define KJS_VALUE_H
#ifndef NDEBUG // protection against problems if committing with KJS_VERBOSE on
@@ -34,43 +33,21 @@
#endif
-#include <stdlib.h> // Needed for size_t
-
-#include "ustring.h"
-
+#include <assert.h>
+#include <stdlib.h> // for size_t
#include "simple_number.h"
-
-// Primitive data types
+#include "ustring.h"
namespace KJS {
- class Value;
- class ValueImp;
- class ValueImpPrivate;
- class Undefined;
- class UndefinedImp;
- class Null;
- class NullImp;
- class Boolean;
- class BooleanImp;
- class String;
- class StringImp;
- class Number;
- class NumberImp;
- class Object;
- class ObjectImp;
- class Reference;
- class ReferenceImp;
- class List;
- class ListImp;
- class Completion;
- class ExecState;
- class ClassInfo;
-
- /**
- * Primitive types
- */
- enum Type {
+class ClassInfo;
+class ExecState;
+class ObjectImp;
+
+/**
+ * Primitive types
+ */
+enum Type {
UnspecifiedType = 0,
UndefinedType = 1,
NullType = 2,
@@ -78,431 +55,404 @@
StringType = 4,
NumberType = 5,
ObjectType = 6
- };
+};
- /**
- * ValueImp is the base type for all primitives (Undefined, Null, Boolean,
- * String, Number) and objects in ECMAScript.
- *
- * Note: you should never inherit from ValueImp as it is for primitive types
- * only (all of which are provided internally by KJS). Instead, inherit from
- * ObjectImp.
- */
- class ValueImp {
- friend class Collector;
- friend class Value;
- friend class ContextImp;
- friend class FunctionCallNode;
- public:
- ValueImp() : _marked(false) { }
- virtual ~ValueImp() { }
-
- virtual void mark();
- bool marked() const;
- void* operator new(size_t);
- void operator delete(void*);
+/**
+ * ValueImp is the base type for all primitives (Undefined, Null, Boolean,
+ * String, Number) and objects in ECMAScript.
+ *
+ * Note: you should never inherit from ValueImp as it is for primitive types
+ * only (all of which are provided internally by KJS). Instead, inherit from
+ * ObjectImp.
+ */
+class ValueImp {
+ friend class AllocatedValueImp; // so it can derive from this class
+ friend class ProtectedValues; // so it can call downcast()
+
+private:
+ ValueImp();
+ ~ValueImp();
+
+public:
+ // Querying the type.
+ Type type() const;
+ bool isUndefined() const;
+ bool isNull() const;
+ bool isUndefinedOrNull() const;
+ bool isBoolean() const;
+ bool isNumber() const;
+ bool isString() const;
+ bool isObject() const;
+ bool isObject(const ClassInfo *) const;
+
+ // Extracting the value.
+ bool getBoolean(bool&) const;
+ 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
+ ObjectImp *getObject(); // NULL if not an object
+ const ObjectImp *getObject() const; // NULL if not an object
+
+ // Extracting integer values.
+ bool getUInt32(uint32_t&) const;
+
+ // Basic conversions.
+ ValueImp *toPrimitive(ExecState *exec, Type preferredType = UnspecifiedType) const;
+ bool toBoolean(ExecState *exec) const;
+ double toNumber(ExecState *exec) const;
+ double toNumber(ExecState *exec, bool& knownToBeInteger) const;
+ UString toString(ExecState *exec) const;
+ ObjectImp *toObject(ExecState *exec) const;
+ // Integer conversions.
double toInteger(ExecState *exec) const;
int32_t toInt32(ExecState *exec) const;
uint32_t toUInt32(ExecState *exec) const;
uint16_t toUInt16(ExecState *exec) const;
- // Dispatch wrappers that handle the special small number case
-
- Type dispatchType() const;
- Value dispatchToPrimitive(ExecState *exec, Type preferredType = UnspecifiedType) const;
- bool dispatchToBoolean(ExecState *exec) const;
- double dispatchToNumber(ExecState *exec) const;
- double dispatchToNumber(ExecState *exec, bool &knownToBeInteger) const;
- UString dispatchToString(ExecState *exec) const;
- bool dispatchToUInt32(uint32_t&) const;
- Object dispatchToObject(ExecState *exec) const;
-
- bool isUndefined() const { return dispatchType() == UndefinedType; }
- bool isNull() const { return dispatchType() == NullType; }
- bool isUndefinedOrNull() const;
-
- bool isBoolean() const { return dispatchType() == BooleanType; }
- bool isBoolean(bool &booleanValue) const;
+ // Garbage collection.
+ void mark();
+ bool marked() const;
- bool isNumber() const { return dispatchType() == NumberType; }
- bool isNumber(double &numericValue) const;
+private:
+ // Implementation details.
+ AllocatedValueImp *downcast();
+ const AllocatedValueImp *downcast() const;
- bool isString() const { return dispatchType() == StringType; }
- bool isString(UString &stringValue) const;
- UString asString() const; // null string if not a string
-
- bool isObject() const { return dispatchType() == ObjectType; }
- bool isObject(ObjectImp *&object);
- ObjectImp *asObject(); // 0 if not an object
- bool isObject(const ClassInfo *) const; // combine an isObject check with an inherits check
+ // Give a compile time error if we try to copy one of these.
+ ValueImp(const ValueImp&);
+ ValueImp& operator=(const ValueImp&);
+};
- private:
+class AllocatedValueImp : public ValueImp {
+ friend class Collector;
+ friend class UndefinedImp;
+ friend class NullImp;
+ friend class BooleanImp;
+ friend class NumberImp;
+ friend class StringImp;
+ friend class ObjectImp;
+private:
+ AllocatedValueImp();
+ virtual ~AllocatedValueImp();
+public:
+ // Querying the type.
virtual Type type() const = 0;
+ bool isBoolean() const;
+ bool isNumber() const;
+ bool isString() const;
+ bool isObject() const;
+ bool isObject(const ClassInfo *) const;
+
+ // Extracting the value.
+ bool getBoolean(bool&) const;
+ 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
+ ObjectImp *getObject(); // NULL if not an object
+ const ObjectImp *getObject() const; // NULL if not an object
- // The conversion operations
+ // Extracting integer values.
+ virtual bool getUInt32(uint32_t&) const;
- virtual Value toPrimitive(ExecState *exec, Type preferredType = UnspecifiedType) const = 0;
+ // Basic conversions.
+ virtual ValueImp *toPrimitive(ExecState *exec, Type preferredType = UnspecifiedType) const = 0;
virtual bool toBoolean(ExecState *exec) const = 0;
virtual double toNumber(ExecState *exec) const = 0;
+ double toNumber(ExecState *exec, bool& knownToBeInteger) const;
virtual UString toString(ExecState *exec) const = 0;
- virtual Object toObject(ExecState *exec) const = 0;
- virtual bool toUInt32(unsigned&) const;
+ virtual ObjectImp *toObject(ExecState *exec) const = 0;
- bool _marked;
+ // Garbage collection.
+ void *operator new(size_t);
+ virtual void mark();
+ bool marked() const;
- // Give a compile time error if we try to copy one of these.
- ValueImp(const ValueImp&);
- ValueImp& operator=(const ValueImp&);
- };
-
- ValueImp *undefined();
- ValueImp *null();
-
- ValueImp *boolean(bool = false);
-
- ValueImp *string(const char * = ""); // returns empty string if passed 0
- ValueImp *string(const UString &); // returns empty string if passed null string
-
- ValueImp *zero();
- ValueImp *one();
- ValueImp *two();
- ValueImp *number(int);
- ValueImp *number(unsigned);
- ValueImp *number(long);
- ValueImp *number(unsigned long);
- ValueImp *number(double);
- ValueImp *number(double, bool knownToBeInteger);
-
- /**
- * FIXME: Now that we have conservative GC, we will be deprecating the
- * Value wrappers and programming in terms of the ValueImp objects.
- * Eventually we will remove Value and rename ValueImp to Value.
- * We'll need to move the comments from Value to ValueImp too.
- */
- /**
- * Value objects are act as wrappers ("smart pointers") around ValueImp
- * objects and their descendents. Instead of using ValueImps
- * (and derivatives) during normal program execution, you should use a
- * Value-derived class.
- *
- * Value maintains a pointer to a ValueImp object and uses a reference
- * counting scheme to ensure that the ValueImp object is not deleted or
- * garbage collected.
- *
- * Note: The conversion operations all return values of various types -
- * if an error occurs during conversion, an error object will instead
- * be returned (where possible), and the execution state's exception
- * will be set appropriately.
- */
- class Value {
- public:
- Value() : rep(0) { }
- Value(ValueImp *v) : rep(v) { }
- operator ValueImp *() const { return rep; }
-
- explicit Value(bool);
-
- explicit Value(int);
- explicit Value(unsigned);
- explicit Value(double);
- explicit Value(long);
- explicit Value(unsigned long);
- Value(double, bool knownToBeInteger);
-
- explicit Value(const char *);
- Value(const UString &);
-
- /**
- * Returns whether or not this is a valid value. An invalid value
- * has a 0 implementation pointer and should not be used for
- * any other operation than this check. Current use: as a
- * distinct return value signalling failing dynamicCast() calls.
- */
- bool isValid() const { return rep != 0; }
- /**
- * @deprecated
- * Use !isValid() instead.
- */
- bool isNull() const { return rep == 0; }
- ValueImp *imp() const { return rep; }
-
- /**
- * Returns the type of value. This is one of UndefinedType, NullType,
- * BooleanType, StringType, NumberType, or ObjectType.
- *
- * @return The type of value
- */
- Type type() const { return rep->dispatchType(); }
-
- /**
- * Checks whether or not the value is of a particular tpye
- *
- * @param t The type to compare with
- * @return true if the value is of the specified type, otherwise false
- */
- bool isA(Type t) const { return rep->dispatchType() == t; }
-
- /**
- * Performs the ToPrimitive type conversion operation on this value
- * (ECMA 9.1)
- */
- Value toPrimitive(ExecState *exec,
- Type preferredType = UnspecifiedType) const
- { return rep->dispatchToPrimitive(exec, preferredType); }
-
- /**
- * Performs the ToBoolean type conversion operation on this value (ECMA 9.2)
- */
- bool toBoolean(ExecState *exec) const { return rep->dispatchToBoolean(exec); }
-
- /**
- * Performs the ToNumber type conversion operation on this value (ECMA 9.3)
- */
- double toNumber(ExecState *exec) const { return rep->dispatchToNumber(exec); }
- double toNumber(ExecState *exec, bool &knownToBeInteger) const { return rep->dispatchToNumber(exec, knownToBeInteger); }
-
- /**
- * Performs the ToInteger type conversion operation on this value (ECMA 9.4)
- */
- double toInteger(ExecState *exec) const { return rep->toInteger(exec); }
-
- /**
- * Performs the ToInt32 type conversion operation on this value (ECMA 9.5)
- */
- int32_t toInt32(ExecState *exec) const { return rep->toInt32(exec); }
-
- /**
- * Performs the ToUint32 type conversion operation on this value (ECMA 9.6)
- */
- uint32_t toUInt32(ExecState *exec) const { return rep->toUInt32(exec); }
-
- /**
- * Performs the ToUint16 type conversion operation on this value (ECMA 9.7)
- */
- uint16_t toUInt16(ExecState *exec) const { return rep->toUInt16(exec); }
-
- /**
- * Performs the ToString type conversion operation on this value (ECMA 9.8)
- */
- UString toString(ExecState *exec) const { return rep->dispatchToString(exec); }
-
- /**
- * Performs the ToObject type conversion operation on this value (ECMA 9.9)
- */
- Object toObject(ExecState *exec) const;
-
- /**
- * Checks if we can do a lossless conversion to UInt32.
- */
- bool toUInt32(uint32_t& i) const { return rep->dispatchToUInt32(i); }
-
- protected:
- ValueImp *rep;
- };
-
- // Primitive types
-
- /**
- * Represents an primitive Undefined value. All instances of this class
- * share the same implementation object, so == will always return true
- * for any comparison between two Undefined objects.
- */
- class Undefined : public Value {
- public:
- Undefined();
-
- /**
- * Converts a Value into an Undefined. If the value's type is not
- * UndefinedType, a null object will be returned (i.e. one with it's
- * internal pointer set to 0). If you do not know for sure whether the
- * value is of type UndefinedType, you should check the isValid()
- * methods afterwards before calling any methods on the returned value.
- *
- * @return The value converted to an Undefined
- */
- static Undefined dynamicCast(const Value &v);
- private:
- friend class UndefinedImp;
- explicit Undefined(UndefinedImp *v);
+private:
+ bool m_marked;
+};
+
+AllocatedValueImp *jsUndefined();
+AllocatedValueImp *jsNull();
+
+AllocatedValueImp *jsBoolean(bool = false);
+
+ValueImp *jsNumber(double);
+ValueImp *jsNumber(double, bool knownToBeInteger);
+AllocatedValueImp *jsNaN();
+ValueImp *jsZero();
+ValueImp *jsOne();
+ValueImp *jsTwo();
+ValueImp *jsNumber(int);
+ValueImp *jsNumber(unsigned);
+ValueImp *jsNumber(long);
+ValueImp *jsNumber(unsigned long);
+
+AllocatedValueImp *jsString(const UString &); // returns empty string if passed null string
+AllocatedValueImp *jsString(const char * = ""); // returns empty string if passed 0
+
+extern const double NaN;
+extern const double Inf;
+
+class ConstantValues {
+public:
+ static AllocatedValueImp *undefined;
+ static AllocatedValueImp *null;
+ static AllocatedValueImp *jsFalse;
+ static AllocatedValueImp *jsTrue;
+ static AllocatedValueImp *NaN;
+
+ static void init();
+ static void clear();
+ static void mark();
+};
- };
+inline AllocatedValueImp *jsUndefined()
+{
+ return ConstantValues::undefined;
+}
- /**
- * Represents an primitive Null value. All instances of this class
- * share the same implementation object, so == will always return true
- * for any comparison between two Null objects.
- */
- class Null : public Value {
- public:
- Null();
-
- /**
- * Converts a Value into an Null. If the value's type is not NullType,
- * a null object will be returned (i.e. one with it's internal pointer set
- * to 0). If you do not know for sure whether the value is of type
- * NullType, you should check the isValid() methods afterwards before
- * calling any methods on the returned value.
- *
- * @return The value converted to a Null
- */
- static Null dynamicCast(const Value &v);
- private:
- friend class NullImp;
- explicit Null(NullImp *v);
- };
+inline AllocatedValueImp *jsNull()
+{
+ return ConstantValues::null;
+}
- /**
- * Represents an primitive Boolean value
- */
- class Boolean : public Value {
- public:
- Boolean(bool b = false);
-
- /**
- * Converts a Value into an Boolean. If the value's type is not BooleanType,
- * a null object will be returned (i.e. one with it's internal pointer set
- * to 0). If you do not know for sure whether the value is of type
- * BooleanType, you should check the isValid() methods afterwards before
- * calling any methods on the returned value.
- *
- * @return The value converted to a Boolean
- */
- static Boolean dynamicCast(const Value &v);
+inline AllocatedValueImp *jsBoolean(bool b)
+{
+ return b ? ConstantValues::jsTrue : ConstantValues::jsFalse;
+}
- bool value() const;
- private:
- friend class BooleanImp;
- explicit Boolean(BooleanImp *v);
- };
+inline AllocatedValueImp *jsNaN()
+{
+ return ConstantValues::NaN;
+}
- /**
- * Represents an primitive String value
- */
- class String : public Value {
- public:
- String(const UString &s = "");
-
- /**
- * Converts a Value into an String. If the value's type is not StringType,
- * a null object will be returned (i.e. one with it's internal pointer set
- * to 0). If you do not know for sure whether the value is of type
- * StringType, you should check the isValid() methods afterwards before
- * calling any methods on the returned value.
- *
- * @return The value converted to a String
- */
- static String dynamicCast(const Value &v);
+inline ValueImp::ValueImp()
+{
+}
- UString value() const;
- private:
- friend class StringImp;
- explicit String(StringImp *v);
- };
+inline ValueImp::~ValueImp()
+{
+}
- extern const double NaN;
- extern const double Inf;
+inline AllocatedValueImp::AllocatedValueImp()
+ : m_marked(false)
+{
+}
- /**
- * Represents an primitive Number value
- */
- class Number : public Value {
- friend class ValueImp;
- public:
- Number(int i);
- Number(unsigned int u);
- Number(double d = 0.0);
- Number(long int l);
- Number(long unsigned int l);
- Number(double d, bool knownToBeInteger);
-
- double value() const;
- int intValue() const;
-
- bool isNaN() const;
- bool isInf() const;
-
- /**
- * Converts a Value into an Number. If the value's type is not NumberType,
- * a null object will be returned (i.e. one with it's internal pointer set
- * to 0). If you do not know for sure whether the value is of type
- * NumberType, you should check the isNull() methods afterwards before
- * calling any methods on the returned value.
- *
- * @return The value converted to a Number
- */
- static Number dynamicCast(const Value &v);
- private:
- friend class NumberImp;
- explicit Number(NumberImp *v);
- };
+inline AllocatedValueImp::~AllocatedValueImp()
+{
+}
-inline bool ValueImp::marked() const
+inline bool AllocatedValueImp::isBoolean() const
{
- // Simple numbers are always considered marked.
- return SimpleNumber::is(this) || _marked;
+ return type() == BooleanType;
}
-// Dispatchers for virtual functions, to special-case simple numbers which
-// won't be real pointers.
+inline bool AllocatedValueImp::isNumber() const
+{
+ return type() == NumberType;
+}
-inline Type ValueImp::dispatchType() const
+inline bool AllocatedValueImp::isString() const
{
- if (SimpleNumber::is(this))
- return NumberType;
- return type();
+ return type() == StringType;
}
-inline Value ValueImp::dispatchToPrimitive(ExecState *exec, Type preferredType) const
+inline bool AllocatedValueImp::isObject() const
{
- if (SimpleNumber::is(this))
- return Value(const_cast<ValueImp *>(this));
- return toPrimitive(exec, preferredType);
+ return type() == ObjectType;
}
-inline bool ValueImp::dispatchToBoolean(ExecState *exec) const
+inline bool AllocatedValueImp::marked() const
{
- if (SimpleNumber::is(this))
- return SimpleNumber::value(this);
- return toBoolean(exec);
+ return m_marked;
}
-inline double ValueImp::dispatchToNumber(ExecState *exec) const
+inline void AllocatedValueImp::mark()
{
- if (SimpleNumber::is(this))
- return SimpleNumber::value(this);
- return toNumber(exec);
+ m_marked = true;
+}
+
+inline AllocatedValueImp *ValueImp::downcast()
+{
+ assert(!SimpleNumber::is(this));
+ return static_cast<AllocatedValueImp *>(this);
+}
+
+inline const AllocatedValueImp *ValueImp::downcast() const
+{
+ assert(!SimpleNumber::is(this));
+ return static_cast<const AllocatedValueImp *>(this);
+}
+
+inline bool ValueImp::isUndefined() const
+{
+ return this == jsUndefined();
+}
+
+inline bool ValueImp::isNull() const
+{
+ return this == jsNull();
}
-inline double ValueImp::dispatchToNumber(ExecState *exec, bool &knownToBeInteger) const
+inline bool ValueImp::isUndefinedOrNull() const
+{
+ return this == jsUndefined() || this == jsNull();
+}
+
+inline bool ValueImp::isBoolean() const
+{
+ return !SimpleNumber::is(this) && downcast()->isBoolean();
+}
+
+inline bool ValueImp::isNumber() const
+{
+ return SimpleNumber::is(this) || downcast()->isNumber();
+}
+
+inline bool ValueImp::isString() const
+{
+ return !SimpleNumber::is(this) && downcast()->isString();
+}
+
+inline bool ValueImp::isObject() const
+{
+ return !SimpleNumber::is(this) && downcast()->isObject();
+}
+
+inline bool ValueImp::isObject(const ClassInfo *c) const
+{
+ return !SimpleNumber::is(this) && downcast()->isObject(c);
+}
+
+inline bool ValueImp::getBoolean(bool& v) const
+{
+ return !SimpleNumber::is(this) && downcast()->getBoolean(v);
+}
+
+inline bool ValueImp::getNumber(double& v) const
{
if (SimpleNumber::is(this)) {
- knownToBeInteger = true;
- return SimpleNumber::value(this);
+ v = SimpleNumber::value(this);
+ return true;
}
- knownToBeInteger = false;
- return toNumber(exec);
+ return downcast()->getNumber(v);
+}
+
+inline double ValueImp::getNumber() const
+{
+ return SimpleNumber::is(this) ? SimpleNumber::value(this) : downcast()->getNumber();
+}
+
+inline bool ValueImp::getString(UString& s) const
+{
+ return !SimpleNumber::is(this) && downcast()->getString(s);
+}
+
+inline UString ValueImp::getString() const
+{
+ return SimpleNumber::is(this) ? UString() : downcast()->getString();
+}
+
+inline ObjectImp *ValueImp::getObject()
+{
+ return SimpleNumber::is(this) ? 0 : downcast()->getObject();
}
-inline UString ValueImp::dispatchToString(ExecState *exec) const
+inline const ObjectImp *ValueImp::getObject() const
{
- if (SimpleNumber::is(this))
- return UString::from(SimpleNumber::value(this));
- return toString(exec);
+ return SimpleNumber::is(this) ? 0 : downcast()->getObject();
}
-inline bool ValueImp::dispatchToUInt32(uint32_t& result) const
+inline bool ValueImp::getUInt32(uint32_t& v) const
{
if (SimpleNumber::is(this)) {
long i = SimpleNumber::value(this);
if (i < 0)
return false;
- result = i;
+ v = i;
return true;
}
- return toUInt32(result);
+ return downcast()->getUInt32(v);
+}
+
+inline void ValueImp::mark()
+{
+ if (!SimpleNumber::is(this))
+ downcast()->mark();
+}
+
+inline bool ValueImp::marked() const
+{
+ return SimpleNumber::is(this) || downcast()->marked();
+}
+
+inline Type ValueImp::type() const
+{
+ return SimpleNumber::is(this) ? NumberType : downcast()->type();
+}
+
+inline ValueImp *ValueImp::toPrimitive(ExecState *exec, Type preferredType) const
+{
+ return SimpleNumber::is(this) ? const_cast<ValueImp *>(this) : downcast()->toPrimitive(exec, preferredType);
+}
+
+inline bool ValueImp::toBoolean(ExecState *exec) const
+{
+ return SimpleNumber::is(this) ? SimpleNumber::value(this) : downcast()->toBoolean(exec);
+}
+
+inline double ValueImp::toNumber(ExecState *exec) const
+{
+ return SimpleNumber::is(this) ? SimpleNumber::value(this) : downcast()->toNumber(exec);
+}
+
+inline double ValueImp::toNumber(ExecState *exec, bool& knownToBeInteger) const
+{
+ if (SimpleNumber::is(this)) {
+ knownToBeInteger = true;
+ return SimpleNumber::value(this);
+ }
+ knownToBeInteger = false;
+ return downcast()->toNumber(exec);
+}
+
+inline UString ValueImp::toString(ExecState *exec) const
+{
+ return SimpleNumber::is(this) ? UString::from(SimpleNumber::value(this)) : downcast()->toString(exec);
+}
+
+inline ValueImp *jsZero()
+{
+ return SimpleNumber::make(0);
}
+inline ValueImp *jsOne()
+{
+ return SimpleNumber::make(1);
+}
+
+inline ValueImp *jsTwo()
+{
+ return SimpleNumber::make(2);
+}
+
+// compatibility names so we don't have to change so much code
+
+inline AllocatedValueImp *Undefined() { return jsUndefined(); }
+inline AllocatedValueImp *Null() { return jsNull(); }
+inline AllocatedValueImp *Boolean(bool b) { return jsBoolean(b); }
+inline ValueImp *Number(double n) { return jsNumber(n); }
+inline ValueImp *Number(int n) { return jsNumber(n); }
+inline ValueImp *Number(unsigned n) { return jsNumber(n); }
+inline ValueImp *Number(long n) { return jsNumber(n); }
+inline ValueImp *Number(unsigned long n) { return jsNumber(n); }
+inline AllocatedValueImp *String(const UString& s) { return jsString(s); }
+inline AllocatedValueImp *String(const char *s) { return jsString(s); }
+
} // namespace
-#endif // _KJS_VALUE_H_
+#endif // KJS_VALUE_H
1.4540 +428 -0 WebCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebCore/ChangeLog,v
retrieving revision 1.4539
retrieving revision 1.4540
diff -u -r1.4539 -r1.4540
--- ChangeLog 7 Aug 2005 20:21:06 -0000 1.4539
+++ ChangeLog 8 Aug 2005 04:07:36 -0000 1.4540
@@ -1,3 +1,431 @@
+2005-08-07 Darin Adler <darin at apple.com>
+
+ Rubber stamped by Maciej.
+
+ - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4313
+ eliminate KJS::Value and KJS::Object smart pointer wrappers (for simplicity and speed)
+
+ * khtml/ecma/domparser.cpp:
+ (KJS::DOMParserConstructorImp::construct):
+ (KJS::DOMParserProtoFunc::callAsFunction):
+ * khtml/ecma/domparser.h:
+ * khtml/ecma/kjs_binding.cpp:
+ (KJS::ScriptInterpreter::ScriptInterpreter):
+ (KJS::ScriptInterpreter::isGlobalObject):
+ (KJS::ScriptInterpreter::createLanguageInstanceForValue):
+ (KJS::getStringOrNull):
+ (KJS::ValueToVariant):
+ (KJS::setDOMException):
+ * khtml/ecma/kjs_binding.h:
+ (KJS::DOMFunction::toPrimitive):
+ (KJS::cacheDOMObject):
+ * khtml/ecma/kjs_css.cpp:
+ (KJS::DOMCSSStyleDeclaration::indexGetter):
+ (KJS::DOMCSSStyleDeclaration::cssPropertyGetter):
+ (KJS::DOMCSSStyleDeclaration::getValueProperty):
+ (KJS::DOMCSSStyleDeclaration::put):
+ (KJS::DOMCSSStyleDeclarationProtoFunc::callAsFunction):
+ (KJS::DOMStyleSheet::getValueProperty):
+ (KJS::DOMStyleSheet::put):
+ (KJS::DOMStyleSheetList::getValueProperty):
+ (KJS::DOMStyleSheetList::indexGetter):
+ (KJS::DOMStyleSheetList::nameGetter):
+ (KJS::DOMStyleSheetListFunc::callAsFunction):
+ (KJS::DOMMediaList::getValueProperty):
+ (KJS::DOMMediaList::indexGetter):
+ (KJS::DOMMediaList::put):
+ (KJS::KJS::DOMMediaListProtoFunc::callAsFunction):
+ (KJS::DOMCSSStyleSheet::getValueProperty):
+ (KJS::DOMCSSStyleSheetProtoFunc::callAsFunction):
+ (KJS::DOMCSSRuleList::getValueProperty):
+ (KJS::DOMCSSRuleList::indexGetter):
+ (KJS::DOMCSSRuleListFunc::callAsFunction):
+ (KJS::DOMCSSRule::getValueProperty):
+ (KJS::DOMCSSRule::put):
+ (KJS::DOMCSSRule::putValueProperty):
+ (KJS::DOMCSSRuleFunc::callAsFunction):
+ (KJS::CSSRuleConstructor::getValueProperty):
+ (KJS::getCSSRuleConstructor):
+ (KJS::DOMCSSValue::getValueProperty):
+ (KJS::DOMCSSValue::put):
+ (KJS::getDOMCSSValue):
+ (KJS::CSSValueConstructor::getValueProperty):
+ (KJS::getCSSValueConstructor):
+ (KJS::DOMCSSPrimitiveValue::getValueProperty):
+ (KJS::DOMCSSPrimitiveValueProtoFunc::callAsFunction):
+ (KJS::CSSPrimitiveValueConstructor::getValueProperty):
+ (KJS::getCSSPrimitiveValueConstructor):
+ (KJS::DOMCSSValueList::getValueProperty):
+ (KJS::DOMCSSValueList::indexGetter):
+ (KJS::DOMCSSValueListFunc::callAsFunction):
+ (KJS::DOMRGBColor::getValueProperty):
+ (KJS::DOMRect::getValueProperty):
+ (KJS::DOMCounter::getValueProperty):
+ * khtml/ecma/kjs_css.h:
+ * khtml/ecma/kjs_dom.cpp:
+ (KJS::DOMNode::getValueProperty):
+ (KJS::DOMNode::put):
+ (KJS::DOMNode::putValueProperty):
+ (KJS::DOMNode::toPrimitive):
+ (KJS::DOMNode::getListener):
+ (KJS::DOMNodeProtoFunc::callAsFunction):
+ (KJS::DOMNodeList::toPrimitive):
+ (KJS::DOMNodeList::getValueProperty):
+ (KJS::DOMNodeList::indexGetter):
+ (KJS::DOMNodeList::nameGetter):
+ (KJS::DOMNodeList::callAsFunction):
+ (KJS::DOMNodeListFunc::DOMNodeListFunc):
+ (KJS::DOMNodeListFunc::callAsFunction):
+ (KJS::DOMAttr::getValueProperty):
+ (KJS::DOMAttr::put):
+ (KJS::DOMAttr::putValueProperty):
+ (KJS::DOMDocument::getValueProperty):
+ (KJS::DOMDocument::put):
+ (KJS::DOMDocument::putValueProperty):
+ (KJS::DOMDocumentProtoFunc::callAsFunction):
+ (KJS::DOMElement::getValueProperty):
+ (KJS::DOMElement::attributeGetter):
+ (KJS::DOMElement::getOwnPropertySlot):
+ (KJS::DOMElementProtoFunc::callAsFunction):
+ (KJS::DOMDOMImplementationProtoFunc::callAsFunction):
+ (KJS::DOMDocumentType::getValueProperty):
+ (KJS::DOMNamedNodeMap::lengthGetter):
+ (KJS::DOMNamedNodeMap::indexGetter):
+ (KJS::DOMNamedNodeMapProtoFunc::callAsFunction):
+ (KJS::DOMProcessingInstruction::getValueProperty):
+ (KJS::DOMProcessingInstruction::put):
+ (KJS::DOMNotation::getValueProperty):
+ (KJS::DOMEntity::getValueProperty):
+ (KJS::NodeConstructor::getValueProperty):
+ (KJS::DOMExceptionConstructor::getValueProperty):
+ (KJS::DOMNamedNodesCollection::lengthGetter):
+ (KJS::DOMNamedNodesCollection::indexGetter):
+ (KJS::DOMCharacterData::getValueProperty):
+ (KJS::DOMCharacterData::put):
+ (KJS::DOMCharacterDataProtoFunc::callAsFunction):
+ (KJS::DOMTextProtoFunc::callAsFunction):
+ * khtml/ecma/kjs_dom.h:
+ * khtml/ecma/kjs_events.cpp:
+ (KJS::JSAbstractEventListener::handleEvent):
+ (KJS::JSUnprotectedEventListener::JSUnprotectedEventListener):
+ (KJS::JSUnprotectedEventListener::~JSUnprotectedEventListener):
+ (KJS::JSUnprotectedEventListener::listenerObj):
+ (KJS::JSUnprotectedEventListener::windowObj):
+ (KJS::JSUnprotectedEventListener::mark):
+ (KJS::JSEventListener::JSEventListener):
+ (KJS::JSEventListener::~JSEventListener):
+ (KJS::JSEventListener::listenerObj):
+ (KJS::JSEventListener::windowObj):
+ (KJS::JSLazyEventListener::JSLazyEventListener):
+ (KJS::JSLazyEventListener::handleEvent):
+ (KJS::JSLazyEventListener::listenerObj):
+ (KJS::JSLazyEventListener::parseCode):
+ (KJS::getNodeEventListener):
+ (KJS::EventConstructor::getValueProperty):
+ (KJS::getEventConstructor):
+ (KJS::DOMEvent::getValueProperty):
+ (KJS::DOMEvent::put):
+ (KJS::DOMEvent::putValueProperty):
+ (KJS::DOMEventProtoFunc::callAsFunction):
+ (KJS::getDOMEvent):
+ (KJS::EventExceptionConstructor::getValueProperty):
+ (KJS::getEventExceptionConstructor):
+ (KJS::DOMUIEvent::getValueProperty):
+ (KJS::DOMUIEventProtoFunc::callAsFunction):
+ (KJS::DOMMouseEvent::getValueProperty):
+ (KJS::DOMMouseEventProtoFunc::callAsFunction):
+ (KJS::DOMKeyboardEvent::getValueProperty):
+ (KJS::DOMKeyboardEventProtoFunc::callAsFunction):
+ (KJS::MutationEventConstructor::getValueProperty):
+ (KJS::getMutationEventConstructor):
+ (KJS::DOMMutationEvent::getValueProperty):
+ (KJS::DOMMutationEventProtoFunc::callAsFunction):
+ (KJS::DOMWheelEvent::getValueProperty):
+ (KJS::DOMWheelEventProtoFunc::callAsFunction):
+ (KJS::stringOrUndefined):
+ (KJS::Clipboard::getValueProperty):
+ (KJS::Clipboard::put):
+ (KJS::Clipboard::putValueProperty):
+ (KJS::ClipboardProtoFunc::callAsFunction):
+ * khtml/ecma/kjs_events.h:
+ (KJS::JSAbstractEventListener::listenerObjImp):
+ * khtml/ecma/kjs_html.cpp:
+ (KJS::KJS::HTMLDocFunction::callAsFunction):
+ (KJS::HTMLDocument::namedItemGetter):
+ (KJS::HTMLDocument::getValueProperty):
+ (KJS::KJS::HTMLDocument::put):
+ (KJS::KJS::HTMLDocument::putValueProperty):
+ (KJS::HTMLElement::formIndexGetter):
+ (KJS::HTMLElement::formNameGetter):
+ (KJS::HTMLElement::selectIndexGetter):
+ (KJS::HTMLElement::framesetNameGetter):
+ (KJS::HTMLElement::frameWindowPropertyGetter):
+ (KJS::HTMLElement::runtimeObjectGetter):
+ (KJS::HTMLElement::runtimeObjectPropertyGetter):
+ (KJS::HTMLElement::getOwnPropertySlot):
+ (KJS::KJS::HTMLElement::implementsCall):
+ (KJS::KJS::HTMLElement::callAsFunction):
+ (KJS::HTMLElement::htmlGetter):
+ (KJS::HTMLElement::headGetter):
+ (KJS::HTMLElement::linkGetter):
+ (KJS::HTMLElement::titleGetter):
+ (KJS::HTMLElement::metaGetter):
+ (KJS::HTMLElement::baseGetter):
+ (KJS::HTMLElement::isIndexGetter):
+ (KJS::HTMLElement::styleGetter):
+ (KJS::HTMLElement::bodyGetter):
+ (KJS::HTMLElement::formGetter):
+ (KJS::HTMLElement::selectGetter):
+ (KJS::HTMLElement::optGroupGetter):
+ (KJS::HTMLElement::optionGetter):
+ (KJS::getInputSelectionStart):
+ (KJS::getInputSelectionEnd):
+ (KJS::HTMLElement::inputGetter):
+ (KJS::HTMLElement::textAreaGetter):
+ (KJS::HTMLElement::buttonGetter):
+ (KJS::HTMLElement::labelGetter):
+ (KJS::HTMLElement::fieldSetGetter):
+ (KJS::HTMLElement::legendGetter):
+ (KJS::HTMLElement::uListGetter):
+ (KJS::HTMLElement::oListGetter):
+ (KJS::HTMLElement::dListGetter):
+ (KJS::HTMLElement::dirGetter):
+ (KJS::HTMLElement::menuGetter):
+ (KJS::HTMLElement::liGetter):
+ (KJS::HTMLElement::divGetter):
+ (KJS::HTMLElement::paragraphGetter):
+ (KJS::HTMLElement::headingGetter):
+ (KJS::HTMLElement::blockQuoteGetter):
+ (KJS::HTMLElement::quoteGetter):
+ (KJS::HTMLElement::preGetter):
+ (KJS::HTMLElement::brGetter):
+ (KJS::HTMLElement::baseFontGetter):
+ (KJS::HTMLElement::fontGetter):
+ (KJS::HTMLElement::hrGetter):
+ (KJS::HTMLElement::modGetter):
+ (KJS::HTMLElement::anchorGetter):
+ (KJS::HTMLElement::imageGetter):
+ (KJS::HTMLElement::objectGetter):
+ (KJS::HTMLElement::paramGetter):
+ (KJS::HTMLElement::appletGetter):
+ (KJS::HTMLElement::mapGetter):
+ (KJS::HTMLElement::areaGetter):
+ (KJS::HTMLElement::scriptGetter):
+ (KJS::HTMLElement::tableGetter):
+ (KJS::HTMLElement::tableCaptionGetter):
+ (KJS::HTMLElement::tableColGetter):
+ (KJS::HTMLElement::tableSectionGetter):
+ (KJS::HTMLElement::tableRowGetter):
+ (KJS::HTMLElement::tableCellGetter):
+ (KJS::HTMLElement::frameSetGetter):
+ (KJS::HTMLElement::frameGetter):
+ (KJS::HTMLElement::iFrameGetter):
+ (KJS::HTMLElement::marqueeGetter):
+ (KJS::HTMLElement::getValueProperty):
+ (KJS::HTMLElementFunction::HTMLElementFunction):
+ (KJS::KJS::HTMLElementFunction::callAsFunction):
+ (KJS::KJS::HTMLElement::put):
+ (KJS::HTMLElement::htmlSetter):
+ (KJS::HTMLElement::headSetter):
+ (KJS::HTMLElement::linkSetter):
+ (KJS::HTMLElement::titleSetter):
+ (KJS::HTMLElement::metaSetter):
+ (KJS::HTMLElement::baseSetter):
+ (KJS::HTMLElement::isIndexSetter):
+ (KJS::HTMLElement::styleSetter):
+ (KJS::HTMLElement::bodySetter):
+ (KJS::HTMLElement::formSetter):
+ (KJS::HTMLElement::selectSetter):
+ (KJS::HTMLElement::optGroupSetter):
+ (KJS::HTMLElement::optionSetter):
+ (KJS::HTMLElement::inputSetter):
+ (KJS::HTMLElement::textAreaSetter):
+ (KJS::HTMLElement::buttonSetter):
+ (KJS::HTMLElement::labelSetter):
+ (KJS::HTMLElement::fieldSetSetter):
+ (KJS::HTMLElement::legendSetter):
+ (KJS::HTMLElement::uListSetter):
+ (KJS::HTMLElement::oListSetter):
+ (KJS::HTMLElement::dListSetter):
+ (KJS::HTMLElement::dirSetter):
+ (KJS::HTMLElement::menuSetter):
+ (KJS::HTMLElement::liSetter):
+ (KJS::HTMLElement::divSetter):
+ (KJS::HTMLElement::paragraphSetter):
+ (KJS::HTMLElement::headingSetter):
+ (KJS::HTMLElement::blockQuoteSetter):
+ (KJS::HTMLElement::quoteSetter):
+ (KJS::HTMLElement::preSetter):
+ (KJS::HTMLElement::brSetter):
+ (KJS::HTMLElement::baseFontSetter):
+ (KJS::HTMLElement::fontSetter):
+ (KJS::HTMLElement::hrSetter):
+ (KJS::HTMLElement::modSetter):
+ (KJS::HTMLElement::anchorSetter):
+ (KJS::HTMLElement::imageSetter):
+ (KJS::HTMLElement::objectSetter):
+ (KJS::HTMLElement::paramSetter):
+ (KJS::HTMLElement::appletSetter):
+ (KJS::HTMLElement::mapSetter):
+ (KJS::HTMLElement::areaSetter):
+ (KJS::HTMLElement::scriptSetter):
+ (KJS::HTMLElement::tableSetter):
+ (KJS::HTMLElement::tableCaptionSetter):
+ (KJS::HTMLElement::tableColSetter):
+ (KJS::HTMLElement::tableSectionSetter):
+ (KJS::HTMLElement::tableRowSetter):
+ (KJS::HTMLElement::tableCellSetter):
+ (KJS::HTMLElement::frameSetSetter):
+ (KJS::HTMLElement::frameSetter):
+ (KJS::HTMLElement::iFrameSetter):
+ (KJS::HTMLElement::marqueeSetter):
+ (KJS::HTMLElement::putValueProperty):
+ (KJS::HTMLCollection::lengthGetter):
+ (KJS::HTMLCollection::indexGetter):
+ (KJS::HTMLCollection::nameGetter):
+ (KJS::HTMLCollection::getOwnPropertySlot):
+ (KJS::KJS::HTMLCollection::callAsFunction):
+ (KJS::KJS::HTMLCollection::getNamedItems):
+ (KJS::KJS::HTMLCollectionProtoFunc::callAsFunction):
+ (KJS::HTMLSelectCollection::selectedIndexGetter):
+ (KJS::KJS::HTMLSelectCollection::put):
+ (KJS::OptionConstructorImp::construct):
+ (KJS::ImageConstructorImp::construct):
+ (KJS::Image::getValueProperty):
+ (KJS::Image::put):
+ (KJS::Image::putValueProperty):
+ (KJS::isGradient):
+ (KJS::isImagePattern):
+ (KJS::KJS::Context2DFunction::callAsFunction):
+ (KJS::Context2D::getValueProperty):
+ (KJS::Context2D::put):
+ (KJS::colorRefFromValue):
+ (KJS::colorFromValue):
+ (KJS::Context2D::setShadow):
+ (KJS::Context2D::updateFillImagePattern):
+ (KJS::Context2D::updateStrokeImagePattern):
+ (KJS::Context2D::putValueProperty):
+ (KJS::Context2D::Context2D):
+ (KJS::Context2D::mark):
+ (KJS::GradientFunction::callAsFunction):
+ (KJS::Gradient::getValueProperty):
+ (KJS::Gradient::put):
+ (KJS::Gradient::putValueProperty):
+ (KJS::ImagePattern::getValueProperty):
+ (KJS::ImagePattern::put):
+ (KJS::ImagePattern::putValueProperty):
+ * khtml/ecma/kjs_html.h:
+ * khtml/ecma/kjs_navigator.cpp:
+ (KJS::Navigator::getValueProperty):
+ (KJS::Plugins::getValueProperty):
+ (KJS::Plugins::indexGetter):
+ (KJS::Plugins::nameGetter):
+ (KJS::MimeTypes::getValueProperty):
+ (KJS::MimeTypes::indexGetter):
+ (KJS::MimeTypes::nameGetter):
+ (KJS::Plugin::getValueProperty):
+ (KJS::Plugin::indexGetter):
+ (KJS::Plugin::nameGetter):
+ (KJS::MimeType::getValueProperty):
+ (KJS::PluginsFunc::callAsFunction):
+ (KJS::NavigatorFunc::callAsFunction):
+ * khtml/ecma/kjs_navigator.h:
+ * khtml/ecma/kjs_proxy.cpp:
+ (KJSProxyImpl::evaluate):
+ (TestFunctionImp::callAsFunction):
+ (KJSProxyImpl::initScript):
+ (KJSProxy::proxy):
+ * khtml/ecma/kjs_range.cpp:
+ (KJS::DOMRange::getValueProperty):
+ (KJS::DOMRangeProtoFunc::callAsFunction):
+ (KJS::RangeConstructor::getValueProperty):
+ * khtml/ecma/kjs_range.h:
+ * khtml/ecma/kjs_traversal.cpp:
+ (KJS::DOMNodeIterator::getValueProperty):
+ (KJS::DOMNodeIteratorProtoFunc::callAsFunction):
+ (KJS::NodeFilterConstructor::getValueProperty):
+ (KJS::getNodeFilterConstructor):
+ (KJS::DOMNodeFilterProtoFunc::callAsFunction):
+ (KJS::DOMTreeWalker::getValueProperty):
+ (KJS::DOMTreeWalker::put):
+ (KJS::DOMTreeWalkerProtoFunc::callAsFunction):
+ (KJS::JSNodeFilterCondition::JSNodeFilterCondition):
+ (KJS::JSNodeFilterCondition::acceptNode):
+ * khtml/ecma/kjs_traversal.h:
+ * khtml/ecma/kjs_views.cpp:
+ (KJS::DOMAbstractView::getValueProperty):
+ (KJS::DOMAbstractViewFunc::callAsFunction):
+ * khtml/ecma/kjs_views.h:
+ * khtml/ecma/kjs_window.cpp:
+ (KJS::Screen::getValueProperty):
+ (KJS::Window::retrieveWindow):
+ (KJS::Window::retrieveActive):
+ (KJS::Window::retrieve):
+ (KJS::parseFeatures):
+ (KJS::showModalDialog):
+ (KJS::Window::getValueProperty):
+ (KJS::Window::childFrameGetter):
+ (KJS::Window::namedFrameGetter):
+ (KJS::Window::indexGetter):
+ (KJS::Window::namedItemGetter):
+ (KJS::Window::put):
+ (KJS::Window::installTimeout):
+ (KJS::Window::setListener):
+ (KJS::Window::getListener):
+ (KJS::Window::getJSEventListener):
+ (KJS::Window::getJSUnprotectedEventListener):
+ (KJS::Window::getJSLazyEventListener):
+ (KJS::WindowFunc::callAsFunction):
+ (KJS::ScheduledAction::ScheduledAction):
+ (KJS::ScheduledAction::execute):
+ (KJS::WindowQObject::installTimeout):
+ (KJS::FrameArray::getValueProperty):
+ (KJS::FrameArray::indexGetter):
+ (KJS::FrameArray::nameGetter):
+ (KJS::Location::getValueProperty):
+ (KJS::Location::put):
+ (KJS::Location::toPrimitive):
+ (KJS::LocationFunc::callAsFunction):
+ (KJS::Selection::getValueProperty):
+ (KJS::Selection::toPrimitive):
+ (KJS::SelectionFunc::callAsFunction):
+ (KJS::BarInfo::getValueProperty):
+ (KJS::History::getValueProperty):
+ (KJS::HistoryFunc::callAsFunction):
+ (KJS::Konqueror::get):
+ (KJS::KonquerorFunc::callAsFunction):
+ * khtml/ecma/kjs_window.h:
+ * khtml/ecma/xmlhttprequest.cpp:
+ (KJS::XMLHttpRequestConstructorImp::construct):
+ (KJS::XMLHttpRequest::getValueProperty):
+ (KJS::XMLHttpRequest::put):
+ (KJS::XMLHttpRequest::putValueProperty):
+ (KJS::XMLHttpRequest::getAllResponseHeaders):
+ (KJS::XMLHttpRequest::getResponseHeader):
+ (KJS::XMLHttpRequest::getStatus):
+ (KJS::XMLHttpRequest::getStatusText):
+ (KJS::XMLHttpRequestProtoFunc::callAsFunction):
+ * khtml/ecma/xmlhttprequest.h:
+ * khtml/ecma/xmlserializer.cpp:
+ (KJS::XMLSerializerConstructorImp::construct):
+ (KJS::XMLSerializerProtoFunc::callAsFunction):
+ * khtml/ecma/xmlserializer.h:
+ * kwq/DOMUtility.mm:
+ (KJS::ScriptInterpreter::createObjcInstanceForValue):
+ * kwq/KWQKHTMLPart.mm:
+ (KWQKHTMLPart::bindingRootObject):
+ (KWQKHTMLPart::windowScriptObject):
+ (KWQKHTMLPart::windowScriptNPObject):
+ * kwq/WebCoreBridge.mm:
+ (-[WebCoreBridge executionContextForView:]):
+ * kwq/WebCoreScriptDebugger.mm:
+ (WebCoreScriptDebuggerImp::callEvent):
+ (WebCoreScriptDebuggerImp::returnEvent):
+ (-[WebCoreScriptDebugger finalize]):
+ (-[WebCoreScriptCallFrame _convertValueToObjcValue:]):
+ (-[WebCoreScriptCallFrame scopeChain]):
+ (-[WebCoreScriptCallFrame evaluateWebScript:]):
+
2005-08-07 Eric Seidel <eseidel at apple.com>
Reviewed by darin.
1.3 +8 -8 WebCore/khtml/ecma/domparser.cpp
Index: domparser.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/domparser.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- domparser.cpp 19 Jul 2005 19:52:48 -0000 1.2
+++ domparser.cpp 8 Aug 2005 04:07:40 -0000 1.3
@@ -48,9 +48,9 @@
return true;
}
-Object DOMParserConstructorImp::construct(ExecState *exec, const List &)
+ObjectImp *DOMParserConstructorImp::construct(ExecState *exec, const List &)
{
- return Object(new DOMParser(exec, doc.get()));
+ return new DOMParser(exec, doc.get());
}
const ClassInfo DOMParser::info = { "DOMParser", 0, &DOMParserTable, 0 };
@@ -67,15 +67,15 @@
}
-Value DOMParserProtoFunc::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *DOMParserProtoFunc::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (!thisObj.inherits(&DOMParser::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&DOMParser::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
- DOMParser *parser = static_cast<DOMParser *>(thisObj.imp());
+ DOMParser *parser = static_cast<DOMParser *>(thisObj);
switch (id) {
case DOMParser::ParseFromString:
@@ -84,8 +84,8 @@
return Undefined();
}
- QString str = args[0].toString(exec).qstring();
- QString contentType = args[1].toString(exec).qstring().stripWhiteSpace();
+ QString str = args[0]->toString(exec).qstring();
+ QString contentType = args[1]->toString(exec).qstring().stripWhiteSpace();
if (contentType == "text/xml" || contentType == "application/xml" || contentType == "application/xhtml+xml") {
DocumentImpl *docImpl = parser->doc->implementation()->createDocument();
1.2 +1 -1 WebCore/khtml/ecma/domparser.h
Index: domparser.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/domparser.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- domparser.h 8 Jun 2005 09:16:42 -0000 1.1
+++ domparser.h 8 Aug 2005 04:07:40 -0000 1.2
@@ -31,7 +31,7 @@
public:
DOMParserConstructorImp(ExecState *, DOM::DocumentImpl *d);
virtual bool implementsConstruct() const;
- virtual Object construct(ExecState *exec, const List &args);
+ virtual ObjectImp *construct(ExecState *exec, const List &args);
private:
khtml::SharedPtr<DOM::DocumentImpl> doc;
};
1.37 +13 -17 WebCore/khtml/ecma/kjs_binding.cpp
Index: kjs_binding.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_binding.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- kjs_binding.cpp 7 Aug 2005 06:17:44 -0000 1.36
+++ kjs_binding.cpp 8 Aug 2005 04:07:40 -0000 1.37
@@ -68,7 +68,7 @@
}
-ScriptInterpreter::ScriptInterpreter( const Object &global, KHTMLPart* part )
+ScriptInterpreter::ScriptInterpreter( ObjectImp *global, KHTMLPart* part )
: Interpreter( global ), m_part( part ),
m_evt( 0L ), m_inlineCode(false), m_timerCallback(false)
{
@@ -205,14 +205,10 @@
}
#if APPLE_CHANGES
-bool ScriptInterpreter::isGlobalObject(const Value &v)
+
+bool ScriptInterpreter::isGlobalObject(ValueImp *v)
{
- if (v.type() == ObjectType) {
- Object o = v.toObject (globalExec());
- if (o.classInfo() == &Window::info)
- return true;
- }
- return false;
+ return v->isObject(&Window::info);
}
bool ScriptInterpreter::isSafeScript (const Interpreter *_target)
@@ -228,7 +224,7 @@
return win->interpreter();
}
-void *ScriptInterpreter::createLanguageInstanceForValue (ExecState *exec, int language, const Object &value, const Bindings::RootObject *origin, const Bindings::RootObject *current)
+void *ScriptInterpreter::createLanguageInstanceForValue (ExecState *exec, int language, ObjectImp *value, const Bindings::RootObject *origin, const Bindings::RootObject *current)
{
void *result = 0;
@@ -304,7 +300,7 @@
return QString((QChar*) data(), size());
}
-Value getStringOrNull(DOMString s)
+ValueImp *getStringOrNull(DOMString s)
{
if (s.isNull())
return Null();
@@ -312,17 +308,17 @@
return String(s);
}
-QVariant ValueToVariant(ExecState* exec, const Value &val) {
+QVariant ValueToVariant(ExecState* exec, ValueImp *val) {
QVariant res;
- switch (val.type()) {
+ switch (val->type()) {
case BooleanType:
- res = QVariant(val.toBoolean(exec), 0);
+ res = QVariant(val->toBoolean(exec), 0);
break;
case NumberType:
- res = QVariant(val.toNumber(exec));
+ res = QVariant(val->toNumber(exec));
break;
case StringType:
- res = QVariant(val.toString(exec).qstring());
+ res = QVariant(val->toString(exec).qstring());
break;
default:
// everything else will be 'invalid'
@@ -350,8 +346,8 @@
char buffer[100]; // needs to fit 20 characters, plus an integer in ASCII, plus a null character
sprintf(buffer, "%s exception %d", type, code);
- Object errorObject = Error::create(exec, GeneralError, buffer);
- errorObject.put(exec, "code", Number(code));
+ ObjectImp *errorObject = Error::create(exec, GeneralError, buffer);
+ errorObject->put(exec, "code", Number(code));
exec->setException(errorObject);
}
1.32 +8 -8 WebCore/khtml/ecma/kjs_binding.h
Index: kjs_binding.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_binding.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- kjs_binding.h 7 Aug 2005 06:17:44 -0000 1.31
+++ kjs_binding.h 8 Aug 2005 04:07:40 -0000 1.32
@@ -59,7 +59,7 @@
public:
virtual bool implementsCall() const { return true; }
virtual bool toBoolean(ExecState *) const { return true; }
- virtual Value toPrimitive(ExecState *exec, Type) const { return String(toString(exec)); }
+ virtual ValueImp *toPrimitive(ExecState *exec, Type) const { return String(toString(exec)); }
virtual UString toString(ExecState *) const { return UString("[function]"); }
};
@@ -73,7 +73,7 @@
class ScriptInterpreter : public Interpreter
{
public:
- ScriptInterpreter(const Object &global, KHTMLPart* part);
+ ScriptInterpreter(ObjectImp *global, KHTMLPart* part);
virtual ~ScriptInterpreter();
static DOMObject* getDOMObject(void* objectHandle);
@@ -107,11 +107,11 @@
DOM::EventImpl *getCurrentEvent() const { return m_evt; }
#if APPLE_CHANGES
- virtual bool isGlobalObject(const Value &v);
+ virtual bool isGlobalObject(ValueImp *v);
virtual Interpreter *interpreterForGlobalObject (const ValueImp *imp);
virtual bool isSafeScript (const Interpreter *target);
- virtual void *createLanguageInstanceForValue (ExecState *exec, int language, const Object &value, const Bindings::RootObject *origin, const Bindings::RootObject *current);
- void *createObjcInstanceForValue (ExecState *exec, const Object &value, const Bindings::RootObject *origin, const Bindings::RootObject *current);
+ virtual void *createLanguageInstanceForValue (ExecState *exec, int language, ObjectImp *value, const Bindings::RootObject *origin, const Bindings::RootObject *current);
+ void *createObjcInstanceForValue (ExecState *exec, ObjectImp *value, const Bindings::RootObject *origin, const Bindings::RootObject *current);
#endif
private:
@@ -129,7 +129,7 @@
inline ValueImp *cacheDOMObject(ExecState *exec, DOMObj *domObj)
{
if (!domObj)
- return null();
+ return jsNull();
ScriptInterpreter *interp = static_cast<ScriptInterpreter *>(exec->dynamicInterpreter());
if (DOMObject *ret = interp->getDOMObject(domObj))
return ret;
@@ -155,12 +155,12 @@
/**
* Get a String object, or Null() if s is null
*/
- Value getStringOrNull(DOM::DOMString s);
+ ValueImp *getStringOrNull(DOM::DOMString s);
/**
* Convert a KJS value into a QVariant
*/
- QVariant ValueToVariant(ExecState* exec, const Value& val);
+ QVariant ValueToVariant(ExecState* exec, ValueImp *val);
} // namespace
1.34 +99 -101 WebCore/khtml/ecma/kjs_css.cpp
Index: kjs_css.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_css.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- kjs_css.cpp 7 Aug 2005 06:17:45 -0000 1.33
+++ kjs_css.cpp 8 Aug 2005 04:07:40 -0000 1.34
@@ -134,13 +134,13 @@
ScriptInterpreter::forgetDOMObject(m_impl.get());
}
-Value DOMCSSStyleDeclaration::indexGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *DOMCSSStyleDeclaration::indexGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
DOMCSSStyleDeclaration *thisObj = static_cast<DOMCSSStyleDeclaration *>(slot.slotBase());
return getStringOrNull(thisObj->m_impl->item(slot.index()));
}
-Value DOMCSSStyleDeclaration::cssPropertyGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *DOMCSSStyleDeclaration::cssPropertyGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
DOMCSSStyleDeclaration *thisObj = static_cast<DOMCSSStyleDeclaration *>(slot.slotBase());
@@ -185,13 +185,13 @@
return DOMObject::getOwnPropertySlot(exec, propertyName, slot);
}
-Value DOMCSSStyleDeclaration::getValueProperty(ExecState *exec, int token)
+ValueImp *DOMCSSStyleDeclaration::getValueProperty(ExecState *exec, int token)
{
switch (token) {
case CssText:
return getStringOrNull(m_impl->cssText());
case Length:
- return Value(m_impl->length());
+ return jsNumber(m_impl->length());
case ParentRule:
return getDOMCSSRule(exec, m_impl->parentRule());
default:
@@ -200,7 +200,7 @@
}
}
-void DOMCSSStyleDeclaration::put(ExecState *exec, const Identifier &propertyName, const Value& value, int attr )
+void DOMCSSStyleDeclaration::put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr )
{
#ifdef KJS_VERBOSE
kdDebug(6070) << "DOMCSSStyleDeclaration::put " << propertyName.qstring() << endl;
@@ -208,12 +208,12 @@
DOMExceptionTranslator exception(exec);
CSSStyleDeclarationImpl &styleDecl = *m_impl;
if (propertyName == "cssText") {
- styleDecl.setCssText(value.toString(exec).string(), exception);
+ styleDecl.setCssText(value->toString(exec).string(), exception);
} else {
if (isCSSPropertyName(propertyName)) {
bool pixelOrPos;
DOMString prop = cssPropertyName(propertyName, &pixelOrPos);
- QString propvalue = value.toString(exec).qstring();
+ QString propvalue = value->toString(exec).qstring();
if (pixelOrPos)
propvalue += "px";
#ifdef KJS_VERBOSE
@@ -237,17 +237,17 @@
}
}
-Value DOMCSSStyleDeclarationProtoFunc::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *DOMCSSStyleDeclarationProtoFunc::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (!thisObj.inherits(&KJS::DOMCSSStyleDeclaration::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&KJS::DOMCSSStyleDeclaration::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
DOMExceptionTranslator exception(exec);
- CSSStyleDeclarationImpl &styleDecl = *static_cast<DOMCSSStyleDeclaration *>(thisObj.imp())->impl();
- String str = args[0].toString(exec);
- DOM::DOMString s = str.value().string();
+ CSSStyleDeclarationImpl &styleDecl = *static_cast<DOMCSSStyleDeclaration *>(thisObj)->impl();
+ UString str = args[0]->toString(exec);
+ DOM::DOMString s = str.string();
switch (id) {
case DOMCSSStyleDeclaration::GetPropertyValue:
@@ -259,10 +259,10 @@
case DOMCSSStyleDeclaration::GetPropertyPriority:
return getStringOrNull(styleDecl.getPropertyPriority(s));
case DOMCSSStyleDeclaration::SetProperty:
- styleDecl.setProperty(s, args[1].toString(exec).string(), args[2].toString(exec).string(), exception);
+ styleDecl.setProperty(s, args[1]->toString(exec).string(), args[2]->toString(exec).string(), exception);
return Undefined();
case DOMCSSStyleDeclaration::Item:
- return getStringOrNull(styleDecl.item(args[0].toInt32(exec)));
+ return getStringOrNull(styleDecl.item(args[0]->toInt32(exec)));
default:
return Undefined();
}
@@ -298,7 +298,7 @@
return getStaticValueSlot<DOMStyleSheet, DOMObject>(exec, &DOMStyleSheetTable, this, propertyName, slot);
}
-Value DOMStyleSheet::getValueProperty(ExecState *exec, int token) const
+ValueImp *DOMStyleSheet::getValueProperty(ExecState *exec, int token) const
{
StyleSheetImpl &styleSheet = *m_impl;
switch (token) {
@@ -317,13 +317,13 @@
case Media:
return getDOMMediaList(exec, styleSheet.media());
}
- return Value();
+ return NULL;
}
-void DOMStyleSheet::put(ExecState *exec, const Identifier &propertyName, const Value& value, int attr)
+void DOMStyleSheet::put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr)
{
if (propertyName == "disabled") {
- m_impl->setDisabled(value.toBoolean(exec));
+ m_impl->setDisabled(value->toBoolean(exec));
}
else
DOMObject::put(exec, propertyName, value, attr);
@@ -364,7 +364,7 @@
ScriptInterpreter::forgetDOMObject(m_impl.get());
}
-Value DOMStyleSheetList::getValueProperty(ExecState *exec, int token) const
+ValueImp *DOMStyleSheetList::getValueProperty(ExecState *exec, int token) const
{
switch(token) {
case Length:
@@ -375,13 +375,13 @@
}
}
-Value DOMStyleSheetList::indexGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *DOMStyleSheetList::indexGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
DOMStyleSheetList *thisObj = static_cast<DOMStyleSheetList *>(slot.slotBase());
return getDOMStyleSheet(exec, thisObj->m_impl->item(slot.index()));
}
-Value DOMStyleSheetList::nameGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *DOMStyleSheetList::nameGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
DOMStyleSheetList *thisObj = static_cast<DOMStyleSheetList *>(slot.slotBase());
ElementImpl *element = thisObj->m_doc->getElementById(propertyName.string());
@@ -464,16 +464,16 @@
}
}
-Value DOMStyleSheetListFunc::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *DOMStyleSheetListFunc::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (!thisObj.inherits(&KJS::DOMStyleSheetList::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&KJS::DOMStyleSheetList::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
- StyleSheetListImpl &styleSheetList = *static_cast<DOMStyleSheetList *>(thisObj.imp())->impl();
+ StyleSheetListImpl &styleSheetList = *static_cast<DOMStyleSheetList *>(thisObj)->impl();
if (id == DOMStyleSheetList::Item)
- return getDOMStyleSheet(exec, styleSheetList.item(args[0].toInt32(exec)));
+ return getDOMStyleSheet(exec, styleSheetList.item(args[0]->toInt32(exec)));
return Undefined();
}
@@ -507,7 +507,7 @@
ScriptInterpreter::forgetDOMObject(m_impl.get());
}
-Value DOMMediaList::getValueProperty(ExecState *exec, int token)
+ValueImp *DOMMediaList::getValueProperty(ExecState *exec, int token)
{
switch (token) {
case MediaText:
@@ -520,7 +520,7 @@
}
}
-Value DOMMediaList::indexGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *DOMMediaList::indexGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
DOMMediaList *thisObj = static_cast<DOMMediaList *>(slot.slotBase());
return getStringOrNull(thisObj->m_impl->item(slot.index()));
@@ -544,11 +544,11 @@
return DOMObject::getOwnPropertySlot(exec, propertyName, slot);
}
-void DOMMediaList::put(ExecState *exec, const Identifier &propertyName, const Value& value, int attr)
+void DOMMediaList::put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr)
{
MediaListImpl &mediaList = *m_impl;
if (propertyName == "mediaText")
- mediaList.setMediaText(value.toString(exec).string());
+ mediaList.setMediaText(value->toString(exec).string());
else
DOMObject::put(exec, propertyName, value, attr);
}
@@ -558,22 +558,22 @@
return cacheDOMObject<MediaListImpl, DOMMediaList>(exec, ml);
}
-Value KJS::DOMMediaListProtoFunc::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *KJS::DOMMediaListProtoFunc::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (!thisObj.inherits(&KJS::DOMMediaList::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&KJS::DOMMediaList::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
- MediaListImpl &mediaList = *static_cast<DOMMediaList *>(thisObj.imp())->impl();
+ MediaListImpl &mediaList = *static_cast<DOMMediaList *>(thisObj)->impl();
switch (id) {
case DOMMediaList::Item:
- return getStringOrNull(mediaList.item(args[0].toInt32(exec)));
+ return getStringOrNull(mediaList.item(args[0]->toInt32(exec)));
case DOMMediaList::DeleteMedium:
- mediaList.deleteMedium(args[0].toString(exec).string());
+ mediaList.deleteMedium(args[0]->toString(exec).string());
return Undefined();
case DOMMediaList::AppendMedium:
- mediaList.appendMedium(args[0].toString(exec).string());
+ mediaList.appendMedium(args[0]->toString(exec).string());
return Undefined();
default:
return Undefined();
@@ -612,7 +612,7 @@
{
}
-Value DOMCSSStyleSheet::getValueProperty(ExecState *exec, int token) const
+ValueImp *DOMCSSStyleSheet::getValueProperty(ExecState *exec, int token) const
{
switch (token) {
case OwnerRule:
@@ -631,26 +631,24 @@
return getStaticValueSlot<DOMCSSStyleSheet, DOMStyleSheet>(exec, &DOMCSSStyleSheetTable, this, propertyName, slot);
}
-Value DOMCSSStyleSheetProtoFunc::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *DOMCSSStyleSheetProtoFunc::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (!thisObj.inherits(&KJS::DOMCSSStyleSheet::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&KJS::DOMCSSStyleSheet::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
DOMExceptionTranslator exception(exec);
- CSSStyleSheetImpl &styleSheet = *static_cast<CSSStyleSheetImpl *>(static_cast<DOMCSSStyleSheet *>(thisObj.imp())->impl());
- Value result;
+ CSSStyleSheetImpl &styleSheet = *static_cast<CSSStyleSheetImpl *>(static_cast<DOMCSSStyleSheet *>(thisObj)->impl());
switch (id) {
case DOMCSSStyleSheet::InsertRule:
- return Number(styleSheet.insertRule(args[0].toString(exec).string(), args[1].toInt32(exec), exception));
- break;
+ return Number(styleSheet.insertRule(args[0]->toString(exec).string(), args[1]->toInt32(exec), exception));
case DOMCSSStyleSheet::DeleteRule:
- styleSheet.deleteRule(args[0].toInt32(exec), exception);
+ styleSheet.deleteRule(args[0]->toInt32(exec), exception);
return Undefined();
case DOMCSSStyleSheet::AddRule: {
- long index = args.size() >= 3 ? args[2].toInt32(exec) : -1;
- styleSheet.addRule(args[0].toString(exec).string(), args[1].toString(exec).string(), index, exception);
+ long index = args.size() >= 3 ? args[2]->toInt32(exec) : -1;
+ styleSheet.addRule(args[0]->toString(exec).string(), args[1]->toString(exec).string(), index, exception);
// As per Microsoft documentation, always return -1.
return Number(-1);
}
@@ -674,7 +672,7 @@
ScriptInterpreter::forgetDOMObject(m_impl.get());
}
-Value DOMCSSRuleList::getValueProperty(ExecState *exec, int token) const
+ValueImp *DOMCSSRuleList::getValueProperty(ExecState *exec, int token) const
{
switch (token) {
case Length:
@@ -685,7 +683,7 @@
}
}
-Value DOMCSSRuleList::indexGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *DOMCSSRuleList::indexGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
DOMCSSRuleList *thisObj = static_cast<DOMCSSRuleList *>(slot.slotBase());
return getDOMCSSRule(exec, thisObj->m_impl->item(slot.index()));
@@ -715,17 +713,17 @@
return DOMObject::getOwnPropertySlot(exec, propertyName, slot);
}
-Value DOMCSSRuleListFunc::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *DOMCSSRuleListFunc::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (!thisObj.inherits(&KJS::DOMCSSRuleList::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&KJS::DOMCSSRuleList::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
- CSSRuleListImpl &cssRuleList = *static_cast<DOMCSSRuleList *>(thisObj.imp())->impl();
+ CSSRuleListImpl &cssRuleList = *static_cast<DOMCSSRuleList *>(thisObj)->impl();
switch (id) {
case DOMCSSRuleList::Item:
- return getDOMCSSRule(exec,cssRuleList.item(args[0].toInt32(exec)));
+ return getDOMCSSRule(exec,cssRuleList.item(args[0]->toInt32(exec)));
default:
return Undefined();
}
@@ -820,7 +818,7 @@
return getStaticPropertySlot<DOMCSSRuleFunc, DOMCSSRule, DOMObject>(exec, &DOMCSSRuleTable, this, propertyName, slot);
}
-Value DOMCSSRule::getValueProperty(ExecState *exec, int token) const
+ValueImp *DOMCSSRule::getValueProperty(ExecState *exec, int token) const
{
CSSRuleImpl &cssRule = *m_impl;
switch (token) {
@@ -873,7 +871,7 @@
return Undefined();
}
-void DOMCSSRule::put(ExecState *exec, const Identifier &propertyName, const Value& value, int attr)
+void DOMCSSRule::put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr)
{
const HashTable* table = classInfo()->propHashTable; // get the right hashtable
const HashEntry* entry = Lookup::findEntry(table, propertyName);
@@ -892,22 +890,22 @@
lookupPut<DOMCSSRule, DOMObject>(exec, propertyName, value, attr, &DOMCSSRuleTable, this);
}
-void DOMCSSRule::putValueProperty(ExecState *exec, int token, const Value& value, int)
+void DOMCSSRule::putValueProperty(ExecState *exec, int token, ValueImp *value, int)
{
switch (token) {
// for DOM::CSSRule::STYLE_RULE:
case Style_SelectorText:
- static_cast<CSSStyleRuleImpl *>(m_impl.get())->setSelectorText(value.toString(exec).string());
+ static_cast<CSSStyleRuleImpl *>(m_impl.get())->setSelectorText(value->toString(exec).string());
return;
// for DOM::CSSRule::PAGE_RULE:
case Page_SelectorText:
- static_cast<CSSPageRuleImpl *>(m_impl.get())->setSelectorText(value.toString(exec).string());
+ static_cast<CSSPageRuleImpl *>(m_impl.get())->setSelectorText(value->toString(exec).string());
return;
// for DOM::CSSRule::CHARSET_RULE:
case Charset_Encoding:
- static_cast<CSSCharsetRuleImpl *>(m_impl.get())->setEncoding(value.toString(exec).string());
+ static_cast<CSSCharsetRuleImpl *>(m_impl.get())->setEncoding(value->toString(exec).string());
return;
default:
@@ -915,21 +913,21 @@
}
}
-Value DOMCSSRuleFunc::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *DOMCSSRuleFunc::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (!thisObj.inherits(&KJS::DOMCSSRule::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&KJS::DOMCSSRule::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
- CSSRuleImpl &cssRule = *static_cast<DOMCSSRule *>(thisObj.imp())->impl();
+ CSSRuleImpl &cssRule = *static_cast<DOMCSSRule *>(thisObj)->impl();
if (cssRule.type() == DOM::CSSRule::MEDIA_RULE) {
CSSMediaRuleImpl &rule = static_cast<CSSMediaRuleImpl &>(cssRule);
if (id == DOMCSSRule::Media_InsertRule)
- return Number(rule.insertRule(args[0].toString(exec).string(),args[1].toInt32(exec)));
+ return Number(rule.insertRule(args[0]->toString(exec).string(),args[1]->toInt32(exec)));
else if (id == DOMCSSRule::Media_DeleteRule)
- rule.deleteRule(args[0].toInt32(exec));
+ rule.deleteRule(args[0]->toInt32(exec));
}
return Undefined();
@@ -960,7 +958,7 @@
return getStaticValueSlot<CSSRuleConstructor, DOMObject>(exec, &CSSRuleConstructorTable, this, propertyName, slot);
}
-Value CSSRuleConstructor::getValueProperty(ExecState *, int token) const
+ValueImp *CSSRuleConstructor::getValueProperty(ExecState *, int token) const
{
switch (token) {
case UNKNOWN_RULE:
@@ -978,10 +976,10 @@
case PAGE_RULE:
return Number(DOM::CSSRule::PAGE_RULE);
}
- return Value();
+ return NULL;
}
-Value getCSSRuleConstructor(ExecState *exec)
+ValueImp *getCSSRuleConstructor(ExecState *exec)
{
return cacheGlobalObject<CSSRuleConstructor>( exec, "[[cssRule.constructor]]" );
}
@@ -1001,7 +999,7 @@
ScriptInterpreter::forgetDOMObject(m_impl.get());
}
-Value DOMCSSValue::getValueProperty(ExecState *exec, int token) const
+ValueImp *DOMCSSValue::getValueProperty(ExecState *exec, int token) const
{
CSSValueImpl &cssValue = *m_impl;
switch (token) {
@@ -1020,11 +1018,11 @@
return getStaticValueSlot<DOMCSSValue, DOMObject>(exec, &DOMCSSValueTable, this, propertyName, slot);
}
-void DOMCSSValue::put(ExecState *exec, const Identifier &propertyName, const Value& value, int attr)
+void DOMCSSValue::put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr)
{
CSSValueImpl &cssValue = *m_impl;
if (propertyName == "cssText")
- cssValue.setCssText(value.toString(exec).string());
+ cssValue.setCssText(value->toString(exec).string());
else
DOMObject::put(exec, propertyName, value, attr);
}
@@ -1036,7 +1034,7 @@
return Null();
ScriptInterpreter* interp = static_cast<ScriptInterpreter *>(exec->dynamicInterpreter());
if ((ret = interp->getDOMObject(v)))
- return Value(ret);
+ return ret;
else {
if (v->isValueList())
ret = new DOMCSSValueList(exec, static_cast<CSSValueListImpl *>(v));
@@ -1065,7 +1063,7 @@
return getStaticValueSlot<CSSValueConstructor, DOMObject>(exec, &CSSValueConstructorTable, this, propertyName, slot);
}
-Value CSSValueConstructor::getValueProperty(ExecState *, int token) const
+ValueImp *CSSValueConstructor::getValueProperty(ExecState *, int token) const
{
switch (token) {
case CSS_INHERIT:
@@ -1077,10 +1075,10 @@
case CSS_CUSTOM:
return Number(DOM::CSSValue::CSS_CUSTOM);
}
- return Value();
+ return NULL;
}
-Value getCSSValueConstructor(ExecState *exec)
+ValueImp *getCSSValueConstructor(ExecState *exec)
{
return cacheGlobalObject<CSSValueConstructor>( exec, "[[cssValue.constructor]]" );
}
@@ -1112,7 +1110,7 @@
setPrototype(DOMCSSPrimitiveValueProto::self(exec));
}
-Value DOMCSSPrimitiveValue::getValueProperty(ExecState *exec, int token)
+ValueImp *DOMCSSPrimitiveValue::getValueProperty(ExecState *exec, int token)
{
assert(token == PrimitiveType);
return Number(static_cast<CSSPrimitiveValueImpl *>(impl())->primitiveType());
@@ -1123,23 +1121,23 @@
return getStaticValueSlot<DOMCSSPrimitiveValue, DOMCSSValue>(exec, &DOMCSSPrimitiveValueTable, this, propertyName, slot);
}
-Value DOMCSSPrimitiveValueProtoFunc::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *DOMCSSPrimitiveValueProtoFunc::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (!thisObj.inherits(&KJS::DOMCSSPrimitiveValue::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&KJS::DOMCSSPrimitiveValue::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
DOMExceptionTranslator exception(exec);
- CSSPrimitiveValueImpl &val = *static_cast<CSSPrimitiveValueImpl *>(static_cast<DOMCSSPrimitiveValue *>(thisObj.imp())->impl());
+ CSSPrimitiveValueImpl &val = *static_cast<CSSPrimitiveValueImpl *>(static_cast<DOMCSSPrimitiveValue *>(thisObj)->impl());
switch (id) {
case DOMCSSPrimitiveValue::SetFloatValue:
- val.setFloatValue(args[0].toInt32(exec), args[1].toNumber(exec), exception);
+ val.setFloatValue(args[0]->toInt32(exec), args[1]->toNumber(exec), exception);
return Undefined();
case DOMCSSPrimitiveValue::GetFloatValue:
- return Number(val.getFloatValue(args[0].toInt32(exec)));
+ return Number(val.getFloatValue(args[0]->toInt32(exec)));
case DOMCSSPrimitiveValue::SetStringValue:
- val.setStringValue(args[0].toInt32(exec), args[1].toString(exec).string(), exception);
+ val.setStringValue(args[0]->toInt32(exec), args[1]->toString(exec).string(), exception);
return Undefined();
case DOMCSSPrimitiveValue::GetStringValue:
return getStringOrNull(val.getStringValue());
@@ -1194,13 +1192,13 @@
return getStaticValueSlot<CSSPrimitiveValueConstructor, CSSValueConstructor>(exec, &CSSPrimitiveValueConstructorTable, this, propertyName, slot);
}
-Value CSSPrimitiveValueConstructor::getValueProperty(ExecState *, int token) const
+ValueImp *CSSPrimitiveValueConstructor::getValueProperty(ExecState *, int token) const
{
// We use the token as the value to return directly
return Number(token);
}
-Value getCSSPrimitiveValueConstructor(ExecState *exec)
+ValueImp *getCSSPrimitiveValueConstructor(ExecState *exec)
{
return cacheGlobalObject<CSSPrimitiveValueConstructor>( exec, "[[cssPrimitiveValue.constructor]]" );
}
@@ -1222,13 +1220,13 @@
{
}
-Value DOMCSSValueList::getValueProperty(ExecState *exec, int token) const
+ValueImp *DOMCSSValueList::getValueProperty(ExecState *exec, int token) const
{
assert(token == Length);
return Number(static_cast<CSSValueListImpl *>(impl())->length());
}
-Value DOMCSSValueList::indexGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *DOMCSSValueList::indexGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
DOMCSSValueList *thisObj = static_cast<DOMCSSValueList *>(slot.slotBase());
return getDOMCSSValue(exec, static_cast<CSSValueListImpl *>(thisObj->impl())->item(slot.index()));
@@ -1255,17 +1253,17 @@
return DOMCSSValue::getOwnPropertySlot(exec, propertyName, slot);
}
-Value DOMCSSValueListFunc::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *DOMCSSValueListFunc::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (!thisObj.inherits(&KJS::DOMCSSValue::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&KJS::DOMCSSValue::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
- CSSValueListImpl &valueList = *static_cast<CSSValueListImpl *>(static_cast<DOMCSSValueList *>(thisObj.imp())->impl());
+ CSSValueListImpl &valueList = *static_cast<CSSValueListImpl *>(static_cast<DOMCSSValueList *>(thisObj)->impl());
switch (id) {
case DOMCSSValueList::Item:
- return getDOMCSSValue(exec,valueList.item(args[0].toInt32(exec)));
+ return getDOMCSSValue(exec,valueList.item(args[0]->toInt32(exec)));
default:
return Undefined();
}
@@ -1292,7 +1290,7 @@
return getStaticValueSlot<DOMRGBColor, DOMObject>(exec, &DOMRGBColorTable, this, propertyName, slot);
}
-Value DOMRGBColor::getValueProperty(ExecState *exec, int token) const
+ValueImp *DOMRGBColor::getValueProperty(ExecState *exec, int token) const
{
int color = m_color;
switch (token) {
@@ -1305,7 +1303,7 @@
case Blue:
return new DOMCSSPrimitiveValue(exec, new CSSPrimitiveValueImpl(color & 0xFF, CSSPrimitiveValue::CSS_NUMBER));
default:
- return Value();
+ return NULL;
}
}
@@ -1336,7 +1334,7 @@
return getStaticValueSlot<DOMRect, DOMObject>(exec, &DOMRectTable, this, propertyName, slot);
}
-Value DOMRect::getValueProperty(ExecState *exec, int token) const
+ValueImp *DOMRect::getValueProperty(ExecState *exec, int token) const
{
RectImpl &rect = *m_rect;
switch (token) {
@@ -1349,7 +1347,7 @@
case Left:
return getDOMCSSValue(exec, rect.left());
default:
- return Value();
+ return NULL;
}
}
@@ -1379,7 +1377,7 @@
return getStaticValueSlot<DOMCounter, DOMObject>(exec, &DOMCounterTable, this, propertyName, slot);
}
-Value DOMCounter::getValueProperty(ExecState *, int token) const
+ValueImp *DOMCounter::getValueProperty(ExecState *, int token) const
{
CounterImpl &counter = *m_counter;
switch (token) {
@@ -1390,7 +1388,7 @@
case separator:
return getStringOrNull(counter.separator());
default:
- return Value();
+ return NULL;
}
}
1.19 +32 -32 WebCore/khtml/ecma/kjs_css.h
Index: kjs_css.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_css.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- kjs_css.h 7 Aug 2005 06:17:45 -0000 1.18
+++ kjs_css.h 8 Aug 2005 04:07:40 -0000 1.19
@@ -50,8 +50,8 @@
DOMCSSStyleDeclaration(ExecState *exec, DOM::CSSStyleDeclarationImpl *s);
virtual ~DOMCSSStyleDeclaration();
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- virtual void put(ExecState *exec, const Identifier &propertyName, const Value& value, int attr = None);
- Value getValueProperty(ExecState *exec, int token);
+ virtual void put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr = None);
+ ValueImp *getValueProperty(ExecState *exec, int token);
virtual const ClassInfo *classInfo() const { return &info; }
static const ClassInfo info;
@@ -60,8 +60,8 @@
GetPropertyPriority, SetProperty, Item };
DOM::CSSStyleDeclarationImpl *impl() const { return m_impl.get(); }
private:
- static Value indexGetter(ExecState *, const Identifier&, const PropertySlot&);
- static Value cssPropertyGetter(ExecState *, const Identifier&, const PropertySlot&);
+ static ValueImp *indexGetter(ExecState *, const Identifier&, const PropertySlot&);
+ static ValueImp *cssPropertyGetter(ExecState *, const Identifier&, const PropertySlot&);
khtml::SharedPtr<DOM::CSSStyleDeclarationImpl> m_impl;
};
@@ -73,8 +73,8 @@
DOMStyleSheet(ExecState *, DOM::StyleSheetImpl *ss) : m_impl(ss) { }
virtual ~DOMStyleSheet();
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
- virtual void put(ExecState *exec, const Identifier &propertyName, const Value& value, int attr = None);
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
+ virtual void put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr = None);
virtual bool toBoolean(ExecState *) const { return true; }
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
@@ -95,7 +95,7 @@
: m_impl(ssl), m_doc(doc) { }
virtual ~DOMStyleSheetList();
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
// no put - all read-only
virtual const ClassInfo* classInfo() const { return &info; }
virtual bool toBoolean(ExecState* ) const { return true; }
@@ -103,8 +103,8 @@
DOM::StyleSheetListImpl *impl() const { return m_impl.get(); }
enum { Item, Length };
private:
- static Value indexGetter(ExecState *, const Identifier&, const PropertySlot&);
- static Value nameGetter(ExecState *, const Identifier&, const PropertySlot&);
+ static ValueImp *indexGetter(ExecState *, const Identifier&, const PropertySlot&);
+ static ValueImp *nameGetter(ExecState *, const Identifier&, const PropertySlot&);
khtml::SharedPtr<DOM::StyleSheetListImpl> m_impl;
khtml::SharedPtr<DOM::DocumentImpl> m_doc;
@@ -118,8 +118,8 @@
DOMMediaList(ExecState *, DOM::MediaListImpl *ml);
virtual ~DOMMediaList();
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token);
- virtual void put(ExecState *exec, const Identifier &propertyName, const Value& value, int attr = None);
+ ValueImp *getValueProperty(ExecState *exec, int token);
+ virtual void put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr = None);
virtual const ClassInfo* classInfo() const { return &info; }
virtual bool toBoolean(ExecState* ) const { return true; }
static const ClassInfo info;
@@ -127,7 +127,7 @@
Item, DeleteMedium, AppendMedium };
DOM::MediaListImpl *impl() const { return m_impl.get(); }
private:
- static Value indexGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
+ static ValueImp *indexGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
khtml::SharedPtr<DOM::MediaListImpl> m_impl;
};
@@ -138,7 +138,7 @@
DOMCSSStyleSheet(ExecState *exec, DOM::CSSStyleSheetImpl *ss);
virtual ~DOMCSSStyleSheet();
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
// no put - all read-only
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
@@ -150,14 +150,14 @@
DOMCSSRuleList(ExecState *, DOM::CSSRuleListImpl *rl) : m_impl(rl) { }
virtual ~DOMCSSRuleList();
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
// no put - all read-only
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
enum { Item, Length };
DOM::CSSRuleListImpl *impl() const { return m_impl.get(); }
private:
- static Value indexGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
+ static ValueImp *indexGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
khtml::SharedPtr<DOM::CSSRuleListImpl> m_impl;
};
@@ -169,9 +169,9 @@
DOMCSSRule(ExecState *, DOM::CSSRuleImpl *r) : m_impl(r) { }
virtual ~DOMCSSRule();
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
- virtual void put(ExecState *exec, const Identifier &propertyName, const Value& value, int attr = None);
- void putValueProperty(ExecState *exec, int token, const Value& value, int attr);
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
+ virtual void put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr = None);
+ void putValueProperty(ExecState *exec, int token, ValueImp *value, int attr);
virtual const ClassInfo* classInfo() const;
static const ClassInfo info;
static const ClassInfo style_info, media_info, fontface_info, page_info, import_info, charset_info;
@@ -191,22 +191,22 @@
public:
CSSRuleConstructor(ExecState *) { }
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
// no put - all read-only
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
enum { UNKNOWN_RULE, STYLE_RULE, CHARSET_RULE, IMPORT_RULE, MEDIA_RULE, FONT_FACE_RULE, PAGE_RULE };
};
- Value getCSSRuleConstructor(ExecState *exec);
+ ValueImp *getCSSRuleConstructor(ExecState *exec);
class DOMCSSValue : public DOMObject {
public:
DOMCSSValue(ExecState *, DOM::CSSValueImpl *v) : m_impl(v) { }
virtual ~DOMCSSValue();
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
- virtual void put(ExecState *exec, const Identifier &propertyName, const Value& value, int attr = None);
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
+ virtual void put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr = None);
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
enum { CssText, CssValueType };
@@ -225,20 +225,20 @@
public:
CSSValueConstructor(ExecState *) { }
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
// no put - all read-only
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
enum { CSS_VALUE_LIST, CSS_PRIMITIVE_VALUE, CSS_CUSTOM, CSS_INHERIT };
};
- Value getCSSValueConstructor(ExecState *exec);
+ ValueImp *getCSSValueConstructor(ExecState *exec);
class DOMCSSPrimitiveValue : public DOMCSSValue {
public:
DOMCSSPrimitiveValue(ExecState *exec, DOM::CSSPrimitiveValueImpl *v);
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token);
+ ValueImp *getValueProperty(ExecState *exec, int token);
// no put - all read-only
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
@@ -251,25 +251,25 @@
public:
CSSPrimitiveValueConstructor(ExecState *exec) : CSSValueConstructor(exec) { }
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
// no put - all read-only
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
};
- Value getCSSPrimitiveValueConstructor(ExecState *exec);
+ ValueImp *getCSSPrimitiveValueConstructor(ExecState *exec);
class DOMCSSValueList : public DOMCSSValue {
public:
DOMCSSValueList(ExecState *exec, DOM::CSSValueListImpl *l);
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
// no put - all read-only
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
enum { Length, Item };
private:
- static Value indexGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
+ static ValueImp *indexGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
};
class DOMRGBColor : public DOMObject {
@@ -277,7 +277,7 @@
DOMRGBColor(unsigned color) : m_color(color) { }
~DOMRGBColor();
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
// no put - all read-only
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
@@ -293,7 +293,7 @@
DOMRect(ExecState *, DOM::RectImpl *r) : m_rect(r) { }
~DOMRect();
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
// no put - all read-only
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
@@ -309,7 +309,7 @@
DOMCounter(ExecState *, DOM::CounterImpl *c) : m_counter(c) { }
~DOMCounter();
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
// no put - all read-only
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
1.86 +166 -168 WebCore/khtml/ecma/kjs_dom.cpp
Index: kjs_dom.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_dom.cpp,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -r1.85 -r1.86
--- kjs_dom.cpp 7 Aug 2005 18:46:44 -0000 1.85
+++ kjs_dom.cpp 8 Aug 2005 04:07:40 -0000 1.86
@@ -87,8 +87,7 @@
friend class DOMNodeList;
public:
DOMNodeListFunc(ExecState *exec, int id, int len);
- virtual Value call(ExecState *exec, Object &thisObj, const List &);
- enum { Item };
+ virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &);
private:
int id;
};
@@ -276,7 +275,7 @@
return getStaticValueSlot<DOMNode, DOMObject>(exec, &DOMNodeTable, this, propertyName, slot);
}
-Value DOMNode::getValueProperty(ExecState *exec, int token) const
+ValueImp *DOMNode::getValueProperty(ExecState *exec, int token) const
{
NodeImpl &node = *m_impl;
switch (token) {
@@ -408,25 +407,25 @@
switch (token) {
case OffsetLeft:
- return rend ? static_cast<Value>(Number(rend->offsetLeft())) : Value(Undefined());
+ return rend ? jsNumber(rend->offsetLeft()) : static_cast<ValueImp *>(jsUndefined());
case OffsetTop:
- return rend ? static_cast<Value>(Number(rend->offsetTop())) : Value(Undefined());
+ return rend ? jsNumber(rend->offsetTop()) : static_cast<ValueImp *>(jsUndefined());
case OffsetWidth:
- return rend ? static_cast<Value>(Number(rend->offsetWidth()) ) : Value(Undefined());
+ return rend ? jsNumber(rend->offsetWidth()) : static_cast<ValueImp *>(jsUndefined());
case OffsetHeight:
- return rend ? static_cast<Value>(Number(rend->offsetHeight() ) ) : Value(Undefined());
+ return rend ? jsNumber(rend->offsetHeight()) : static_cast<ValueImp *>(jsUndefined());
case OffsetParent: {
khtml::RenderObject* par = rend ? rend->offsetParent() : 0;
return getDOMNode(exec, par ? par->element() : 0);
}
case ClientWidth:
- return rend ? static_cast<Value>(Number(rend->clientWidth()) ) : Value(Undefined());
+ return rend ? jsNumber(rend->clientWidth()) : static_cast<ValueImp *>(jsUndefined());
case ClientHeight:
- return rend ? static_cast<Value>(Number(rend->clientHeight()) ) : Value(Undefined());
+ return rend ? jsNumber(rend->clientHeight()) : static_cast<ValueImp *>(jsUndefined());
case ScrollWidth:
- return rend ? static_cast<Value>(Number(rend->scrollWidth()) ) : Value(Undefined());
+ return rend ? jsNumber(rend->scrollWidth()) : static_cast<ValueImp *>(jsUndefined());
case ScrollHeight:
- return rend ? static_cast<Value>(Number(rend->scrollHeight()) ) : Value(Undefined());
+ return rend ? jsNumber(rend->scrollHeight()) : static_cast<ValueImp *>(jsUndefined());
case ScrollLeft:
return Number(rend && rend->layer() ? rend->layer()->scrollXOffset() : 0);
case ScrollTop:
@@ -437,10 +436,10 @@
}
}
- return Value();
+ return NULL;
}
-void DOMNode::put(ExecState *exec, const Identifier& propertyName, const Value& value, int attr)
+void DOMNode::put(ExecState *exec, const Identifier& propertyName, ValueImp *value, int attr)
{
#ifdef KJS_VERBOSE
kdDebug(6070) << "DOMNode::put " << propertyName.qstring() << endl;
@@ -449,16 +448,16 @@
&DOMNodeTable, this );
}
-void DOMNode::putValueProperty(ExecState *exec, int token, const Value& value, int /*attr*/)
+void DOMNode::putValueProperty(ExecState *exec, int token, ValueImp *value, int /*attr*/)
{
DOMExceptionTranslator exception(exec);
NodeImpl &node = *m_impl;
switch (token) {
case NodeValue:
- node.setNodeValue(value.toString(exec).string(), exception);
+ node.setNodeValue(value->toString(exec).string(), exception);
break;
case Prefix:
- node.setPrefix(value.toString(exec).string().implementation(), exception);
+ node.setPrefix(value->toString(exec).string().implementation(), exception);
break;
case OnAbort:
setListener(exec,DOM::EventImpl::ABORT_EVENT,value);
@@ -589,13 +588,13 @@
case ScrollTop: {
khtml::RenderObject *rend = node.renderer();
if (rend && rend->hasOverflowClip())
- rend->layer()->scrollToYOffset(value.toInt32(exec));
+ rend->layer()->scrollToYOffset(value->toInt32(exec));
break;
}
case ScrollLeft: {
khtml::RenderObject *rend = node.renderer();
if (rend && rend->hasOverflowClip())
- rend->layer()->scrollToXOffset(value.toInt32(exec));
+ rend->layer()->scrollToXOffset(value->toInt32(exec));
break;
}
default:
@@ -603,7 +602,7 @@
}
}
-Value DOMNode::toPrimitive(ExecState *exec, Type /*preferred*/) const
+ValueImp *DOMNode::toPrimitive(ExecState *exec, Type /*preferred*/) const
{
if (m_impl.isNull())
return Null();
@@ -623,7 +622,7 @@
m_impl->setHTMLEventListener(eventId, Window::retrieveActive(exec)->getJSEventListener(func, true));
}
-Value DOMNode::getListener(int eventId) const
+ValueImp *DOMNode::getListener(int eventId) const
{
DOM::EventListener *listener = m_impl->getHTMLEventListener(eventId);
JSEventListener *jsListener = static_cast<JSEventListener*>(listener);
@@ -637,38 +636,38 @@
{
}
-Value DOMNodeProtoFunc::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *DOMNodeProtoFunc::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (!thisObj.inherits(&DOMNode::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&DOMNode::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
DOMExceptionTranslator exception(exec);
- NodeImpl &node = *static_cast<DOMNode *>(thisObj.imp())->impl();
+ NodeImpl &node = *static_cast<DOMNode *>(thisObj)->impl();
switch (id) {
case DOMNode::HasAttributes:
return Boolean(node.hasAttributes());
case DOMNode::HasChildNodes:
return Boolean(node.hasChildNodes());
case DOMNode::CloneNode:
- return getDOMNode(exec,node.cloneNode(args[0].toBoolean(exec)));
+ return getDOMNode(exec,node.cloneNode(args[0]->toBoolean(exec)));
case DOMNode::Normalize:
node.normalize();
return Undefined();
case DOMNode::IsSupported:
- return Boolean(node.isSupported(args[0].toString(exec).string(),
- (args[1].type() != UndefinedType && args[1].type() != NullType) ? args[1].toString(exec).string() : DOMString()));
+ return Boolean(node.isSupported(args[0]->toString(exec).string(),
+ args[1]->isUndefinedOrNull() ? DOMString() : args[1]->toString(exec).string()));
case DOMNode::AddEventListener: {
JSEventListener *listener = Window::retrieveActive(exec)->getJSEventListener(args[1]);
if (listener)
- node.addEventListener(args[0].toString(exec).string(),listener,args[2].toBoolean(exec));
+ node.addEventListener(args[0]->toString(exec).string(),listener,args[2]->toBoolean(exec));
return Undefined();
}
case DOMNode::RemoveEventListener: {
JSEventListener *listener = Window::retrieveActive(exec)->getJSEventListener(args[1]);
if (listener)
- node.removeEventListener(args[0].toString(exec).string(),listener,args[2].toBoolean(exec));
+ node.removeEventListener(args[0]->toString(exec).string(),listener,args[2]->toBoolean(exec));
return Undefined();
}
case DOMNode::DispatchEvent:
@@ -689,7 +688,7 @@
// when the parameter is not a node? When the object is not an element?
return Undefined();
case DOMNode::Item:
- return getDOMNode(exec, node.childNodes()->item(args[0].toInt32(exec)));
+ return getDOMNode(exec, node.childNodes()->item(args[0]->toInt32(exec)));
}
return Undefined();
@@ -718,7 +717,7 @@
ScriptInterpreter::forgetDOMObject(m_impl.get());
}
-Value DOMNodeList::toPrimitive(ExecState *exec, Type /*preferred*/) const
+ValueImp *DOMNodeList::toPrimitive(ExecState *exec, Type /*preferred*/) const
{
if (m_impl.isNull())
return Null();
@@ -726,19 +725,19 @@
return String(toString(exec));
}
-Value DOMNodeList::getValueProperty(ExecState *exec, int token) const
+ValueImp *DOMNodeList::getValueProperty(ExecState *exec, int token) const
{
assert(token == Length);
return Number(m_impl->length());
}
-Value DOMNodeList::indexGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *DOMNodeList::indexGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
DOMNodeList *thisObj = static_cast<DOMNodeList *>(slot.slotBase());
return getDOMNode(exec, thisObj->m_impl->item(slot.index()));
}
-Value DOMNodeList::nameGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *DOMNodeList::nameGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
DOMNodeList *thisObj = static_cast<DOMNodeList *>(slot.slotBase());
return getDOMNode(exec, thisObj->m_impl->itemById(propertyName.string()));
@@ -775,10 +774,10 @@
}
// Need to support both get and call, so that list[0] and list(0) work.
-Value DOMNodeList::call(ExecState *exec, Object &, const List &args)
+ValueImp *DOMNodeList::callAsFunction(ExecState *exec, ObjectImp *, const List &args)
{
// Do not use thisObj here. See HTMLCollection.
- UString s = args[0].toString(exec);
+ UString s = args[0]->toString(exec);
bool ok;
unsigned int u = s.toULong(&ok);
if (ok)
@@ -788,26 +787,25 @@
}
DOMNodeListFunc::DOMNodeListFunc(ExecState *exec, int i, int len)
- : DOMFunction(), id(i)
+ : id(i)
{
- Value protect(this);
put(exec,lengthPropertyName,Number(len),DontDelete|ReadOnly|DontEnum);
}
// Not a prototype class currently, but should probably be converted to one
-Value DOMNodeListFunc::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *DOMNodeListFunc::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (!thisObj.inherits(&KJS::DOMNodeList::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&KJS::DOMNodeList::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
- DOM::NodeListImpl &list = *static_cast<DOMNodeList *>(thisObj.imp())->impl();
- Value result;
+ DOM::NodeListImpl &list = *static_cast<DOMNodeList *>(thisObj)->impl();
- if (id == Item)
- result = getDOMNode(exec, list.item(args[0].toInt32(exec)));
- return result;
+ if (id == DOMNodeList::Item)
+ return getDOMNode(exec, list.item(args[0]->toInt32(exec)));
+
+ return jsUndefined();
}
// -------------------------------------------------------------------------
@@ -833,7 +831,7 @@
return getStaticValueSlot<DOMAttr, DOMNode>(exec, &DOMAttrTable, this, propertyName, slot);
}
-Value DOMAttr::getValueProperty(ExecState *exec, int token) const
+ValueImp *DOMAttr::getValueProperty(ExecState *exec, int token) const
{
AttrImpl *attr = static_cast<AttrImpl *>(impl());
switch (token) {
@@ -846,10 +844,10 @@
case OwnerElement: // DOM2
return getDOMNode(exec, attr->ownerElement());
}
- return Value(); // not reached
+ return NULL; // not reached
}
-void DOMAttr::put(ExecState *exec, const Identifier &propertyName, const Value& value, int attr)
+void DOMAttr::put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr)
{
#ifdef KJS_VERBOSE
kdDebug(6070) << "DOMAttr::put " << propertyName.qstring() << endl;
@@ -858,12 +856,12 @@
&DOMAttrTable, this );
}
-void DOMAttr::putValueProperty(ExecState *exec, int token, const Value& value, int /*attr*/)
+void DOMAttr::putValueProperty(ExecState *exec, int token, ValueImp *value, int /*attr*/)
{
DOMExceptionTranslator exception(exec);
switch (token) {
case ValueProperty:
- static_cast<AttrImpl *>(impl())->setValue(value.toString(exec).string(), exception);
+ static_cast<AttrImpl *>(impl())->setValue(value->toString(exec).string(), exception);
return;
default:
kdWarning() << "DOMAttr::putValueProperty unhandled token " << token << endl;
@@ -949,7 +947,7 @@
return getStaticValueSlot<DOMDocument, DOMNode>(exec, &DOMDocumentTable, this, propertyName, slot);
}
-Value DOMDocument::getValueProperty(ExecState *exec, int token) const
+ValueImp *DOMDocument::getValueProperty(ExecState *exec, int token) const
{
DocumentImpl &doc = *static_cast<DocumentImpl *>(impl());
@@ -980,11 +978,11 @@
return getDOMAbstractView(exec,doc.defaultView());
default:
kdWarning() << "DOMDocument::getValueProperty unhandled token " << token << endl;
- return Value();
+ return NULL;
}
}
-void DOMDocument::put(ExecState *exec, const Identifier& propertyName, const Value& value, int attr)
+void DOMDocument::put(ExecState *exec, const Identifier& propertyName, ValueImp *value, int attr)
{
#ifdef KJS_VERBOSE
kdDebug(6070) << "DOMDocument::put " << propertyName.qstring() << endl;
@@ -992,29 +990,29 @@
lookupPut<DOMDocument,DOMNode>(exec, propertyName, value, attr, &DOMDocumentTable, this );
}
-void DOMDocument::putValueProperty(ExecState *exec, int token, const Value& value, int /*attr*/)
+void DOMDocument::putValueProperty(ExecState *exec, int token, ValueImp *value, int /*attr*/)
{
DocumentImpl &doc = *static_cast<DocumentImpl *>(impl());
switch (token) {
case SelectedStylesheetSet: {
- doc.setSelectedStylesheetSet(value.toString(exec).string());
+ doc.setSelectedStylesheetSet(value->toString(exec).string());
break;
}
}
}
-Value DOMDocumentProtoFunc::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *DOMDocumentProtoFunc::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (!thisObj.inherits(&KJS::DOMNode::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&KJS::DOMNode::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
DOMExceptionTranslator exception(exec);
- NodeImpl &node = *static_cast<DOMNode *>(thisObj.imp())->impl();
+ NodeImpl &node = *static_cast<DOMNode *>(thisObj)->impl();
DocumentImpl &doc = static_cast<DocumentImpl &>(node);
- String str = args[0].toString(exec);
- DOM::DOMString s = str.value().string();
+ UString str = args[0]->toString(exec);
+ DOM::DOMString s = str.string();
switch(id) {
case DOMDocument::CreateElement:
@@ -1028,72 +1026,72 @@
case DOMDocument::CreateCDATASection:
return getDOMNode(exec,doc.createCDATASection(s)); /* TODO: okay ? */
case DOMDocument::CreateProcessingInstruction:
- return getDOMNode(exec,doc.createProcessingInstruction(args[0].toString(exec).string(),
- args[1].toString(exec).string()));
+ return getDOMNode(exec,doc.createProcessingInstruction(args[0]->toString(exec).string(),
+ args[1]->toString(exec).string()));
case DOMDocument::CreateAttribute:
return getDOMNode(exec,doc.createAttribute(s, exception));
case DOMDocument::CreateEntityReference:
return getDOMNode(exec,doc.createEntityReference(s));
case DOMDocument::ElementFromPoint:
- return getDOMNode(exec,doc.elementFromPoint((int)args[0].toNumber(exec), (int)args[1].toNumber(exec)));
+ return getDOMNode(exec,doc.elementFromPoint((int)args[0]->toNumber(exec), (int)args[1]->toNumber(exec)));
case DOMDocument::GetElementsByTagName:
return getDOMNodeList(exec,doc.getElementsByTagName(s).get());
case DOMDocument::ImportNode: // DOM2
- return getDOMNode(exec,doc.importNode(toNode(args[0]), args[1].toBoolean(exec), exception));
+ return getDOMNode(exec,doc.importNode(toNode(args[0]), args[1]->toBoolean(exec), exception));
case DOMDocument::CreateElementNS: // DOM2
- return getDOMNode(exec,doc.createElementNS(s, args[1].toString(exec).string(), exception));
+ return getDOMNode(exec,doc.createElementNS(s, args[1]->toString(exec).string(), exception));
case DOMDocument::CreateAttributeNS: // DOM2
- return getDOMNode(exec,doc.createAttributeNS(s, args[1].toString(exec).string(), exception));
+ return getDOMNode(exec,doc.createAttributeNS(s, args[1]->toString(exec).string(), exception));
case DOMDocument::GetElementsByTagNameNS: // DOM2
- return getDOMNodeList(exec,doc.getElementsByTagNameNS(s, args[1].toString(exec).string()).get());
+ return getDOMNodeList(exec,doc.getElementsByTagNameNS(s, args[1]->toString(exec).string()).get());
case DOMDocument::GetElementById:
- return getDOMNode(exec,doc.getElementById(args[0].toString(exec).string()));
+ return getDOMNode(exec,doc.getElementById(args[0]->toString(exec).string()));
case DOMDocument::CreateRange:
return getDOMRange(exec,doc.createRange());
case DOMDocument::CreateNodeIterator: {
NodeFilterImpl *filter = 0;
- ValueImp *arg2 = args.impAt(2);
+ ValueImp *arg2 = args[2];
if (arg2->isObject()) {
- Object o(static_cast<ObjectImp *>(arg2));
+ ObjectImp *o(static_cast<ObjectImp *>(arg2));
filter = new NodeFilterImpl(new JSNodeFilterCondition(o));
}
- return getDOMNodeIterator(exec,doc.createNodeIterator(toNode(args[0]), args[1].toUInt32(exec),
- filter, args[3].toBoolean(exec), exception));
+ return getDOMNodeIterator(exec,doc.createNodeIterator(toNode(args[0]), args[1]->toUInt32(exec),
+ filter, args[3]->toBoolean(exec), exception));
}
case DOMDocument::CreateTreeWalker: {
NodeFilterImpl *filter = 0;
- ValueImp *arg2 = args.impAt(2);
+ ValueImp *arg2 = args[2];
if (arg2->isObject()) {
- Object o(static_cast<ObjectImp *>(arg2));
+ ObjectImp *o(static_cast<ObjectImp *>(arg2));
filter = new NodeFilterImpl(new JSNodeFilterCondition(o));
}
- return getDOMTreeWalker(exec,doc.createTreeWalker(toNode(args[0]), args[1].toUInt32(exec),
- filter, args[3].toBoolean(exec), exception));
+ return getDOMTreeWalker(exec,doc.createTreeWalker(toNode(args[0]), args[1]->toUInt32(exec),
+ filter, args[3]->toBoolean(exec), exception));
}
case DOMDocument::CreateEvent:
return getDOMEvent(exec,doc.createEvent(s, exception));
case DOMDocument::GetOverrideStyle:
if (ElementImpl *element0 = toElement(args[0]))
- return getDOMCSSStyleDeclaration(exec,doc.getOverrideStyle(element0, args[1].toString(exec).string()));
+ return getDOMCSSStyleDeclaration(exec,doc.getOverrideStyle(element0, args[1]->toString(exec).string()));
// FIXME: Is undefined right here, or should we raise an exception?
return Undefined();
case DOMDocument::ExecCommand: {
- return Boolean(doc.execCommand(args[0].toString(exec).string(), args[1].toBoolean(exec), args[2].toString(exec).string()));
+ return Boolean(doc.execCommand(args[0]->toString(exec).string(), args[1]->toBoolean(exec), args[2]->toString(exec).string()));
}
case DOMDocument::QueryCommandEnabled: {
- return Boolean(doc.queryCommandEnabled(args[0].toString(exec).string()));
+ return Boolean(doc.queryCommandEnabled(args[0]->toString(exec).string()));
}
case DOMDocument::QueryCommandIndeterm: {
- return Boolean(doc.queryCommandIndeterm(args[0].toString(exec).string()));
+ return Boolean(doc.queryCommandIndeterm(args[0]->toString(exec).string()));
}
case DOMDocument::QueryCommandState: {
- return Boolean(doc.queryCommandState(args[0].toString(exec).string()));
+ return Boolean(doc.queryCommandState(args[0]->toString(exec).string()));
}
case DOMDocument::QueryCommandSupported: {
- return Boolean(doc.queryCommandSupported(args[0].toString(exec).string()));
+ return Boolean(doc.queryCommandSupported(args[0]->toString(exec).string()));
}
case DOMDocument::QueryCommandValue: {
- DOM::DOMString commandValue(doc.queryCommandValue(args[0].toString(exec).string()));
+ DOM::DOMString commandValue(doc.queryCommandValue(args[0]->toString(exec).string()));
// Method returns null DOMString to signal command is unsupported.
// Microsoft documentation for this method says:
// "If not supported [for a command identifier], this method returns a Boolean set to false."
@@ -1158,7 +1156,7 @@
{
}
-Value DOMElement::getValueProperty(ExecState *exec, int token) const
+ValueImp *DOMElement::getValueProperty(ExecState *exec, int token) const
{
ElementImpl *element = static_cast<ElementImpl *>(impl());
switch (token) {
@@ -1172,7 +1170,7 @@
}
}
-Value DOMElement::attributeGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *DOMElement::attributeGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
DOMElement *thisObj = static_cast<DOMElement *>(slot.slotBase());
@@ -1195,8 +1193,8 @@
if (DOMNode::getOwnPropertySlot(exec, propertyName, slot))
return true;
- ValueImp *proto = prototype().imp();
- if (proto->dispatchType() == ObjectType && static_cast<ObjectImp *>(proto)->hasProperty(exec, propertyName))
+ ValueImp *proto = prototype();
+ if (proto->isObject() && static_cast<ObjectImp *>(proto)->hasProperty(exec, propertyName))
return false;
ElementImpl &element = *static_cast<ElementImpl *>(impl());
@@ -1212,57 +1210,57 @@
return false;
}
-Value DOMElementProtoFunc::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *DOMElementProtoFunc::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (!thisObj.inherits(&KJS::DOMNode::info)) { // node should be enough here, given the cast
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&KJS::DOMNode::info)) { // node should be enough here, given the cast
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
DOMExceptionTranslator exception(exec);
- NodeImpl &node = *static_cast<DOMNode *>(thisObj.imp())->impl();
+ NodeImpl &node = *static_cast<DOMNode *>(thisObj)->impl();
ElementImpl &element = static_cast<ElementImpl &>(node);
switch(id) {
case DOMElement::GetAttribute:
// getStringOrNull should be used here, since if the attribute isn't present at all, you should
// return null and not "".
- return getStringOrNull(element.getAttribute(args[0].toString(exec).string()));
+ return getStringOrNull(element.getAttribute(args[0]->toString(exec).string()));
case DOMElement::SetAttribute:
- element.setAttribute(args[0].toString(exec).string(), args[1].toString(exec).string(), exception);
+ element.setAttribute(args[0]->toString(exec).string(), args[1]->toString(exec).string(), exception);
return Undefined();
case DOMElement::RemoveAttribute:
- element.removeAttribute(args[0].toString(exec).string(), exception);
+ element.removeAttribute(args[0]->toString(exec).string(), exception);
return Undefined();
case DOMElement::GetAttributeNode:
- return getDOMNode(exec,element.getAttributeNode(args[0].toString(exec).string()));
+ return getDOMNode(exec,element.getAttributeNode(args[0]->toString(exec).string()));
case DOMElement::SetAttributeNode:
return getDOMNode(exec,element.setAttributeNode(toAttr(args[0]), exception).get());
case DOMElement::RemoveAttributeNode:
return getDOMNode(exec,element.removeAttributeNode(toAttr(args[0]), exception).get());
case DOMElement::GetElementsByTagName:
- return getDOMNodeList(exec, element.getElementsByTagName(args[0].toString(exec).string()).get());
+ return getDOMNodeList(exec, element.getElementsByTagName(args[0]->toString(exec).string()).get());
case DOMElement::HasAttribute: // DOM2
- return Boolean(element.hasAttribute(args[0].toString(exec).string()));
+ return Boolean(element.hasAttribute(args[0]->toString(exec).string()));
case DOMElement::GetAttributeNS: // DOM2
- return String(element.getAttributeNS(args[0].toString(exec).string(),args[1].toString(exec).string()).string());
+ return String(element.getAttributeNS(args[0]->toString(exec).string(),args[1]->toString(exec).string()).string());
case DOMElement::SetAttributeNS: // DOM2
- element.setAttributeNS(args[0].toString(exec).string(), args[1].toString(exec).string(), args[2].toString(exec).string(), exception);
+ element.setAttributeNS(args[0]->toString(exec).string(), args[1]->toString(exec).string(), args[2]->toString(exec).string(), exception);
return Undefined();
case DOMElement::RemoveAttributeNS: // DOM2
- element.removeAttributeNS(args[0].toString(exec).string(), args[1].toString(exec).string(), exception);
+ element.removeAttributeNS(args[0]->toString(exec).string(), args[1]->toString(exec).string(), exception);
return Undefined();
case DOMElement::GetAttributeNodeNS: // DOM2
- return getDOMNode(exec,element.getAttributeNodeNS(args[0].toString(exec).string(),args[1].toString(exec).string()));
+ return getDOMNode(exec,element.getAttributeNodeNS(args[0]->toString(exec).string(),args[1]->toString(exec).string()));
case DOMElement::SetAttributeNodeNS: // DOM2
return getDOMNode(exec, element.setAttributeNodeNS(toAttr(args[0]), exception).get());
case DOMElement::GetElementsByTagNameNS: // DOM2
- return getDOMNodeList(exec, element.getElementsByTagNameNS(args[0].toString(exec).string() ,args[1].toString(exec).string()).get());
+ return getDOMNodeList(exec, element.getElementsByTagNameNS(args[0]->toString(exec).string() ,args[1]->toString(exec).string()).get());
case DOMElement::HasAttributeNS: // DOM2
- return Boolean(element.hasAttributeNS(args[0].toString(exec).string(),args[1].toString(exec).string()));
+ return Boolean(element.hasAttributeNS(args[0]->toString(exec).string(),args[1]->toString(exec).string()));
case DOMElement::ScrollIntoView:
- (args[0].type() != UndefinedType && args[0].type() != NullType) ? element.scrollIntoView(args[0].toBoolean(exec)) : element.scrollIntoView(true);
- return Undefined();
+ element.scrollIntoView(args[0]->isUndefinedOrNull() || args[0]->toBoolean(exec));
+ return Undefined();
case DOMElement::ScrollByLines:
case DOMElement::ScrollByPages:
if (DocumentImpl* doc = element.getDocument()) {
@@ -1270,7 +1268,7 @@
if (RenderObject *rend = element.renderer())
if (rend->hasOverflowClip()) {
KWQScrollDirection direction = KWQScrollDown;
- int multiplier = args[0].toInt32(exec);
+ int multiplier = args[0]->toInt32(exec);
if (multiplier < 0) {
direction = KWQScrollUp;
multiplier = -multiplier;
@@ -1321,30 +1319,30 @@
ScriptInterpreter::forgetDOMObject(m_impl.get());
}
-Value DOMDOMImplementationProtoFunc::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *DOMDOMImplementationProtoFunc::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (!thisObj.inherits(&KJS::DOMDOMImplementation::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&KJS::DOMDOMImplementation::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
DOMExceptionTranslator exception(exec);
- DOMImplementationImpl &implementation = *static_cast<DOMDOMImplementation *>(thisObj.imp())->impl();
+ DOMImplementationImpl &implementation = *static_cast<DOMDOMImplementation *>(thisObj)->impl();
switch(id) {
case DOMDOMImplementation::HasFeature:
- return Boolean(implementation.hasFeature(args[0].toString(exec).string(),
- (args[1].type() != UndefinedType && args[1].type() != NullType) ? args[1].toString(exec).string() : DOMString()));
+ return Boolean(implementation.hasFeature(args[0]->toString(exec).string(),
+ args[1]->isUndefinedOrNull() ? DOMString() : args[1]->toString(exec).string()));
case DOMDOMImplementation::CreateDocumentType: // DOM2
- return getDOMNode(exec, implementation.createDocumentType(args[0].toString(exec).string(),
- args[1].toString(exec).string(), args[2].toString(exec).string(), exception));
+ return getDOMNode(exec, implementation.createDocumentType(args[0]->toString(exec).string(),
+ args[1]->toString(exec).string(), args[2]->toString(exec).string(), exception));
case DOMDOMImplementation::CreateDocument: // DOM2
- return getDOMNode(exec, implementation.createDocument(args[0].toString(exec).string(),
- args[1].toString(exec).string(), toDocumentType(args[2]), exception));
+ return getDOMNode(exec, implementation.createDocument(args[0]->toString(exec).string(),
+ args[1]->toString(exec).string(), toDocumentType(args[2]), exception));
case DOMDOMImplementation::CreateCSSStyleSheet: // DOM2
- return getDOMStyleSheet(exec, implementation.createCSSStyleSheet(args[0].toString(exec).string(), args[1].toString(exec).string(), exception));
+ return getDOMStyleSheet(exec, implementation.createCSSStyleSheet(args[0]->toString(exec).string(), args[1]->toString(exec).string(), exception));
case DOMDOMImplementation::CreateHTMLDocument: // DOM2-HTML
- return getDOMNode(exec, implementation.createHTMLDocument(args[0].toString(exec).string()));
+ return getDOMNode(exec, implementation.createHTMLDocument(args[0]->toString(exec).string()));
default:
break;
}
@@ -1374,7 +1372,7 @@
return getStaticValueSlot<DOMDocumentType, DOMNode>(exec, &DOMDocumentTypeTable, this, propertyName, slot);
}
-Value DOMDocumentType::getValueProperty(ExecState *exec, int token) const
+ValueImp *DOMDocumentType::getValueProperty(ExecState *exec, int token) const
{
DocumentTypeImpl &type = *static_cast<DocumentTypeImpl *>(impl());
switch (token) {
@@ -1392,7 +1390,7 @@
return getStringOrNull(type.internalSubset());
default:
kdWarning() << "DOMDocumentType::getValueProperty unhandled token " << token << endl;
- return Value();
+ return NULL;
}
}
@@ -1434,13 +1432,13 @@
ScriptInterpreter::forgetDOMObject(m_impl.get());
}
-Value DOMNamedNodeMap::lengthGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *DOMNamedNodeMap::lengthGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
{
DOMNamedNodeMap *thisObj = static_cast<DOMNamedNodeMap *>(slot.slotBase());
return Number(thisObj->m_impl->length());
}
-Value DOMNamedNodeMap::indexGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *DOMNamedNodeMap::indexGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
{
DOMNamedNodeMap *thisObj = static_cast<DOMNamedNodeMap *>(slot.slotBase());
return getDOMNode(exec, thisObj->m_impl->item(slot.index()));
@@ -1465,31 +1463,31 @@
return DOMObject::getOwnPropertySlot(exec, propertyName, slot);
}
-Value DOMNamedNodeMapProtoFunc::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *DOMNamedNodeMapProtoFunc::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (!thisObj.inherits(&KJS::DOMNamedNodeMap::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&KJS::DOMNamedNodeMap::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
DOMExceptionTranslator exception(exec);
- NamedNodeMapImpl &map = *static_cast<DOMNamedNodeMap *>(thisObj.imp())->impl();
+ NamedNodeMapImpl &map = *static_cast<DOMNamedNodeMap *>(thisObj)->impl();
switch(id) {
case DOMNamedNodeMap::GetNamedItem:
- return getDOMNode(exec, map.getNamedItem(args[0].toString(exec).string()));
+ return getDOMNode(exec, map.getNamedItem(args[0]->toString(exec).string()));
case DOMNamedNodeMap::SetNamedItem:
return getDOMNode(exec, map.setNamedItem(toNode(args[0]), exception).get());
case DOMNamedNodeMap::RemoveNamedItem:
- return getDOMNode(exec, map.removeNamedItem(args[0].toString(exec).string(), exception).get());
+ return getDOMNode(exec, map.removeNamedItem(args[0]->toString(exec).string(), exception).get());
case DOMNamedNodeMap::Item:
- return getDOMNode(exec, map.item(args[0].toInt32(exec)));
+ return getDOMNode(exec, map.item(args[0]->toInt32(exec)));
case DOMNamedNodeMap::GetNamedItemNS: // DOM2
- return getDOMNode(exec, map.getNamedItemNS(args[0].toString(exec).string(), args[1].toString(exec).string()));
+ return getDOMNode(exec, map.getNamedItemNS(args[0]->toString(exec).string(), args[1]->toString(exec).string()));
case DOMNamedNodeMap::SetNamedItemNS: // DOM2
return getDOMNode(exec, map.setNamedItemNS(toNode(args[0]), exception).get());
case DOMNamedNodeMap::RemoveNamedItemNS: // DOM2
- return getDOMNode(exec, map.removeNamedItemNS(args[0].toString(exec).string(), args[1].toString(exec).string(), exception).get());
+ return getDOMNode(exec, map.removeNamedItemNS(args[0]->toString(exec).string(), args[1]->toString(exec).string(), exception).get());
default:
break;
}
@@ -1519,7 +1517,7 @@
return getStaticValueSlot<DOMProcessingInstruction, DOMNode>(exec, &DOMProcessingInstructionTable, this, propertyName, slot);
}
-Value DOMProcessingInstruction::getValueProperty(ExecState *exec, int token) const
+ValueImp *DOMProcessingInstruction::getValueProperty(ExecState *exec, int token) const
{
ProcessingInstructionImpl *pi = static_cast<ProcessingInstructionImpl *>(impl());
switch (token) {
@@ -1531,17 +1529,17 @@
return getDOMStyleSheet(exec,pi->sheet());
default:
kdWarning() << "DOMProcessingInstruction::getValueProperty unhandled token " << token << endl;
- return Value();
+ return NULL;
}
}
-void DOMProcessingInstruction::put(ExecState *exec, const Identifier &propertyName, const Value& value, int attr)
+void DOMProcessingInstruction::put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr)
{
ProcessingInstructionImpl *pi = static_cast<ProcessingInstructionImpl *>(impl());
DOMExceptionTranslator exception(exec);
// Not worth using the hashtable for this one ;)
if (propertyName == "data")
- pi->setData(value.toString(exec).string(), exception);
+ pi->setData(value->toString(exec).string(), exception);
else
DOMNode::put(exec, propertyName, value, attr);
}
@@ -1567,7 +1565,7 @@
return getStaticValueSlot<DOMNotation, DOMNode>(exec, &DOMNotationTable, this, propertyName, slot);
}
-Value DOMNotation::getValueProperty(ExecState *, int token) const
+ValueImp *DOMNotation::getValueProperty(ExecState *, int token) const
{
switch (token) {
case PublicId:
@@ -1576,7 +1574,7 @@
return getStringOrNull(static_cast<NotationImpl *>(impl())->systemId());
default:
kdWarning() << "DOMNotation::getValueProperty unhandled token " << token << endl;
- return Value();
+ return NULL;
}
}
@@ -1602,7 +1600,7 @@
return getStaticValueSlot<DOMEntity, DOMNode>(exec, &DOMEntityTable, this, propertyName, slot);
}
-Value DOMEntity::getValueProperty(ExecState *, int token) const
+ValueImp *DOMEntity::getValueProperty(ExecState *, int token) const
{
switch (token) {
case PublicId:
@@ -1613,7 +1611,7 @@
return getStringOrNull(static_cast<EntityImpl *>(impl())->notationName());
default:
kdWarning() << "DOMEntity::getValueProperty unhandled token " << token << endl;
- return Value();
+ return NULL;
}
}
@@ -1776,7 +1774,7 @@
return getStaticValueSlot<NodeConstructor, DOMObject>(exec, &NodeConstructorTable, this, propertyName, slot);
}
-Value NodeConstructor::getValueProperty(ExecState *, int token) const
+ValueImp *NodeConstructor::getValueProperty(ExecState *, int token) const
{
// We use the token as the value to return directly
return Number((unsigned int)token);
@@ -1808,7 +1806,7 @@
return Number((unsigned int)DOM::Node::NOTATION_NODE);
default:
kdWarning() << "NodeConstructor::getValueProperty unhandled token " << token << endl;
- return Value();
+ return NULL;
}
#endif
}
@@ -1847,7 +1845,7 @@
return getStaticValueSlot<DOMExceptionConstructor, DOMObject>(exec, &DOMExceptionConstructorTable, this, propertyName, slot);
}
-Value DOMExceptionConstructor::getValueProperty(ExecState *, int token) const
+ValueImp *DOMExceptionConstructor::getValueProperty(ExecState *, int token) const
{
// We use the token as the value to return directly
return Number((unsigned int)token);
@@ -1885,7 +1883,7 @@
return Number((unsigned int)DOM::DOMException::INVALID_ACCESS_ERR);
default:
kdWarning() << "DOMExceptionConstructor::getValueProperty unhandled token " << token << endl;
- return Value();
+ return NULL;
}
#endif
}
@@ -1905,13 +1903,13 @@
{
}
-Value DOMNamedNodesCollection::lengthGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *DOMNamedNodesCollection::lengthGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
{
DOMNamedNodesCollection *thisObj = static_cast<DOMNamedNodesCollection *>(slot.slotBase());
return Number(thisObj->m_nodes.count());
}
-Value DOMNamedNodesCollection::indexGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *DOMNamedNodesCollection::indexGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
{
DOMNamedNodesCollection *thisObj = static_cast<DOMNamedNodesCollection *>(slot.slotBase());
return getDOMNode(exec, thisObj->m_nodes[slot.index()].get());
@@ -1986,7 +1984,7 @@
return getStaticValueSlot<DOMCharacterData, DOMNode>(exec, &DOMCharacterDataTable, this, propertyName, slot);
}
-Value DOMCharacterData::getValueProperty(ExecState *, int token) const
+ValueImp *DOMCharacterData::getValueProperty(ExecState *, int token) const
{
CharacterDataImpl &data = *static_cast<CharacterDataImpl *>(impl());
switch (token) {
@@ -1996,56 +1994,56 @@
return Number(data.length());
default:
kdWarning() << "Unhandled token in DOMCharacterData::getValueProperty : " << token << endl;
- return Value();
+ return NULL;
}
}
-void DOMCharacterData::put(ExecState *exec, const Identifier &propertyName, const Value& value, int attr)
+void DOMCharacterData::put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr)
{
DOMExceptionTranslator exception(exec);
if (propertyName == "data")
- static_cast<CharacterDataImpl *>(impl())->setData(value.toString(exec).string(), exception);
+ static_cast<CharacterDataImpl *>(impl())->setData(value->toString(exec).string(), exception);
else
DOMNode::put(exec, propertyName,value,attr);
}
-Value DOMCharacterDataProtoFunc::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *DOMCharacterDataProtoFunc::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (!thisObj.inherits(&KJS::DOMCharacterData::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&KJS::DOMCharacterData::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
DOMExceptionTranslator exception(exec);
- CharacterDataImpl &data = *static_cast<CharacterDataImpl *>(static_cast<DOMCharacterData *>(thisObj.imp())->impl());
+ CharacterDataImpl &data = *static_cast<CharacterDataImpl *>(static_cast<DOMCharacterData *>(thisObj)->impl());
switch(id) {
case DOMCharacterData::SubstringData: {
- const int count = args[1].toInt32(exec);
+ const int count = args[1]->toInt32(exec);
if (count < 0)
setDOMException(exec, DOMException::INDEX_SIZE_ERR);
else
- return getStringOrNull(data.substringData(args[0].toInt32(exec), count, exception));
+ return getStringOrNull(data.substringData(args[0]->toInt32(exec), count, exception));
}
case DOMCharacterData::AppendData:
- data.appendData(args[0].toString(exec).string(), exception);
+ data.appendData(args[0]->toString(exec).string(), exception);
return Undefined();
case DOMCharacterData::InsertData:
- data.insertData(args[0].toInt32(exec), args[1].toString(exec).string(), exception);
+ data.insertData(args[0]->toInt32(exec), args[1]->toString(exec).string(), exception);
return Undefined();
case DOMCharacterData::DeleteData: {
- const int count = args[1].toInt32(exec);
+ const int count = args[1]->toInt32(exec);
if (count < 0)
setDOMException(exec, DOMException::INDEX_SIZE_ERR);
else
- data.deleteData(args[0].toInt32(exec), count, exception);
+ data.deleteData(args[0]->toInt32(exec), count, exception);
return Undefined();
}
case DOMCharacterData::ReplaceData: {
- const int count = args[1].toInt32(exec);
+ const int count = args[1]->toInt32(exec);
if (count < 0)
setDOMException(exec, DOMException::INDEX_SIZE_ERR);
else
- data.replaceData(args[0].toInt32(exec), count, args[2].toString(exec).string(), exception);
+ data.replaceData(args[0]->toInt32(exec), count, args[2]->toString(exec).string(), exception);
return Undefined();
}
default:
@@ -2072,18 +2070,18 @@
setPrototype(DOMTextProto::self(exec));
}
-Value DOMTextProtoFunc::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *DOMTextProtoFunc::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (!thisObj.inherits(&KJS::DOMText::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&KJS::DOMText::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
DOMExceptionTranslator exception(exec);
- TextImpl &text = *static_cast<TextImpl *>(static_cast<DOMText *>(thisObj.imp())->impl());
+ TextImpl &text = *static_cast<TextImpl *>(static_cast<DOMText *>(thisObj)->impl());
switch(id) {
case DOMText::SplitText:
- return getDOMNode(exec, text.splitText(args[0].toInt32(exec), exception));
+ return getDOMNode(exec, text.splitText(args[0]->toInt32(exec), exception));
}
return Undefined();
}
1.48 +31 -31 WebCore/khtml/ecma/kjs_dom.h
Index: kjs_dom.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_dom.h,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- kjs_dom.h 7 Aug 2005 18:46:44 -0000 1.47
+++ kjs_dom.h 8 Aug 2005 04:07:41 -0000 1.48
@@ -50,18 +50,18 @@
virtual ~DOMNode();
virtual bool toBoolean(ExecState *) const;
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
virtual void mark();
- virtual void put(ExecState *exec, const Identifier &propertyName, const Value& value, int attr = None);
- void putValueProperty(ExecState *exec, int token, const Value& value, int attr);
+ virtual void put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr = None);
+ void putValueProperty(ExecState *exec, int token, ValueImp *value, int attr);
DOM::NodeImpl *impl() const { return m_impl.get(); }
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
- virtual Value toPrimitive(ExecState *exec, Type preferred = UndefinedType) const;
+ virtual ValueImp *toPrimitive(ExecState *exec, Type preferred = UndefinedType) const;
virtual UString toString(ExecState *exec) const;
void setListener(ExecState *exec, int eventId, ValueImp *func) const;
- Value getListener(int eventId) const;
+ ValueImp *getListener(int eventId) const;
virtual void pushEventHandlerScope(ExecState *exec, ScopeChain &scope) const;
enum { NodeName, NodeValue, NodeType, ParentNode, ParentElement,
@@ -92,8 +92,8 @@
DOMNodeList(ExecState *, DOM::NodeListImpl *l) : m_impl(l) { }
~DOMNodeList();
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
- virtual Value call(ExecState *exec, Object &thisObj, const List&args);
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
+ virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List&args);
virtual bool implementsCall() const { return true; }
// no put - all read-only
virtual const ClassInfo* classInfo() const { return &info; }
@@ -102,11 +102,11 @@
enum { Length, Item };
DOM::NodeListImpl *impl() const { return m_impl.get(); }
- virtual Value toPrimitive(ExecState *exec, Type preferred = UndefinedType) const;
+ virtual ValueImp *toPrimitive(ExecState *exec, Type preferred = UndefinedType) const;
private:
- static Value indexGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
- static Value nameGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
+ static ValueImp *indexGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
+ static ValueImp *nameGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
khtml::SharedPtr<DOM::NodeListImpl> m_impl;
};
@@ -116,9 +116,9 @@
DOMDocument(ExecState *exec, DOM::DocumentImpl *d);
~DOMDocument();
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
- virtual void put(ExecState *exec, const Identifier &propertyName, const Value& value, int attr = None);
- void putValueProperty(ExecState *exec, int token, const Value& value, int attr);
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
+ virtual void put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr = None);
+ void putValueProperty(ExecState *exec, int token, ValueImp *value, int attr);
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
enum { DocType, Implementation, DocumentElement,
@@ -142,9 +142,9 @@
public:
DOMAttr(ExecState *exec, DOM::AttrImpl *a);
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- virtual void put(ExecState *exec, const Identifier &propertyName, const Value& value, int attr = None);
- Value getValueProperty(ExecState *exec, int token) const;
- void putValueProperty(ExecState *exec, int token, const Value& value, int attr);
+ virtual void put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr = None);
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
+ void putValueProperty(ExecState *exec, int token, ValueImp *value, int attr);
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
enum { Name, Specified, ValueProperty, OwnerElement };
@@ -156,7 +156,7 @@
public:
DOMElement(ExecState *exec, DOM::ElementImpl *e);
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
// no put - all read-only
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
@@ -170,7 +170,7 @@
// Constructor for inherited classes; doesn't set up a prototype.
DOMElement(DOM::ElementImpl *e);
private:
- static Value attributeGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
+ static ValueImp *attributeGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
};
DOM::ElementImpl *toElement(ValueImp *); // returns 0 if passed-in value is not a DOMElement object
@@ -194,7 +194,7 @@
public:
DOMDocumentType(ExecState *exec, DOM::DocumentTypeImpl *dt);
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
// no put - all read-only
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
@@ -216,8 +216,8 @@
GetNamedItemNS, SetNamedItemNS, RemoveNamedItemNS };
DOM::NamedNodeMapImpl *impl() const { return m_impl.get(); }
private:
- static Value lengthGetter(ExecState* exec, const Identifier&, const PropertySlot& slot);
- static Value indexGetter(ExecState* exec, const Identifier&, const PropertySlot& slot);
+ static ValueImp *lengthGetter(ExecState* exec, const Identifier&, const PropertySlot& slot);
+ static ValueImp *indexGetter(ExecState* exec, const Identifier&, const PropertySlot& slot);
khtml::SharedPtr<DOM::NamedNodeMapImpl> m_impl;
};
@@ -226,8 +226,8 @@
public:
DOMProcessingInstruction(ExecState *exec, DOM::ProcessingInstructionImpl *pi);
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
- virtual void put(ExecState *exec, const Identifier &propertyName, const Value& value, int attr = None);
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
+ virtual void put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr = None);
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
enum { Target, Data, Sheet };
@@ -237,7 +237,7 @@
public:
DOMNotation(ExecState *exec, DOM::NotationImpl *n);
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
// no put - all read-only
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
@@ -248,7 +248,7 @@
public:
DOMEntity(ExecState *exec, DOM::EntityImpl *e);
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
// no put - all read-only
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
@@ -260,7 +260,7 @@
public:
NodeConstructor(ExecState *) { }
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
// no put - all read-only
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
@@ -271,7 +271,7 @@
public:
DOMExceptionConstructor(ExecState *) { }
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
// no put - all read-only
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
@@ -294,8 +294,8 @@
DOMNamedNodesCollection(ExecState *exec, const QValueList< khtml::SharedPtr<DOM::NodeImpl> >& nodes );
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
private:
- static Value lengthGetter(ExecState* exec, const Identifier&, const PropertySlot& slot);
- static Value indexGetter(ExecState* exec, const Identifier&, const PropertySlot& slot);
+ static ValueImp *lengthGetter(ExecState* exec, const Identifier&, const PropertySlot& slot);
+ static ValueImp *indexGetter(ExecState* exec, const Identifier&, const PropertySlot& slot);
QValueList< khtml::SharedPtr<DOM::NodeImpl> > m_nodes;
};
@@ -304,8 +304,8 @@
public:
DOMCharacterData(ExecState *exec, DOM::CharacterDataImpl *d);
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *, int token) const;
- virtual void put(ExecState *exec, const Identifier &propertyName, const Value& value, int attr = None);
+ ValueImp *getValueProperty(ExecState *, int token) const;
+ virtual void put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr = None);
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
DOM::CharacterDataImpl *toData() const;
1.54 +173 -174 WebCore/khtml/ecma/kjs_events.cpp
Index: kjs_events.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_events.cpp,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- kjs_events.cpp 7 Aug 2005 06:17:45 -0000 1.53
+++ kjs_events.cpp 8 Aug 2005 04:07:41 -0000 1.54
@@ -73,56 +73,56 @@
EventImpl *evt = ele.handle();
#endif
- Object listener = listenerObj();
- Object win = windowObj();
+ ObjectImp *listener = listenerObj();
+ ObjectImp *win = windowObj();
- KHTMLPart *part = static_cast<Window*>(win.imp())->part();
+ KHTMLPart *part = static_cast<Window*>(win)->part();
KJSProxy *proxy = 0;
if (part)
proxy = KJSProxy::proxy( part );
- if (proxy && listener.implementsCall()) {
+ if (proxy && listener->implementsCall()) {
ref();
- KJS::ScriptInterpreter *interpreter = static_cast<KJS::ScriptInterpreter *>(proxy->interpreter());
+ ScriptInterpreter *interpreter = static_cast<ScriptInterpreter *>(proxy->interpreter());
ExecState *exec = interpreter->globalExec();
List args;
args.append(getDOMEvent(exec,evt));
- Window *window = static_cast<Window*>(win.imp());
+ Window *window = static_cast<Window*>(win);
// Set the event we're handling in the Window object
window->setCurrentEvent(evt);
// ... and in the interpreter
interpreter->setCurrentEvent(evt);
- Object thisObj;
+ ObjectImp *thisObj;
if (isWindowEvent) {
thisObj = win;
} else {
- KJS::Interpreter::lock();
- thisObj = Object::dynamicCast(getDOMNode(exec, evt->currentTarget()));
- KJS::Interpreter::unlock();
+ Interpreter::lock();
+ thisObj = static_cast<ObjectImp *>(getDOMNode(exec, evt->currentTarget()));
+ Interpreter::unlock();
}
- KJS::Interpreter::lock();
- Value retval = listener.call(exec, thisObj, args);
- KJS::Interpreter::unlock();
+ Interpreter::lock();
+ ValueImp *retval = listener->call(exec, thisObj, args);
+ Interpreter::unlock();
window->setCurrentEvent( 0 );
interpreter->setCurrentEvent( 0 );
#if APPLE_CHANGES
if ( exec->hadException() ) {
- KJS::Interpreter::lock();
- char *message = exec->exception().toObject(exec).get(exec, messagePropertyName).toString(exec).ascii();
- int lineNumber = exec->exception().toObject(exec).get(exec, "line").toInt32(exec);
+ Interpreter::lock();
+ char *message = exec->exception()->toObject(exec)->get(exec, messagePropertyName)->toString(exec).ascii();
+ int lineNumber = exec->exception()->toObject(exec)->get(exec, "line")->toInt32(exec);
QString sourceURL;
{
// put this in a block to make sure UString is deallocated inside the lock
- UString uSourceURL = exec->exception().toObject(exec).get(exec, "sourceURL").toString(exec);
+ UString uSourceURL = exec->exception()->toObject(exec)->get(exec, "sourceURL")->toString(exec);
sourceURL = uSourceURL.qstring();
}
- KJS::Interpreter::unlock();
+ Interpreter::unlock();
if (Interpreter::shouldPrintExceptions()) {
printf("(event handler):%s\n", message);
}
@@ -155,75 +155,73 @@
// -------------------------------------------------------------------------
-JSUnprotectedEventListener::JSUnprotectedEventListener(Object _listener, const Object &_win, bool _html)
+JSUnprotectedEventListener::JSUnprotectedEventListener(ObjectImp *_listener, ObjectImp *_win, bool _html)
: JSAbstractEventListener(_html)
, listener(_listener)
, win(_win)
{
- if (_listener.imp()) {
- static_cast<Window*>(win.imp())->jsUnprotectedEventListeners.insert(_listener.imp(), this);
+ if (_listener) {
+ static_cast<Window*>(win)->jsUnprotectedEventListeners.insert(_listener, this);
}
}
JSUnprotectedEventListener::~JSUnprotectedEventListener()
{
- if (listener.imp()) {
- static_cast<Window*>(win.imp())->jsUnprotectedEventListeners.remove(listener.imp());
+ if (listener) {
+ static_cast<Window*>(win)->jsUnprotectedEventListeners.remove(listener);
}
}
-Object JSUnprotectedEventListener::listenerObj() const
+ObjectImp *JSUnprotectedEventListener::listenerObj() const
{
return listener;
}
-Object JSUnprotectedEventListener::windowObj() const
+ObjectImp *JSUnprotectedEventListener::windowObj() const
{
return win;
}
void JSUnprotectedEventListener::mark()
{
- ObjectImp *listenerImp = listener.imp();
+ ObjectImp *listenerImp = listener;
if (listenerImp && !listenerImp->marked())
listenerImp->mark();
}
// -------------------------------------------------------------------------
-JSEventListener::JSEventListener(Object _listener, const Object &_win, bool _html)
+JSEventListener::JSEventListener(ObjectImp *_listener, ObjectImp *_win, bool _html)
: JSAbstractEventListener(_html)
, listener(_listener)
, win(_win)
{
- //fprintf(stderr,"JSEventListener::JSEventListener this=%p listener=%p\n",this,listener.imp());
- if (_listener.imp()) {
- static_cast<Window*>(win.imp())->jsEventListeners.insert(_listener.imp(), this);
- }
+ if (_listener)
+ static_cast<Window*>(_win)->jsEventListeners.insert(_listener, this);
}
JSEventListener::~JSEventListener()
{
- if (listener.imp()) {
- static_cast<Window*>(win.imp())->jsEventListeners.remove(listener.imp());
+ if (ObjectImp *l = listener) {
+ ObjectImp *w = win;
+ static_cast<Window *>(w)->jsEventListeners.remove(l);
}
- //fprintf(stderr,"JSEventListener::~JSEventListener this=%p listener=%p\n",this,listener.imp());
}
-Object JSEventListener::listenerObj() const
+ObjectImp *JSEventListener::listenerObj() const
{
return listener;
}
-Object JSEventListener::windowObj() const
+ObjectImp *JSEventListener::windowObj() const
{
return win;
}
// -------------------------------------------------------------------------
-JSLazyEventListener::JSLazyEventListener(QString _code, const Object &_win, NodeImpl *_originalNode, int lineno)
- : JSEventListener(Object(), _win, true),
+JSLazyEventListener::JSLazyEventListener(QString _code, ObjectImp *_win, NodeImpl *_originalNode, int lineno)
+ : JSEventListener(NULL, _win, true),
code(_code),
parsed(false)
{
@@ -240,14 +238,14 @@
void JSLazyEventListener::handleEvent(EventListenerEvent evt, bool isWindowEvent)
{
- parseCode();
- if (!listener.isNull()) {
- JSEventListener::handleEvent(evt, isWindowEvent);
- }
+ parseCode();
+ ObjectImp *listenerObj = listener;
+ if (listenerObj)
+ JSEventListener::handleEvent(evt, isWindowEvent);
}
-Object JSLazyEventListener::listenerObj() const
+ObjectImp *JSLazyEventListener::listenerObj() const
{
parseCode();
return listener;
@@ -256,48 +254,49 @@
void JSLazyEventListener::parseCode() const
{
if (!parsed) {
- KHTMLPart *part = static_cast<Window*>(win.imp())->part();
+ ObjectImp *w = win;
+ KHTMLPart *part = static_cast<Window *>(w)->part();
KJSProxy *proxy = 0L;
if (part)
proxy = KJSProxy::proxy( part );
if (proxy) {
- KJS::ScriptInterpreter *interpreter = static_cast<KJS::ScriptInterpreter *>(proxy->interpreter());
+ ScriptInterpreter *interpreter = static_cast<ScriptInterpreter *>(proxy->interpreter());
ExecState *exec = interpreter->globalExec();
- KJS::Interpreter::lock();
- //KJS::Constructor constr(KJS::Global::current().get("Function").imp());
- KJS::Object constr = interpreter->builtinFunction();
- KJS::List args;
+ Interpreter::lock();
+ //Constructor constr(Global::current().get("Function"));
+ ObjectImp *constr = interpreter->builtinFunction();
+ List args;
- static ProtectedValue eventString = KJS::String("event");
+ static ProtectedValue eventString = String("event");
UString sourceURL(part->m_url.url());
args.append(eventString);
- args.append(KJS::String(code));
- listener = constr.construct(exec, args, sourceURL, lineNumber); // ### is globalExec ok ?
+ args.append(String(code));
+ listener = constr->construct(exec, args, sourceURL, lineNumber); // ### is globalExec ok ?
- KJS::Interpreter::unlock();
+ Interpreter::unlock();
if (exec->hadException()) {
exec->clearException();
// failed to parse, so let's just make this listener a no-op
- listener = Object();
+ listener = NULL;
} else if (originalNode) {
// Add the event's home element to the scope
- // (and the document, and the form - see KJS::HTMLElement::eventHandlerScope)
- ScopeChain scope = listener.scope();
+ // (and the document, and the form - see HTMLElement::eventHandlerScope)
+ ScopeChain scope = listener->scope();
- KJS::Interpreter::lock();
- Object thisObj = Object::dynamicCast(getDOMNode(exec, originalNode));
- KJS::Interpreter::unlock();
+ Interpreter::lock();
+ ObjectImp *thisObj = static_cast<ObjectImp *>(getDOMNode(exec, originalNode));
+ Interpreter::unlock();
- if (!thisObj.isNull()) {
- KJS::Interpreter::lock();
- static_cast<DOMNode*>(thisObj.imp())->pushEventHandlerScope(exec, scope);
- KJS::Interpreter::unlock();
+ if (thisObj) {
+ Interpreter::lock();
+ static_cast<DOMNode*>(thisObj)->pushEventHandlerScope(exec, scope);
+ Interpreter::unlock();
- listener.setScope(scope);
+ listener->setScope(scope);
}
}
}
@@ -305,9 +304,9 @@
// no more need to keep the unparsed code around
code = QString();
- if (!listener.isNull()) {
- static_cast<Window*>(win.imp())->jsEventListeners.insert(listener.imp(),
- (KJS::JSEventListener *)(this));
+ if (ObjectImp *l = listener) {
+ ObjectImp *w = win;
+ static_cast<Window *>(w)->jsEventListeners.insert(l, const_cast<JSLazyEventListener *>(this));
}
parsed = true;
@@ -320,7 +319,7 @@
if (listener)
if (ValueImp *obj = listener->listenerObjImp())
return obj;
- return null();
+ return jsNull();
}
// -------------------------------------------------------------------------
@@ -356,13 +355,13 @@
return getStaticValueSlot<EventConstructor, DOMObject>(exec, &EventConstructorTable, this, propertyName, slot);
}
-Value EventConstructor::getValueProperty(ExecState *, int token) const
+ValueImp *EventConstructor::getValueProperty(ExecState *, int token) const
{
// We use the token as the value to return directly
return Number(token);
}
-Value getEventConstructor(ExecState *exec)
+ValueImp *getEventConstructor(ExecState *exec)
{
return cacheGlobalObject<EventConstructor>(exec, "[[event.constructor]]");
}
@@ -419,7 +418,7 @@
return getStaticValueSlot<DOMEvent, DOMObject>(exec, &DOMEventTable, this, propertyName, slot);
}
-Value DOMEvent::getValueProperty(ExecState *exec, int token) const
+ValueImp *DOMEvent::getValueProperty(ExecState *exec, int token) const
{
EventImpl &event = *m_impl;
switch (token) {
@@ -449,7 +448,7 @@
if (!clipboard) {
clipboard = new Clipboard(exec, impl->clipboard());
}
- return Object(clipboard);
+ return clipboard;
} else {
return Undefined();
}
@@ -461,47 +460,47 @@
if (!clipboard) {
clipboard = new Clipboard(exec, impl->clipboard());
}
- return Object(clipboard);
+ return clipboard;
} else {
return Undefined();
}
}
default:
kdWarning() << "Unhandled token in DOMEvent::getValueProperty : " << token << endl;
- return Value();
+ return NULL;
}
}
void DOMEvent::put(ExecState *exec, const Identifier &propertyName,
- const Value& value, int attr)
+ ValueImp *value, int attr)
{
lookupPut<DOMEvent, DOMObject>(exec, propertyName, value, attr,
&DOMEventTable, this);
}
-void DOMEvent::putValueProperty(ExecState *exec, int token, const Value& value, int)
+void DOMEvent::putValueProperty(ExecState *exec, int token, ValueImp *value, int)
{
EventImpl &event = *m_impl;
switch (token) {
case ReturnValue:
- event.setDefaultPrevented(!value.toBoolean(exec));
+ event.setDefaultPrevented(!value->toBoolean(exec));
break;
case CancelBubble:
- event.setCancelBubble(value.toBoolean(exec));
+ event.setCancelBubble(value->toBoolean(exec));
break;
default:
break;
}
}
-Value DOMEventProtoFunc::call(ExecState *exec, Object & thisObj, const List &args)
+ValueImp *DOMEventProtoFunc::callAsFunction(ExecState *exec, ObjectImp * thisObj, const List &args)
{
- if (!thisObj.inherits(&KJS::DOMEvent::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&DOMEvent::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
- EventImpl &event = *static_cast<DOMEvent *>( thisObj.imp() )->impl();
+ EventImpl &event = *static_cast<DOMEvent *>( thisObj )->impl();
switch (id) {
case DOMEvent::StopPropagation:
event.stopPropagation();
@@ -509,7 +508,7 @@
event.preventDefault();
return Undefined();
case DOMEvent::InitEvent:
- event.initEvent(args[0].toString(exec).string(),args[1].toBoolean(exec),args[2].toBoolean(exec));
+ event.initEvent(args[0]->toString(exec).string(),args[1]->toBoolean(exec),args[2]->toBoolean(exec));
return Undefined();
};
return Undefined();
@@ -521,7 +520,7 @@
return Null();
ScriptInterpreter* interp = static_cast<ScriptInterpreter *>(exec->dynamicInterpreter());
- KJS::Interpreter::lock();
+ Interpreter::lock();
DOMObject *ret = interp->getDOMObject(e);
if (!ret) {
@@ -541,7 +540,7 @@
interp->putDOMObject(e, ret);
}
- KJS::Interpreter::unlock();
+ Interpreter::unlock();
return ret;
}
@@ -567,13 +566,13 @@
return getStaticValueSlot<EventExceptionConstructor, DOMObject>(exec, &EventExceptionConstructorTable, this, propertyName, slot);
}
-Value EventExceptionConstructor::getValueProperty(ExecState *, int token) const
+ValueImp *EventExceptionConstructor::getValueProperty(ExecState *, int token) const
{
// We use the token as the value to return directly
return Number(token);
}
-Value getEventExceptionConstructor(ExecState *exec)
+ValueImp *getEventExceptionConstructor(ExecState *exec)
{
return cacheGlobalObject<EventExceptionConstructor>(exec, "[[eventException.constructor]]");
}
@@ -616,7 +615,7 @@
return getStaticValueSlot<DOMUIEvent, DOMEvent>(exec, &DOMUIEventTable, this, propertyName, slot);
}
-Value DOMUIEvent::getValueProperty(ExecState *exec, int token) const
+ValueImp *DOMUIEvent::getValueProperty(ExecState *exec, int token) const
{
UIEventImpl &event = *static_cast<UIEventImpl *>(impl());
switch (token) {
@@ -644,21 +643,21 @@
}
}
-Value DOMUIEventProtoFunc::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *DOMUIEventProtoFunc::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (!thisObj.inherits(&KJS::DOMUIEvent::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&DOMUIEvent::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
- UIEventImpl &uiEvent = *static_cast<UIEventImpl *>(static_cast<DOMUIEvent *>(thisObj.imp())->impl());
+ UIEventImpl &uiEvent = *static_cast<UIEventImpl *>(static_cast<DOMUIEvent *>(thisObj)->impl());
switch (id) {
case DOMUIEvent::InitUIEvent:
- uiEvent.initUIEvent(args[0].toString(exec).string(),
- args[1].toBoolean(exec),
- args[2].toBoolean(exec),
+ uiEvent.initUIEvent(args[0]->toString(exec).string(),
+ args[1]->toBoolean(exec),
+ args[2]->toBoolean(exec),
toAbstractView(args[3]),
- args[4].toInt32(exec));
+ args[4]->toInt32(exec));
return Undefined();
}
return Undefined();
@@ -733,7 +732,7 @@
return QPoint(x, y);
}
-Value DOMMouseEvent::getValueProperty(ExecState *exec, int token) const
+ValueImp *DOMMouseEvent::getValueProperty(ExecState *exec, int token) const
{
MouseEventImpl &event = *static_cast<MouseEventImpl *>(impl());
switch (token) {
@@ -782,34 +781,34 @@
return getDOMNode(exec, event.relatedTarget());
default:
kdWarning() << "Unhandled token in DOMMouseEvent::getValueProperty : " << token << endl;
- return Value();
+ return NULL;
}
}
-Value DOMMouseEventProtoFunc::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *DOMMouseEventProtoFunc::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (!thisObj.inherits(&KJS::DOMMouseEvent::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&DOMMouseEvent::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
- MouseEventImpl &mouseEvent = *static_cast<MouseEventImpl *>(static_cast<DOMMouseEvent *>(thisObj.imp())->impl());
+ MouseEventImpl &mouseEvent = *static_cast<MouseEventImpl *>(static_cast<DOMMouseEvent *>(thisObj)->impl());
switch (id) {
case DOMMouseEvent::InitMouseEvent:
- mouseEvent.initMouseEvent(args[0].toString(exec).string(), // typeArg
- args[1].toBoolean(exec), // canBubbleArg
- args[2].toBoolean(exec), // cancelableArg
+ mouseEvent.initMouseEvent(args[0]->toString(exec).string(), // typeArg
+ args[1]->toBoolean(exec), // canBubbleArg
+ args[2]->toBoolean(exec), // cancelableArg
toAbstractView(args[3]), // viewArg
- args[4].toInt32(exec), // detailArg
- args[5].toInt32(exec), // screenXArg
- args[6].toInt32(exec), // screenYArg
- args[7].toInt32(exec), // clientXArg
- args[8].toInt32(exec), // clientYArg
- args[9].toBoolean(exec), // ctrlKeyArg
- args[10].toBoolean(exec), // altKeyArg
- args[11].toBoolean(exec), // shiftKeyArg
- args[12].toBoolean(exec), // metaKeyArg
- args[13].toInt32(exec), // buttonArg
+ args[4]->toInt32(exec), // detailArg
+ args[5]->toInt32(exec), // screenXArg
+ args[6]->toInt32(exec), // screenYArg
+ args[7]->toInt32(exec), // clientXArg
+ args[8]->toInt32(exec), // clientYArg
+ args[9]->toBoolean(exec), // ctrlKeyArg
+ args[10]->toBoolean(exec), // altKeyArg
+ args[11]->toBoolean(exec), // shiftKeyArg
+ args[12]->toBoolean(exec), // metaKeyArg
+ args[13]->toInt32(exec), // buttonArg
toNode(args[14])); // relatedTargetArg
return Undefined();
}
@@ -858,7 +857,7 @@
return getStaticValueSlot<DOMKeyboardEvent, DOMUIEvent>(exec, &DOMKeyboardEventTable, this, propertyName, slot);
}
-Value DOMKeyboardEvent::getValueProperty(ExecState *exec, int token) const
+ValueImp *DOMKeyboardEvent::getValueProperty(ExecState *exec, int token) const
{
KeyboardEventImpl &event = *static_cast<KeyboardEventImpl *>(impl());
switch (token) {
@@ -878,31 +877,31 @@
return Boolean(event.altGraphKey());
default:
kdWarning() << "Unhandled token in DOMKeyboardEvent::getValueProperty : " << token << endl;
- return Value();
+ return NULL;
}
}
-Value DOMKeyboardEventProtoFunc::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *DOMKeyboardEventProtoFunc::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (!thisObj.inherits(&DOMKeyboardEvent::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&DOMKeyboardEvent::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
- KeyboardEventImpl &event = *static_cast<KeyboardEventImpl *>(static_cast<DOMUIEvent *>(thisObj.imp())->impl());
+ KeyboardEventImpl &event = *static_cast<KeyboardEventImpl *>(static_cast<DOMUIEvent *>(thisObj)->impl());
switch (id) {
case DOMKeyboardEvent::InitKeyboardEvent:
- event.initKeyboardEvent(args[0].toString(exec).string(), // typeArg
- args[1].toBoolean(exec), // canBubbleArg
- args[2].toBoolean(exec), // cancelableArg
+ event.initKeyboardEvent(args[0]->toString(exec).string(), // typeArg
+ args[1]->toBoolean(exec), // canBubbleArg
+ args[2]->toBoolean(exec), // cancelableArg
toAbstractView(args[3]), // viewArg
- args[4].toString(exec).string(), // keyIdentifier
- args[5].toInt32(exec), // keyLocationArg
- args[6].toBoolean(exec), // ctrlKeyArg
- args[7].toBoolean(exec), // altKeyArg
- args[8].toBoolean(exec), // shiftKeyArg
- args[9].toBoolean(exec), // metaKeyArg
- args[10].toBoolean(exec)); // altGraphKeyArg
+ args[4]->toString(exec).string(), // keyIdentifier
+ args[5]->toInt32(exec), // keyLocationArg
+ args[6]->toBoolean(exec), // ctrlKeyArg
+ args[7]->toBoolean(exec), // altKeyArg
+ args[8]->toBoolean(exec), // shiftKeyArg
+ args[9]->toBoolean(exec), // metaKeyArg
+ args[10]->toBoolean(exec)); // altGraphKeyArg
return Undefined();
}
return Undefined();
@@ -923,13 +922,13 @@
return getStaticValueSlot<MutationEventConstructor, DOMObject>(exec, &MutationEventConstructorTable, this, propertyName, slot);
}
-Value MutationEventConstructor::getValueProperty(ExecState *, int token) const
+ValueImp *MutationEventConstructor::getValueProperty(ExecState *, int token) const
{
// We use the token as the value to return directly
return Number(token);
}
-Value getMutationEventConstructor(ExecState *exec)
+ValueImp *getMutationEventConstructor(ExecState *exec)
{
return cacheGlobalObject<MutationEventConstructor>(exec, "[[mutationEvent.constructor]]");
}
@@ -968,7 +967,7 @@
return getStaticValueSlot<DOMMutationEvent, DOMEvent>(exec, &DOMMutationEventTable, this, propertyName, slot);
}
-Value DOMMutationEvent::getValueProperty(ExecState *exec, int token) const
+ValueImp *DOMMutationEvent::getValueProperty(ExecState *exec, int token) const
{
MutationEventImpl &event = *static_cast<MutationEventImpl *>(impl());
switch (token) {
@@ -984,28 +983,28 @@
return Number(event.attrChange());
default:
kdWarning() << "Unhandled token in DOMMutationEvent::getValueProperty : " << token << endl;
- return Value();
+ return NULL;
}
}
-Value DOMMutationEventProtoFunc::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *DOMMutationEventProtoFunc::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (!thisObj.inherits(&KJS::DOMMutationEvent::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&DOMMutationEvent::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
- MutationEventImpl &mutationEvent = *static_cast<MutationEventImpl *>(static_cast<DOMEvent *>(thisObj.imp())->impl());
+ MutationEventImpl &mutationEvent = *static_cast<MutationEventImpl *>(static_cast<DOMEvent *>(thisObj)->impl());
switch (id) {
case DOMMutationEvent::InitMutationEvent:
- mutationEvent.initMutationEvent(args[0].toString(exec).string(), // typeArg,
- args[1].toBoolean(exec), // canBubbleArg
- args[2].toBoolean(exec), // cancelableArg
+ mutationEvent.initMutationEvent(args[0]->toString(exec).string(), // typeArg,
+ args[1]->toBoolean(exec), // canBubbleArg
+ args[2]->toBoolean(exec), // cancelableArg
toNode(args[3]), // relatedNodeArg
- args[4].toString(exec).string(), // prevValueArg
- args[5].toString(exec).string(), // newValueArg
- args[6].toString(exec).string(), // attrNameArg
- args[7].toInt32(exec)); // attrChangeArg
+ args[4]->toString(exec).string(), // prevValueArg
+ args[5]->toString(exec).string(), // newValueArg
+ args[6]->toString(exec).string(), // attrNameArg
+ args[7]->toInt32(exec)); // attrChangeArg
return Undefined();
}
return Undefined();
@@ -1047,7 +1046,7 @@
return getStaticValueSlot<DOMWheelEvent, DOMEvent>(exec, &DOMWheelEventTable, this, propertyName, slot);
}
-Value DOMWheelEvent::getValueProperty(ExecState *exec, int token) const
+ValueImp *DOMWheelEvent::getValueProperty(ExecState *exec, int token) const
{
DOM::WheelEventImpl *e = static_cast<DOM::WheelEventImpl *>(impl());
switch (token) {
@@ -1079,10 +1078,10 @@
return Undefined();
}
-Value DOMWheelEventProtoFunc::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *DOMWheelEventProtoFunc::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (!thisObj.inherits(&DOMWheelEvent::info)) {
- Object error = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&DOMWheelEvent::info)) {
+ ObjectImp *error = Error::create(exec,TypeError);
exec->setException(error);
return error;
}
@@ -1126,7 +1125,7 @@
clipboard->deref();
}
-static Value stringOrUndefined(const DOM::DOMString &str)
+static ValueImp *stringOrUndefined(const DOM::DOMString &str)
{
if (str.isNull()) {
return Undefined();
@@ -1140,7 +1139,7 @@
return getStaticValueSlot<Clipboard, DOMObject>(exec, &ClipboardTable, this, propertyName, slot);
}
-Value Clipboard::getValueProperty(ExecState *exec, int token) const
+ValueImp *Clipboard::getValueProperty(ExecState *exec, int token) const
{
switch (token) {
case DropEffect:
@@ -1159,57 +1158,57 @@
for (QStringList::Iterator it = qTypes.begin(); it != qTypes.end(); ++it) {
list.append(String(UString(*it)));
}
- return exec->lexicalInterpreter()->builtinArray().construct(exec, list);
+ return exec->lexicalInterpreter()->builtinArray()->construct(exec, list);
}
}
default:
kdWarning() << "Clipboard::getValueProperty unhandled token " << token << endl;
- return Value();
+ return NULL;
}
}
-void Clipboard::put(ExecState *exec, const Identifier &propertyName, const Value& value, int attr)
+void Clipboard::put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr)
{
lookupPut<Clipboard,DOMObject>(exec, propertyName, value, attr, &ClipboardTable, this );
}
-void Clipboard::putValueProperty(ExecState *exec, int token, const Value& value, int /*attr*/)
+void Clipboard::putValueProperty(ExecState *exec, int token, ValueImp *value, int /*attr*/)
{
switch (token) {
case DropEffect:
// can never set this when not for dragging, thus getting always returns NULL string
if (clipboard->isForDragging())
- clipboard->setDropEffect(value.toString(exec).string());
+ clipboard->setDropEffect(value->toString(exec).string());
break;
case EffectAllowed:
// can never set this when not for dragging, thus getting always returns NULL string
if (clipboard->isForDragging())
- clipboard->setEffectAllowed(value.toString(exec).string());
+ clipboard->setEffectAllowed(value->toString(exec).string());
break;
default:
kdWarning() << "Clipboard::putValueProperty unhandled token " << token << endl;
}
}
-Value ClipboardProtoFunc::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *ClipboardProtoFunc::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (!thisObj.inherits(&KJS::Clipboard::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&Clipboard::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
- Clipboard *cb = static_cast<Clipboard *>(thisObj.imp());
+ Clipboard *cb = static_cast<Clipboard *>(thisObj);
switch (id) {
case Clipboard::ClearData:
if (args.size() == 0) {
cb->clipboard->clearAllData();
return Undefined();
} else if (args.size() == 1) {
- cb->clipboard->clearData(args[0].toString(exec).string());
+ cb->clipboard->clearData(args[0]->toString(exec).string());
return Undefined();
} else {
- Object err = Error::create(exec,SyntaxError,"clearData: Invalid number of arguments");
+ ObjectImp *err = Error::create(exec,SyntaxError,"clearData: Invalid number of arguments");
exec->setException(err);
return err;
}
@@ -1217,23 +1216,23 @@
{
if (args.size() == 1) {
bool success;
- DOM::DOMString result = cb->clipboard->getData(args[0].toString(exec).string(), success);
+ DOM::DOMString result = cb->clipboard->getData(args[0]->toString(exec).string(), success);
if (success) {
return String(result);
} else {
return Undefined();
}
} else {
- Object err = Error::create(exec,SyntaxError,"getData: Invalid number of arguments");
+ ObjectImp *err = Error::create(exec,SyntaxError,"getData: Invalid number of arguments");
exec->setException(err);
return err;
}
}
case Clipboard::SetData:
if (args.size() == 2) {
- return Boolean(cb->clipboard->setData(args[0].toString(exec).string(), args[1].toString(exec).string()));
+ return Boolean(cb->clipboard->setData(args[0]->toString(exec).string(), args[1]->toString(exec).string()));
} else {
- Object err = Error::create(exec,SyntaxError,"setData: Invalid number of arguments");
+ ObjectImp *err = Error::create(exec,SyntaxError,"setData: Invalid number of arguments");
exec->setException(err);
return err;
}
@@ -1244,13 +1243,13 @@
}
if (args.size() != 3) {
- Object err = Error::create(exec, SyntaxError,"setDragImage: Invalid number of arguments");
+ ObjectImp *err = Error::create(exec, SyntaxError,"setDragImage: Invalid number of arguments");
exec->setException(err);
return err;
}
- int x = (int)args[1].toNumber(exec);
- int y = (int)args[2].toNumber(exec);
+ int x = (int)args[1]->toNumber(exec);
+ int y = (int)args[2]->toNumber(exec);
// See if they passed us a node
NodeImpl *node = toNode(args[0]);
@@ -1259,20 +1258,20 @@
cb->clipboard->setDragImageElement(node, QPoint(x,y));
return Undefined();
} else {
- Object err = Error::create(exec, SyntaxError,"setDragImageFromElement: Invalid first argument");
+ ObjectImp *err = Error::create(exec, SyntaxError,"setDragImageFromElement: Invalid first argument");
exec->setException(err);
return err;
}
}
// See if they passed us an Image object
- ObjectImp *o = static_cast<ObjectImp*>(args[0].imp());
+ ObjectImp *o = static_cast<ObjectImp*>(args[0]);
if (o->inherits(&Image::info)) {
Image *JSImage = static_cast<Image*>(o);
cb->clipboard->setDragImage(JSImage->image()->pixmap(), QPoint(x,y));
return Undefined();
} else {
- Object err = Error::create(exec,TypeError);
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
1.30 +30 -30 WebCore/khtml/ecma/kjs_events.h
Index: kjs_events.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_events.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- kjs_events.h 7 Aug 2005 06:17:45 -0000 1.29
+++ kjs_events.h 8 Aug 2005 04:07:41 -0000 1.30
@@ -48,31 +48,31 @@
virtual ~JSAbstractEventListener();
virtual void handleEvent(DOM::EventListenerEvent evt, bool isWindowEvent);
virtual DOM::DOMString eventListenerType();
- virtual Object listenerObj() const = 0;
- virtual Object windowObj() const = 0;
- ObjectImp *listenerObjImp() const { return listenerObj().imp(); }
+ virtual ObjectImp *listenerObj() const = 0;
+ virtual ObjectImp *windowObj() const = 0;
+ ObjectImp *listenerObjImp() const { return listenerObj(); }
protected:
bool html;
};
class JSUnprotectedEventListener : public JSAbstractEventListener {
public:
- JSUnprotectedEventListener(Object _listener, const Object &_win, bool _html = false);
+ JSUnprotectedEventListener(ObjectImp *_listener, ObjectImp *_win, bool _html = false);
virtual ~JSUnprotectedEventListener();
- virtual Object listenerObj() const;
- virtual Object windowObj() const;
+ virtual ObjectImp *listenerObj() const;
+ virtual ObjectImp *windowObj() const;
void mark();
protected:
- Object listener;
- Object win;
+ ObjectImp *listener;
+ ObjectImp *win;
};
class JSEventListener : public JSAbstractEventListener {
public:
- JSEventListener(Object _listener, const Object &_win, bool _html = false);
+ JSEventListener(ObjectImp *_listener, ObjectImp *_win, bool _html = false);
virtual ~JSEventListener();
- virtual Object listenerObj() const;
- virtual Object windowObj() const;
+ virtual ObjectImp *listenerObj() const;
+ virtual ObjectImp *windowObj() const;
protected:
mutable ProtectedObject listener;
ProtectedObject win;
@@ -80,9 +80,9 @@
class JSLazyEventListener : public JSEventListener {
public:
- JSLazyEventListener(QString _code, const Object &_win, DOM::NodeImpl *node, int lineno = 0);
+ JSLazyEventListener(QString _code, ObjectImp *_win, DOM::NodeImpl *node, int lineno = 0);
virtual void handleEvent(DOM::EventListenerEvent evt, bool isWindowEvent);
- Object listenerObj() const;
+ ObjectImp *listenerObj() const;
private:
void parseCode() const;
@@ -100,23 +100,23 @@
public:
EventConstructor(ExecState *) { }
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *, int token) const;
+ ValueImp *getValueProperty(ExecState *, int token) const;
// no put - all read-only
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
};
- Value getEventConstructor(ExecState *exec);
+ ValueImp *getEventConstructor(ExecState *exec);
class DOMEvent : public DOMObject {
public:
DOMEvent(ExecState *exec, DOM::EventImpl *e);
~DOMEvent();
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *, int token) const;
+ ValueImp *getValueProperty(ExecState *, int token) const;
virtual void put(ExecState *exec, const Identifier &propertyName,
- const Value& value, int attr = None);
- void putValueProperty(ExecState *exec, int token, const Value& value, int);
+ ValueImp *value, int attr = None);
+ void putValueProperty(ExecState *exec, int token, ValueImp *value, int);
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
enum { Type, Target, CurrentTarget, EventPhase, Bubbles,
@@ -138,20 +138,20 @@
public:
EventExceptionConstructor(ExecState *) { }
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *, int token) const;
+ ValueImp *getValueProperty(ExecState *, int token) const;
// no put - all read-only
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
};
- Value getEventExceptionConstructor(ExecState *exec);
+ ValueImp *getEventExceptionConstructor(ExecState *exec);
class DOMUIEvent : public DOMEvent {
public:
DOMUIEvent(ExecState *exec, DOM::UIEventImpl *ue);
~DOMUIEvent();
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *, int token) const;
+ ValueImp *getValueProperty(ExecState *, int token) const;
// no put - all read-only
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
@@ -163,7 +163,7 @@
DOMMouseEvent(ExecState *exec, DOM::MouseEventImpl *me);
~DOMMouseEvent();
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *, int token) const;
+ ValueImp *getValueProperty(ExecState *, int token) const;
virtual void mark();
// no put - all read-only
virtual const ClassInfo* classInfo() const { return &info; }
@@ -179,7 +179,7 @@
DOMKeyboardEvent(ExecState *exec, DOM::KeyboardEventImpl *ke);
~DOMKeyboardEvent();
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *, int token) const;
+ ValueImp *getValueProperty(ExecState *, int token) const;
// no put - all read-only
virtual const ClassInfo* classInfo() const;
static const ClassInfo info;
@@ -191,20 +191,20 @@
public:
MutationEventConstructor(ExecState *) { }
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *, int token) const;
+ ValueImp *getValueProperty(ExecState *, int token) const;
// no put - all read-only
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
};
- Value getMutationEventConstructor(ExecState *exec);
+ ValueImp *getMutationEventConstructor(ExecState *exec);
class DOMMutationEvent : public DOMEvent {
public:
DOMMutationEvent(ExecState *exec, DOM::MutationEventImpl *me);
~DOMMutationEvent();
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *, int token) const;
+ ValueImp *getValueProperty(ExecState *, int token) const;
// no put - all read-only
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
@@ -216,7 +216,7 @@
public:
DOMWheelEvent(ExecState *, DOM::WheelEventImpl *);
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *, int token) const;
+ ValueImp *getValueProperty(ExecState *, int token) const;
// no put - all read-only
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
@@ -230,9 +230,9 @@
Clipboard(ExecState *exec, DOM::ClipboardImpl *ds);
~Clipboard();
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
- virtual void put(ExecState *exec, const Identifier &propertyName, const Value& value, int attr = None);
- void putValueProperty(ExecState *exec, int token, const Value& value, int /*attr*/);
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
+ virtual void put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr = None);
+ void putValueProperty(ExecState *exec, int token, ValueImp *value, int /*attr*/);
virtual bool toBoolean(ExecState *) const { return true; }
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
1.133 +567 -608 WebCore/khtml/ecma/kjs_html.cpp
Index: kjs_html.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_html.cpp,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -r1.132 -r1.133
--- kjs_html.cpp 7 Aug 2005 06:17:45 -0000 1.132
+++ kjs_html.cpp 8 Aug 2005 04:07:41 -0000 1.133
@@ -142,21 +142,21 @@
class HTMLElementFunction : public DOMFunction {
public:
HTMLElementFunction(ExecState *exec, int i, int len);
- virtual Value call(ExecState *exec, Object &thisObj, const List&args);
+ virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List&args);
private:
int id;
};
IMPLEMENT_PROTOFUNC(HTMLDocFunction)
-Value KJS::HTMLDocFunction::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *KJS::HTMLDocFunction::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (!thisObj.inherits(&HTMLDocument::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&HTMLDocument::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
- HTMLDocumentImpl &doc = *static_cast<HTMLDocumentImpl *>(static_cast<HTMLDocument *>(thisObj.imp())->impl());
+ HTMLDocumentImpl &doc = *static_cast<HTMLDocumentImpl *>(static_cast<HTMLDocument *>(thisObj)->impl());
switch (id) {
case HTMLDocument::Clear: // even IE doesn't support that one...
@@ -169,14 +169,13 @@
if (part) {
Window *window = Window::retrieveWindow(part);
if (window) {
- Object functionObject = Object::dynamicCast(window->get(exec, "open"));
- if (functionObject.isNull() || !functionObject.implementsCall()) {
- Object exception = Error::create(exec, TypeError);
+ ObjectImp *functionObject = window->get(exec, "open")->getObject();
+ if (!functionObject || !functionObject->implementsCall()) {
+ ObjectImp *exception = Error::create(exec, TypeError);
exec->setException(exception);
return exception;
}
- Object windowObject(window);
- return functionObject.call(exec, windowObject, args);
+ return functionObject->call(exec, window, args);
}
}
return Undefined();
@@ -194,7 +193,7 @@
// or no arguments
UString str = "";
for (int i = 0; i < args.size(); i++)
- str += args[i].toString(exec);
+ str += args[i]->toString(exec);
if (id == HTMLDocument::WriteLn)
str += "\n";
//kdDebug() << "document.write: " << str.ascii() << endl;
@@ -202,7 +201,7 @@
return Undefined();
}
case HTMLDocument::GetElementsByName:
- return getDOMNodeList(exec, doc.getElementsByName(args[0].toString(exec).string()).get());
+ return getDOMNodeList(exec, doc.getElementsByName(args[0]->toString(exec).string()).get());
case HTMLDocument::CaptureEvents:
case HTMLDocument::ReleaseEvents:
// Do nothing for now. These are NS-specific legacy calls.
@@ -269,7 +268,7 @@
{
}
-Value HTMLDocument::namedItemGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *HTMLDocument::namedItemGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
HTMLDocument *thisObj = static_cast<HTMLDocument *>(slot.slotBase());
HTMLDocumentImpl &doc = *static_cast<HTMLDocumentImpl *>(thisObj->impl());
@@ -290,7 +289,7 @@
return getHTMLCollection(exec, collection.get());
}
-Value HTMLDocument::getValueProperty(ExecState *exec, int token) const
+ValueImp *HTMLDocument::getValueProperty(ExecState *exec, int token) const
{
HTMLDocumentImpl &doc = *static_cast<HTMLDocumentImpl *>(impl());
@@ -312,12 +311,8 @@
case Body:
return getDOMNode(exec, body);
case Location:
- if (part) {
- Window* win = Window::retrieveWindow(part);
- if (win)
- return Value(win->location());
- }
-
+ if (Window* win = Window::retrieveWindow(part))
+ return win->location();
return Undefined();
case Cookie:
return String(doc.cookie());
@@ -337,8 +332,8 @@
{
// To be implemented. Meanwhile, return an object with a length property set to 0
kdWarning() << "KJS::HTMLDocument document.scripts called - not implemented" << endl;
- Object obj(new ObjectImp());
- obj.put(exec, lengthPropertyName, Number(0));
+ ObjectImp *obj = new ObjectImp;
+ obj->put(exec, lengthPropertyName, Number(0));
return obj;
}
case All:
@@ -406,7 +401,7 @@
return DOMDocument::getOwnPropertySlot(exec, propertyName, slot);
}
-void KJS::HTMLDocument::put(ExecState *exec, const Identifier &propertyName, const Value& value, int attr)
+void KJS::HTMLDocument::put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr)
{
#ifdef KJS_VERBOSE
kdDebug(6070) << "KJS::HTMLDocument::put " << propertyName.qstring() << endl;
@@ -414,7 +409,7 @@
lookupPut<HTMLDocument, DOMDocument>( exec, propertyName, value, attr, &HTMLDocumentTable, this );
}
-void KJS::HTMLDocument::putValueProperty(ExecState *exec, int token, const Value& value, int /*attr*/)
+void KJS::HTMLDocument::putValueProperty(ExecState *exec, int token, ValueImp *value, int /*attr*/)
{
DOMExceptionTranslator exception(exec);
HTMLDocumentImpl &doc = *static_cast<HTMLDocumentImpl *>(impl());
@@ -423,22 +418,22 @@
switch (token) {
case Title:
- doc.setTitle(value.toString(exec).string());
+ doc.setTitle(value->toString(exec).string());
break;
case Body:
doc.setBody(toHTMLElement(value), exception);
break;
case Domain: // not part of the DOM
- doc.setDomain(value.toString(exec).string());
+ doc.setDomain(value->toString(exec).string());
break;
case Cookie:
- doc.setCookie(value.toString(exec).string());
+ doc.setCookie(value->toString(exec).string());
break;
case Location: {
KHTMLPart *part = doc.part();
if (part)
{
- QString str = value.toString(exec).qstring();
+ QString str = value->toString(exec).qstring();
// When assigning location, IE and Mozilla both resolve the URL
// relative to the frame where the JavaScript is executing not
@@ -455,18 +450,18 @@
}
case BgColor:
if (bodyElement)
- bodyElement->setBgColor(value.toString(exec).string());
+ bodyElement->setBgColor(value->toString(exec).string());
break;
case FgColor:
if (bodyElement)
- bodyElement->setText(value.toString(exec).string());
+ bodyElement->setText(value->toString(exec).string());
break;
case AlinkColor:
if (bodyElement) {
// this check is a bit silly, but some benchmarks like to set the
// document's link colors over and over to the same value and we
// don't want to incur a style update each time.
- DOMString newColor = value.toString(exec).string();
+ DOMString newColor = value->toString(exec).string();
if (bodyElement->aLink() != newColor)
bodyElement->setALink(newColor);
}
@@ -476,7 +471,7 @@
// this check is a bit silly, but some benchmarks like to set the
// document's link colors over and over to the same value and we
// don't want to incur a style update each time.
- DOMString newColor = value.toString(exec).string();
+ DOMString newColor = value->toString(exec).string();
if (bodyElement->link() != newColor)
bodyElement->setLink(newColor);
}
@@ -486,17 +481,17 @@
// this check is a bit silly, but some benchmarks like to set the
// document's link colors over and over to the same value and we
// don't want to incur a style update each time.
- DOMString newColor = value.toString(exec).string();
+ DOMString newColor = value->toString(exec).string();
if (bodyElement->vLink() != newColor)
bodyElement->setVLink(newColor);
}
break;
case Dir:
- body->setDir(value.toString(exec).string());
+ body->setDir(value->toString(exec).string());
break;
case DesignMode:
{
- DOMString modeString = value.toString(exec).string();
+ DOMString modeString = value->toString(exec).string();
DocumentImpl::InheritedBool mode;
if (!strcasecmp(modeString, "on"))
mode = DocumentImpl::on;
@@ -1268,7 +1263,7 @@
{
}
-Value HTMLElement::formIndexGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *HTMLElement::formIndexGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
HTMLElement *thisObj = static_cast<HTMLElement *>(slot.slotBase());
HTMLFormElementImpl *form = static_cast<HTMLFormElementImpl *>(thisObj->impl());
@@ -1276,7 +1271,7 @@
return getDOMNode(exec, form->elements()->item(slot.index()));
}
-Value HTMLElement::formNameGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *HTMLElement::formNameGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
HTMLElement *thisObj = static_cast<HTMLElement *>(slot.slotBase());
HTMLFormElementImpl *form = static_cast<HTMLFormElementImpl *>(thisObj->impl());
@@ -1284,7 +1279,7 @@
return HTMLCollection(exec, form->elements().get()).getNamedItems(exec, propertyName);
}
-Value HTMLElement::selectIndexGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *HTMLElement::selectIndexGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
HTMLElement *thisObj = static_cast<HTMLElement *>(slot.slotBase());
HTMLSelectElementImpl *select = static_cast<HTMLSelectElementImpl *>(thisObj->impl());
@@ -1292,44 +1287,31 @@
return getDOMNode(exec, select->optionsHTMLCollection()->item(slot.index()));
}
-Value HTMLElement::framesetNameGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *HTMLElement::framesetNameGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
HTMLElement *thisObj = static_cast<HTMLElement *>(slot.slotBase());
HTMLElementImpl *element = static_cast<HTMLElementImpl *>(thisObj->impl());
NodeImpl *frame = element->children()->namedItem(propertyName.string());
- DocumentImpl* doc = static_cast<HTMLFrameElementImpl *>(frame)->contentDocument();
- if (doc) {
- KHTMLPart* part = doc->part();
- if (part) {
- Window *window = Window::retrieveWindow(part);
- if (window) {
- return Value(window);
- }
- }
- }
+ if (DocumentImpl* doc = static_cast<HTMLFrameElementImpl *>(frame)->contentDocument())
+ if (Window *window = Window::retrieveWindow(doc->part()))
+ return window;
return Undefined();
}
-Value HTMLElement::frameWindowPropertyGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *HTMLElement::frameWindowPropertyGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
HTMLElement *thisObj = static_cast<HTMLElement *>(slot.slotBase());
- DocumentImpl *doc = static_cast<HTMLFrameElementImpl *>(thisObj->impl())->contentDocument();
- if (doc) {
- KHTMLPart* part = doc->part();
- if (part) {
- Window *window = Window::retrieveWindow(part);
- if (window)
- return window->get(exec, propertyName);
- }
- }
+ if (DocumentImpl *doc = static_cast<HTMLFrameElementImpl *>(thisObj->impl())->contentDocument())
+ if (Window *window = Window::retrieveWindow(doc->part()))
+ return window->get(exec, propertyName);
return Undefined();
}
-Value HTMLElement::runtimeObjectGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *HTMLElement::runtimeObjectGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
HTMLElement *thisObj = static_cast<HTMLElement *>(slot.slotBase());
HTMLElementImpl *element = static_cast<HTMLElementImpl *>(thisObj->impl());
@@ -1337,14 +1319,13 @@
return getRuntimeObject(exec, element);
}
-Value HTMLElement::runtimeObjectPropertyGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *HTMLElement::runtimeObjectPropertyGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
HTMLElement *thisObj = static_cast<HTMLElement *>(slot.slotBase());
HTMLElementImpl *element = static_cast<HTMLElementImpl *>(thisObj->impl());
- Value runtimeObject = getRuntimeObject(exec, element);
- if (!runtimeObject.isNull())
- return static_cast<ObjectImp *>(runtimeObject.imp())->get(exec, propertyName);
+ if (ValueImp *runtimeObject = getRuntimeObject(exec, element))
+ return static_cast<ObjectImp *>(runtimeObject)->get(exec, propertyName);
return Undefined();
}
@@ -1383,15 +1364,11 @@
slot.setCustom(this, framesetNameGetter);
}
} else if (element.hasLocalName(frameTag) || element.hasLocalName(iframeTag)) {
- DocumentImpl* doc = static_cast<HTMLFrameElementImpl &>(element).contentDocument();
- if (doc) {
- KHTMLPart* part = doc->part();
- if (part) {
- Window *window = Window::retrieveWindow(part);
- if (window && window->hasProperty(exec, propertyName)) {
- slot.setCustom(this, frameWindowPropertyGetter);
- return true;
- }
+ if (DocumentImpl* doc = static_cast<HTMLFrameElementImpl &>(element).contentDocument()) {
+ Window *window = Window::retrieveWindow(doc->part());
+ if (window && window->hasProperty(exec, propertyName)) {
+ slot.setCustom(this, frameWindowPropertyGetter);
+ return true;
}
}
}
@@ -1402,9 +1379,9 @@
slot.setCustom(this, runtimeObjectGetter);
return true;
}
- Value runtimeObject = getRuntimeObject(exec,&element);
- if (!runtimeObject.isNull()) {
- ObjectImp *imp = static_cast<ObjectImp *>(runtimeObject.imp());
+ ValueImp *runtimeObject = getRuntimeObject(exec,&element);
+ if (runtimeObject) {
+ ObjectImp *imp = static_cast<ObjectImp *>(runtimeObject);
if (imp->hasProperty(exec, propertyName)) {
slot.setCustom(this, runtimeObjectPropertyGetter);
return true;
@@ -1447,37 +1424,27 @@
bool KJS::HTMLElement::implementsCall() const
{
HTMLElementImpl *element = static_cast<HTMLElementImpl *>(impl());
- if (element->hasTagName(embedTag) ||
- element->hasTagName(objectTag) ||
- element->hasTagName(appletTag)) {
+ if (element->hasTagName(embedTag) || element->hasTagName(objectTag) || element->hasTagName(appletTag)) {
DocumentImpl* doc = element->getDocument();
KJSProxy *proxy = KJSProxy::proxy(doc->part());
ExecState *exec = proxy->interpreter()->globalExec();
- Value runtimeObject = getRuntimeObject(exec,element);
- if (!runtimeObject.isNull()) {
- ObjectImp *imp = static_cast<ObjectImp *>(runtimeObject.imp());
- return imp->implementsCall ();
- }
+ if (ValueImp *runtimeObject = getRuntimeObject(exec, element))
+ return static_cast<ObjectImp *>(runtimeObject)->implementsCall();
}
return false;
}
-Value KJS::HTMLElement::call(ExecState *exec, Object &thisObj, const List&args)
+ValueImp *KJS::HTMLElement::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List&args)
{
HTMLElementImpl *element = static_cast<HTMLElementImpl *>(impl());
- if (element->hasTagName(embedTag) ||
- element->hasTagName(objectTag) ||
- element->hasTagName(appletTag)) {
- Value runtimeObject = getRuntimeObject(exec,element);
- if (!runtimeObject.isNull()) {
- ObjectImp *imp = static_cast<ObjectImp *>(runtimeObject.imp());
- return imp->call (exec, thisObj, args);
- }
+ if (element->hasTagName(embedTag) || element->hasTagName(objectTag) || element->hasTagName(appletTag)) {
+ if (ValueImp *runtimeObject = getRuntimeObject(exec, element))
+ return static_cast<ObjectImp *>(runtimeObject)->call(exec, thisObj, args);
}
return Undefined();
}
-Value HTMLElement::htmlGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::htmlGetter(ExecState* exec, int token) const
{
HTMLHtmlElementImpl& html = *static_cast<HTMLHtmlElementImpl*>(impl());
if (token == HtmlVersion)
@@ -1485,7 +1452,7 @@
return Undefined();
}
-Value HTMLElement::headGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::headGetter(ExecState* exec, int token) const
{
HTMLHeadElementImpl &head = *static_cast<HTMLHeadElementImpl*>(impl());
if (token == HeadProfile)
@@ -1493,7 +1460,7 @@
return Undefined();
}
-Value HTMLElement::linkGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::linkGetter(ExecState* exec, int token) const
{
HTMLLinkElementImpl &link = *static_cast<HTMLLinkElementImpl*>(impl());
switch (token) {
@@ -1521,7 +1488,7 @@
return Undefined();
}
-Value HTMLElement::titleGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::titleGetter(ExecState* exec, int token) const
{
HTMLTitleElementImpl& title = *static_cast<HTMLTitleElementImpl*>(impl());
if (token == TitleText)
@@ -1529,7 +1496,7 @@
return Undefined();
}
-Value HTMLElement::metaGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::metaGetter(ExecState* exec, int token) const
{
HTMLMetaElementImpl& meta = *static_cast<HTMLMetaElementImpl*>(impl());
switch (token) {
@@ -1541,7 +1508,7 @@
return Undefined();
}
-Value HTMLElement::baseGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::baseGetter(ExecState* exec, int token) const
{
HTMLBaseElementImpl& base = *static_cast<HTMLBaseElementImpl*>(impl());
switch (token) {
@@ -1551,7 +1518,7 @@
return Undefined();
}
-Value HTMLElement::isIndexGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::isIndexGetter(ExecState* exec, int token) const
{
HTMLIsIndexElementImpl& isindex = *static_cast<HTMLIsIndexElementImpl*>(impl());
switch (token) {
@@ -1561,7 +1528,7 @@
return Undefined();
}
-Value HTMLElement::styleGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::styleGetter(ExecState* exec, int token) const
{
HTMLStyleElementImpl& style = *static_cast<HTMLStyleElementImpl*>(impl());
switch (token) {
@@ -1573,7 +1540,7 @@
return Undefined();
}
-Value HTMLElement::bodyGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::bodyGetter(ExecState* exec, int token) const
{
HTMLBodyElementImpl& body = *static_cast<HTMLBodyElementImpl*>(impl());
switch (token) {
@@ -1604,7 +1571,7 @@
return Undefined();
}
-Value HTMLElement::formGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::formGetter(ExecState* exec, int token) const
{
HTMLFormElementImpl& form = *static_cast<HTMLFormElementImpl*>(impl());
switch (token) {
@@ -1620,7 +1587,7 @@
return Undefined();
}
-Value HTMLElement::selectGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::selectGetter(ExecState* exec, int token) const
{
HTMLSelectElementImpl& select = *static_cast<HTMLSelectElementImpl*>(impl());
switch (token) {
@@ -1639,7 +1606,7 @@
return Undefined();
}
-Value HTMLElement::optGroupGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::optGroupGetter(ExecState* exec, int token) const
{
HTMLOptGroupElementImpl& optgroup = *static_cast<HTMLOptGroupElementImpl*>(impl());
switch (token) {
@@ -1649,7 +1616,7 @@
return Undefined();
}
-Value HTMLElement::optionGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::optionGetter(ExecState* exec, int token) const
{
HTMLOptionElementImpl& option = *static_cast<HTMLOptionElementImpl*>(impl());
switch (token) {
@@ -1665,21 +1632,21 @@
return Undefined();
}
-static Value getInputSelectionStart(HTMLInputElementImpl &input)
+static ValueImp *getInputSelectionStart(HTMLInputElementImpl &input)
{
if (input.canHaveSelection())
return Number(input.selectionStart());
return Undefined();
}
-static Value getInputSelectionEnd(HTMLInputElementImpl &input)
+static ValueImp *getInputSelectionEnd(HTMLInputElementImpl &input)
{
if (input.canHaveSelection())
return Number(input.selectionEnd());
return Undefined();
}
-Value HTMLElement::inputGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::inputGetter(ExecState* exec, int token) const
{
HTMLInputElementImpl& input = *static_cast<HTMLInputElementImpl*>(impl());
switch (token) {
@@ -1707,7 +1674,7 @@
return Undefined();
}
-Value HTMLElement::textAreaGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::textAreaGetter(ExecState* exec, int token) const
{
HTMLTextAreaElementImpl& textarea = *static_cast<HTMLTextAreaElementImpl*>(impl());
switch (token) {
@@ -1728,7 +1695,7 @@
return Undefined();
}
-Value HTMLElement::buttonGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::buttonGetter(ExecState* exec, int token) const
{
HTMLButtonElementImpl& button = *static_cast<HTMLButtonElementImpl*>(impl());
switch (token) {
@@ -1743,7 +1710,7 @@
return Undefined();
}
-Value HTMLElement::labelGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::labelGetter(ExecState* exec, int token) const
{
HTMLLabelElementImpl& label = *static_cast<HTMLLabelElementImpl*>(impl());
switch (token) {
@@ -1754,7 +1721,7 @@
return Undefined();
}
-Value HTMLElement::fieldSetGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::fieldSetGetter(ExecState* exec, int token) const
{
HTMLFieldSetElementImpl& fieldSet = *static_cast<HTMLFieldSetElementImpl*>(impl());
if (token == FieldSetForm)
@@ -1762,7 +1729,7 @@
return Undefined();
}
-Value HTMLElement::legendGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::legendGetter(ExecState* exec, int token) const
{
HTMLLegendElementImpl& legend = *static_cast<HTMLLegendElementImpl*>(impl());
switch (token) {
@@ -1773,7 +1740,7 @@
return Undefined();
}
-Value HTMLElement::uListGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::uListGetter(ExecState* exec, int token) const
{
HTMLUListElementImpl& uList = *static_cast<HTMLUListElementImpl*>(impl());
switch (token) {
@@ -1783,7 +1750,7 @@
return Undefined();
}
-Value HTMLElement::oListGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::oListGetter(ExecState* exec, int token) const
{
HTMLOListElementImpl& oList = *static_cast<HTMLOListElementImpl*>(impl());
switch (token) {
@@ -1794,7 +1761,7 @@
return Undefined();
}
-Value HTMLElement::dListGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::dListGetter(ExecState* exec, int token) const
{
HTMLDListElementImpl& dList = *static_cast<HTMLDListElementImpl*>(impl());
if (token == DListCompact)
@@ -1802,7 +1769,7 @@
return Undefined();
}
-Value HTMLElement::dirGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::dirGetter(ExecState* exec, int token) const
{
HTMLDirectoryElementImpl& dir = *static_cast<HTMLDirectoryElementImpl*>(impl());
if (token == DirectoryCompact)
@@ -1810,7 +1777,7 @@
return Undefined();
}
-Value HTMLElement::menuGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::menuGetter(ExecState* exec, int token) const
{
HTMLMenuElementImpl& menu = *static_cast<HTMLMenuElementImpl*>(impl());
if (token == MenuCompact)
@@ -1818,7 +1785,7 @@
return Undefined();
}
-Value HTMLElement::liGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::liGetter(ExecState* exec, int token) const
{
HTMLLIElementImpl& li = *static_cast<HTMLLIElementImpl*>(impl());
switch (token) {
@@ -1828,7 +1795,7 @@
return Undefined();
}
-Value HTMLElement::divGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::divGetter(ExecState* exec, int token) const
{
HTMLDivElementImpl& div = *static_cast<HTMLDivElementImpl*>(impl());
if (token == DivAlign)
@@ -1836,7 +1803,7 @@
return Undefined();
}
-Value HTMLElement::paragraphGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::paragraphGetter(ExecState* exec, int token) const
{
HTMLParagraphElementImpl& p = *static_cast<HTMLParagraphElementImpl*>(impl());
if (token == ParagraphAlign)
@@ -1844,7 +1811,7 @@
return Undefined();
}
-Value HTMLElement::headingGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::headingGetter(ExecState* exec, int token) const
{
HTMLHeadingElementImpl& h = *static_cast<HTMLHeadingElementImpl*>(impl());
if (token == HeadingAlign)
@@ -1852,7 +1819,7 @@
return Undefined();
}
-Value HTMLElement::blockQuoteGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::blockQuoteGetter(ExecState* exec, int token) const
{
HTMLBlockquoteElementImpl& blockQuote = *static_cast<HTMLBlockquoteElementImpl*>(impl());
if (token == BlockQuoteCite)
@@ -1860,7 +1827,7 @@
return Undefined();
}
-Value HTMLElement::quoteGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::quoteGetter(ExecState* exec, int token) const
{
HTMLQuoteElementImpl& quote = *static_cast<HTMLQuoteElementImpl*>(impl());
if (token == QuoteCite)
@@ -1868,7 +1835,7 @@
return Undefined();
}
-Value HTMLElement::preGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::preGetter(ExecState* exec, int token) const
{
// FIXME: Add support for 'wrap' when white-space: pre-wrap is implemented.
HTMLPreElementImpl& pre = *static_cast<HTMLPreElementImpl*>(impl());
@@ -1877,7 +1844,7 @@
return Undefined();
}
-Value HTMLElement::brGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::brGetter(ExecState* exec, int token) const
{
HTMLBRElementImpl& br = *static_cast<HTMLBRElementImpl*>(impl());
if (token == BRClear)
@@ -1885,7 +1852,7 @@
return Undefined();
}
-Value HTMLElement::baseFontGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::baseFontGetter(ExecState* exec, int token) const
{
HTMLBaseFontElementImpl& baseFont = *static_cast<HTMLBaseFontElementImpl*>(impl());
switch (token) {
@@ -1896,7 +1863,7 @@
return Undefined();
}
-Value HTMLElement::fontGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::fontGetter(ExecState* exec, int token) const
{
HTMLFontElementImpl& font = *static_cast<HTMLFontElementImpl*>(impl());
switch (token) {
@@ -1907,7 +1874,7 @@
return Undefined();
}
-Value HTMLElement::hrGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::hrGetter(ExecState* exec, int token) const
{
HTMLHRElementImpl& hr = *static_cast<HTMLHRElementImpl*>(impl());
switch (token) {
@@ -1919,7 +1886,7 @@
return Undefined();
}
-Value HTMLElement::modGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::modGetter(ExecState* exec, int token) const
{
HTMLModElementImpl& mod = *static_cast<HTMLModElementImpl*>(impl());
switch (token) {
@@ -1929,7 +1896,7 @@
return Undefined();
}
-Value HTMLElement::anchorGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::anchorGetter(ExecState* exec, int token) const
{
HTMLAnchorElementImpl& anchor = *static_cast<HTMLAnchorElementImpl*>(impl());
switch (token) {
@@ -1967,7 +1934,7 @@
return Undefined();
}
-Value HTMLElement::imageGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::imageGetter(ExecState* exec, int token) const
{
HTMLImageElementImpl& image = *static_cast<HTMLImageElementImpl*>(impl());
switch (token) {
@@ -1989,7 +1956,7 @@
return Undefined();
}
-Value HTMLElement::objectGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::objectGetter(ExecState* exec, int token) const
{
HTMLObjectElementImpl& object = *static_cast<HTMLObjectElementImpl*>(impl());
switch (token) {
@@ -2017,7 +1984,7 @@
return Undefined();
}
-Value HTMLElement::paramGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::paramGetter(ExecState* exec, int token) const
{
HTMLParamElementImpl& param = *static_cast<HTMLParamElementImpl*>(impl());
switch (token) {
@@ -2029,7 +1996,7 @@
return Undefined();
}
-Value HTMLElement::appletGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::appletGetter(ExecState* exec, int token) const
{
HTMLAppletElementImpl& applet = *static_cast<HTMLAppletElementImpl*>(impl());
switch (token) {
@@ -2048,7 +2015,7 @@
return Undefined();
}
-Value HTMLElement::mapGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::mapGetter(ExecState* exec, int token) const
{
HTMLMapElementImpl& map = *static_cast<HTMLMapElementImpl*>(impl());
switch (token) {
@@ -2058,7 +2025,7 @@
return Undefined();
}
-Value HTMLElement::areaGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::areaGetter(ExecState* exec, int token) const
{
HTMLAreaElementImpl& area = *static_cast<HTMLAreaElementImpl*>(impl());
switch (token) {
@@ -2088,7 +2055,7 @@
return Undefined();
}
-Value HTMLElement::scriptGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::scriptGetter(ExecState* exec, int token) const
{
HTMLScriptElementImpl& script = *static_cast<HTMLScriptElementImpl*>(impl());
switch (token) {
@@ -2103,7 +2070,7 @@
return Undefined();
}
-Value HTMLElement::tableGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::tableGetter(ExecState* exec, int token) const
{
HTMLTableElementImpl& table = *static_cast<HTMLTableElementImpl*>(impl());
switch (token) {
@@ -2125,7 +2092,7 @@
return Undefined();
}
-Value HTMLElement::tableCaptionGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::tableCaptionGetter(ExecState* exec, int token) const
{
HTMLTableCaptionElementImpl& tableCaption = *static_cast<HTMLTableCaptionElementImpl*>(impl());
if (token == TableCaptionAlign)
@@ -2133,7 +2100,7 @@
return Undefined();
}
-Value HTMLElement::tableColGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::tableColGetter(ExecState* exec, int token) const
{
HTMLTableColElementImpl& tableCol = *static_cast<HTMLTableColElementImpl*>(impl());
switch (token) {
@@ -2147,7 +2114,7 @@
return Undefined();
}
-Value HTMLElement::tableSectionGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::tableSectionGetter(ExecState* exec, int token) const
{
HTMLTableSectionElementImpl& tableSection = *static_cast<HTMLTableSectionElementImpl*>(impl());
switch (token) {
@@ -2160,7 +2127,7 @@
return Undefined();
}
-Value HTMLElement::tableRowGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::tableRowGetter(ExecState* exec, int token) const
{
HTMLTableRowElementImpl& tableRow = *static_cast<HTMLTableRowElementImpl*>(impl());
switch (token) {
@@ -2176,7 +2143,7 @@
return Undefined();
}
-Value HTMLElement::tableCellGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::tableCellGetter(ExecState* exec, int token) const
{
HTMLTableCellElementImpl& tableCell = *static_cast<HTMLTableCellElementImpl*>(impl());
switch (token) {
@@ -2199,7 +2166,7 @@
return Undefined();
}
-Value HTMLElement::frameSetGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::frameSetGetter(ExecState* exec, int token) const
{
HTMLFrameSetElementImpl& frameSet = *static_cast<HTMLFrameSetElementImpl*>(impl());
switch (token) {
@@ -2209,7 +2176,7 @@
return Undefined();
}
-Value HTMLElement::frameGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::frameGetter(ExecState* exec, int token) const
{
HTMLFrameElementImpl& frameElement = *static_cast<HTMLFrameElementImpl*>(impl());
switch (token) {
@@ -2231,7 +2198,7 @@
return Undefined();
}
-Value HTMLElement::iFrameGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::iFrameGetter(ExecState* exec, int token) const
{
HTMLIFrameElementImpl& iFrame = *static_cast<HTMLIFrameElementImpl*>(impl());
switch (token) {
@@ -2256,13 +2223,13 @@
return Undefined();
}
-Value HTMLElement::marqueeGetter(ExecState* exec, int token) const
+ValueImp *HTMLElement::marqueeGetter(ExecState* exec, int token) const
{
// FIXME: Find out what WinIE exposes as properties and implement this.
return Undefined();
}
-Value HTMLElement::getValueProperty(ExecState *exec, int token) const
+ValueImp *HTMLElement::getValueProperty(ExecState *exec, int token) const
{
// Check our set of generic properties first.
HTMLElementImpl &element = *static_cast<HTMLElementImpl *>(impl());
@@ -2357,20 +2324,19 @@
HTMLElementFunction::HTMLElementFunction(ExecState *exec, int i, int len)
: DOMFunction(), id(i)
{
- Value protect(this);
put(exec,lengthPropertyName,Number(len),DontDelete|ReadOnly|DontEnum);
}
-Value KJS::HTMLElementFunction::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *KJS::HTMLElementFunction::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (!thisObj.inherits(&KJS::HTMLElement::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&KJS::HTMLElement::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
kdDebug() << "KJS::HTMLElementFunction::tryCall " << endl;
DOMExceptionTranslator exception(exec);
- HTMLElementImpl &element = *static_cast<HTMLElementImpl *>(static_cast<HTMLElement *>(thisObj.imp())->impl());
+ HTMLElementImpl &element = *static_cast<HTMLElementImpl *>(static_cast<HTMLElement *>(thisObj)->impl());
if (element.hasLocalName(formTag)) {
HTMLFormElementImpl &form = static_cast<HTMLFormElementImpl &>(element);
@@ -2390,7 +2356,7 @@
return Undefined();
}
else if (id == KJS::HTMLElement::SelectRemove) {
- select.remove(int(args[0].toNumber(exec)));
+ select.remove(int(args[0]->toNumber(exec)));
return Undefined();
}
else if (id == KJS::HTMLElement::SelectBlur) {
@@ -2421,7 +2387,7 @@
return Undefined();
}
else if (id == KJS::HTMLElement::InputSetSelectionRange) {
- input.setSelectionRange(args[0].toInt32(exec), args[1].toInt32(exec));
+ input.setSelectionRange(args[0]->toInt32(exec), args[1]->toInt32(exec));
return Undefined();
}
}
@@ -2465,7 +2431,7 @@
return Undefined();
}
else if (id == KJS::HTMLElement::TextAreaSetSelectionRange) {
- textarea.setSelectionRange(args[0].toInt32(exec), args[1].toInt32(exec));
+ textarea.setSelectionRange(args[0]->toInt32(exec), args[1]->toInt32(exec));
return Undefined();
}
}
@@ -2480,7 +2446,7 @@
return Undefined();
}
else if (id == KJS::HTMLElement::AnchorToString)
- return String(thisObj.toString(exec));
+ return String(thisObj->toString(exec));
}
else if (element.hasLocalName(tableTag)) {
HTMLTableElementImpl &table = static_cast<HTMLTableElementImpl &>(element);
@@ -2503,9 +2469,9 @@
return Undefined();
}
else if (id == KJS::HTMLElement::TableInsertRow)
- return getDOMNode(exec,table.insertRow(args[0].toInt32(exec), exception));
+ return getDOMNode(exec,table.insertRow(args[0]->toInt32(exec), exception));
else if (id == KJS::HTMLElement::TableDeleteRow) {
- table.deleteRow(args[0].toInt32(exec), exception);
+ table.deleteRow(args[0]->toInt32(exec), exception);
return Undefined();
}
}
@@ -2514,18 +2480,18 @@
element.hasLocalName(tfootTag)) {
HTMLTableSectionElementImpl &tableSection = static_cast<HTMLTableSectionElementImpl &>(element);
if (id == KJS::HTMLElement::TableSectionInsertRow)
- return getDOMNode(exec, tableSection.insertRow(args[0].toInt32(exec), exception));
+ return getDOMNode(exec, tableSection.insertRow(args[0]->toInt32(exec), exception));
else if (id == KJS::HTMLElement::TableSectionDeleteRow) {
- tableSection.deleteRow(args[0].toInt32(exec), exception);
+ tableSection.deleteRow(args[0]->toInt32(exec), exception);
return Undefined();
}
}
else if (element.hasLocalName(trTag)) {
HTMLTableRowElementImpl &tableRow = static_cast<HTMLTableRowElementImpl &>(element);
if (id == KJS::HTMLElement::TableRowInsertCell)
- return getDOMNode(exec,tableRow.insertCell(args[0].toInt32(exec), exception));
+ return getDOMNode(exec,tableRow.insertCell(args[0]->toInt32(exec), exception));
else if (id == KJS::HTMLElement::TableRowDeleteCell) {
- tableRow.deleteCell(args[0].toInt32(exec), exception);
+ tableRow.deleteCell(args[0]->toInt32(exec), exception);
return Undefined();
}
}
@@ -2546,8 +2512,8 @@
#if APPLE_CHANGES
else if (element.hasLocalName(canvasTag)) {
if (id == KJS::HTMLElement::GetContext) {
- if (args.size() == 0 || (args.size() == 1 && args[0].toString(exec).qstring().lower() == "2d")) {
- return Object(new Context2D(&element));
+ if (args.size() == 0 || (args.size() == 1 && args[0]->toString(exec).qstring().lower() == "2d")) {
+ return new Context2D(&element);
}
return Undefined();
}
@@ -2557,10 +2523,10 @@
return Undefined();
}
-void KJS::HTMLElement::put(ExecState *exec, const Identifier &propertyName, const Value& value, int attr)
+void KJS::HTMLElement::put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr)
{
#ifdef KJS_VERBOSE
- DOM::DOMString str = value.isA(NullType) ? DOM::DOMString() : value.toString(exec).string();
+ DOM::DOMString str = value.isNull() ? DOM::DOMString() : value->toString(exec).string();
#endif
HTMLElementImpl &element = *static_cast<HTMLElementImpl *>(impl());
#ifdef KJS_VERBOSE
@@ -2574,21 +2540,17 @@
bool ok;
/*uint u =*/ propertyName.toULong(&ok);
if (ok) {
- Object coll = Object::dynamicCast( getSelectHTMLCollection(exec, select.optionsHTMLCollection().get(), &select) );
- if (!coll.isNull())
- coll.put(exec,propertyName,value);
+ ObjectImp *coll = static_cast<ObjectImp *>(getSelectHTMLCollection(exec, select.optionsHTMLCollection().get(), &select));
+ coll->put(exec,propertyName,value);
return;
}
}
#if APPLE_CHANGES
- else if (element.hasLocalName(embedTag) ||
- element.hasLocalName(objectTag) ||
- element.hasLocalName(appletTag)) {
- Value runtimeObject = getRuntimeObject(exec,&element);
- if (!runtimeObject.isNull()) {
- ObjectImp *imp = static_cast<ObjectImp *>(runtimeObject.imp());
+ else if (element.hasLocalName(embedTag) || element.hasLocalName(objectTag) || element.hasLocalName(appletTag)) {
+ if (ValueImp *runtimeObject = getRuntimeObject(exec, &element)) {
+ ObjectImp *imp = static_cast<ObjectImp *>(runtimeObject);
if (imp->canPut(exec, propertyName))
- return imp->put (exec, propertyName, value);
+ return imp->put(exec, propertyName, value);
}
}
#endif
@@ -2609,25 +2571,25 @@
lookupPut<KJS::HTMLElement, DOMElement>(exec, propertyName, value, attr, &HTMLElementTable, this);
}
-void HTMLElement::htmlSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::htmlSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLHeadElementImpl &head = *static_cast<HTMLHeadElementImpl*>(impl());
if (token == HeadProfile)
head.setProfile(str);
}
-void HTMLElement::headSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::headSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLHeadElementImpl &head = *static_cast<HTMLHeadElementImpl*>(impl());
if (token == HeadProfile)
head.setProfile(str);
}
-void HTMLElement::linkSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::linkSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLLinkElementImpl &link = *static_cast<HTMLLinkElementImpl*>(impl());
switch (token) {
- case LinkDisabled: { link.setDisabled(value.toBoolean(exec)); return; }
+ case LinkDisabled: { link.setDisabled(value->toBoolean(exec)); return; }
case LinkCharset: { link.setCharset(str); return; }
case LinkHref: { link.setHref(str); return; }
case LinkHrefLang: { link.setHreflang(str); return; }
@@ -2639,14 +2601,14 @@
}
}
-void HTMLElement::titleSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::titleSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLTitleElementImpl& title = *static_cast<HTMLTitleElementImpl*>(impl());
if (token == TitleText)
title.setText(str);
}
-void HTMLElement::metaSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::metaSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLMetaElementImpl& meta = *static_cast<HTMLMetaElementImpl*>(impl());
switch (token) {
@@ -2657,7 +2619,7 @@
}
}
-void HTMLElement::baseSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::baseSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLBaseElementImpl& base = *static_cast<HTMLBaseElementImpl*>(impl());
switch (token) {
@@ -2666,24 +2628,24 @@
}
}
-void HTMLElement::isIndexSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::isIndexSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLIsIndexElementImpl& isindex = *static_cast<HTMLIsIndexElementImpl*>(impl());
if (token == IsIndexPrompt)
isindex.setPrompt(str);
}
-void HTMLElement::styleSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::styleSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLStyleElementImpl& style = *static_cast<HTMLStyleElementImpl*>(impl());
switch (token) {
- case StyleDisabled: { style.setDisabled(value.toBoolean(exec)); return; }
+ case StyleDisabled: { style.setDisabled(value->toBoolean(exec)); return; }
case StyleMedia: { style.setMedia(str); return; }
case StyleType: { style.setType(str); return; }
}
}
-void HTMLElement::bodySetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::bodySetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLBodyElementImpl& body = *static_cast<HTMLBodyElementImpl*>(impl());
switch (token) {
@@ -2701,16 +2663,16 @@
if (DocumentImpl* doc = body.getDocument())
doc->updateLayoutIgnorePendingStylesheets();
if (token == BodyScrollLeft)
- sview->setContentsPos(value.toInt32(exec), sview->contentsY());
+ sview->setContentsPos(value->toInt32(exec), sview->contentsY());
else
- sview->setContentsPos(sview->contentsX(), value.toInt32(exec));
+ sview->setContentsPos(sview->contentsX(), value->toInt32(exec));
}
return;
}
}
}
-void HTMLElement::formSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::formSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLFormElementImpl& form = *static_cast<HTMLFormElementImpl*>(impl());
switch (token) {
@@ -2725,116 +2687,115 @@
}
}
-void HTMLElement::selectSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::selectSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLSelectElementImpl& select = *static_cast<HTMLSelectElementImpl*>(impl());
switch (token) {
// read-only: type
- case SelectSelectedIndex: { select.setSelectedIndex(value.toInt32(exec)); return; }
+ case SelectSelectedIndex: { select.setSelectedIndex(value->toInt32(exec)); return; }
case SelectValue: { select.setValue(str); return; }
case SelectLength: { // read-only according to the NS spec, but webpages need it writeable
- Object coll = Object::dynamicCast( getSelectHTMLCollection(exec, select.optionsHTMLCollection().get(), &select) );
- if ( !coll.isNull() )
- coll.put(exec,lengthPropertyName,value);
- return;
+ ObjectImp *coll = static_cast<ObjectImp *>(getSelectHTMLCollection(exec, select.optionsHTMLCollection().get(), &select));
+ coll->put(exec,lengthPropertyName,value);
+ return;
}
// read-only: form
// read-only: options
- case SelectDisabled: { select.setDisabled(value.toBoolean(exec)); return; }
- case SelectMultiple: { select.setMultiple(value.toBoolean(exec)); return; }
+ case SelectDisabled: { select.setDisabled(value->toBoolean(exec)); return; }
+ case SelectMultiple: { select.setMultiple(value->toBoolean(exec)); return; }
case SelectName: { select.setName(str); return; }
- case SelectSize: { select.setSize(value.toInt32(exec)); return; }
- case SelectTabIndex: { select.setTabIndex(value.toInt32(exec)); return; }
+ case SelectSize: { select.setSize(value->toInt32(exec)); return; }
+ case SelectTabIndex: { select.setTabIndex(value->toInt32(exec)); return; }
}
}
-void HTMLElement::optGroupSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::optGroupSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLOptGroupElementImpl& optgroup = *static_cast<HTMLOptGroupElementImpl*>(impl());
switch (token) {
- case OptGroupDisabled: { optgroup.setDisabled(value.toBoolean(exec)); return; }
+ case OptGroupDisabled: { optgroup.setDisabled(value->toBoolean(exec)); return; }
case OptGroupLabel: { optgroup.setLabel(str); return; }
}
}
-void HTMLElement::optionSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::optionSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
DOMExceptionTranslator exception(exec);
HTMLOptionElementImpl& option = *static_cast<HTMLOptionElementImpl*>(impl());
switch (token) {
// read-only: form
- case OptionDefaultSelected: { option.setDefaultSelected(value.toBoolean(exec)); return; }
+ case OptionDefaultSelected: { option.setDefaultSelected(value->toBoolean(exec)); return; }
case OptionText: { option.setText(str, exception); return; }
// read-only: index
- case OptionDisabled: { option.setDisabled(value.toBoolean(exec)); return; }
+ case OptionDisabled: { option.setDisabled(value->toBoolean(exec)); return; }
case OptionLabel: { option.setLabel(str); return; }
- case OptionSelected: { option.setSelected(value.toBoolean(exec)); return; }
+ case OptionSelected: { option.setSelected(value->toBoolean(exec)); return; }
case OptionValue: { option.setValue(str); return; }
}
}
-void HTMLElement::inputSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::inputSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLInputElementImpl& input = *static_cast<HTMLInputElementImpl*>(impl());
switch (token) {
case InputDefaultValue: { input.setDefaultValue(str); return; }
- case InputDefaultChecked: { input.setDefaultChecked(value.toBoolean(exec)); return; }
+ case InputDefaultChecked: { input.setDefaultChecked(value->toBoolean(exec)); return; }
// read-only: form
case InputAccept: { input.setAccept(str); return; }
case InputAccessKey: { input.setAccessKey(str); return; }
case InputAlign: { input.setAlign(str); return; }
case InputAlt: { input.setAlt(str); return; }
- case InputChecked: { input.setChecked(value.toBoolean(exec)); return; }
- case InputDisabled: { input.setDisabled(value.toBoolean(exec)); return; }
- case InputMaxLength: { input.setMaxLength(value.toInt32(exec)); return; }
+ case InputChecked: { input.setChecked(value->toBoolean(exec)); return; }
+ case InputDisabled: { input.setDisabled(value->toBoolean(exec)); return; }
+ case InputMaxLength: { input.setMaxLength(value->toInt32(exec)); return; }
case InputName: { input.setName(str); return; }
- case InputReadOnly: { input.setReadOnly(value.toBoolean(exec)); return; }
- case InputSize: { input.setSize(value.toInt32(exec)); return; }
- case InputSelectionStart: { input.setSelectionStart(value.toInt32(exec)); return; }
- case InputSelectionEnd: { input.setSelectionEnd(value.toInt32(exec)); return; }
+ case InputReadOnly: { input.setReadOnly(value->toBoolean(exec)); return; }
+ case InputSize: { input.setSize(value->toInt32(exec)); return; }
+ case InputSelectionStart: { input.setSelectionStart(value->toInt32(exec)); return; }
+ case InputSelectionEnd: { input.setSelectionEnd(value->toInt32(exec)); return; }
case InputSrc: { input.setSrc(str); return; }
- case InputTabIndex: { input.setTabIndex(value.toInt32(exec)); return; }
+ case InputTabIndex: { input.setTabIndex(value->toInt32(exec)); return; }
case InputType: { input.setType(str); return; }
case InputUseMap: { input.setUseMap(str); return; }
case InputValue: { input.setValue(str); return; }
}
}
-void HTMLElement::textAreaSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::textAreaSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLTextAreaElementImpl& textarea = *static_cast<HTMLTextAreaElementImpl*>(impl());
switch (token) {
case TextAreaDefaultValue: { textarea.setDefaultValue(str); return; }
// read-only: form
case TextAreaAccessKey: { textarea.setAccessKey(str); return; }
- case TextAreaCols: { textarea.setCols(value.toInt32(exec)); return; }
- case TextAreaDisabled: { textarea.setDisabled(value.toBoolean(exec)); return; }
+ case TextAreaCols: { textarea.setCols(value->toInt32(exec)); return; }
+ case TextAreaDisabled: { textarea.setDisabled(value->toBoolean(exec)); return; }
case TextAreaName: { textarea.setName(str); return; }
- case TextAreaReadOnly: { textarea.setReadOnly(value.toBoolean(exec)); return; }
- case TextAreaRows: { textarea.setRows(value.toInt32(exec)); return; }
- case TextAreaSelectionStart: { textarea.setSelectionStart(value.toInt32(exec)); return; }
- case TextAreaSelectionEnd: { textarea.setSelectionEnd(value.toInt32(exec)); return; }
- case TextAreaTabIndex: { textarea.setTabIndex(value.toInt32(exec)); return; }
+ case TextAreaReadOnly: { textarea.setReadOnly(value->toBoolean(exec)); return; }
+ case TextAreaRows: { textarea.setRows(value->toInt32(exec)); return; }
+ case TextAreaSelectionStart: { textarea.setSelectionStart(value->toInt32(exec)); return; }
+ case TextAreaSelectionEnd: { textarea.setSelectionEnd(value->toInt32(exec)); return; }
+ case TextAreaTabIndex: { textarea.setTabIndex(value->toInt32(exec)); return; }
// read-only: type
case TextAreaValue: { textarea.setValue(str); return; }
}
}
-void HTMLElement::buttonSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::buttonSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLButtonElementImpl& button = *static_cast<HTMLButtonElementImpl*>(impl());
switch (token) {
// read-only: form
case ButtonAccessKey: { button.setAccessKey(str); return; }
- case ButtonDisabled: { button.setDisabled(value.toBoolean(exec)); return; }
+ case ButtonDisabled: { button.setDisabled(value->toBoolean(exec)); return; }
case ButtonName: { button.setName(str); return; }
- case ButtonTabIndex: { button.setTabIndex(value.toInt32(exec)); return; }
+ case ButtonTabIndex: { button.setTabIndex(value->toInt32(exec)); return; }
// read-only: type
case ButtonValue: { button.setValue(str); return; }
}
}
-void HTMLElement::labelSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::labelSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLLabelElementImpl& label = *static_cast<HTMLLabelElementImpl*>(impl());
switch (token) {
@@ -2844,11 +2805,11 @@
}
}
-void HTMLElement::fieldSetSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::fieldSetSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
}
-void HTMLElement::legendSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::legendSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLLegendElementImpl& legend = *static_cast<HTMLLegendElementImpl*>(impl());
switch (token) {
@@ -2858,106 +2819,106 @@
}
}
-void HTMLElement::uListSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::uListSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLUListElementImpl& uList = *static_cast<HTMLUListElementImpl*>(impl());
switch (token) {
- case UListCompact: { uList.setCompact(value.toBoolean(exec)); return; }
+ case UListCompact: { uList.setCompact(value->toBoolean(exec)); return; }
case UListType: { uList.setType(str); return; }
}
}
-void HTMLElement::oListSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::oListSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLOListElementImpl& oList = *static_cast<HTMLOListElementImpl*>(impl());
switch (token) {
- case OListCompact: { oList.setCompact(value.toBoolean(exec)); return; }
- case OListStart: { oList.setStart(value.toInt32(exec)); return; }
+ case OListCompact: { oList.setCompact(value->toBoolean(exec)); return; }
+ case OListStart: { oList.setStart(value->toInt32(exec)); return; }
case OListType: { oList.setType(str); return; }
}
}
-void HTMLElement::dListSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::dListSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLDListElementImpl& dList = *static_cast<HTMLDListElementImpl*>(impl());
if (token == DListCompact)
- dList.setCompact(value.toBoolean(exec));
+ dList.setCompact(value->toBoolean(exec));
}
-void HTMLElement::dirSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::dirSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLDirectoryElementImpl& directory = *static_cast<HTMLDirectoryElementImpl*>(impl());
if (token == DirectoryCompact)
- directory.setCompact(value.toBoolean(exec));
+ directory.setCompact(value->toBoolean(exec));
}
-void HTMLElement::menuSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::menuSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLMenuElementImpl& menu = *static_cast<HTMLMenuElementImpl*>(impl());
if (token == MenuCompact)
- menu.setCompact(value.toBoolean(exec));
+ menu.setCompact(value->toBoolean(exec));
}
-void HTMLElement::liSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::liSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLLIElementImpl& li = *static_cast<HTMLLIElementImpl*>(impl());
switch (token) {
case LIType: { li.setType(str); return; }
- case LIValue: { li.setValue(value.toInt32(exec)); return; }
+ case LIValue: { li.setValue(value->toInt32(exec)); return; }
}
}
-void HTMLElement::divSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::divSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLDivElementImpl& div = *static_cast<HTMLDivElementImpl*>(impl());
if (token == DivAlign)
div.setAlign(str);
}
-void HTMLElement::paragraphSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::paragraphSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLParagraphElementImpl& paragraph = *static_cast<HTMLParagraphElementImpl*>(impl());
if (token == ParagraphAlign)
paragraph.setAlign(str);
}
-void HTMLElement::headingSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::headingSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLHeadingElementImpl& heading = *static_cast<HTMLHeadingElementImpl*>(impl());
if (token == HeadingAlign)
heading.setAlign(str);
}
-void HTMLElement::blockQuoteSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::blockQuoteSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLBlockquoteElementImpl& blockQuote = *static_cast<HTMLBlockquoteElementImpl*>(impl());
if (token == BlockQuoteCite)
blockQuote.setCite(str);
}
-void HTMLElement::quoteSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::quoteSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLQuoteElementImpl& quote = *static_cast<HTMLQuoteElementImpl*>(impl());
if (token == QuoteCite)
quote.setCite(str);
}
-void HTMLElement::preSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::preSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
// FIXME: Add support for 'wrap' when white-space: pre-wrap is implemented.
HTMLPreElementImpl& pre = *static_cast<HTMLPreElementImpl*>(impl());
if (token == PreWidth)
- pre.setWidth(value.toInt32(exec));
+ pre.setWidth(value->toInt32(exec));
}
-void HTMLElement::brSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::brSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLBRElementImpl& br = *static_cast<HTMLBRElementImpl*>(impl());
if (token == BRClear)
br.setClear(str);
}
-void HTMLElement::baseFontSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::baseFontSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLBaseFontElementImpl& baseFont = *static_cast<HTMLBaseFontElementImpl*>(impl());
switch (token) {
@@ -2967,7 +2928,7 @@
}
}
-void HTMLElement::fontSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::fontSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLFontElementImpl& font = *static_cast<HTMLFontElementImpl*>(impl());
switch (token) {
@@ -2977,18 +2938,18 @@
}
}
-void HTMLElement::hrSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::hrSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLHRElementImpl& hr = *static_cast<HTMLHRElementImpl*>(impl());
switch (token) {
case HRAlign: { hr.setAlign(str); return; }
- case HRNoShade: { hr.setNoShade(value.toBoolean(exec)); return; }
+ case HRNoShade: { hr.setNoShade(value->toBoolean(exec)); return; }
case HRSize: { hr.setSize(str); return; }
case HRWidth: { hr.setWidth(str); return; }
}
}
-void HTMLElement::modSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::modSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLModElementImpl& mod = *static_cast<HTMLModElementImpl*>(impl());
switch (token) {
@@ -2997,7 +2958,7 @@
}
}
-void HTMLElement::anchorSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::anchorSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLAnchorElementImpl& anchor = *static_cast<HTMLAnchorElementImpl*>(impl());
switch (token) {
@@ -3010,32 +2971,32 @@
case AnchorRel: { anchor.setRel(str); return; }
case AnchorRev: { anchor.setRev(str); return; }
case AnchorShape: { anchor.setShape(str); return; }
- case AnchorTabIndex: { anchor.setTabIndex(value.toInt32(exec)); return; }
+ case AnchorTabIndex: { anchor.setTabIndex(value->toInt32(exec)); return; }
case AnchorTarget: { anchor.setTarget(str); return; }
case AnchorType: { anchor.setType(str); return; }
}
}
-void HTMLElement::imageSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::imageSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLImageElementImpl& image = *static_cast<HTMLImageElementImpl*>(impl());
switch (token) {
case ImageName: { image.setName(str); return; }
case ImageAlign: { image.setAlign(str); return; }
case ImageAlt: { image.setAlt(str); return; }
- case ImageBorder: { image.setBorder(value.toInt32(exec)); return; }
- case ImageHeight: { image.setHeight(value.toInt32(exec)); return; }
- case ImageHspace: { image.setHspace(value.toInt32(exec)); return; }
- case ImageIsMap: { image.setIsMap(value.toBoolean(exec)); return; }
+ case ImageBorder: { image.setBorder(value->toInt32(exec)); return; }
+ case ImageHeight: { image.setHeight(value->toInt32(exec)); return; }
+ case ImageHspace: { image.setHspace(value->toInt32(exec)); return; }
+ case ImageIsMap: { image.setIsMap(value->toBoolean(exec)); return; }
case ImageLongDesc: { image.setLongDesc(str); return; }
case ImageSrc: { image.setSrc(str); return; }
case ImageUseMap: { image.setUseMap(str); return; }
- case ImageVspace: { image.setVspace(value.toInt32(exec)); return; }
- case ImageWidth: { image.setWidth(value.toInt32(exec)); return; }
+ case ImageVspace: { image.setVspace(value->toInt32(exec)); return; }
+ case ImageWidth: { image.setWidth(value->toInt32(exec)); return; }
}
}
-void HTMLElement::objectSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::objectSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLObjectElementImpl& object = *static_cast<HTMLObjectElementImpl*>(impl());
switch (token) {
@@ -3048,12 +3009,12 @@
case ObjectCodeType: { object.setCodeType(str); return; }
// read-only: ObjectContentDocument
case ObjectData: { object.setData(str); return; }
- case ObjectDeclare: { object.setDeclare(value.toBoolean(exec)); return; }
+ case ObjectDeclare: { object.setDeclare(value->toBoolean(exec)); return; }
case ObjectHeight: { object.setHeight(str); return; }
case ObjectHspace: { object.setHspace(str); return; }
case ObjectName: { object.setName(str); return; }
case ObjectStandby: { object.setStandby(str); return; }
- case ObjectTabIndex: { object.setTabIndex(value.toInt32(exec)); return; }
+ case ObjectTabIndex: { object.setTabIndex(value->toInt32(exec)); return; }
case ObjectType: { object.setType(str); return; }
case ObjectUseMap: { object.setUseMap(str); return; }
case ObjectVspace: { object.setVspace(str); return; }
@@ -3061,7 +3022,7 @@
}
}
-void HTMLElement::paramSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::paramSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLParamElementImpl& param = *static_cast<HTMLParamElementImpl*>(impl());
switch (token) {
@@ -3072,7 +3033,7 @@
}
}
-void HTMLElement::appletSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::appletSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLAppletElementImpl& applet = *static_cast<HTMLAppletElementImpl*>(impl());
switch (token) {
@@ -3090,7 +3051,7 @@
}
}
-void HTMLElement::mapSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::mapSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLMapElementImpl& map = *static_cast<HTMLMapElementImpl*>(impl());
if (token == MapName)
@@ -3098,7 +3059,7 @@
map.setName(str);
}
-void HTMLElement::areaSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::areaSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLAreaElementImpl& area = *static_cast<HTMLAreaElementImpl*>(impl());
switch (token) {
@@ -3106,14 +3067,14 @@
case AreaAlt: { area.setAlt(str); return; }
case AreaCoords: { area.setCoords(str); return; }
case AreaHref: { area.setHref(str); return; }
- case AreaNoHref: { area.setNoHref(value.toBoolean(exec)); return; }
+ case AreaNoHref: { area.setNoHref(value->toBoolean(exec)); return; }
case AreaShape: { area.setShape(str); return; }
- case AreaTabIndex: { area.setTabIndex(value.toInt32(exec)); return; }
+ case AreaTabIndex: { area.setTabIndex(value->toInt32(exec)); return; }
case AreaTarget: { area.setTarget(str); return; }
}
}
-void HTMLElement::scriptSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::scriptSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLScriptElementImpl& script = *static_cast<HTMLScriptElementImpl*>(impl());
switch (token) {
@@ -3121,13 +3082,13 @@
case ScriptHtmlFor: { script.setHtmlFor(str); return; }
case ScriptEvent: { script.setEvent(str); return; }
case ScriptCharset: { script.setCharset(str); return; }
- case ScriptDefer: { script.setDefer(value.toBoolean(exec)); return; }
+ case ScriptDefer: { script.setDefer(value->toBoolean(exec)); return; }
case ScriptSrc: { script.setSrc(str); return; }
case ScriptType: { script.setType(str); return; }
}
}
-void HTMLElement::tableSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::tableSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLTableElementImpl& table = *static_cast<HTMLTableElementImpl*>(impl());
switch (token) {
@@ -3148,27 +3109,27 @@
}
}
-void HTMLElement::tableCaptionSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::tableCaptionSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLTableCaptionElementImpl& tableCaption = *static_cast<HTMLTableCaptionElementImpl*>(impl());
if (token == TableCaptionAlign)
tableCaption.setAlign(str);
}
-void HTMLElement::tableColSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::tableColSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLTableColElementImpl& tableCol = *static_cast<HTMLTableColElementImpl*>(impl());
switch (token) {
case TableColAlign: { tableCol.setAlign(str); return; }
case TableColCh: { tableCol.setCh(str); return; }
case TableColChOff: { tableCol.setChOff(str); return; }
- case TableColSpan: { tableCol.setSpan(value.toInt32(exec)); return; }
+ case TableColSpan: { tableCol.setSpan(value->toInt32(exec)); return; }
case TableColVAlign: { tableCol.setVAlign(str); return; }
case TableColWidth: { tableCol.setWidth(str); return; }
}
}
-void HTMLElement::tableSectionSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::tableSectionSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLTableSectionElementImpl& tableSection = *static_cast<HTMLTableSectionElementImpl*>(impl());
switch (token) {
@@ -3180,7 +3141,7 @@
}
}
-void HTMLElement::tableRowSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::tableRowSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLTableRowElementImpl& tableRow = *static_cast<HTMLTableRowElementImpl*>(impl());
switch (token) {
@@ -3195,7 +3156,7 @@
}
}
-void HTMLElement::tableCellSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::tableCellSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLTableCellElementImpl& tableCell = *static_cast<HTMLTableCellElementImpl*>(impl());
switch (token) {
@@ -3206,18 +3167,18 @@
case TableCellBgColor: { tableCell.setBgColor(str); return; }
case TableCellCh: { tableCell.setCh(str); return; }
case TableCellChOff: { tableCell.setChOff(str); return; }
- case TableCellColSpan: { tableCell.setColSpan(value.toInt32(exec)); return; }
+ case TableCellColSpan: { tableCell.setColSpan(value->toInt32(exec)); return; }
case TableCellHeaders: { tableCell.setHeaders(str); return; }
case TableCellHeight: { tableCell.setHeight(str); return; }
- case TableCellNoWrap: { tableCell.setNoWrap(value.toBoolean(exec)); return; }
- case TableCellRowSpan: { tableCell.setRowSpan(value.toInt32(exec)); return; }
+ case TableCellNoWrap: { tableCell.setNoWrap(value->toBoolean(exec)); return; }
+ case TableCellRowSpan: { tableCell.setRowSpan(value->toInt32(exec)); return; }
case TableCellScope: { tableCell.setScope(str); return; }
case TableCellVAlign: { tableCell.setVAlign(str); return; }
case TableCellWidth: { tableCell.setWidth(str); return; }
}
}
-void HTMLElement::frameSetSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::frameSetSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLFrameSetElementImpl& frameSet = *static_cast<HTMLFrameSetElementImpl*>(impl());
switch (token) {
@@ -3226,7 +3187,7 @@
}
}
-void HTMLElement::frameSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::frameSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLFrameElementImpl& frameElement = *static_cast<HTMLFrameElementImpl*>(impl());
switch (token) {
@@ -3236,14 +3197,14 @@
case FrameMarginHeight: { frameElement.setMarginHeight(str); return; }
case FrameMarginWidth: { frameElement.setMarginWidth(str); return; }
case FrameName: { frameElement.setName(str); return; }
- case FrameNoResize: { frameElement.setNoResize(value.toBoolean(exec)); return; }
+ case FrameNoResize: { frameElement.setNoResize(value->toBoolean(exec)); return; }
case FrameScrolling: { frameElement.setScrolling(str); return; }
case FrameSrc: { frameElement.setSrc(str); return; }
case FrameLocation: { frameElement.setLocation(str); return; }
}
}
-void HTMLElement::iFrameSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::iFrameSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
HTMLIFrameElementImpl& iFrame = *static_cast<HTMLIFrameElementImpl*>(impl());
switch (token) {
@@ -3261,15 +3222,15 @@
}
}
-void HTMLElement::marqueeSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+void HTMLElement::marqueeSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str)
{
// FIXME: Find out what WinIE supports and implement it.
}
-void HTMLElement::putValueProperty(ExecState *exec, int token, const Value& value, int)
+void HTMLElement::putValueProperty(ExecState *exec, int token, ValueImp *value, int)
{
DOMExceptionTranslator exception(exec);
- DOM::DOMString str = value.isA(NullType) ? DOM::DOMString() : value.toString(exec).string();
+ DOM::DOMString str = value->toString(exec).string();
// Check our set of generic properties first.
HTMLElementImpl &element = *static_cast<HTMLElementImpl *>(impl());
@@ -3360,19 +3321,19 @@
ScriptInterpreter::forgetDOMObject(m_impl.get());
}
-Value HTMLCollection::lengthGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *HTMLCollection::lengthGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
HTMLCollection *thisObj = static_cast<HTMLCollection *>(slot.slotBase());
return Number(thisObj->m_impl->length());
}
-Value HTMLCollection::indexGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *HTMLCollection::indexGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
HTMLCollection *thisObj = static_cast<HTMLCollection *>(slot.slotBase());
return getDOMNode(exec, thisObj->m_impl->item(slot.index()));
}
-Value HTMLCollection::nameGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *HTMLCollection::nameGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
HTMLCollection *thisObj = static_cast<HTMLCollection *>(slot.slotBase());
return thisObj->getNamedItems(exec, propertyName);
@@ -3385,8 +3346,8 @@
return true;
} else {
// Look in the prototype (for functions) before assuming it's an item's name
- Object proto = Object::dynamicCast(prototype());
- if (!proto.isNull() && proto.hasProperty(exec, propertyName))
+ ValueImp *proto = prototype();
+ if (proto->isObject() && static_cast<ObjectImp *>(proto)->hasProperty(exec, propertyName))
return false;
// name or index ?
@@ -3397,7 +3358,7 @@
return true;
}
- if (!getNamedItems(exec, propertyName).imp()->isUndefined()) {
+ if (!getNamedItems(exec, propertyName)->isUndefined()) {
slot.setCustom(this, nameGetter);
return true;
}
@@ -3408,15 +3369,9 @@
// HTMLCollections are strange objects, they support both get and call,
// so that document.forms.item(0) and document.forms(0) both work.
-Value KJS::HTMLCollection::call(ExecState *exec, Object &, const List &args)
+ValueImp *KJS::HTMLCollection::callAsFunction(ExecState *exec, ObjectImp *, const List &args)
{
// Do not use thisObj here. It can be the HTMLDocument, in the document.forms(i) case.
- /*if( thisObj.imp() != this )
- {
- kdWarning() << "thisObj.imp() != this in HTMLCollection::call" << endl;
- KJS::printInfo(exec,"KJS::HTMLCollection::call thisObj",thisObj,-1);
- KJS::printInfo(exec,"KJS::HTMLCollection::call this",Value(this),-1);
- }*/
HTMLCollectionImpl &collection = *m_impl;
// Also, do we need the TypeError test here ?
@@ -3424,7 +3379,7 @@
if (args.size() == 1) {
// support for document.all(<index>) etc.
bool ok;
- UString s = args[0].toString(exec);
+ UString s = args[0]->toString(exec);
unsigned int u = s.toULong(&ok);
if (ok)
return getDOMNode(exec, collection.item(u));
@@ -3434,8 +3389,8 @@
else if (args.size() >= 1) // the second arg, if set, is the index of the item we want
{
bool ok;
- UString s = args[0].toString(exec);
- unsigned int u = args[1].toString(exec).toULong(&ok);
+ UString s = args[0]->toString(exec);
+ unsigned int u = args[1]->toString(exec).toULong(&ok);
if (ok)
{
DOM::DOMString pstr = s.string();
@@ -3451,7 +3406,7 @@
return Undefined();
}
-Value KJS::HTMLCollection::getNamedItems(ExecState *exec, const Identifier &propertyName) const
+ValueImp *KJS::HTMLCollection::getNamedItems(ExecState *exec, const Identifier &propertyName) const
{
#ifdef KJS_VERBOSE
kdDebug(6070) << "KJS::HTMLCollection::getNamedItems " << propertyName.ascii() << endl;
@@ -3470,25 +3425,25 @@
if (namedItems.count() == 1)
return getDOMNode(exec, namedItems[0].get());
- return Value(new DOMNamedNodesCollection(exec,namedItems));
+ return new DOMNamedNodesCollection(exec, namedItems);
}
-Value KJS::HTMLCollectionProtoFunc::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *KJS::HTMLCollectionProtoFunc::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (!thisObj.inherits(&KJS::HTMLCollection::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&KJS::HTMLCollection::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
- HTMLCollectionImpl &coll = *static_cast<HTMLCollection *>(thisObj.imp())->impl();
+ HTMLCollectionImpl &coll = *static_cast<HTMLCollection *>(thisObj)->impl();
switch (id) {
case KJS::HTMLCollection::Item:
- return getDOMNode(exec,coll.item(args[0].toUInt32(exec)));
+ return getDOMNode(exec,coll.item(args[0]->toUInt32(exec)));
case KJS::HTMLCollection::Tags:
- return getDOMNodeList(exec, coll.base()->getElementsByTagName(args[0].toString(exec).string()).get());
+ return getDOMNodeList(exec, coll.base()->getElementsByTagName(args[0]->toString(exec).string()).get());
case KJS::HTMLCollection::NamedItem:
- return static_cast<HTMLCollection *>(thisObj.imp())->getNamedItems(exec, Identifier(args[0].toString(exec)));
+ return static_cast<HTMLCollection *>(thisObj)->getNamedItems(exec, Identifier(args[0]->toString(exec)));
default:
return Undefined();
}
@@ -3501,7 +3456,7 @@
{
}
-Value HTMLSelectCollection::selectedIndexGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *HTMLSelectCollection::selectedIndexGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
HTMLSelectCollection *thisObj = static_cast<HTMLSelectCollection *>(slot.slotBase());
return Number(thisObj->m_element->selectedIndex());
@@ -3518,13 +3473,13 @@
return HTMLCollection::getOwnPropertySlot(exec, propertyName, slot);
}
-void KJS::HTMLSelectCollection::put(ExecState *exec, const Identifier &propertyName, const Value& value, int)
+void KJS::HTMLSelectCollection::put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int)
{
#ifdef KJS_VERBOSE
kdDebug(6070) << "KJS::HTMLSelectCollection::put " << propertyName.qstring() << endl;
#endif
if ( propertyName == "selectedIndex" ) {
- m_element->setSelectedIndex( value.toInt32( exec ) );
+ m_element->setSelectedIndex( value->toInt32( exec ) );
return;
}
// resize ?
@@ -3532,7 +3487,7 @@
int exception = 0;
unsigned newLen;
- bool converted = value.toUInt32(newLen);
+ bool converted = value->getUInt32(newLen);
if (!converted) {
return;
@@ -3561,7 +3516,7 @@
if (!ok)
return;
- if (value.isA(NullType) || value.isA(UndefinedType)) {
+ if (value->isUndefinedOrNull()) {
// null and undefined delete. others, too ?
m_element->remove(u);
return;
@@ -3613,7 +3568,7 @@
return true;
}
-Object OptionConstructorImp::construct(ExecState *exec, const List &args)
+ObjectImp *OptionConstructorImp::construct(ExecState *exec, const List &args)
{
int exception = 0;
SharedPtr<ElementImpl> el(m_doc->createElement("option", exception));
@@ -3625,18 +3580,18 @@
t->ref();
opt->appendChild(t, exception);
if (exception == 0 && sz > 0)
- t->setData(args[0].toString(exec).string(), exception); // set the text
+ t->setData(args[0]->toString(exec).string(), exception); // set the text
if (exception == 0 && sz > 1)
- opt->setValue(args[1].toString(exec).string());
+ opt->setValue(args[1]->toString(exec).string());
if (exception == 0 && sz > 2)
- opt->setDefaultSelected(args[2].toBoolean(exec));
+ opt->setDefaultSelected(args[2]->toBoolean(exec));
if (exception == 0 && sz > 3)
- opt->setSelected(args[3].toBoolean(exec));
+ opt->setSelected(args[3]->toBoolean(exec));
t->deref();
}
setDOMException(exec, exception);
- return Object::dynamicCast(getDOMNode(exec,opt));
+ return static_cast<ObjectImp *>(getDOMNode(exec,opt));
}
////////////////////// Image Object ////////////////////////
@@ -3651,22 +3606,22 @@
return true;
}
-Object ImageConstructorImp::construct(ExecState * exec, const List & list)
+ObjectImp *ImageConstructorImp::construct(ExecState * exec, const List & list)
{
bool widthSet = false, heightSet = false;
int width = 0, height = 0;
if (list.size() > 0) {
widthSet = true;
- Value w = list.at(0);
- width = w.toInt32(exec);
+ ValueImp *w = list.at(0);
+ width = w->toInt32(exec);
}
if (list.size() > 1) {
heightSet = true;
- Value h = list.at(1);
- height = h.toInt32(exec);
+ ValueImp *h = list.at(1);
+ height = h->toInt32(exec);
}
- Object result(new Image(m_doc.get(), widthSet, width, heightSet, height));
+ ObjectImp *result(new Image(m_doc.get(), widthSet, width, heightSet, height));
/* TODO: do we need a prototype ? */
return result;
@@ -3689,7 +3644,7 @@
return getStaticValueSlot<Image,DOMObject>(exec, &ImageTable, this, propertyName, slot);
}
-Value Image::getValueProperty(ExecState *, int token) const
+ValueImp *Image::getValueProperty(ExecState *, int token) const
{
switch (token) {
case Src:
@@ -3726,22 +3681,21 @@
}
default:
kdWarning() << "Image::getValueProperty unhandled token " << token << endl;
- return Value();
+ return NULL;
}
}
-void Image::put(ExecState *exec, const Identifier &propertyName, const Value& value, int attr)
+void Image::put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr)
{
lookupPut<Image,DOMObject>(exec, propertyName, value, attr, &ImageTable, this );
}
-void Image::putValueProperty(ExecState *exec, int token, const Value& value, int /*attr*/)
+void Image::putValueProperty(ExecState *exec, int token, ValueImp *value, int /*attr*/)
{
switch(token) {
case Src:
{
- String str = value.toString(exec);
- src = str.value();
+ src = value->toString(exec);
if ( img ) img->deref(this);
img = doc ? doc->docLoader()->requestImage( src.string() ) : 0;
if ( img ) img->ref(this);
@@ -3753,11 +3707,11 @@
break;
case Width:
widthSet = true;
- width = value.toInt32(exec);
+ width = value->toInt32(exec);
break;
case Height:
heightSet = true;
- height = value.toInt32(exec);
+ height = value->toInt32(exec);
break;
default:
kdWarning() << "HTMLDocument::putValueProperty unhandled token " << token << endl;
@@ -3796,34 +3750,28 @@
IMPLEMENT_PROTOFUNC(Context2DFunction)
-static bool isGradient(const Value &value)
+static bool isGradient(ValueImp *value)
{
- ObjectImp *o = static_cast<ObjectImp*>(value.imp());
- if (o->type() == ObjectType && o->inherits(&Gradient::info))
- return true;
- return false;
+ return value->isObject(&Gradient::info);
}
-static bool isImagePattern(const Value &value)
+static bool isImagePattern(ValueImp *value)
{
- ObjectImp *o = static_cast<ObjectImp*>(value.imp());
- if (o->type() == ObjectType && o->inherits(&ImagePattern::info))
- return true;
- return false;
+ return value->isObject(&ImagePattern::info);
}
#define BITS_PER_COMPONENT 8
#define BYTES_PER_ROW(width,bitsPerComponent,numComponents) ((width * bitsPerComponent * numComponents + 7)/8)
-Value KJS::Context2DFunction::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *KJS::Context2DFunction::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (!thisObj.inherits(&Context2D::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&Context2D::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
- Context2D *contextObject = static_cast<KJS::Context2D *>(thisObj.imp());
+ Context2D *contextObject = static_cast<KJS::Context2D *>(thisObj);
khtml::RenderCanvasImage *renderer = static_cast<khtml::RenderCanvasImage*>(contextObject->_element->renderer());
if (!renderer)
return Undefined();
@@ -3835,7 +3783,7 @@
switch (id) {
case Context2D::Save: {
if (args.size() != 0) {
- Object err = Error::create(exec,SyntaxError);
+ ObjectImp *err = Error::create(exec,SyntaxError);
exec->setException(err);
return err;
}
@@ -3847,7 +3795,7 @@
}
case Context2D::Restore: {
if (args.size() != 0) {
- Object err = Error::create(exec,SyntaxError);
+ ObjectImp *err = Error::create(exec,SyntaxError);
exec->setException(err);
return err;
}
@@ -3859,7 +3807,7 @@
}
case Context2D::BeginPath: {
if (args.size() != 0) {
- Object err = Error::create(exec,SyntaxError);
+ ObjectImp *err = Error::create(exec,SyntaxError);
exec->setException(err);
return err;
}
@@ -3868,7 +3816,7 @@
}
case Context2D::ClosePath: {
if (args.size() != 0) {
- Object err = Error::create(exec,SyntaxError);
+ ObjectImp *err = Error::create(exec,SyntaxError);
exec->setException(err);
return err;
}
@@ -3885,50 +3833,50 @@
int numArgs = args.size();
switch (numArgs) {
case 1: {
- if (args[0].type() == StringType) {
- QRgb color = DOM::CSSParser::parseColor(args[0].toString(exec).string());
+ if (args[0]->isString()) {
+ QRgb color = DOM::CSSParser::parseColor(args[0]->toString(exec).string());
QColor qc(color);
CGContextSetRGBStrokeColor(drawingContext, qc.red()/255., qc.green()/255., qc.blue()/255., qc.alpha()/255.);
}
else {
- float g = (float)args[0].toNumber(exec);
+ float g = (float)args[0]->toNumber(exec);
CGContextSetGrayStrokeColor(drawingContext, g, 1.);
}
}
break;
case 2: {
- float a = args[1].toNumber(exec);
- if (args[0].type() == StringType) {
- QRgb color = DOM::CSSParser::parseColor(args[0].toString(exec).string());
+ float a = args[1]->toNumber(exec);
+ if (args[0]->isString()) {
+ QRgb color = DOM::CSSParser::parseColor(args[0]->toString(exec).string());
QColor qc(color);
CGContextSetRGBStrokeColor(drawingContext, qc.red()/255., qc.green()/255., qc.blue()/255., a);
}
else {
- float g = (float)args[0].toNumber(exec);
+ float g = (float)args[0]->toNumber(exec);
CGContextSetGrayStrokeColor(drawingContext, g, a);
}
}
break;
case 4: {
- float r = (float)args[0].toNumber(exec);
- float g = (float)args[1].toNumber(exec);
- float b = (float)args[2].toNumber(exec);
- float a = (float)args[3].toNumber(exec);
+ float r = (float)args[0]->toNumber(exec);
+ float g = (float)args[1]->toNumber(exec);
+ float b = (float)args[2]->toNumber(exec);
+ float a = (float)args[3]->toNumber(exec);
CGContextSetRGBStrokeColor(drawingContext, r, g, b, a);
}
break;
case 5: {
- float c = (float)args[0].toNumber(exec);
- float m = (float)args[1].toNumber(exec);
- float y = (float)args[2].toNumber(exec);
- float k = (float)args[3].toNumber(exec);
- float a = (float)args[4].toNumber(exec);
+ float c = (float)args[0]->toNumber(exec);
+ float m = (float)args[1]->toNumber(exec);
+ float y = (float)args[2]->toNumber(exec);
+ float k = (float)args[3]->toNumber(exec);
+ float a = (float)args[4]->toNumber(exec);
CGContextSetCMYKStrokeColor(drawingContext, c, m, y, k, a);
}
break;
default: {
- Object err = Error::create(exec,SyntaxError);
+ ObjectImp *err = Error::create(exec,SyntaxError);
exec->setException(err);
return err;
}
@@ -3945,49 +3893,49 @@
int numArgs = args.size();
switch (numArgs) {
case 1: {
- if (args[0].type() == StringType) {
- QRgb color = DOM::CSSParser::parseColor(args[0].toString(exec).string());
+ if (args[0]->isString()) {
+ QRgb color = DOM::CSSParser::parseColor(args[0]->toString(exec).string());
QColor qc(color);
CGContextSetRGBFillColor(drawingContext, qc.red()/255., qc.green()/255., qc.blue()/255., qc.alpha()/255.);
}
else {
- float g = (float)args[0].toNumber(exec);
+ float g = (float)args[0]->toNumber(exec);
CGContextSetGrayFillColor(drawingContext, g, 1.);
}
}
break;
case 2: {
- float a = args[1].toNumber(exec);
- if (args[0].type() == StringType) {
- QRgb color = DOM::CSSParser::parseColor(args[0].toString(exec).string());
+ float a = args[1]->toNumber(exec);
+ if (args[0]->isString()) {
+ QRgb color = DOM::CSSParser::parseColor(args[0]->toString(exec).string());
QColor qc(color);
CGContextSetRGBFillColor(drawingContext, qc.red()/255., qc.green()/255., qc.blue()/255., a);
}
else {
- float g = (float)args[0].toNumber(exec);
+ float g = (float)args[0]->toNumber(exec);
CGContextSetGrayFillColor(drawingContext, g, a);
}
}
break;
case 4: {
- float r = (float)args[0].toNumber(exec);
- float g = (float)args[1].toNumber(exec);
- float b = (float)args[2].toNumber(exec);
- float a = (float)args[3].toNumber(exec);
+ float r = (float)args[0]->toNumber(exec);
+ float g = (float)args[1]->toNumber(exec);
+ float b = (float)args[2]->toNumber(exec);
+ float a = (float)args[3]->toNumber(exec);
CGContextSetRGBFillColor(drawingContext, r, g, b, a);
}
break;
case 5: {
- float c = (float)args[0].toNumber(exec);
- float m = (float)args[1].toNumber(exec);
- float y = (float)args[2].toNumber(exec);
- float k = (float)args[3].toNumber(exec);
- float a = (float)args[4].toNumber(exec);
+ float c = (float)args[0]->toNumber(exec);
+ float m = (float)args[1]->toNumber(exec);
+ float y = (float)args[2]->toNumber(exec);
+ float k = (float)args[3]->toNumber(exec);
+ float a = (float)args[4]->toNumber(exec);
CGContextSetCMYKStrokeColor(drawingContext, c, m, y, k, a);
}
break;
default: {
- Object err = Error::create(exec,SyntaxError);
+ ObjectImp *err = Error::create(exec,SyntaxError);
exec->setException(err);
return err;
}
@@ -3996,22 +3944,22 @@
}
case Context2D::SetLineWidth: {
if (args.size() != 1) {
- Object err = Error::create(exec,SyntaxError);
+ ObjectImp *err = Error::create(exec,SyntaxError);
exec->setException(err);
return err;
}
- float w = (float)args[0].toNumber(exec);
+ float w = (float)args[0]->toNumber(exec);
CGContextSetLineWidth (drawingContext, w);
break;
}
case Context2D::SetLineCap: {
if (args.size() != 1) {
- Object err = Error::create(exec,SyntaxError);
+ ObjectImp *err = Error::create(exec,SyntaxError);
exec->setException(err);
return err;
}
CGLineCap cap = kCGLineCapButt;
- QString capString = args[0].toString(exec).qstring().lower();
+ QString capString = args[0]->toString(exec).qstring().lower();
if (capString == "round")
cap = kCGLineCapRound;
else if (capString == "square")
@@ -4021,12 +3969,12 @@
}
case Context2D::SetLineJoin: {
if (args.size() != 1) {
- Object err = Error::create(exec,SyntaxError);
+ ObjectImp *err = Error::create(exec,SyntaxError);
exec->setException(err);
return err;
}
CGLineJoin join = kCGLineJoinMiter;
- QString joinString = args[0].toString(exec).qstring().lower();
+ QString joinString = args[0]->toString(exec).qstring().lower();
if (joinString == "round")
join = kCGLineJoinRound;
else if (joinString == "bevel")
@@ -4036,17 +3984,17 @@
}
case Context2D::SetMiterLimit: {
if (args.size() != 1) {
- Object err = Error::create(exec,SyntaxError);
+ ObjectImp *err = Error::create(exec,SyntaxError);
exec->setException(err);
return err;
}
- float l = (float)args[0].toNumber(exec);
+ float l = (float)args[0]->toNumber(exec);
CGContextSetMiterLimit (drawingContext, l);
break;
}
case Context2D::Fill: {
if (args.size() != 0) {
- Object err = Error::create(exec,SyntaxError);
+ ObjectImp *err = Error::create(exec,SyntaxError);
exec->setException(err);
return err;
}
@@ -4058,7 +4006,7 @@
// operates on clippin regions! Odd, but true.
CGContextClip(drawingContext);
- ObjectImp *o = static_cast<ObjectImp*>(contextObject->_fillStyle.imp());
+ ObjectImp *o = static_cast<ObjectImp*>(contextObject->_fillStyle);
Gradient *gradient = static_cast<Gradient*>(o);
CGShadingRef shading = gradient->getShading();
CGContextDrawShading(drawingContext, shading);
@@ -4076,7 +4024,7 @@
}
case Context2D::Stroke: {
if (args.size() != 0) {
- Object err = Error::create(exec,SyntaxError);
+ ObjectImp *err = Error::create(exec,SyntaxError);
exec->setException(err);
return err;
}
@@ -4090,7 +4038,7 @@
CGContextReplacePathWithStrokedPath(drawingContext);
CGContextClip(drawingContext);
- ObjectImp *o = static_cast<ObjectImp*>(contextObject->_strokeStyle.imp());
+ ObjectImp *o = static_cast<ObjectImp*>(contextObject->_strokeStyle);
Gradient *gradient = static_cast<Gradient*>(o);
CGShadingRef shading = gradient->getShading();
@@ -4108,137 +4056,137 @@
}
case Context2D::Scale: {
if (args.size() != 2) {
- Object err = Error::create(exec,SyntaxError);
+ ObjectImp *err = Error::create(exec,SyntaxError);
exec->setException(err);
return err;
}
- float sx = (float)args[0].toNumber(exec);
- float sy = (float)args[1].toNumber(exec);
+ float sx = (float)args[0]->toNumber(exec);
+ float sy = (float)args[1]->toNumber(exec);
CGContextScaleCTM (drawingContext, sx, sy);
contextObject->_needsFlushRasterCache = true;
break;
}
case Context2D::Rotate: {
if (args.size() != 1) {
- Object err = Error::create(exec,SyntaxError);
+ ObjectImp *err = Error::create(exec,SyntaxError);
exec->setException(err);
return err;
}
- float angle = (float)args[0].toNumber(exec);
+ float angle = (float)args[0]->toNumber(exec);
CGContextRotateCTM (drawingContext, angle);
contextObject->_needsFlushRasterCache = true;
break;
}
case Context2D::Translate: {
if (args.size() != 2) {
- Object err = Error::create(exec,SyntaxError);
+ ObjectImp *err = Error::create(exec,SyntaxError);
exec->setException(err);
return err;
}
- float tx = (float)args[0].toNumber(exec);
- float ty = (float)args[1].toNumber(exec);
+ float tx = (float)args[0]->toNumber(exec);
+ float ty = (float)args[1]->toNumber(exec);
CGContextTranslateCTM (drawingContext, tx, ty);
break;
}
case Context2D::MoveTo: {
if (args.size() != 2) {
- Object err = Error::create(exec,SyntaxError);
+ ObjectImp *err = Error::create(exec,SyntaxError);
exec->setException(err);
return err;
}
- float x = (float)args[0].toNumber(exec);
- float y = (float)args[1].toNumber(exec);
+ float x = (float)args[0]->toNumber(exec);
+ float y = (float)args[1]->toNumber(exec);
CGContextMoveToPoint (drawingContext, x, y);
renderer->setNeedsImageUpdate();
break;
}
case Context2D::LineTo: {
if (args.size() != 2) {
- Object err = Error::create(exec,SyntaxError);
+ ObjectImp *err = Error::create(exec,SyntaxError);
exec->setException(err);
return err;
}
- float x = (float)args[0].toNumber(exec);
- float y = (float)args[1].toNumber(exec);
+ float x = (float)args[0]->toNumber(exec);
+ float y = (float)args[1]->toNumber(exec);
CGContextAddLineToPoint (drawingContext, x, y);
renderer->setNeedsImageUpdate();
break;
}
case Context2D::QuadraticCurveTo: {
if (args.size() != 4) {
- Object err = Error::create(exec,SyntaxError);
+ ObjectImp *err = Error::create(exec,SyntaxError);
exec->setException(err);
return err;
}
- float cpx = (float)args[0].toNumber(exec);
- float cpy = (float)args[1].toNumber(exec);
- float x = (float)args[2].toNumber(exec);
- float y = (float)args[3].toNumber(exec);
+ float cpx = (float)args[0]->toNumber(exec);
+ float cpy = (float)args[1]->toNumber(exec);
+ float x = (float)args[2]->toNumber(exec);
+ float y = (float)args[3]->toNumber(exec);
CGContextAddQuadCurveToPoint (drawingContext, cpx, cpy, x, y);
renderer->setNeedsImageUpdate();
break;
}
case Context2D::BezierCurveTo: {
if (args.size() != 6) {
- Object err = Error::create(exec,SyntaxError);
+ ObjectImp *err = Error::create(exec,SyntaxError);
exec->setException(err);
return err;
}
- float cp1x = (float)args[0].toNumber(exec);
- float cp1y = (float)args[1].toNumber(exec);
- float cp2x = (float)args[2].toNumber(exec);
- float cp2y = (float)args[3].toNumber(exec);
- float x = (float)args[4].toNumber(exec);
- float y = (float)args[5].toNumber(exec);
+ float cp1x = (float)args[0]->toNumber(exec);
+ float cp1y = (float)args[1]->toNumber(exec);
+ float cp2x = (float)args[2]->toNumber(exec);
+ float cp2y = (float)args[3]->toNumber(exec);
+ float x = (float)args[4]->toNumber(exec);
+ float y = (float)args[5]->toNumber(exec);
CGContextAddCurveToPoint (drawingContext, cp1x, cp1y, cp2x, cp2y, x, y);
renderer->setNeedsImageUpdate();
break;
}
case Context2D::ArcTo: {
if (args.size() != 5) {
- Object err = Error::create(exec,SyntaxError);
+ ObjectImp *err = Error::create(exec,SyntaxError);
exec->setException(err);
return err;
}
- float x1 = (float)args[0].toNumber(exec);
- float y1 = (float)args[1].toNumber(exec);
- float x2 = (float)args[2].toNumber(exec);
- float y2 = (float)args[3].toNumber(exec);
- float r = (float)args[4].toNumber(exec);
+ float x1 = (float)args[0]->toNumber(exec);
+ float y1 = (float)args[1]->toNumber(exec);
+ float x2 = (float)args[2]->toNumber(exec);
+ float y2 = (float)args[3]->toNumber(exec);
+ float r = (float)args[4]->toNumber(exec);
CGContextAddArcToPoint (drawingContext, x1, y1, x2, y2, r);
break;
}
case Context2D::Arc: {
if (args.size() != 6) {
- Object err = Error::create(exec,SyntaxError);
+ ObjectImp *err = Error::create(exec,SyntaxError);
exec->setException(err);
return err;
}
- float x = (float)args[0].toNumber(exec);
- float y = (float)args[1].toNumber(exec);
- float r = (float)args[2].toNumber(exec);
- float sa = (float)args[3].toNumber(exec);
- float ea = (float)args[4].toNumber(exec);
- bool clockwise = args[5].toBoolean(exec);
+ float x = (float)args[0]->toNumber(exec);
+ float y = (float)args[1]->toNumber(exec);
+ float r = (float)args[2]->toNumber(exec);
+ float sa = (float)args[3]->toNumber(exec);
+ float ea = (float)args[4]->toNumber(exec);
+ bool clockwise = args[5]->toBoolean(exec);
CGContextAddArc (drawingContext, x, y, r, sa, ea, clockwise);
break;
}
case Context2D::Rect: {
if (args.size() != 4) {
- Object err = Error::create(exec,SyntaxError);
+ ObjectImp *err = Error::create(exec,SyntaxError);
exec->setException(err);
return err;
}
- float x = (float)args[0].toNumber(exec);
- float y = (float)args[1].toNumber(exec);
- float w = (float)args[2].toNumber(exec);
- float h = (float)args[3].toNumber(exec);
+ float x = (float)args[0]->toNumber(exec);
+ float y = (float)args[1]->toNumber(exec);
+ float w = (float)args[2]->toNumber(exec);
+ float h = (float)args[3]->toNumber(exec);
CGContextAddRect (drawingContext, CGRectMake(x,y,w,h));
break;
}
case Context2D::Clip: {
if (args.size() != 0) {
- Object err = Error::create(exec,SyntaxError);
+ ObjectImp *err = Error::create(exec,SyntaxError);
exec->setException(err);
return err;
}
@@ -4248,28 +4196,28 @@
case Context2D::ClearRect: {
if (args.size() != 4) {
- Object err = Error::create(exec,SyntaxError);
+ ObjectImp *err = Error::create(exec,SyntaxError);
exec->setException(err);
return err;
}
- float x = (float)args[0].toNumber(exec);
- float y = (float)args[1].toNumber(exec);
- float w = (float)args[2].toNumber(exec);
- float h = (float)args[3].toNumber(exec);
+ float x = (float)args[0]->toNumber(exec);
+ float y = (float)args[1]->toNumber(exec);
+ float w = (float)args[2]->toNumber(exec);
+ float h = (float)args[3]->toNumber(exec);
CGContextClearRect (drawingContext, CGRectMake(x,y,w,h));
renderer->setNeedsImageUpdate();
break;
}
case Context2D::FillRect: {
if (args.size() != 4) {
- Object err = Error::create(exec,SyntaxError);
+ ObjectImp *err = Error::create(exec,SyntaxError);
exec->setException(err);
return err;
}
- float x = (float)args[0].toNumber(exec);
- float y = (float)args[1].toNumber(exec);
- float w = (float)args[2].toNumber(exec);
- float h = (float)args[3].toNumber(exec);
+ float x = (float)args[0]->toNumber(exec);
+ float y = (float)args[1]->toNumber(exec);
+ float w = (float)args[2]->toNumber(exec);
+ float h = (float)args[3]->toNumber(exec);
if (isImagePattern(contextObject->_fillStyle))
contextObject->updateFillImagePattern();
CGContextFillRect (drawingContext, CGRectMake(x,y,w,h));
@@ -4279,18 +4227,19 @@
case Context2D::StrokeRect: {
int size = args.size();
if (size < 4) {
- Object err = Error::create(exec,SyntaxError);
+ ObjectImp *err = Error::create(exec,SyntaxError);
exec->setException(err);
return err;
}
- float x = (float)args[0].toNumber(exec);
- float y = (float)args[1].toNumber(exec);
- float w = (float)args[2].toNumber(exec);
- float h = (float)args[3].toNumber(exec);
+ float x = (float)args[0]->toNumber(exec);
+ float y = (float)args[1]->toNumber(exec);
+ float w = (float)args[2]->toNumber(exec);
+ float h = (float)args[3]->toNumber(exec);
+
if (isImagePattern(contextObject->_strokeStyle))
contextObject->updateStrokeImagePattern();
if (size > 4)
- CGContextStrokeRectWithWidth (drawingContext, CGRectMake(x,y,w,h), (float)args[4].toNumber(exec));
+ CGContextStrokeRectWithWidth (drawingContext, CGRectMake(x,y,w,h), (float)args[4]->toNumber(exec));
else
CGContextStrokeRect (drawingContext, CGRectMake(x,y,w,h));
renderer->setNeedsImageUpdate();
@@ -4300,17 +4249,17 @@
int numArgs = args.size();
if (numArgs < 3) {
- Object err = Error::create(exec,SyntaxError);
+ ObjectImp *err = Error::create(exec,SyntaxError);
exec->setException(err);
return err;
}
CGSize offset;
- offset.width = (float)args[0].toNumber(exec);
- offset.height = (float)args[1].toNumber(exec);
- float blur = (float)args[2].toNumber(exec);
+ offset.width = (float)args[0]->toNumber(exec);
+ offset.height = (float)args[1]->toNumber(exec);
+ float blur = (float)args[2]->toNumber(exec);
- QColor color = QColor(args[3].toString(exec).ascii());
+ QColor color = QColor(args[3]->toString(exec).ascii());
if (numArgs == 3) {
CGContextSetShadow (drawingContext, offset, blur);
@@ -4320,8 +4269,8 @@
switch (numArgs - 3) {
case 1: {
- if (args[3].type() == StringType) {
- QRgb color = DOM::CSSParser::parseColor(args[3].toString(exec).string());
+ if (args[3]->isString()) {
+ QRgb color = DOM::CSSParser::parseColor(args[3]->toString(exec).string());
QColor qc(color);
components[0] = qc.red()/255.;
components[1] = qc.green()/255.;
@@ -4330,16 +4279,16 @@
colorSpace = CGColorSpaceCreateDeviceRGB();
}
else {
- components[0] = (float)args[3].toNumber(exec);
+ components[0] = (float)args[3]->toNumber(exec);
components[1] = 1.0f;
colorSpace = CGColorSpaceCreateDeviceGray();
}
}
break;
case 2: {
- float a = args[4].toNumber(exec);
- if (args[3].type() == StringType) {
- QRgb color = DOM::CSSParser::parseColor(args[3].toString(exec).string());
+ float a = args[4]->toNumber(exec);
+ if (args[3]->isString()) {
+ QRgb color = DOM::CSSParser::parseColor(args[3]->toString(exec).string());
QColor qc(color);
components[0] = qc.red()/255.;
components[1] = qc.green()/255.;
@@ -4348,32 +4297,32 @@
colorSpace = CGColorSpaceCreateDeviceRGB();
}
else {
- components[0] = (float)args[3].toNumber(exec);
+ components[0] = (float)args[3]->toNumber(exec);
components[1] = a;
colorSpace = CGColorSpaceCreateDeviceGray();
}
}
break;
case 4: {
- components[0] = (float)args[3].toNumber(exec); // r
- components[1] = (float)args[4].toNumber(exec); // g
- components[2] = (float)args[5].toNumber(exec); // b
- components[3] = (float)args[6].toNumber(exec); // a
+ components[0] = (float)args[3]->toNumber(exec); // r
+ components[1] = (float)args[4]->toNumber(exec); // g
+ components[2] = (float)args[5]->toNumber(exec); // b
+ components[3] = (float)args[6]->toNumber(exec); // a
colorSpace = CGColorSpaceCreateDeviceRGB();
}
break;
case 5: {
- components[0] = (float)args[3].toNumber(exec); // c
- components[1] = (float)args[4].toNumber(exec); // m
- components[2] = (float)args[5].toNumber(exec); // y
- components[3] = (float)args[6].toNumber(exec); // k
- components[4] = (float)args[7].toNumber(exec); // a
+ components[0] = (float)args[3]->toNumber(exec); // c
+ components[1] = (float)args[4]->toNumber(exec); // m
+ components[2] = (float)args[5]->toNumber(exec); // y
+ components[3] = (float)args[6]->toNumber(exec); // k
+ components[4] = (float)args[7]->toNumber(exec); // a
colorSpace = CGColorSpaceCreateDeviceCMYK();
}
break;
default: {
- Object err = Error::create(exec,SyntaxError);
+ ObjectImp *err = Error::create(exec,SyntaxError);
exec->setException(err);
return err;
}
@@ -4388,7 +4337,7 @@
}
case Context2D::ClearShadow: {
if (args.size() != 0) {
- Object err = Error::create(exec,SyntaxError);
+ ObjectImp *err = Error::create(exec,SyntaxError);
exec->setException(err);
return err;
}
@@ -4404,15 +4353,15 @@
// img parameter can be a JavaScript Image, <img>, or a <canvas>
case Context2D::DrawImage: {
if (args.size() < 3) {
- Object err = Error::create(exec,SyntaxError);
+ ObjectImp *err = Error::create(exec,SyntaxError);
exec->setException(err);
return err;
}
// Make sure first argument is an object.
- ObjectImp *o = static_cast<ObjectImp*>(args[0].imp());
- if (o->type() != ObjectType) {
- Object err = Error::create(exec,TypeError);
+ ObjectImp *o = static_cast<ObjectImp*>(args[0]);
+ if (!o->isObject()) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
@@ -4437,14 +4386,14 @@
h = pixmap.height();
}
else if (o->inherits(&KJS::HTMLElement::img_info)){
- NodeImpl *n = static_cast<HTMLElement *>(args[0].imp())->impl();
+ NodeImpl *n = static_cast<HTMLElement *>(args[0])->impl();
HTMLImageElementImpl *e = static_cast<HTMLImageElementImpl*>(n);
pixmap = e->pixmap();
w = pixmap.width();
h = pixmap.height();
}
else if (o->inherits(&KJS::HTMLElement::canvas_info)){
- NodeImpl *n = static_cast<HTMLElement *>(args[0].imp())->impl();
+ NodeImpl *n = static_cast<HTMLElement *>(args[0])->impl();
HTMLCanvasElementImpl *e = static_cast<HTMLCanvasElementImpl*>(n);
khtml::RenderCanvasImage *renderer = static_cast<khtml::RenderCanvasImage*>(e->renderer());
if (!renderer) {
@@ -4457,7 +4406,7 @@
h = (float)CGBitmapContextGetHeight(sourceContext);
}
else {
- Object err = Error::create(exec,TypeError);
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
@@ -4466,27 +4415,27 @@
float sx = 0.f, sy = 0.f, sw = w, sh = h;
if (args.size() == 3) {
- dx = args[1].toNumber(exec);
- dy = args[2].toNumber(exec);
+ dx = args[1]->toNumber(exec);
+ dy = args[2]->toNumber(exec);
}
else if (args.size() == 5) {
- dx = args[1].toNumber(exec);
- dy = args[2].toNumber(exec);
- dw = args[3].toNumber(exec);
- dh = args[4].toNumber(exec);
+ dx = args[1]->toNumber(exec);
+ dy = args[2]->toNumber(exec);
+ dw = args[3]->toNumber(exec);
+ dh = args[4]->toNumber(exec);
}
else if (args.size() == 9) {
- sx = args[1].toNumber(exec);
- sy = args[2].toNumber(exec);
- sw = args[3].toNumber(exec);
- sh = args[4].toNumber(exec);
- dx = args[5].toNumber(exec);
- dy = args[6].toNumber(exec);
- dw = args[7].toNumber(exec);
- dh = args[8].toNumber(exec);
+ sx = args[1]->toNumber(exec);
+ sy = args[2]->toNumber(exec);
+ sw = args[3]->toNumber(exec);
+ sh = args[4]->toNumber(exec);
+ dx = args[5]->toNumber(exec);
+ dy = args[6]->toNumber(exec);
+ dw = args[7]->toNumber(exec);
+ dh = args[8]->toNumber(exec);
}
else {
- Object err = Error::create(exec,SyntaxError);
+ ObjectImp *err = Error::create(exec,SyntaxError);
exec->setException(err);
return err;
}
@@ -4494,7 +4443,7 @@
if (!sourceContext) {
QPainter p;
p.drawFloatPixmap (dx, dy, dw, dh, pixmap, sx, sy, sw, sh,
- QPainter::compositeOperatorFromString(contextObject->_globalComposite.toString(exec).qstring().lower()), drawingContext);
+ QPainter::compositeOperatorFromString(contextObject->_globalComposite->toString(exec).qstring().lower()), drawingContext);
}
else {
// Cheap, because the image is backed by copy-on-write memory, and we're
@@ -4540,26 +4489,26 @@
}
case Context2D::DrawImageFromRect: {
if (args.size() != 10) {
- Object err = Error::create(exec,SyntaxError);
+ ObjectImp *err = Error::create(exec,SyntaxError);
exec->setException(err);
return err;
}
- ObjectImp *o = static_cast<ObjectImp*>(args[0].imp());
- if (o->type() != ObjectType || !o->inherits(&Image::info)) {
- Object err = Error::create(exec,TypeError);
+ ObjectImp *o = static_cast<ObjectImp*>(args[0]);
+ if (!o->isObject() || !o->inherits(&Image::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
Image *i = static_cast<Image*>(o);
- float sx = args[1].toNumber(exec);
- float sy = args[2].toNumber(exec);
- float sw = args[3].toNumber(exec);
- float sh = args[4].toNumber(exec);
- float dx = args[5].toNumber(exec);
- float dy = args[6].toNumber(exec);
- float dw = args[7].toNumber(exec);
- float dh = args[8].toNumber(exec);
- QString compositeOperator = args[9].toString(exec).qstring().lower();
+ float sx = args[1]->toNumber(exec);
+ float sy = args[2]->toNumber(exec);
+ float sw = args[3]->toNumber(exec);
+ float sh = args[4]->toNumber(exec);
+ float dx = args[5]->toNumber(exec);
+ float dy = args[6]->toNumber(exec);
+ float dw = args[7]->toNumber(exec);
+ float dh = args[8]->toNumber(exec);
+ QString compositeOperator = args[9]->toString(exec).qstring().lower();
khtml::CachedImage *ci = i->image();
if (ci) {
QPixmap pixmap = ci->pixmap();
@@ -4576,76 +4525,76 @@
}
case Context2D::SetAlpha: {
if (args.size() != 1) {
- Object err = Error::create(exec,SyntaxError);
+ ObjectImp *err = Error::create(exec,SyntaxError);
exec->setException(err);
return err;
}
- float a = (float)args[0].toNumber(exec);
+ float a = (float)args[0]->toNumber(exec);
CGContextSetAlpha (drawingContext, a);
break;
}
case Context2D::SetCompositeOperation: {
if (args.size() != 1) {
- Object err = Error::create(exec,SyntaxError);
+ ObjectImp *err = Error::create(exec,SyntaxError);
exec->setException(err);
return err;
}
- QString compositeOperator = args[0].toString(exec).qstring().lower();
+ QString compositeOperator = args[0]->toString(exec).qstring().lower();
QPainter::setCompositeOperation (drawingContext,compositeOperator);
break;
}
case Context2D::CreateLinearGradient: {
if (args.size() != 4) {
- Object err = Error::create(exec,SyntaxError);
+ ObjectImp *err = Error::create(exec,SyntaxError);
exec->setException(err);
return err;
}
- float x0 = args[0].toNumber(exec);
- float y0 = args[1].toNumber(exec);
- float x1 = args[2].toNumber(exec);
- float y1 = args[3].toNumber(exec);
+ float x0 = args[0]->toNumber(exec);
+ float y0 = args[1]->toNumber(exec);
+ float x1 = args[2]->toNumber(exec);
+ float y1 = args[3]->toNumber(exec);
- return Object(new Gradient(x0, y0, x1, y1));
+ return new Gradient(x0, y0, x1, y1);
}
case Context2D::CreateRadialGradient: {
if (args.size() != 6) {
- Object err = Error::create(exec,SyntaxError);
+ ObjectImp *err = Error::create(exec,SyntaxError);
exec->setException(err);
return err;
}
- float x0 = args[0].toNumber(exec);
- float y0 = args[1].toNumber(exec);
- float r0 = args[2].toNumber(exec);
- float x1 = args[3].toNumber(exec);
- float y1 = args[4].toNumber(exec);
- float r1 = args[5].toNumber(exec);
+ float x0 = args[0]->toNumber(exec);
+ float y0 = args[1]->toNumber(exec);
+ float r0 = args[2]->toNumber(exec);
+ float x1 = args[3]->toNumber(exec);
+ float y1 = args[4]->toNumber(exec);
+ float r1 = args[5]->toNumber(exec);
- return Object(new Gradient(x0, y0, r0, x1, y1, r1));
+ return new Gradient(x0, y0, r0, x1, y1, r1);
}
case Context2D::CreatePattern: {
if (args.size() != 2) {
- Object err = Error::create(exec,SyntaxError);
+ ObjectImp *err = Error::create(exec,SyntaxError);
exec->setException(err);
return err;
}
- ObjectImp *o = static_cast<ObjectImp*>(args[0].imp());
- if (o->type() != ObjectType || !o->inherits(&Image::info)) {
- Object err = Error::create(exec,TypeError);
+ ObjectImp *o = static_cast<ObjectImp*>(args[0]);
+ if (!o->isObject() || !o->inherits(&Image::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
int repetitionType = ImagePattern::Repeat;
- QString repetitionString = args[1].toString(exec).qstring().lower();
+ QString repetitionString = args[1]->toString(exec).qstring().lower();
if (repetitionString == "repeat-x")
repetitionType = ImagePattern::RepeatX;
else if (repetitionString == "repeat-y")
repetitionType = ImagePattern::RepeatY;
else if (repetitionString == "no-repeat")
repetitionType = ImagePattern::NoRepeat;
- return Object(new ImagePattern(static_cast<Image*>(o), repetitionType));
+ return new ImagePattern(static_cast<Image*>(o), repetitionType);
}
}
@@ -4712,7 +4661,7 @@
return getStaticPropertySlot<Context2DFunction, Context2D, DOMObject>(exec, &Context2DTable, this, propertyName, slot);
}
-Value Context2D::getValueProperty(ExecState *, int token) const
+ValueImp *Context2D::getValueProperty(ExecState *, int token) const
{
switch(token) {
case StrokeStyle: {
@@ -4770,7 +4719,7 @@
return Undefined();
}
-void Context2D::put(ExecState *exec, const Identifier &propertyName, const Value& value, int attr)
+void Context2D::put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr)
{
lookupPut<Context2D,DOMObject>(exec, propertyName, value, attr, &Context2DTable, this );
}
@@ -4789,13 +4738,13 @@
}
-CGColorRef colorRefFromValue(ExecState *exec, const Value &value)
+CGColorRef colorRefFromValue(ExecState *exec, ValueImp *value)
{
CGColorSpaceRef colorSpace;
float components[4];
- if (value.type() == StringType) {
- QRgb color = DOM::CSSParser::parseColor(value.toString(exec).string());
+ if (value->isString()) {
+ QRgb color = DOM::CSSParser::parseColor(value->toString(exec).string());
QColor qc(color);
components[0] = qc.red()/255.;
components[1] = qc.green()/255.;
@@ -4812,9 +4761,9 @@
return colorRef;
}
-QColor colorFromValue(ExecState *exec, const Value &value)
+QColor colorFromValue(ExecState *exec, ValueImp *value)
{
- QRgb color = DOM::CSSParser::parseColor(value.toString(exec).string());
+ QRgb color = DOM::CSSParser::parseColor(value->toString(exec).string());
return QColor(color);
}
@@ -4825,9 +4774,9 @@
return;
CGSize offset;
- offset.width = (float)_shadowOffsetX.toNumber(exec);
- offset.height = (float)_shadowOffsetY.toNumber(exec);
- float blur = (float)_shadowBlur.toNumber(exec);
+ offset.width = (float)_shadowOffsetX->toNumber(exec);
+ offset.height = (float)_shadowOffsetY->toNumber(exec);
+ float blur = (float)_shadowBlur->toNumber(exec);
CGColorRef colorRef = colorRefFromValue(exec, _shadowColor);
CGContextSetShadowWithColor (context, offset, blur, colorRef);
CFRelease (colorRef);
@@ -4839,7 +4788,7 @@
CGAffineTransform transform = CGContextGetCTM(context);
if (!_validFillImagePattern || !CGAffineTransformEqualToTransform(transform, _lastFillImagePatternCTM)) {
- ImagePattern *imagePattern = static_cast<ImagePattern *>(_fillStyle.imp());
+ ImagePattern *imagePattern = static_cast<ImagePattern *>(_fillStyle);
CGPatternRef pattern = imagePattern->createPattern(CGContextGetCTM(context));
float patternAlpha = 1;
CGColorSpaceRef patternSpace = CGColorSpaceCreatePattern(0);
@@ -4858,7 +4807,7 @@
CGAffineTransform transform = CGContextGetCTM(context);
if (!_validStrokeImagePattern || !CGAffineTransformEqualToTransform(transform, _lastStrokeImagePatternCTM)) {
- ImagePattern *imagePattern = static_cast<ImagePattern *>(_fillStyle.imp());
+ ImagePattern *imagePattern = static_cast<ImagePattern *>(_fillStyle);
CGPatternRef pattern = imagePattern->createPattern(CGContextGetCTM(context));
float patternAlpha = 1;
CGColorSpaceRef patternSpace = CGColorSpaceCreatePattern(0);
@@ -4871,7 +4820,7 @@
}
}
-void Context2D::putValueProperty(ExecState *exec, int token, const Value& value, int /*attr*/)
+void Context2D::putValueProperty(ExecState *exec, int token, ValueImp *value, int /*attr*/)
{
CGContextRef context = drawingContext();
if (!context)
@@ -4880,18 +4829,17 @@
switch(token) {
case StrokeStyle: {
_strokeStyle = value;
- if (value.type() == StringType) {
+ if (value->isString()) {
QColor qc = colorFromValue(exec, value);
CGContextSetRGBStrokeColor(context, qc.red()/255., qc.green()/255., qc.blue()/255., qc.alpha()/255.);
}
else {
// _strokeStyle is used when stroke() is called on the context.
// CG doesn't have the notion of a setting a stroke gradient.
- ObjectImp *o = static_cast<ObjectImp*>(value.imp());
+ ObjectImp *o = static_cast<ObjectImp*>(value);
- if (o->type() != ObjectType ||
- (!(o->inherits(&Gradient::info) || o->inherits(&ImagePattern::info)))) {
- Object err = Error::create(exec,TypeError);
+ if (!o->isObject() || !(o->inherits(&Gradient::info) || o->inherits(&ImagePattern::info))) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return;
}
@@ -4901,18 +4849,17 @@
case FillStyle: {
_fillStyle = value;
- if (value.type() == StringType) {
+ if (value->isString()) {
QColor qc = colorFromValue(exec, value);
CGContextSetRGBFillColor(context, qc.red()/255., qc.green()/255., qc.blue()/255., qc.alpha()/255.);
}
else {
// _fillStyle is checked when fill() is called on the context.
// CG doesn't have the notion of setting a fill gradient.
- ObjectImp *o = static_cast<ObjectImp*>(value.imp());
+ ObjectImp *o = static_cast<ObjectImp*>(value);
- if (o->type() != ObjectType ||
- (!(o->inherits(&Gradient::info) || o->inherits(&ImagePattern::info)))) {
- Object err = Error::create(exec,TypeError);
+ if (o->type() != ObjectType || !(o->inherits(&Gradient::info) || o->inherits(&ImagePattern::info))) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return;
}
@@ -4924,7 +4871,7 @@
case LineWidth: {
_lineWidth = value;
- float w = (float)value.toNumber(exec);
+ float w = (float)value->toNumber(exec);
CGContextSetLineWidth (context, w);
break;
}
@@ -4933,7 +4880,7 @@
_lineCap = value;
CGLineCap cap = kCGLineCapButt;
- QString capString = value.toString(exec).qstring().lower();
+ QString capString = value->toString(exec).qstring().lower();
if (capString == "round")
cap = kCGLineCapRound;
else if (capString == "square")
@@ -4946,7 +4893,7 @@
_lineJoin = value;
CGLineJoin join = kCGLineJoinMiter;
- QString joinString = value.toString(exec).qstring().lower();
+ QString joinString = value->toString(exec).qstring().lower();
if (joinString == "round")
join = kCGLineJoinRound;
else if (joinString == "bevel")
@@ -4958,7 +4905,7 @@
case MiterLimit: {
_miterLimit = value;
- float l = (float)value.toNumber(exec);
+ float l = (float)value->toNumber(exec);
CGContextSetMiterLimit (context, l);
break;
}
@@ -4989,14 +4936,14 @@
case GlobalAlpha: {
_globalAlpha = value;
- float a = (float)value.toNumber(exec);
+ float a = (float)value->toNumber(exec);
CGContextSetAlpha (context, a);
break;
}
case GlobalCompositeOperation: {
_globalComposite = value;
- QString compositeOperator = value.toString(exec).qstring().lower();
+ QString compositeOperator = value->toString(exec).qstring().lower();
QPainter::setCompositeOperation (context, compositeOperator);
break;
}
@@ -5054,7 +5001,19 @@
Context2D::Context2D(HTMLElementImpl *e)
: _validFillImagePattern(false), _validStrokeImagePattern(false),
- _element(e), _needsFlushRasterCache(false)
+ _element(e), _needsFlushRasterCache(false),
+ _strokeStyle(jsUndefined()),
+ _fillStyle(jsUndefined()),
+ _lineWidth(jsUndefined()),
+ _lineCap(jsUndefined()),
+ _lineJoin(jsUndefined()),
+ _miterLimit(jsUndefined()),
+ _shadowOffsetX(jsUndefined()),
+ _shadowOffsetY(jsUndefined()),
+ _shadowBlur(jsUndefined()),
+ _shadowColor(jsUndefined()),
+ _globalAlpha(jsUndefined()),
+ _globalComposite(jsUndefined())
{
_lineWidth = Number (1.);
_strokeStyle = String ("black");
@@ -5084,51 +5043,51 @@
ValueImp *v;
v = _strokeStyle;
- if (v && !v->marked())
+ if (!v->marked())
v->mark();
v = _fillStyle;
- if (v && !v->marked())
+ if (!v->marked())
v->mark();
v = _lineWidth;
- if (v && !v->marked())
+ if (!v->marked())
v->mark();
v = _lineCap;
- if (v && !v->marked())
+ if (!v->marked())
v->mark();
v = _lineJoin;
- if (v && !v->marked())
+ if (!v->marked())
v->mark();
v = _miterLimit;
- if (v && !v->marked())
+ if (!v->marked())
v->mark();
v = _shadowOffsetX;
- if (v && !v->marked())
+ if (!v->marked())
v->mark();
v = _shadowOffsetY;
- if (v && !v->marked())
+ if (!v->marked())
v->mark();
v = _shadowBlur;
- if (v && !v->marked())
+ if (!v->marked())
v->mark();
v = _shadowColor;
- if (v && !v->marked())
+ if (!v->marked())
v->mark();
v = _globalAlpha;
- if (v && !v->marked())
+ if (!v->marked())
v->mark();
v = _globalComposite;
- if (v && !v->marked())
+ if (!v->marked())
v->mark();
QPtrListIterator<List> it(stateStack);
@@ -5151,26 +5110,26 @@
IMPLEMENT_PROTOFUNC(GradientFunction)
-Value GradientFunction::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *GradientFunction::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (!thisObj.inherits(&Gradient::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&Gradient::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
- Gradient *gradient = static_cast<KJS::Gradient *>(thisObj.imp());
+ Gradient *gradient = static_cast<KJS::Gradient *>(thisObj);
switch (id) {
case Gradient::AddColorStop: {
if (args.size() != 2) {
- Object err = Error::create(exec,SyntaxError);
+ ObjectImp *err = Error::create(exec,SyntaxError);
exec->setException(err);
return err;
}
QColor color = colorFromValue(exec, args[1]);
- gradient->addColorStop ((float)args[0].toNumber(exec), color.red()/255.f, color.green()/255.f, color.blue()/255.f, color.alpha()/255.f);
+ gradient->addColorStop ((float)args[0]->toNumber(exec), color.red()/255.f, color.green()/255.f, color.blue()/255.f, color.alpha()/255.f);
}
}
@@ -5273,17 +5232,17 @@
return getStaticPropertySlot<GradientFunction, Gradient, DOMObject>(exec, &GradientTable, this, propertyName, slot);
}
-Value Gradient::getValueProperty(ExecState *, int token) const
+ValueImp *Gradient::getValueProperty(ExecState *, int token) const
{
return Undefined();
}
-void Gradient::put(ExecState *exec, const Identifier &propertyName, const Value& value, int attr)
+void Gradient::put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr)
{
lookupPut<Gradient,DOMObject>(exec, propertyName, value, attr, &GradientTable, this );
}
-void Gradient::putValueProperty(ExecState *exec, int token, const Value& value, int /*attr*/)
+void Gradient::putValueProperty(ExecState *exec, int token, ValueImp *value, int /*attr*/)
{
}
@@ -5469,17 +5428,17 @@
return getStaticValueSlot<ImagePattern, DOMObject>(exec, &ImagePatternTable, this, propertyName, slot);
}
-Value ImagePattern::getValueProperty(ExecState *, int token) const
+ValueImp *ImagePattern::getValueProperty(ExecState *, int token) const
{
return Undefined();
}
-void ImagePattern::put(ExecState *exec, const Identifier &propertyName, const Value& value, int attr)
+void ImagePattern::put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr)
{
lookupPut<ImagePattern,DOMObject>(exec, propertyName, value, attr, &ImagePatternTable, this );
}
-void ImagePattern::putValueProperty(ExecState *exec, int token, const Value& value, int /*attr*/)
+void ImagePattern::putValueProperty(ExecState *exec, int token, ValueImp *value, int /*attr*/)
{
}
1.55 +158 -158 WebCore/khtml/ecma/kjs_html.h
Index: kjs_html.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_html.h,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -r1.54 -r1.55
--- kjs_html.h 7 Aug 2005 06:17:45 -0000 1.54
+++ kjs_html.h 8 Aug 2005 04:07:41 -0000 1.55
@@ -48,9 +48,9 @@
public:
HTMLDocument(ExecState *exec, DOM::HTMLDocumentImpl *d);
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
- virtual void put(ExecState *exec, const Identifier &propertyName, const Value& value, int attr = None);
- void putValueProperty(ExecState *exec, int token, const Value& value, int /*attr*/);
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
+ virtual void put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr = None);
+ void putValueProperty(ExecState *exec, int token, ValueImp *value, int /*attr*/);
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
enum { Title, Referrer, Domain, URL, Body, Location, Cookie,
@@ -58,19 +58,19 @@
Write, WriteLn, GetElementsByName, CaptureEvents, ReleaseEvents,
BgColor, FgColor, AlinkColor, LinkColor, VlinkColor, LastModified, Height, Width, Dir, DesignMode };
private:
- static Value namedItemGetter(ExecState *, const Identifier&, const PropertySlot&);
+ static ValueImp *namedItemGetter(ExecState *, const Identifier&, const PropertySlot&);
};
class HTMLElement : public DOMElement {
public:
HTMLElement(ExecState *exec, DOM::HTMLElementImpl *e);
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
- virtual void put(ExecState *exec, const Identifier &propertyName, const Value& value, int attr = None);
- void putValueProperty(ExecState *exec, int token, const Value& value, int);
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
+ virtual void put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr = None);
+ void putValueProperty(ExecState *exec, int token, ValueImp *value, int);
virtual UString toString(ExecState *exec) const;
virtual void pushEventHandlerScope(ExecState *exec, ScopeChain &scope) const;
- virtual Value call(ExecState *exec, Object &thisObj, const List&args);
+ virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List&args);
virtual bool implementsCall() const;
virtual const ClassInfo* classInfo() const;
static const ClassInfo info;
@@ -87,8 +87,8 @@
tablecell_info, frameSet_info, frame_info, iFrame_info, marquee_info;
// FIXME: Might make sense to combine this with ClassInfo some day.
- typedef Value (HTMLElement::*GetterFunction)(ExecState *exec, int token) const;
- typedef void (HTMLElement::*SetterFunction)(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ typedef ValueImp *(HTMLElement::*GetterFunction)(ExecState *exec, int token) const;
+ typedef void (HTMLElement::*SetterFunction)(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
struct Accessors { GetterFunction m_getter; SetterFunction m_setter; };
const Accessors* getSetInfo() const;
static const Accessors html_accessors, head_accessors, link_accessors, title_accessors,
@@ -102,114 +102,114 @@
caption_accessors, col_accessors, tablesection_accessors, tr_accessors,
tablecell_accessors, frameSet_accessors, frame_accessors, iFrame_accessors, marquee_accessors;
- Value htmlGetter(ExecState* exec, int token) const;
- void htmlSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value headGetter(ExecState* exec, int token) const;
- void headSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value linkGetter(ExecState* exec, int token) const;
- void linkSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value titleGetter(ExecState* exec, int token) const;
- void titleSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value metaGetter(ExecState* exec, int token) const;
- void metaSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value baseGetter(ExecState* exec, int token) const;
- void baseSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value isIndexGetter(ExecState* exec, int token) const;
- void isIndexSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value styleGetter(ExecState* exec, int token) const;
- void styleSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value bodyGetter(ExecState* exec, int token) const;
- void bodySetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value formGetter(ExecState* exec, int token) const;
- void formSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value selectGetter(ExecState* exec, int token) const;
- void selectSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value optGroupGetter(ExecState* exec, int token) const;
- void optGroupSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value optionGetter(ExecState* exec, int token) const;
- void optionSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value inputGetter(ExecState* exec, int token) const;
- void inputSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value textAreaGetter(ExecState* exec, int token) const;
- void textAreaSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value buttonGetter(ExecState* exec, int token) const;
- void buttonSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value labelGetter(ExecState* exec, int token) const;
- void labelSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value fieldSetGetter(ExecState* exec, int token) const;
- void fieldSetSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value legendGetter(ExecState* exec, int token) const;
- void legendSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value uListGetter(ExecState* exec, int token) const;
- void uListSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value oListGetter(ExecState* exec, int token) const;
- void oListSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value dListGetter(ExecState* exec, int token) const;
- void dListSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value dirGetter(ExecState* exec, int token) const;
- void dirSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value menuGetter(ExecState* exec, int token) const;
- void menuSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value liGetter(ExecState* exec, int token) const;
- void liSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value divGetter(ExecState* exec, int token) const;
- void divSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value paragraphGetter(ExecState* exec, int token) const;
- void paragraphSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value headingGetter(ExecState* exec, int token) const;
- void headingSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value blockQuoteGetter(ExecState* exec, int token) const;
- void blockQuoteSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value quoteGetter(ExecState* exec, int token) const;
- void quoteSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value preGetter(ExecState* exec, int token) const;
- void preSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value brGetter(ExecState* exec, int token) const;
- void brSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value baseFontGetter(ExecState* exec, int token) const;
- void baseFontSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value fontGetter(ExecState* exec, int token) const;
- void fontSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value hrGetter(ExecState* exec, int token) const;
- void hrSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value modGetter(ExecState* exec, int token) const;
- void modSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value anchorGetter(ExecState* exec, int token) const;
- void anchorSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value imageGetter(ExecState* exec, int token) const;
- void imageSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value objectGetter(ExecState* exec, int token) const;
- void objectSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value paramGetter(ExecState* exec, int token) const;
- void paramSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value appletGetter(ExecState* exec, int token) const;
- void appletSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value mapGetter(ExecState* exec, int token) const;
- void mapSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value areaGetter(ExecState* exec, int token) const;
- void areaSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value scriptGetter(ExecState* exec, int token) const;
- void scriptSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value tableGetter(ExecState* exec, int token) const;
- void tableSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value tableCaptionGetter(ExecState* exec, int token) const;
- void tableCaptionSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value tableColGetter(ExecState* exec, int token) const;
- void tableColSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value tableSectionGetter(ExecState* exec, int token) const;
- void tableSectionSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value tableRowGetter(ExecState* exec, int token) const;
- void tableRowSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value tableCellGetter(ExecState* exec, int token) const;
- void tableCellSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value frameSetGetter(ExecState* exec, int token) const;
- void frameSetSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value frameGetter(ExecState* exec, int token) const;
- void frameSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value iFrameGetter(ExecState* exec, int token) const;
- void iFrameSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
- Value marqueeGetter(ExecState* exec, int token) const;
- void marqueeSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ ValueImp *htmlGetter(ExecState* exec, int token) const;
+ void htmlSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *headGetter(ExecState* exec, int token) const;
+ void headSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *linkGetter(ExecState* exec, int token) const;
+ void linkSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *titleGetter(ExecState* exec, int token) const;
+ void titleSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *metaGetter(ExecState* exec, int token) const;
+ void metaSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *baseGetter(ExecState* exec, int token) const;
+ void baseSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *isIndexGetter(ExecState* exec, int token) const;
+ void isIndexSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *styleGetter(ExecState* exec, int token) const;
+ void styleSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *bodyGetter(ExecState* exec, int token) const;
+ void bodySetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *formGetter(ExecState* exec, int token) const;
+ void formSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *selectGetter(ExecState* exec, int token) const;
+ void selectSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *optGroupGetter(ExecState* exec, int token) const;
+ void optGroupSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *optionGetter(ExecState* exec, int token) const;
+ void optionSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *inputGetter(ExecState* exec, int token) const;
+ void inputSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *textAreaGetter(ExecState* exec, int token) const;
+ void textAreaSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *buttonGetter(ExecState* exec, int token) const;
+ void buttonSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *labelGetter(ExecState* exec, int token) const;
+ void labelSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *fieldSetGetter(ExecState* exec, int token) const;
+ void fieldSetSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *legendGetter(ExecState* exec, int token) const;
+ void legendSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *uListGetter(ExecState* exec, int token) const;
+ void uListSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *oListGetter(ExecState* exec, int token) const;
+ void oListSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *dListGetter(ExecState* exec, int token) const;
+ void dListSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *dirGetter(ExecState* exec, int token) const;
+ void dirSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *menuGetter(ExecState* exec, int token) const;
+ void menuSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *liGetter(ExecState* exec, int token) const;
+ void liSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *divGetter(ExecState* exec, int token) const;
+ void divSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *paragraphGetter(ExecState* exec, int token) const;
+ void paragraphSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *headingGetter(ExecState* exec, int token) const;
+ void headingSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *blockQuoteGetter(ExecState* exec, int token) const;
+ void blockQuoteSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *quoteGetter(ExecState* exec, int token) const;
+ void quoteSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *preGetter(ExecState* exec, int token) const;
+ void preSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *brGetter(ExecState* exec, int token) const;
+ void brSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *baseFontGetter(ExecState* exec, int token) const;
+ void baseFontSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *fontGetter(ExecState* exec, int token) const;
+ void fontSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *hrGetter(ExecState* exec, int token) const;
+ void hrSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *modGetter(ExecState* exec, int token) const;
+ void modSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *anchorGetter(ExecState* exec, int token) const;
+ void anchorSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *imageGetter(ExecState* exec, int token) const;
+ void imageSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *objectGetter(ExecState* exec, int token) const;
+ void objectSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *paramGetter(ExecState* exec, int token) const;
+ void paramSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *appletGetter(ExecState* exec, int token) const;
+ void appletSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *mapGetter(ExecState* exec, int token) const;
+ void mapSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *areaGetter(ExecState* exec, int token) const;
+ void areaSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *scriptGetter(ExecState* exec, int token) const;
+ void scriptSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *tableGetter(ExecState* exec, int token) const;
+ void tableSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *tableCaptionGetter(ExecState* exec, int token) const;
+ void tableCaptionSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *tableColGetter(ExecState* exec, int token) const;
+ void tableColSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *tableSectionGetter(ExecState* exec, int token) const;
+ void tableSectionSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *tableRowGetter(ExecState* exec, int token) const;
+ void tableRowSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *tableCellGetter(ExecState* exec, int token) const;
+ void tableCellSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *frameSetGetter(ExecState* exec, int token) const;
+ void frameSetSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *frameGetter(ExecState* exec, int token) const;
+ void frameSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *iFrameGetter(ExecState* exec, int token) const;
+ void iFrameSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
+ ValueImp *marqueeGetter(ExecState* exec, int token) const;
+ void marqueeSetter(ExecState *exec, int token, ValueImp *value, const DOM::DOMString& str);
enum { HtmlVersion, HeadProfile, LinkHref, LinkRel, LinkMedia,
LinkCharset, LinkDisabled, LinkHrefLang, LinkRev, LinkTarget, LinkType,
@@ -287,13 +287,13 @@
ElementClassName, ElementInnerText, ElementDocument, ElementChildren, ElementContentEditable,
ElementIsContentEditable, ElementOuterHTML, ElementOuterText};
private:
- static Value formIndexGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
- static Value formNameGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
- static Value selectIndexGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
- static Value framesetNameGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
- static Value frameWindowPropertyGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
- static Value runtimeObjectGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
- static Value runtimeObjectPropertyGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
+ static ValueImp *formIndexGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
+ static ValueImp *formNameGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
+ static ValueImp *selectIndexGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
+ static ValueImp *framesetNameGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
+ static ValueImp *frameWindowPropertyGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
+ static ValueImp *runtimeObjectGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
+ static ValueImp *runtimeObjectPropertyGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
};
DOM::HTMLElementImpl *toHTMLElement(ValueImp *); // returns 0 if passed-in value is not a HTMLElement object
@@ -305,29 +305,29 @@
HTMLCollection(ExecState *exec, DOM::HTMLCollectionImpl *c);
~HTMLCollection();
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- virtual Value call(ExecState *exec, Object &thisObj, const List&args);
+ virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List&args);
virtual bool implementsCall() const { return true; }
virtual bool toBoolean(ExecState *) const { return true; }
enum { Item, NamedItem, Tags };
- Value getNamedItems(ExecState *exec, const Identifier &propertyName) const;
+ ValueImp *getNamedItems(ExecState *exec, const Identifier &propertyName) const;
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
DOM::HTMLCollectionImpl *impl() const { return m_impl.get(); }
protected:
khtml::SharedPtr<DOM::HTMLCollectionImpl> m_impl;
private:
- static Value lengthGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
- static Value indexGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
- static Value nameGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
+ static ValueImp *lengthGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
+ static ValueImp *indexGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
+ static ValueImp *nameGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
};
class HTMLSelectCollection : public HTMLCollection {
public:
HTMLSelectCollection(ExecState *exec, DOM::HTMLCollectionImpl *c, DOM::HTMLSelectElementImpl *e);
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- virtual void put(ExecState *exec, const Identifier &propertyName, const Value& value, int attr = None);
+ virtual void put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr = None);
private:
- static Value selectedIndexGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
+ static ValueImp *selectedIndexGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
khtml::SharedPtr<DOM::HTMLSelectElementImpl> m_element;
};
@@ -338,7 +338,7 @@
public:
OptionConstructorImp(ExecState *exec, DOM::DocumentImpl *d);
virtual bool implementsConstruct() const;
- virtual Object construct(ExecState *exec, const List &args);
+ virtual ObjectImp *construct(ExecState *exec, const List &args);
private:
khtml::SharedPtr<DOM::DocumentImpl> m_doc;
};
@@ -349,7 +349,7 @@
public:
ImageConstructorImp(ExecState *exec, DOM::DocumentImpl *d);
virtual bool implementsConstruct() const;
- virtual Object construct(ExecState *exec, const List &args);
+ virtual ObjectImp *construct(ExecState *exec, const List &args);
private:
khtml::SharedPtr<DOM::DocumentImpl> m_doc;
};
@@ -359,9 +359,9 @@
Image(DOM::DocumentImpl *d, bool ws, int w, bool hs, int h);
~Image();
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
- virtual void put(ExecState *exec, const Identifier &propertyName, const Value& value, int attr = None);
- void putValueProperty(ExecState *exec, int token, const Value& value, int /*attr*/);
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
+ virtual void put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr = None);
+ void putValueProperty(ExecState *exec, int token, ValueImp *value, int /*attr*/);
void notifyFinished(khtml::CachedObject *);
virtual bool toBoolean(ExecState *) const { return true; }
virtual const ClassInfo* classInfo() const { return &info; }
@@ -389,9 +389,9 @@
Context2D(DOM::HTMLElementImpl *e);
~Context2D();
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
- virtual void put(ExecState *exec, const Identifier &propertyName, const Value& value, int attr = None);
- void putValueProperty(ExecState *exec, int token, const Value& value, int /*attr*/);
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
+ virtual void put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr = None);
+ void putValueProperty(ExecState *exec, int token, ValueImp *value, int /*attr*/);
virtual bool toBoolean(ExecState *) const { return true; }
virtual void mark();
virtual const ClassInfo* classInfo() const { return &info; }
@@ -445,18 +445,18 @@
QPtrList<List> stateStack;
- Value _strokeStyle;
- Value _fillStyle;
- Value _lineWidth;
- Value _lineCap;
- Value _lineJoin;
- Value _miterLimit;
- Value _shadowOffsetX;
- Value _shadowOffsetY;
- Value _shadowBlur;
- Value _shadowColor;
- Value _globalAlpha;
- Value _globalComposite;
+ ValueImp *_strokeStyle;
+ ValueImp *_fillStyle;
+ ValueImp *_lineWidth;
+ ValueImp *_lineCap;
+ ValueImp *_lineJoin;
+ ValueImp *_miterLimit;
+ ValueImp *_shadowOffsetX;
+ ValueImp *_shadowOffsetY;
+ ValueImp *_shadowBlur;
+ ValueImp *_shadowColor;
+ ValueImp *_globalAlpha;
+ ValueImp *_globalComposite;
};
// FIXME: Macintosh specific, and should be abstracted by KWQ in QPainter.
@@ -481,9 +481,9 @@
Gradient(float x0, float y0, float r0, float x1, float y1, float r1);
~Gradient();
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
- virtual void put(ExecState *exec, const Identifier &propertyName, const Value& value, int attr = None);
- void putValueProperty(ExecState *exec, int token, const Value& value, int /*attr*/);
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
+ virtual void put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr = None);
+ void putValueProperty(ExecState *exec, int token, ValueImp *value, int /*attr*/);
virtual bool toBoolean(ExecState *) const { return true; }
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
@@ -527,9 +527,9 @@
public:
ImagePattern(Image *i, int type);
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
- virtual void put(ExecState *exec, const Identifier &propertyName, const Value& value, int attr = None);
- void putValueProperty(ExecState *exec, int token, const Value& value, int /*attr*/);
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
+ virtual void put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr = None);
+ void putValueProperty(ExecState *exec, int token, ValueImp *value, int /*attr*/);
virtual bool toBoolean(ExecState *) const { return true; }
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
1.33 +39 -41 WebCore/khtml/ecma/kjs_navigator.cpp
Index: kjs_navigator.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_navigator.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- kjs_navigator.cpp 7 Aug 2005 18:46:44 -0000 1.32
+++ kjs_navigator.cpp 8 Aug 2005 04:07:41 -0000 1.33
@@ -75,39 +75,39 @@
public:
Plugins(ExecState *exec) : PluginBase(exec) {};
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *, int token) const;
+ ValueImp *getValueProperty(ExecState *, int token) const;
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
enum { Length, Refresh };
private:
- static Value indexGetter(ExecState *, const Identifier&, const PropertySlot&);
- static Value nameGetter(ExecState *, const Identifier&, const PropertySlot&);
+ static ValueImp *indexGetter(ExecState *, const Identifier&, const PropertySlot&);
+ static ValueImp *nameGetter(ExecState *, const Identifier&, const PropertySlot&);
};
class MimeTypes : public PluginBase {
public:
MimeTypes(ExecState *exec) : PluginBase(exec) { };
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *, int token) const;
+ ValueImp *getValueProperty(ExecState *, int token) const;
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
enum { Length };
private:
- static Value indexGetter(ExecState *, const Identifier&, const PropertySlot&);
- static Value nameGetter(ExecState *, const Identifier&, const PropertySlot&);
+ static ValueImp *indexGetter(ExecState *, const Identifier&, const PropertySlot&);
+ static ValueImp *nameGetter(ExecState *, const Identifier&, const PropertySlot&);
};
class Plugin : public PluginBase {
public:
Plugin(ExecState *exec, PluginInfo *info) : PluginBase(exec), m_info(info) { }
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *, int token) const;
+ ValueImp *getValueProperty(ExecState *, int token) const;
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
enum { Name, Filename, Description, Length };
private:
- static Value indexGetter(ExecState *, const Identifier&, const PropertySlot&);
- static Value nameGetter(ExecState *, const Identifier&, const PropertySlot&);
+ static ValueImp *indexGetter(ExecState *, const Identifier&, const PropertySlot&);
+ static ValueImp *nameGetter(ExecState *, const Identifier&, const PropertySlot&);
PluginInfo *m_info;
};
@@ -116,7 +116,7 @@
public:
MimeType( ExecState *exec, MimeClassInfo *info ) : PluginBase(exec), m_info(info) { }
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *, int token) const;
+ ValueImp *getValueProperty(ExecState *, int token) const;
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
enum { Type, Suffixes, Description, EnabledPlugin };
@@ -167,7 +167,7 @@
return getStaticPropertySlot<NavigatorFunc, Navigator, ObjectImp>(exec, &NavigatorTable, this, propertyName, slot);
}
-Value Navigator::getValueProperty(ExecState *exec, int token) const
+ValueImp *Navigator::getValueProperty(ExecState *exec, int token) const
{
#if APPLE_CHANGES
QString userAgent = KWQ(m_part)->userAgent();
@@ -242,9 +242,9 @@
else
return String(QString::fromLatin1("X11"));
case _Plugins:
- return Value(new Plugins(exec));
+ return new Plugins(exec);
case _MimeTypes:
- return Value(new MimeTypes(exec));
+ return new MimeTypes(exec);
case CookieEnabled:
#if APPLE_CHANGES
return Boolean(KWQKCookieJar::cookieEnabled());
@@ -253,7 +253,7 @@
#endif
default:
kdWarning() << "Unhandled token in DOMEvent::getValueProperty : " << token << endl;
- return Value();
+ return NULL;
}
}
@@ -361,22 +361,22 @@
*/
IMPLEMENT_PROTOFUNC(PluginsFunc)
-Value Plugins::getValueProperty(ExecState *exec, int token) const
+ValueImp *Plugins::getValueProperty(ExecState *exec, int token) const
{
assert(token == Length);
return Number(plugins->count());
}
-Value Plugins::indexGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *Plugins::indexGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
- return Value(new Plugin(exec, plugins->at(slot.index())));
+ return new Plugin(exec, plugins->at(slot.index()));
}
-Value Plugins::nameGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *Plugins::nameGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
for (PluginInfo *pl = plugins->first(); pl; pl = plugins->next()) {
if (pl->name == propertyName.qstring()) {
- return Value(new Plugin(exec, pl));
+ return new Plugin(exec, pl);
}
}
return Undefined();
@@ -420,23 +420,22 @@
@end
*/
-Value MimeTypes::getValueProperty(ExecState *exec, int token) const
+ValueImp *MimeTypes::getValueProperty(ExecState *exec, int token) const
{
assert(token == Length);
return Number(plugins->count());
}
-Value MimeTypes::indexGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *MimeTypes::indexGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
- return Value(new MimeType(exec, mimes->at(slot.index())));
+ return new MimeType(exec, mimes->at(slot.index()));
}
-Value MimeTypes::nameGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *MimeTypes::nameGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
for (MimeClassInfo *m = mimes->first(); m; m = mimes->next()) {
- if (m->type == propertyName.qstring()) {
- return Value(new MimeType(exec, m));
- }
+ if (m->type == propertyName.qstring())
+ return new MimeType(exec, m);
}
return Undefined();
}
@@ -480,7 +479,7 @@
@end
*/
-Value Plugin::getValueProperty(ExecState *exec, int token) const
+ValueImp *Plugin::getValueProperty(ExecState *exec, int token) const
{
switch (token) {
case Name:
@@ -497,19 +496,18 @@
}
}
-Value Plugin::indexGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *Plugin::indexGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
Plugin *thisObj = static_cast<Plugin *>(slot.slotBase());
- return Value(new MimeType(exec, thisObj->m_info->mimes.at(slot.index())));
+ return new MimeType(exec, thisObj->m_info->mimes.at(slot.index()));
}
-Value Plugin::nameGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *Plugin::nameGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
Plugin *thisObj = static_cast<Plugin *>(slot.slotBase());
for (MimeClassInfo *m = thisObj->m_info->mimes.first(); m; m = thisObj->m_info->mimes.next()) {
- if (m->type == propertyName.qstring()) {
- return Value(new MimeType(exec, m));
- }
+ if (m->type == propertyName.qstring())
+ return new MimeType(exec, m);
}
return Undefined();
}
@@ -553,7 +551,7 @@
@end
*/
-Value MimeType::getValueProperty(ExecState *exec, int token) const
+ValueImp *MimeType::getValueProperty(ExecState *exec, int token) const
{
switch (token) {
case Type:
@@ -563,7 +561,7 @@
case Description:
return String(m_info->desc);
case EnabledPlugin:
- return Value(new Plugin(exec, m_info->plugin));
+ return new Plugin(exec, m_info->plugin);
default:
return Undefined();
}
@@ -574,20 +572,20 @@
return getStaticValueSlot<MimeType, PluginBase>(exec, &MimeTypeTable, this, propertyName, slot);
}
-Value PluginsFunc::call(ExecState *exec, Object &, const List &args)
+ValueImp *PluginsFunc::callAsFunction(ExecState *exec, ObjectImp *, const List &args)
{
- PluginBase(exec).refresh(args[0].toBoolean(exec));
+ PluginBase(exec).refresh(args[0]->toBoolean(exec));
return Undefined();
}
-Value NavigatorFunc::call(ExecState *exec, Object &thisObj, const List &)
+ValueImp *NavigatorFunc::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &)
{
- if (!thisObj.inherits(&KJS::Navigator::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&KJS::Navigator::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
- Navigator *nav = static_cast<Navigator *>(thisObj.imp());
+ Navigator *nav = static_cast<Navigator *>(thisObj);
// javaEnabled()
return Boolean(nav->part()->javaEnabled());
}
1.8 +1 -1 WebCore/khtml/ecma/kjs_navigator.h
Index: kjs_navigator.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_navigator.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- kjs_navigator.h 7 Aug 2005 06:17:45 -0000 1.7
+++ kjs_navigator.h 8 Aug 2005 04:07:41 -0000 1.8
@@ -31,7 +31,7 @@
public:
Navigator(ExecState *exec, KHTMLPart *p);
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
enum { AppCodeName, AppName, AppVersion, Language, UserAgent, Platform,
1.22 +12 -13 WebCore/khtml/ecma/kjs_proxy.cpp
Index: kjs_proxy.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_proxy.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- kjs_proxy.cpp 12 May 2005 17:11:21 -0000 1.21
+++ kjs_proxy.cpp 8 Aug 2005 04:07:41 -0000 1.22
@@ -112,7 +112,7 @@
#endif
m_script->setInlineCode(inlineCode);
- KJS::Value thisNode = n ? Window::retrieve( m_part ) : Value(getDOMNode(m_script->globalExec(), n));
+ KJS::ValueImp *thisNode = n ? Window::retrieve(m_part) : getDOMNode(m_script->globalExec(), n);
KJS::Interpreter::lock();
UString code( str );
@@ -125,14 +125,14 @@
#endif
// let's try to convert the return value
- if (success && !comp.value().isNull())
- return ValueToVariant( m_script->globalExec(), comp.value());
+ if (success && comp.value())
+ return ValueToVariant(m_script->globalExec(), comp.value());
if ( comp.complType() == Throw ) {
KJS::Interpreter::lock();
- UString errorMessage = comp.value().toString(m_script->globalExec());
- int lineNumber = comp.value().toObject(m_script->globalExec()).get(m_script->globalExec(), "line").toInt32(m_script->globalExec());
- UString sourceURL = comp.value().toObject(m_script->globalExec()).get(m_script->globalExec(), "sourceURL").toString(m_script->globalExec());
+ UString errorMessage = comp.value()->toString(m_script->globalExec());
+ int lineNumber = comp.value()->toObject(m_script->globalExec())->get(m_script->globalExec(), "line")->toInt32(m_script->globalExec());
+ UString sourceURL = comp.value()->toObject(m_script->globalExec())->get(m_script->globalExec(), "sourceURL")->toString(m_script->globalExec());
KJS::Interpreter::unlock();
#if APPLE_CHANGES
@@ -250,12 +250,12 @@
public:
TestFunctionImp() : ObjectImp() {}
virtual bool implementsCall() const { return true; }
- virtual Value call(ExecState *exec, Object &thisObj, const List &args);
+ virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args);
};
-Value TestFunctionImp::call(ExecState *exec, Object &/*thisObj*/, const List &args)
+ValueImp *TestFunctionImp::callAsFunction(ExecState *exec, ObjectImp */*thisObj*/, const List &args)
{
- fprintf(stderr,"--> %s\n",args[0].toString(exec).ascii());
+ fprintf(stderr,"--> %s\n",args[0]->toString(exec).ascii());
return Undefined();
}
@@ -266,7 +266,7 @@
// Build the global object - which is a Window instance
KJS::Interpreter::lock();
- Object globalObject( new Window(m_part) );
+ ObjectImp *globalObject( new Window(m_part) );
KJS::Interpreter::unlock();
// Create a KJS interpreter for this part
@@ -277,8 +277,7 @@
#endif
//m_script->enableDebug();
KJS::Interpreter::lock();
- globalObject.put(m_script->globalExec(),
- "debug", Value(new TestFunctionImp()), Internal);
+ globalObject->put(m_script->globalExec(), "debug", new TestFunctionImp(), Internal);
KJS::Interpreter::unlock();
#if APPLE_CHANGES
@@ -300,7 +299,7 @@
// as friend to KHTMLPart
KJSProxy * KJSProxy::proxy( KHTMLPart *part )
{
- return part->jScript();
+ return part ? part->jScript() : NULL;
}
// initialize HTML module
1.14 +15 -16 WebCore/khtml/ecma/kjs_range.cpp
Index: kjs_range.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_range.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- kjs_range.cpp 7 Aug 2005 06:17:45 -0000 1.13
+++ kjs_range.cpp 8 Aug 2005 04:07:41 -0000 1.14
@@ -88,7 +88,7 @@
return getStaticValueSlot<DOMRange, DOMObject>(exec, &DOMRangeTable, this, propertyName, slot);
}
-Value DOMRange::getValueProperty(ExecState *exec, int token) const
+ValueImp *DOMRange::getValueProperty(ExecState *exec, int token) const
{
DOMExceptionTranslator exception(exec);
RangeImpl &range = *m_impl;
@@ -96,7 +96,7 @@
case StartContainer:
return getDOMNode(exec, range.startContainer(exception));
case StartOffset:
- return number(range.startOffset(exception));
+ return jsNumber(range.startOffset(exception));
case EndContainer:
return getDOMNode(exec, range.endContainer(exception));
case EndOffset:
@@ -107,27 +107,27 @@
return getDOMNode(exec, range.commonAncestorContainer(exception));
default:
kdWarning() << "Unhandled token in DOMRange::getValueProperty : " << token << endl;
- return Value();
+ return NULL;
}
}
-Value DOMRangeProtoFunc::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *DOMRangeProtoFunc::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (!thisObj.inherits(&KJS::DOMRange::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&KJS::DOMRange::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
- RangeImpl &range = *static_cast<DOMRange *>(thisObj.imp())->impl();
- Value result = Undefined();
+ RangeImpl &range = *static_cast<DOMRange *>(thisObj)->impl();
+ ValueImp *result = Undefined();
int exception = 0;
switch (id) {
case DOMRange::SetStart:
- range.setStart(toNode(args[0]), args.impAt(1)->toInt32(exec), exception);
+ range.setStart(toNode(args[0]), args[1]->toInt32(exec), exception);
break;
case DOMRange::SetEnd:
- range.setEnd(toNode(args[0]), args.impAt(1)->toInt32(exec), exception);
+ range.setEnd(toNode(args[0]), args[1]->toInt32(exec), exception);
break;
case DOMRange::SetStartBefore:
range.setStartBefore(toNode(args[0]), exception);
@@ -142,7 +142,7 @@
range.setEndAfter(toNode(args[0]), exception);
break;
case DOMRange::Collapse:
- range.collapse(args[0].toBoolean(exec), exception);
+ range.collapse(args[0]->toBoolean(exec), exception);
break;
case DOMRange::SelectNode:
range.selectNode(toNode(args[0]), exception);
@@ -151,8 +151,8 @@
range.selectNodeContents(toNode(args[0]), exception);
break;
case DOMRange::CompareBoundaryPoints:
- result = number(range.compareBoundaryPoints(static_cast<Range::CompareHow>(args[0].toInt32(exec)), toRange(args[1]), exception));
- break;
+ result = jsNumber(range.compareBoundaryPoints(static_cast<Range::CompareHow>(args[0]->toInt32(exec)), toRange(args[1]), exception));
+ break;
case DOMRange::DeleteContents:
range.deleteContents(exception);
break;
@@ -178,8 +178,7 @@
range.detach(exception);
break;
case DOMRange::CreateContextualFragment:
- Value value = args[0];
- DOMString str = value.isA(NullType) ? DOM::DOMString() : value.toString(exec).string();
+ DOMString str = args[0]->toString(exec).string();
result = getDOMNode(exec, range.createContextualFragment(str, exception));
break;
};
@@ -209,7 +208,7 @@
return getStaticValueSlot<RangeConstructor,DOMObject>(exec, &RangeConstructorTable, this, propertyName, slot);
}
-Value RangeConstructor::getValueProperty(ExecState *, int token) const
+ValueImp *RangeConstructor::getValueProperty(ExecState *, int token) const
{
return Number(token);
}
1.9 +2 -2 WebCore/khtml/ecma/kjs_range.h
Index: kjs_range.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_range.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- kjs_range.h 7 Aug 2005 06:17:45 -0000 1.8
+++ kjs_range.h 8 Aug 2005 04:07:41 -0000 1.9
@@ -34,7 +34,7 @@
DOMRange(ExecState *exec, DOM::RangeImpl *r);
~DOMRange();
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
// no put - all read-only
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
@@ -55,7 +55,7 @@
public:
RangeConstructor(ExecState *) { }
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *, int token) const;
+ ValueImp *getValueProperty(ExecState *, int token) const;
// no put - all read-only
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
1.15 +24 -24 WebCore/khtml/ecma/kjs_traversal.cpp
Index: kjs_traversal.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_traversal.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- kjs_traversal.cpp 7 Aug 2005 06:17:45 -0000 1.14
+++ kjs_traversal.cpp 8 Aug 2005 04:07:41 -0000 1.15
@@ -73,7 +73,7 @@
return getStaticValueSlot<DOMNodeIterator, DOMObject>(exec, &DOMNodeIteratorTable, this, propertyName, slot);
}
-Value DOMNodeIterator::getValueProperty(ExecState *exec, int token) const
+ValueImp *DOMNodeIterator::getValueProperty(ExecState *exec, int token) const
{
NodeIteratorImpl &ni = *m_impl;
switch (token) {
@@ -91,19 +91,19 @@
return Boolean(ni.pointerBeforeReferenceNode());
default:
kdWarning() << "Unhandled token in DOMNodeIterator::getValueProperty : " << token << endl;
- return Value();
+ return NULL;
}
}
-Value DOMNodeIteratorProtoFunc::call(ExecState *exec, Object &thisObj, const List &)
+ValueImp *DOMNodeIteratorProtoFunc::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &)
{
- if (!thisObj.inherits(&KJS::DOMNodeIterator::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&KJS::DOMNodeIterator::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
DOMExceptionTranslator exception(exec);
- NodeIteratorImpl &nodeIterator = *static_cast<DOMNodeIterator *>(thisObj.imp())->impl();
+ NodeIteratorImpl &nodeIterator = *static_cast<DOMNodeIterator *>(thisObj)->impl();
switch (id) {
case DOMNodeIterator::PreviousNode:
return getDOMNode(exec,nodeIterator.previousNode(exception));
@@ -150,13 +150,13 @@
return getStaticValueSlot<NodeFilterConstructor, DOMObject>(exec, &NodeFilterConstructorTable, this, propertyName, slot);
}
-Value NodeFilterConstructor::getValueProperty(ExecState *, int token) const
+ValueImp *NodeFilterConstructor::getValueProperty(ExecState *, int token) const
{
// We use the token as the value to return directly
return Number(token);
}
-Value getNodeFilterConstructor(ExecState *exec)
+ValueImp *getNodeFilterConstructor(ExecState *exec)
{
return cacheGlobalObject<NodeFilterConstructor>(exec, "[[nodeFilter.constructor]]");
}
@@ -184,14 +184,14 @@
ScriptInterpreter::forgetDOMObject(m_impl.get());
}
-Value DOMNodeFilterProtoFunc::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *DOMNodeFilterProtoFunc::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (!thisObj.inherits(&KJS::DOMNodeFilter::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&KJS::DOMNodeFilter::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
- NodeFilterImpl &nodeFilter = *static_cast<DOMNodeFilter *>(thisObj.imp())->impl();
+ NodeFilterImpl &nodeFilter = *static_cast<DOMNodeFilter *>(thisObj)->impl();
switch (id) {
case DOMNodeFilter::AcceptNode:
return Number(nodeFilter.acceptNode(toNode(args[0])));
@@ -252,7 +252,7 @@
return getStaticValueSlot<DOMTreeWalker, DOMObject>(exec, &DOMTreeWalkerTable, this, propertyName, slot);
}
-Value DOMTreeWalker::getValueProperty(ExecState *exec, int token) const
+ValueImp *DOMTreeWalker::getValueProperty(ExecState *exec, int token) const
{
TreeWalkerImpl &tw = *m_impl;
switch (token) {
@@ -268,12 +268,12 @@
return getDOMNode(exec,tw.currentNode());
default:
kdWarning() << "Unhandled token in DOMTreeWalker::getValueProperty : " << token << endl;
- return Value();
+ return NULL;
}
}
void DOMTreeWalker::put(ExecState *exec, const Identifier &propertyName,
- const Value& value, int attr)
+ ValueImp *value, int attr)
{
if (propertyName == "currentNode") {
DOMExceptionTranslator exception(exec);
@@ -283,14 +283,14 @@
ObjectImp::put(exec, propertyName, value, attr);
}
-Value DOMTreeWalkerProtoFunc::call(ExecState *exec, Object &thisObj, const List &)
+ValueImp *DOMTreeWalkerProtoFunc::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &)
{
- if (!thisObj.inherits(&KJS::DOMTreeWalker::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&KJS::DOMTreeWalker::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
- TreeWalkerImpl &treeWalker = *static_cast<DOMTreeWalker *>(thisObj.imp())->impl();
+ TreeWalkerImpl &treeWalker = *static_cast<DOMTreeWalker *>(thisObj)->impl();
switch (id) {
case DOMTreeWalker::ParentNode:
return getDOMNode(exec,treeWalker.parentNode());
@@ -317,7 +317,7 @@
// -------------------------------------------------------------------------
-JSNodeFilterCondition::JSNodeFilterCondition(Object & _filter) : filter( _filter )
+JSNodeFilterCondition::JSNodeFilterCondition(ObjectImp * _filter) : filter( _filter )
{
}
@@ -330,13 +330,13 @@
#endif
KHTMLPart *part = node->getDocument()->part();
KJSProxy *proxy = KJSProxy::proxy(part);
- if (proxy && filter.implementsCall()) {
+ if (proxy && filter->implementsCall()) {
ExecState *exec = proxy->interpreter()->globalExec();
List args;
args.append(getDOMNode(exec, node));
- Object obj = const_cast<ProtectedObject &>(filter);
- Value result = obj.call(exec, obj, args);
- return result.toInt32(exec);
+ ObjectImp *obj = filter;
+ ValueImp *result = obj->call(exec, obj, args);
+ return result->toInt32(exec);
}
return DOM::NodeFilter::FILTER_REJECT;
1.10 +6 -7 WebCore/khtml/ecma/kjs_traversal.h
Index: kjs_traversal.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_traversal.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- kjs_traversal.h 7 Aug 2005 06:17:46 -0000 1.9
+++ kjs_traversal.h 8 Aug 2005 04:07:41 -0000 1.10
@@ -38,7 +38,7 @@
DOMNodeIterator(ExecState *exec, DOM::NodeIteratorImpl *ni);
~DOMNodeIterator();
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
// no put - all read-only
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
@@ -54,7 +54,7 @@
public:
NodeFilterConstructor(ExecState *) { }
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot& slot);
- Value getValueProperty(ExecState *exec, int token) const;
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
// no put - all read-only
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
@@ -78,9 +78,8 @@
DOMTreeWalker(ExecState *exec, DOM::TreeWalkerImpl *tw);
~DOMTreeWalker();
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot& slot);
- Value getValueProperty(ExecState *exec, int token) const;
- virtual void put(ExecState *exec, const Identifier &propertyName,
- const Value& value, int attr = None);
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
+ virtual void put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr = None);
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
enum { Root, WhatToShow, Filter, ExpandEntityReferences, CurrentNode,
@@ -92,7 +91,7 @@
};
ValueImp *getDOMNodeIterator(ExecState *exec, DOM::NodeIteratorImpl *ni);
- Value getNodeFilterConstructor(ExecState *exec);
+ ValueImp *getNodeFilterConstructor(ExecState *exec);
ValueImp *getDOMNodeFilter(ExecState *exec, DOM::NodeFilterImpl *nf);
ValueImp *getDOMTreeWalker(ExecState *exec, DOM::TreeWalkerImpl *tw);
@@ -100,7 +99,7 @@
class JSNodeFilterCondition : public DOM::NodeFilterCondition {
public:
- JSNodeFilterCondition(Object & _filter);
+ JSNodeFilterCondition(ObjectImp * _filter);
virtual ~JSNodeFilterCondition() {}
virtual short acceptNode(DOM::FilterNode) const;
protected:
1.9 +6 -6 WebCore/khtml/ecma/kjs_views.cpp
Index: kjs_views.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_views.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- kjs_views.cpp 7 Aug 2005 06:17:46 -0000 1.8
+++ kjs_views.cpp 8 Aug 2005 04:07:41 -0000 1.9
@@ -54,7 +54,7 @@
ScriptInterpreter::forgetDOMObject(m_impl.get());
}
-Value DOMAbstractView::getValueProperty(ExecState *exec, int token)
+ValueImp *DOMAbstractView::getValueProperty(ExecState *exec, int token)
{
assert(token == Document);
return getDOMNode(exec, impl()->document());
@@ -65,14 +65,14 @@
return getStaticPropertySlot<DOMAbstractViewFunc, DOMAbstractView, DOMObject>(exec, &DOMAbstractViewTable, this, propertyName, slot);
}
-Value DOMAbstractViewFunc::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *DOMAbstractViewFunc::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (!thisObj.inherits(&DOMAbstractView::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&DOMAbstractView::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
- AbstractViewImpl &abstractView = *static_cast<DOMAbstractView *>(thisObj.imp())->impl();
+ AbstractViewImpl &abstractView = *static_cast<DOMAbstractView *>(thisObj)->impl();
switch (id) {
case DOMAbstractView::GetComputedStyle: {
ElementImpl *arg0 = toElement(args[0]);
@@ -81,7 +81,7 @@
else {
if (DocumentImpl* doc = arg0->getDocument())
doc->updateLayoutIgnorePendingStylesheets();
- return getDOMCSSStyleDeclaration(exec, abstractView.getComputedStyle(arg0, args[1].toString(exec).string().implementation()));
+ return getDOMCSSStyleDeclaration(exec, abstractView.getComputedStyle(arg0, args[1]->toString(exec).string().implementation()));
}
}
}
1.8 +1 -1 WebCore/khtml/ecma/kjs_views.h
Index: kjs_views.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_views.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- kjs_views.h 7 Aug 2005 06:17:46 -0000 1.7
+++ kjs_views.h 8 Aug 2005 04:07:41 -0000 1.8
@@ -34,7 +34,7 @@
DOMAbstractView(ExecState *, DOM::AbstractViewImpl *av) : m_impl(av) { }
~DOMAbstractView();
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token);
+ ValueImp *getValueProperty(ExecState *exec, int token);
// no put - all read-only
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
1.170 +135 -146 WebCore/khtml/ecma/kjs_window.cpp
Index: kjs_window.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_window.cpp,v
retrieving revision 1.169
retrieving revision 1.170
diff -u -r1.169 -r1.170
--- kjs_window.cpp 7 Aug 2005 06:17:46 -0000 1.169
+++ kjs_window.cpp 8 Aug 2005 04:07:41 -0000 1.170
@@ -105,7 +105,7 @@
History(ExecState *exec, KHTMLPart *p)
: ObjectImp(exec->lexicalInterpreter()->builtinObjectPrototype()), part(p) { }
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
enum { Back, Forward, Go, Length };
@@ -119,12 +119,12 @@
FrameArray(ExecState *exec, KHTMLPart *p)
: ObjectImp(exec->lexicalInterpreter()->builtinObjectPrototype()), part(p) { }
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token);
+ ValueImp *getValueProperty(ExecState *exec, int token);
virtual UString toString(ExecState *exec) const;
enum { Length, Location };
private:
- static Value indexGetter(ExecState *, const Identifier&, const PropertySlot&);
- static Value nameGetter(ExecState *, const Identifier&, const PropertySlot&);
+ static ValueImp *indexGetter(ExecState *, const Identifier&, const PropertySlot&);
+ static ValueImp *nameGetter(ExecState *, const Identifier&, const PropertySlot&);
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
@@ -137,7 +137,7 @@
public:
KonquerorFunc(const Konqueror* k, const char* name)
: DOMFunction(), konqueror(k), m_name(name) { }
- virtual Value call(ExecState *exec, Object &thisObj, const List &args);
+ virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args);
private:
const Konqueror* konqueror;
@@ -178,7 +178,7 @@
return getStaticValueSlot<Screen, ObjectImp>(exec, &ScreenTable, this, propertyName, slot);
}
-Value Screen::getValueProperty(ExecState *exec, int token) const
+ValueImp *Screen::getValueProperty(ExecState *exec, int token) const
{
KWinModule info;
QWidget *thisWidget = Window::retrieveActive(exec)->part()->view();
@@ -362,25 +362,25 @@
Window *Window::retrieveWindow(KHTMLPart *p)
{
- Object obj = Object::dynamicCast( retrieve( p ) );
+ ObjectImp *obj = retrieve(p)->getObject();
#ifndef NDEBUG
// obj should never be null, except when javascript has been disabled in that part.
if ( p && p->jScriptEnabled() )
{
- assert( !obj.isNull() );
+ assert(obj);
#ifndef QWS
- //assert( dynamic_cast<KJS::Window*>(obj.imp()) ); // type checking
+ //assert( dynamic_cast<KJS::Window*>(obj) ); // type checking
#endif
}
#endif
- if ( obj.isNull() ) // JS disabled
+ if (!obj) // JS disabled
return 0;
- return static_cast<KJS::Window*>(obj.imp());
+ return static_cast<Window*>(obj);
}
Window *Window::retrieveActive(ExecState *exec)
{
- ValueImp *imp = exec->dynamicInterpreter()->globalObject().imp();
+ ValueImp *imp = exec->dynamicInterpreter()->globalObject();
assert( imp );
#ifndef QWS
//assert( dynamic_cast<KJS::Window*>(imp) );
@@ -388,13 +388,13 @@
return static_cast<KJS::Window*>(imp);
}
-Value Window::retrieve(KHTMLPart *p)
+ValueImp *Window::retrieve(KHTMLPart *p)
{
assert(p);
KJSProxy *proxy = KJSProxy::proxy( p );
if (proxy) {
#ifdef KJS_VERBOSE
- kdDebug(6070) << "Window::retrieve part=" << p << " interpreter=" << proxy->interpreter() << " window=" << proxy->interpreter()->globalObject().imp() << endl;
+ kdDebug(6070) << "Window::retrieve part=" << p << " interpreter=" << proxy->interpreter() << " window=" << proxy->interpreter()->globalObject() << endl;
#endif
return proxy->interpreter()->globalObject(); // the Global object is the "window"
} else
@@ -521,7 +521,7 @@
{
QMap<QString, QString> map;
- QStringList features = QStringList::split(';', featuresArg->dispatchToString(exec).qstring());
+ QStringList features = QStringList::split(';', featuresArg->toString(exec).qstring());
QStringList::ConstIterator end = features.end();
for (QStringList::ConstIterator it = features.begin(); it != end; ++it) {
QString s = *it;
@@ -636,10 +636,10 @@
static ValueImp *showModalDialog(ExecState *exec, Window *openerWindow, const List &args)
{
- UString URL = args[0].toString(exec);
+ UString URL = args[0]->toString(exec);
if (!canShowModalDialogNow(openerWindow) || !allowPopUp(exec, openerWindow))
- return Undefined().imp();
+ return Undefined();
const QMap<QString, QString> features = parseFeatures(exec, args[2]);
@@ -686,17 +686,17 @@
KHTMLPart *dialogPart = createNewWindow(exec, openerWindow, URL.qstring(), "", wargs, args[1]);
if (!dialogPart)
- return Undefined().imp();
+ return Undefined();
Window *dialogWindow = Window::retrieveWindow(dialogPart);
- ValueImp *returnValue = Undefined().imp();
+ ValueImp *returnValue = Undefined();
dialogWindow->setReturnValueSlot(&returnValue);
static_cast<KHTMLPartBrowserExtension *>(dialogPart->browserExtension())->runModal();
dialogWindow->setReturnValueSlot(NULL);
return returnValue;
}
-Value Window::getValueProperty(ExecState *exec, int token) const
+ValueImp *Window::getValueProperty(ExecState *exec, int token) const
{
assert(token == Closed || m_part);
@@ -755,11 +755,11 @@
// the security check the first time, but not subsequent times, seems weird.
const_cast<Window *>(this)->putDirect("navigator", n, DontDelete|ReadOnly);
const_cast<Window *>(this)->putDirect("clientInformation", n, DontDelete|ReadOnly);
- return Value(n);
+ return n;
}
#ifdef Q_WS_QWS
case _Konqueror:
- return Value(new Konqueror(m_part));
+ return new Konqueror(m_part);
#endif
case Locationbar:
return locationbar(exec);
@@ -793,9 +793,9 @@
updateLayout();
return Number(m_part->view()->contentsY());
case Parent:
- return Value(retrieve(m_part->parentPart() ? m_part->parentPart() : (KHTMLPart*)m_part));
+ return retrieve(m_part->parentPart() ? m_part->parentPart() : (KHTMLPart*)m_part);
case Personalbar:
- return Value(personalbar(exec));
+ return personalbar(exec);
case ScreenLeft:
case ScreenX: {
if (m_part->view()) {
@@ -836,14 +836,14 @@
updateLayout();
return Number(m_part->view()->contentsY());
case Scrollbars:
- return Value(scrollbars(exec));
+ return scrollbars(exec);
case Statusbar:
- return Value(statusbar(exec));
+ return statusbar(exec);
case Toolbar:
- return Value(toolbar(exec));
+ return toolbar(exec);
case Self:
case _Window:
- return Value(retrieve(m_part));
+ return retrieve(m_part);
case Top: {
KHTMLPart *p = m_part;
while (p->parentPart())
@@ -948,19 +948,19 @@
return Undefined();
}
-Value Window::childFrameGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *Window::childFrameGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
Window *thisObj = static_cast<Window *>(slot.slotBase());
return retrieve(thisObj->m_part->childFrameNamed(propertyName.qstring()));
}
-Value Window::namedFrameGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *Window::namedFrameGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
Window *thisObj = static_cast<Window *>(slot.slotBase());
return retrieve(thisObj->m_part->findFrame(propertyName.qstring()));
}
-Value Window::indexGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *Window::indexGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
Window *thisObj = static_cast<Window *>(slot.slotBase());
@@ -971,7 +971,7 @@
return retrieve(static_cast<KHTMLPart*>(frame));
}
-Value Window::namedItemGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *Window::namedItemGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
Window *thisObj = static_cast<Window *>(slot.slotBase());
DocumentImpl *doc = thisObj->m_part->xmlDocImpl();
@@ -1082,7 +1082,7 @@
return ObjectImp::getOwnPropertySlot(exec, propertyName, slot);
}
-void Window::put(ExecState* exec, const Identifier &propertyName, const Value &value, int attr)
+void Window::put(ExecState* exec, const Identifier &propertyName, ValueImp *value, int attr)
{
// Called by an internal KJS call (e.g. InterpreterImp's constructor) ?
// If yes, save time and jump directly to ObjectImp.
@@ -1098,20 +1098,16 @@
if (entry)
{
switch( entry->value ) {
- case Status: {
- String s = value.toString(exec);
- m_part->setJSStatusBarText(s.value().qstring());
+ case Status:
+ m_part->setJSStatusBarText(value->toString(exec).qstring());
return;
- }
- case DefaultStatus: {
- String s = value.toString(exec);
- m_part->setJSDefaultStatusBarText(s.value().qstring());
+ case DefaultStatus:
+ m_part->setJSDefaultStatusBarText(value->toString(exec).qstring());
return;
- }
case _Location: {
KHTMLPart* p = Window::retrieveActive(exec)->m_part;
if (p) {
- QString dstUrl = p->xmlDocImpl()->completeURL(value.toString(exec).qstring());
+ QString dstUrl = p->xmlDocImpl()->completeURL(value->toString(exec).qstring());
if (!dstUrl.startsWith("javascript:", false) || isSafeScript(exec))
{
bool userGesture = static_cast<ScriptInterpreter *>(exec->dynamicInterpreter())->wasRunByUserGesture();
@@ -1234,9 +1230,9 @@
case Name:
if (isSafeScript(exec))
#if APPLE_CHANGES
- m_part->setName( value.toString(exec).qstring() );
+ m_part->setName( value->toString(exec).qstring() );
#else
- m_part->setName( value.toString(exec).qstring().local8Bit().data() );
+ m_part->setName( value->toString(exec).qstring().local8Bit().data() );
#endif
return;
default:
@@ -1258,7 +1254,7 @@
return winq->installTimeout(handler, t, singleShot);
}
-int Window::installTimeout(const Value &function, List &args, int t, bool singleShot)
+int Window::installTimeout(ValueImp *function, List &args, int t, bool singleShot)
{
return winq->installTimeout(function, args, t, singleShot);
}
@@ -1426,7 +1422,7 @@
return false;
}
-void Window::setListener(ExecState *exec, int eventId, Value func)
+void Window::setListener(ExecState *exec, int eventId, ValueImp *func)
{
if (!isSafeScript(exec))
return;
@@ -1437,7 +1433,7 @@
doc->setHTMLWindowEventListener(eventId,getJSEventListener(func,true));
}
-Value Window::getListener(ExecState *exec, int eventId) const
+ValueImp *Window::getListener(ExecState *exec, int eventId) const
{
if (!isSafeScript(exec))
return Undefined();
@@ -1452,27 +1448,25 @@
return Null();
}
-JSEventListener *Window::getJSEventListener(const Value& val, bool html)
+JSEventListener *Window::getJSEventListener(ValueImp *val, bool html)
{
- // This function is so hot that it's worth coding it directly with imps.
- if (val.type() != ObjectType)
+ if (!val->isObject())
return 0;
- ObjectImp *listenerObject = static_cast<ObjectImp *>(val.imp());
+ ObjectImp *listenerObject = static_cast<ObjectImp *>(val);
JSEventListener *existingListener = jsEventListeners[listenerObject];
if (existingListener)
return existingListener;
// Note that the JSEventListener constructor adds it to our jsEventListeners list
- return new JSEventListener(Object(listenerObject), Object(this), html);
+ return new JSEventListener(listenerObject, this, html);
}
-JSUnprotectedEventListener *Window::getJSUnprotectedEventListener(const Value& val, bool html)
+JSUnprotectedEventListener *Window::getJSUnprotectedEventListener(ValueImp *val, bool html)
{
- // This function is so hot that it's worth coding it directly with imps.
- if (val.type() != ObjectType)
+ if (!val->isObject())
return 0;
- ObjectImp *listenerObject = static_cast<ObjectImp *>(val.imp());
+ ObjectImp *listenerObject = static_cast<ObjectImp *>(val);
JSUnprotectedEventListener *existingListener = jsUnprotectedEventListeners[listenerObject];
if (existingListener)
@@ -1480,12 +1474,12 @@
// Note that the JSUnprotectedEventListener constructor adds it to
// our jsUnprotectedEventListeners list
- return new JSUnprotectedEventListener(Object(listenerObject), Object(this), html);
+ return new JSUnprotectedEventListener(listenerObject, this, html);
}
JSLazyEventListener *Window::getJSLazyEventListener(const QString& code, DOM::NodeImpl *node, int lineNumber)
{
- return new JSLazyEventListener(code, Object(this), node, lineNumber);
+ return new JSLazyEventListener(code, this, node, lineNumber);
}
void Window::clear( ExecState *exec )
@@ -1513,14 +1507,14 @@
//kdDebug(6070) << "Window " << this << " (part=" << m_part << ")::setCurrentEvent m_evt=" << evt << endl;
}
-Value WindowFunc::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *WindowFunc::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (!thisObj.inherits(&Window::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&Window::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
- Window *window = static_cast<Window *>(thisObj.imp());
+ Window *window = static_cast<Window *>(thisObj);
QString str, str2;
KHTMLPart *part = window->m_part;
@@ -1528,8 +1522,8 @@
return Undefined();
KHTMLView *widget = part->view();
- Value v = args[0];
- UString s = v.toString(exec);
+ ValueImp *v = args[0];
+ UString s = v->toString(exec);
str = s.qstring();
switch (id) {
@@ -1556,13 +1550,13 @@
part->xmlDocImpl()->updateRendering();
bool ok;
#if APPLE_CHANGES
- ok = KWQ(part)->runJavaScriptPrompt(str, args.size() >= 2 ? args[1].toString(exec).qstring() : QString::null, str2);
+ ok = KWQ(part)->runJavaScriptPrompt(str, args.size() >= 2 ? args[1]->toString(exec).qstring() : QString::null, str2);
#else
if (args.size() >= 2)
str2 = QInputDialog::getText(i18n("Konqueror: Prompt"),
QStyleSheet::convertFromPlainText(str),
QLineEdit::Normal,
- args[1].toString(exec).qstring(), &ok);
+ args[1]->toString(exec).qstring(), &ok);
else
str2 = QInputDialog::getText(i18n("Konqueror: Prompt"),
QStyleSheet::convertFromPlainText(str),
@@ -1601,21 +1595,19 @@
#else
{
policy = 0;
- LOG(PopupBlocking, "Allowed JavaScript window open of %s", args[0].toString(exec).qstring().ascii());
+ LOG(PopupBlocking, "Allowed JavaScript window open of %s", args[0]->toString(exec).qstring().ascii());
} else {
- LOG(PopupBlocking, "Blocked JavaScript window open of %s", args[0].toString(exec).qstring().ascii());
+ LOG(PopupBlocking, "Blocked JavaScript window open of %s", args[0]->toString(exec).qstring().ascii());
}
#endif
}
- QString frameName = !args[1].isNull() && args[1].type() != UndefinedType ?
- args[1].toString(exec).qstring()
- : QString("_blank");
+ QString frameName = args[1]->isUndefinedOrNull() ? QString("_blank") : args[1]->toString(exec).qstring();
if ( policy != 0 && !(part->findFrame(frameName) || frameName == "_top" || frameName == "_parent" || frameName == "_self")) {
return Undefined();
} else {
- if (v.type() == UndefinedType)
+ if (v->isUndefined())
str = QString();
KParts::WindowArgs winargs;
@@ -1623,8 +1615,8 @@
// scan feature argument
v = args[2];
QString features;
- if (!v.isNull() && v.type() != UndefinedType && v.toString(exec).size() > 0) {
- features = v.toString(exec).qstring();
+ if (!v->isUndefinedOrNull() && v->toString(exec).size() > 0) {
+ features = v->toString(exec).qstring();
// specifying window params means false defaults
winargs.menuBarVisible = false;
winargs.toolBarsVisible = false;
@@ -1827,20 +1819,20 @@
case Window::ScrollBy:
window->updateLayout();
if(args.size() >= 2 && widget)
- widget->scrollBy(args[0].toInt32(exec), args[1].toInt32(exec));
+ widget->scrollBy(args[0]->toInt32(exec), args[1]->toInt32(exec));
return Undefined();
case Window::Scroll:
case Window::ScrollTo:
window->updateLayout();
if(args.size() >= 2 && widget)
- widget->setContentsPos(args[0].toInt32(exec), args[1].toInt32(exec));
+ widget->setContentsPos(args[0]->toInt32(exec), args[1]->toInt32(exec));
return Undefined();
case Window::MoveBy:
if(args.size() >= 2 && widget)
{
QWidget * tl = widget->topLevelWidget();
QRect sg = QApplication::desktop()->screenGeometry(QApplication::desktop()->screenNumber(tl));
- QPoint dest = tl->pos() + QPoint( args[0].toInt32(exec), args[1].toInt32(exec) );
+ QPoint dest = tl->pos() + QPoint( args[0]->toInt32(exec), args[1]->toInt32(exec) );
// Security check (the spec talks about UniversalBrowserWrite to disable this check...)
if ( dest.x() >= sg.x() && dest.y() >= sg.x() &&
dest.x()+tl->width() <= sg.width()+sg.x() &&
@@ -1853,7 +1845,7 @@
{
QWidget * tl = widget->topLevelWidget();
QRect sg = QApplication::desktop()->screenGeometry(QApplication::desktop()->screenNumber(tl));
- QPoint dest( args[0].toInt32(exec)+sg.x(), args[1].toInt32(exec)+sg.y() );
+ QPoint dest( args[0]->toInt32(exec)+sg.x(), args[1]->toInt32(exec)+sg.y() );
// Security check (the spec talks about UniversalBrowserWrite to disable this check...)
if ( dest.x() >= sg.x() && dest.y() >= sg.y() &&
dest.x()+tl->width() <= sg.width()+sg.x() &&
@@ -1865,7 +1857,7 @@
if(args.size() >= 2 && widget)
{
QWidget * tl = widget->topLevelWidget();
- QSize dest = tl->size() + QSize( args[0].toInt32(exec), args[1].toInt32(exec) );
+ QSize dest = tl->size() + QSize( args[0]->toInt32(exec), args[1]->toInt32(exec) );
QRect sg = QApplication::desktop()->screenGeometry(QApplication::desktop()->screenNumber(tl));
// Security check: within desktop limits and bigger than 100x100 (per spec)
if ( tl->x()+dest.width() <= sg.x()+sg.width() &&
@@ -1883,7 +1875,7 @@
if(args.size() >= 2 && widget)
{
QWidget * tl = widget->topLevelWidget();
- QSize dest = QSize( args[0].toInt32(exec), args[1].toInt32(exec) );
+ QSize dest = QSize( args[0]->toInt32(exec), args[1]->toInt32(exec) );
QRect sg = QApplication::desktop()->screenGeometry(QApplication::desktop()->screenNumber(tl));
// Security check: within desktop limits and bigger than 100x100 (per spec)
if ( tl->x()+dest.width() <= sg.x()+sg.width() &&
@@ -1900,14 +1892,14 @@
case Window::SetTimeout:
if (!window->isSafeScript(exec))
return Undefined();
- if (args.size() >= 2 && v.isA(StringType)) {
- int i = args[1].toInt32(exec);
+ if (args.size() >= 2 && v->isString()) {
+ int i = args[1]->toInt32(exec);
int r = (const_cast<Window*>(window))->installTimeout(s, i, true /*single shot*/);
return Number(r);
}
- else if (args.size() >= 2 && v.isA(ObjectType) && Object::dynamicCast(v).implementsCall()) {
- Value func = args[0];
- int i = args[1].toInt32(exec);
+ else if (args.size() >= 2 && v->isObject() && static_cast<ObjectImp *>(v)->implementsCall()) {
+ ValueImp *func = args[0];
+ int i = args[1]->toInt32(exec);
// All arguments after the second should go to the function
// FIXME: could be more efficient
@@ -1921,15 +1913,14 @@
case Window::SetInterval:
if (!window->isSafeScript(exec))
return Undefined();
- if (args.size() >= 2 && v.isA(StringType)) {
- int i = args[1].toInt32(exec);
+ if (args.size() >= 2 && v->isString()) {
+ int i = args[1]->toInt32(exec);
int r = (const_cast<Window*>(window))->installTimeout(s, i, false);
return Number(r);
}
- else if (args.size() >= 2 && !Object::dynamicCast(v).isNull() &&
- Object::dynamicCast(v).implementsCall()) {
- Value func = args[0];
- int i = args[1].toInt32(exec);
+ else if (args.size() >= 2 && v->isObject() && static_cast<ObjectImp *>(v)->implementsCall()) {
+ ValueImp *func = args[0];
+ int i = args[1]->toInt32(exec);
// All arguments after the second should go to the function
// FIXME: could be more efficient
@@ -1944,7 +1935,7 @@
case Window::ClearInterval:
if (!window->isSafeScript(exec))
return Undefined();
- (const_cast<Window*>(window))->clearTimeout(v.toInt32(exec));
+ (const_cast<Window*>(window))->clearTimeout(v->toInt32(exec));
return Undefined();
case Window::Focus:
if (widget)
@@ -1953,7 +1944,7 @@
case Window::GetSelection:
if (!window->isSafeScript(exec))
return Undefined();
- return Value(window->selection());
+ return window->selection();
case Window::Blur:
#if APPLE_CHANGES
KWQ(part)->unfocusWindow();
@@ -1977,7 +1968,7 @@
// To conform to the SPEC, we only ask if the window
// has more than one entry in the history (NS does that too).
History history(exec,part);
- if ( history.get( exec, lengthPropertyName ).toInt32(exec) <= 1
+ if ( history.get( exec, lengthPropertyName )->toInt32(exec) <= 1
#if APPLE_CHANGES
// FIXME: How are we going to handle this?
#else
@@ -2006,7 +1997,7 @@
if (listener) {
DocumentImpl* docimpl = part->xmlDocImpl();
if (docimpl)
- docimpl->addWindowEventListener(DOM::EventImpl::typeToId(args[0].toString(exec).string()),listener,args[2].toBoolean(exec));
+ docimpl->addWindowEventListener(DOM::EventImpl::typeToId(args[0]->toString(exec).string()),listener,args[2]->toBoolean(exec));
}
return Undefined();
}
@@ -2017,7 +2008,7 @@
if (listener) {
DocumentImpl* docimpl = part->xmlDocImpl();
if (docimpl)
- docimpl->removeWindowEventListener(DOM::EventImpl::typeToId(args[0].toString(exec).string()),listener,args[2].toBoolean(exec));
+ docimpl->removeWindowEventListener(DOM::EventImpl::typeToId(args[0]->toString(exec).string()),listener,args[2]->toBoolean(exec));
}
return Undefined();
}
@@ -2037,7 +2028,7 @@
////////////////////// ScheduledAction ////////////////////////
-ScheduledAction::ScheduledAction(Object _func, List _args, bool _singleShot)
+ScheduledAction::ScheduledAction(ObjectImp *_func, List _args, bool _singleShot)
{
//kdDebug(6070) << "ScheduledAction::ScheduledAction(isFunction) " << this << endl;
func = _func;
@@ -2065,23 +2056,23 @@
//kdDebug(6070) << "ScheduledAction::execute " << this << endl;
if (isFunction) {
- if (func.implementsCall()) {
+ if (func->implementsCall()) {
// #### check this
Q_ASSERT( window->m_part );
if ( window->m_part )
{
KJS::Interpreter *interpreter = KJSProxy::proxy( window->m_part )->interpreter();
ExecState *exec = interpreter->globalExec();
- Q_ASSERT( window == interpreter->globalObject().imp() );
- Object obj( window );
+ Q_ASSERT( window == interpreter->globalObject() );
+ ObjectImp *obj( window );
Interpreter::lock();
- func.call(exec,obj,args); // note that call() creates its own execution state for the func call
+ func->call(exec,obj,args); // note that call() creates its own execution state for the func call
Interpreter::unlock();
if ( exec->hadException() ) {
#if APPLE_CHANGES
Interpreter::lock();
- char *message = exec->exception().toObject(exec).get(exec, messagePropertyName).toString(exec).ascii();
- int lineNumber = exec->exception().toObject(exec).get(exec, "line").toInt32(exec);
+ char *message = exec->exception()->toObject(exec)->get(exec, messagePropertyName)->toString(exec).ascii();
+ int lineNumber = exec->exception()->toObject(exec)->get(exec, "line")->toInt32(exec);
Interpreter::unlock();
if (Interpreter::shouldPrintExceptions()) {
printf("(timer):%s\n", message);
@@ -2144,9 +2135,9 @@
return id;
}
-int WindowQObject::installTimeout(const Value &func, List args, int t, bool singleShot)
+int WindowQObject::installTimeout(ValueImp *func, List args, int t, bool singleShot)
{
- Object objFunc = Object::dynamicCast( func );
+ ObjectImp *objFunc = static_cast<ObjectImp *>(func);
int id = startTimer(t);
scheduledActions.insert(id, new ScheduledAction(objFunc,args,singleShot));
return id;
@@ -2246,7 +2237,7 @@
*/
-Value FrameArray::getValueProperty(ExecState *exec, int token)
+ValueImp *FrameArray::getValueProperty(ExecState *exec, int token)
{
switch (token) {
case Length: {
@@ -2254,20 +2245,18 @@
unsigned int len = frames.count();
return Number(len);
}
- case Location: {
+ case Location:
// non-standard property, but works in NS and IE
- Object obj = Object::dynamicCast(Window::retrieve(part));
- if (!obj.isNull())
- return obj.get(exec, "location");
+ if (ObjectImp *obj = Window::retrieveWindow(part))
+ return obj->get(exec, "location");
return Undefined();
- }
default:
assert(0);
return Undefined();
}
}
-Value FrameArray::indexGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *FrameArray::indexGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
FrameArray *thisObj = static_cast<FrameArray *>(slot.slotBase());
KParts::ReadOnlyPart *frame = thisObj->part->frames().at(slot.index());
@@ -2280,7 +2269,7 @@
return Undefined();
}
-Value FrameArray::nameGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
+ValueImp *FrameArray::nameGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot)
{
FrameArray *thisObj = static_cast<FrameArray *>(slot.slotBase());
KParts::ReadOnlyPart *frame = thisObj->part->findFrame(propertyName.qstring());
@@ -2353,7 +2342,7 @@
{
}
-Value Location::getValueProperty(ExecState *exec, int token) const
+ValueImp *Location::getValueProperty(ExecState *exec, int token) const
{
KURL url = m_part->url();
switch (token) {
@@ -2403,12 +2392,12 @@
return getStaticPropertySlot<LocationFunc, Location, ObjectImp>(exec, &LocationTable, this, propertyName, slot);
}
-void Location::put(ExecState *exec, const Identifier &p, const Value &v, int attr)
+void Location::put(ExecState *exec, const Identifier &p, ValueImp *v, int attr)
{
if (m_part.isNull())
return;
- QString str = v.toString(exec).qstring();
+ QString str = v->toString(exec).qstring();
KURL url = m_part->url();
const HashEntry *entry = Lookup::findEntry(&LocationTable, p);
if (entry)
@@ -2465,7 +2454,7 @@
}
}
-Value Location::toPrimitive(ExecState *exec, Type) const
+ValueImp *Location::toPrimitive(ExecState *exec, Type) const
{
return String(toString(exec));
}
@@ -2478,14 +2467,14 @@
return m_part->url().prettyURL();
}
-Value LocationFunc::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *LocationFunc::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (!thisObj.inherits(&Location::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&Location::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
- Location *location = static_cast<Location *>(thisObj.imp());
+ Location *location = static_cast<Location *>(thisObj);
KHTMLPart *part = location->part();
if (part) {
@@ -2496,7 +2485,7 @@
switch (id) {
case Location::Replace:
{
- QString str = args[0].toString(exec).qstring();
+ QString str = args[0]->toString(exec).qstring();
KHTMLPart* p = Window::retrieveActive(exec)->part();
if ( p ) {
const Window* window = Window::retrieveWindow(part);
@@ -2522,7 +2511,7 @@
KHTMLPart *p = Window::retrieveActive(exec)->part();
if (p) {
const Window *window = Window::retrieveWindow(part);
- QString dstUrl = p->xmlDocImpl()->completeURL(args[0].toString(exec).qstring());
+ QString dstUrl = p->xmlDocImpl()->completeURL(args[0]->toString(exec).qstring());
if (!dstUrl.startsWith("javascript:", false) || (window && window->isSafeScript(exec))) {
bool userGesture = static_cast<ScriptInterpreter *>(exec->dynamicInterpreter())->wasRunByUserGesture();
#if APPLE_CHANGES
@@ -2574,7 +2563,7 @@
{
}
-Value Selection::getValueProperty(ExecState *exec, int token) const
+ValueImp *Selection::getValueProperty(ExecState *exec, int token) const
{
const Window* window = Window::retrieveWindow(m_part);
if (!window) {
@@ -2624,7 +2613,7 @@
return getStaticPropertySlot<SelectionFunc, Selection, ObjectImp>(exec, &SelectionTable, this, propertyName, slot);
}
-Value Selection::toPrimitive(ExecState *exec, Type) const
+ValueImp *Selection::toPrimitive(ExecState *exec, Type) const
{
return String(toString(exec));
}
@@ -2637,14 +2626,14 @@
return UString(m_part->selection().toRange()->toString(exception));
}
-Value SelectionFunc::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *SelectionFunc::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (!thisObj.inherits(&Selection::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&Selection::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
- Selection *selection = static_cast<Selection *>(thisObj.imp());
+ Selection *selection = static_cast<Selection *>(thisObj);
KHTMLPart *part = selection->part();
if (part) {
DocumentImpl *docimpl = part->xmlDocImpl();
@@ -2654,7 +2643,7 @@
switch (id) {
case Selection::Collapse:
TypingCommand::closeTyping(part->lastEditCommand());
- part->setSelection(khtml::Selection(Position(toNode(args[0]), args[1].toInt32(exec)), khtml::SEL_DEFAULT_AFFINITY));
+ part->setSelection(khtml::Selection(Position(toNode(args[0]), args[1]->toInt32(exec)), khtml::SEL_DEFAULT_AFFINITY));
break;
case Selection::CollapseToEnd:
TypingCommand::closeTyping(part->lastEditCommand());
@@ -2670,22 +2659,22 @@
break;
case Selection::SetBaseAndExtent: {
TypingCommand::closeTyping(part->lastEditCommand());
- Position base(toNode(args[0]), args[1].toInt32(exec));
- Position extent(toNode(args[2]), args[3].toInt32(exec));
+ Position base(toNode(args[0]), args[1]->toInt32(exec));
+ Position extent(toNode(args[2]), args[3]->toInt32(exec));
part->setSelection(khtml::Selection(base, khtml::SEL_DEFAULT_AFFINITY, extent, khtml::SEL_DEFAULT_AFFINITY));
break;
}
case Selection::SetPosition:
TypingCommand::closeTyping(part->lastEditCommand());
- part->setSelection(khtml::Selection(Position(toNode(args[0]), args[1].toInt32(exec)), khtml::SEL_DEFAULT_AFFINITY));
+ part->setSelection(khtml::Selection(Position(toNode(args[0]), args[1]->toInt32(exec)), khtml::SEL_DEFAULT_AFFINITY));
break;
case Selection::Modify: {
TypingCommand::closeTyping(part->lastEditCommand());
khtml::Selection s(part->selection());
khtml::Selection::EAlter alter = khtml::Selection::MOVE;
- if (args[0].toString(exec).string().lower() == "extend")
+ if (args[0]->toString(exec).string().lower() == "extend")
alter = khtml::Selection::EXTEND;
- DOMString directionString = args[1].toString(exec).string().lower();
+ DOMString directionString = args[1]->toString(exec).string().lower();
khtml::Selection::EDirection direction = khtml::Selection::FORWARD;
if (directionString == "backward")
direction = khtml::Selection::BACKWARD;
@@ -2694,7 +2683,7 @@
if (directionString == "right")
direction = khtml::Selection::RIGHT;
khtml::ETextGranularity granularity = khtml::CHARACTER;
- DOMString granularityString = args[2].toString(exec).string().lower();
+ DOMString granularityString = args[2]->toString(exec).string().lower();
if (granularityString == "word")
granularity = khtml::WORD;
else if (granularityString == "line")
@@ -2726,7 +2715,7 @@
{
}
-Value BarInfo::getValueProperty(ExecState *exec, int token) const
+ValueImp *BarInfo::getValueProperty(ExecState *exec, int token) const
{
assert(token == Visible);
switch (m_type) {
@@ -2775,7 +2764,7 @@
return getStaticPropertySlot<HistoryFunc, History, ObjectImp>(exec, &HistoryTable, this, propertyName, slot);
}
-Value History::getValueProperty(ExecState *, int token) const
+ValueImp *History::getValueProperty(ExecState *, int token) const
{
switch (token) {
case Length:
@@ -2806,14 +2795,14 @@
return "[object History]";
}
-Value HistoryFunc::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *HistoryFunc::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (!thisObj.inherits(&History::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&History::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
- History *history = static_cast<History *>(thisObj.imp());
+ History *history = static_cast<History *>(thisObj);
int steps;
switch (id) {
@@ -2824,7 +2813,7 @@
steps = 1;
break;
case History::Go:
- steps = args[0].toInt32(exec);
+ steps = args[0]->toInt32(exec);
break;
default:
return Undefined();
@@ -2847,7 +2836,7 @@
return true;
}
-Value Konqueror::get(ExecState *exec, const Identifier &p) const
+ValueImp *Konqueror::get(ExecState *exec, const Identifier &p) const
{
if ( p == "goHistory" || part->url().protocol() != "http" || part->url().host() != "localhost" )
return Undefined();
@@ -2863,7 +2852,7 @@
case QVariant::Int:
return Number( prop.toInt() );
case QVariant::String:
- return String( prop.toString() );
+ return String( prop->toString() );
default:
break;
}
@@ -2874,7 +2863,7 @@
return /*Function*/( new KonquerorFunc(this, p.qstring().latin1() ) );
}
-Value KonquerorFunc::call(ExecState *exec, Object &, const List &args)
+ValueImp *KonquerorFunc::callAsFunction(ExecState *exec, ObjectImp *, const List &args)
{
KParts::BrowserExtension *ext = konqueror->part->browserExtension();
1.50 +21 -21 WebCore/khtml/ecma/kjs_window.h
Index: kjs_window.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_window.h,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- kjs_window.h 7 Aug 2005 06:17:46 -0000 1.49
+++ kjs_window.h 8 Aug 2005 04:07:42 -0000 1.50
@@ -60,7 +60,7 @@
AvailWidth
};
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
private:
KHTMLView *view;
virtual const ClassInfo* classInfo() const { return &info; }
@@ -82,7 +82,7 @@
* for the specified part p this will be returned in order to have unique
* bindings.
*/
- static Value retrieve(KHTMLPart *p);
+ static ValueImp *retrieve(KHTMLPart *p);
/**
* Returns the Window object for a given HTML part
*/
@@ -95,11 +95,11 @@
QGuardedPtr<KHTMLPart> part() const { return m_part; }
virtual void mark();
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
- virtual void put(ExecState *exec, const Identifier &propertyName, const Value &value, int attr = None);
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
+ virtual void put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr = None);
virtual bool toBoolean(ExecState *exec) const;
int installTimeout(const UString &handler, int t, bool singleShot);
- int installTimeout(const Value &function, List &args, int t, bool singleShot);
+ int installTimeout(ValueImp *function, List &args, int t, bool singleShot);
void clearTimeout(int timerId);
#ifdef APPLE_CHANGES
bool hasTimeouts();
@@ -121,8 +121,8 @@
BarInfo *scrollbars(ExecState *exec) const;
BarInfo *statusbar(ExecState *exec) const;
BarInfo *toolbar(ExecState *exec) const;
- JSEventListener *getJSEventListener(const Value &val, bool html = false);
- JSUnprotectedEventListener *getJSUnprotectedEventListener(const Value &val, bool html = false);
+ JSEventListener *getJSEventListener(ValueImp *val, bool html = false);
+ JSUnprotectedEventListener *getJSUnprotectedEventListener(ValueImp *val, bool html = false);
JSLazyEventListener *getJSLazyEventListener(const QString &code, DOM::NodeImpl *node, int lineno = 0);
void clear( ExecState *exec );
virtual UString toString(ExecState *exec) const;
@@ -153,13 +153,13 @@
Onselect, Onsubmit, Onunload,
Statusbar, Toolbar, FrameElement, ShowModalDialog };
protected:
- Value getListener(ExecState *exec, int eventId) const;
- void setListener(ExecState *exec, int eventId, Value func);
+ ValueImp *getListener(ExecState *exec, int eventId) const;
+ void setListener(ExecState *exec, int eventId, ValueImp *func);
private:
- static Value childFrameGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
- static Value namedFrameGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
- static Value indexGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
- static Value namedItemGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
+ static ValueImp *childFrameGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
+ static ValueImp *namedFrameGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
+ static ValueImp *indexGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
+ static ValueImp *namedItemGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
void updateLayout() const;
@@ -187,7 +187,7 @@
*/
class ScheduledAction {
public:
- ScheduledAction(Object _func, List _args, bool _singleShot);
+ ScheduledAction(ObjectImp *_func, List _args, bool _singleShot);
ScheduledAction(const QString &_code, bool _singleShot);
void execute(Window *window);
@@ -204,7 +204,7 @@
WindowQObject(Window *w);
~WindowQObject();
int installTimeout(const UString &handler, int t, bool singleShot);
- int installTimeout(const Value &func, List args, int t, bool singleShot);
+ int installTimeout(ValueImp *func, List args, int t, bool singleShot);
void clearTimeout(int timerId, bool delAction = true);
#ifdef APPLE_CHANGES
bool hasTimeouts();
@@ -227,9 +227,9 @@
class Location : public ObjectImp {
public:
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
- virtual void put(ExecState *exec, const Identifier &propertyName, const Value &value, int attr = None);
- virtual Value toPrimitive(ExecState *exec, Type preferred) const;
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
+ virtual void put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr = None);
+ virtual ValueImp *toPrimitive(ExecState *exec, Type preferred) const;
virtual UString toString(ExecState *exec) const;
enum { Hash, Href, Hostname, Host, Pathname, Port, Protocol, Search, EqualEqual,
Replace, Reload, ToString, Assign };
@@ -245,8 +245,8 @@
class Selection : public ObjectImp {
public:
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
- virtual Value toPrimitive(ExecState *exec, Type preferred) const;
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
+ virtual ValueImp *toPrimitive(ExecState *exec, Type preferred) const;
virtual UString toString(ExecState *exec) const;
enum { AnchorNode, AnchorOffset, FocusNode, FocusOffset, BaseNode, BaseOffset, ExtentNode, ExtentOffset,
IsCollapsed, _Type, EqualEqual, Collapse, CollapseToEnd, CollapseToStart, Empty, ToString,
@@ -263,7 +263,7 @@
class BarInfo : public ObjectImp {
public:
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
enum { Visible };
enum Type { Locationbar, Menubar, Personalbar, Scrollbars, Statusbar, Toolbar };
KHTMLPart *part() const { return m_part; }
1.35 +28 -28 WebCore/khtml/ecma/xmlhttprequest.cpp
Index: xmlhttprequest.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/xmlhttprequest.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- xmlhttprequest.cpp 7 Aug 2005 06:17:46 -0000 1.34
+++ xmlhttprequest.cpp 8 Aug 2005 04:07:42 -0000 1.35
@@ -108,9 +108,9 @@
return true;
}
-Object XMLHttpRequestConstructorImp::construct(ExecState *exec, const List &)
+ObjectImp *XMLHttpRequestConstructorImp::construct(ExecState *exec, const List &)
{
- return Object(new XMLHttpRequest(exec, doc.get()));
+ return new XMLHttpRequest(exec, doc.get());
}
const ClassInfo XMLHttpRequest::info = { "XMLHttpRequest", 0, &XMLHttpRequestTable, 0 };
@@ -132,7 +132,7 @@
return getStaticValueSlot<XMLHttpRequest, DOMObject>(exec, &XMLHttpRequestTable, this, propertyName, slot);
}
-Value XMLHttpRequest::getValueProperty(ExecState *exec, int token) const
+ValueImp *XMLHttpRequest::getValueProperty(ExecState *exec, int token) const
{
switch (token) {
case ReadyState:
@@ -147,11 +147,11 @@
QString mimeType;
if (MIMETypeOverride.isEmpty()) {
- Value header = getResponseHeader("Content-Type");
- if (header.type() == UndefinedType) {
+ ValueImp *header = getResponseHeader("Content-Type");
+ if (header->isUndefined()) {
mimeType = "text/xml";
} else {
- mimeType = QStringList::split(";", header.toString(exec).qstring())[0].stripWhiteSpace();
+ mimeType = QStringList::split(";", header->toString(exec).qstring())[0].stripWhiteSpace();
}
} else {
mimeType = MIMETypeOverride;
@@ -197,16 +197,16 @@
}
default:
kdWarning() << "XMLHttpRequest::getValueProperty unhandled token " << token << endl;
- return Value();
+ return NULL;
}
}
-void XMLHttpRequest::put(ExecState *exec, const Identifier &propertyName, const Value& value, int attr)
+void XMLHttpRequest::put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr)
{
lookupPut<XMLHttpRequest,DOMObject>(exec, propertyName, value, attr, &XMLHttpRequestTable, this );
}
-void XMLHttpRequest::putValueProperty(ExecState *exec, int token, const Value& value, int /*attr*/)
+void XMLHttpRequest::putValueProperty(ExecState *exec, int token, ValueImp *value, int /*attr*/)
{
switch(token) {
case Onreadystatechange:
@@ -426,7 +426,7 @@
requestHeaders += value;
}
-Value XMLHttpRequest::getAllResponseHeaders() const
+ValueImp *XMLHttpRequest::getAllResponseHeaders() const
{
if (responseHeaders.isEmpty()) {
return Undefined();
@@ -441,7 +441,7 @@
return String(responseHeaders.mid(endOfLine + 1) + "\n");
}
-Value XMLHttpRequest::getResponseHeader(const QString& name) const
+ValueImp *XMLHttpRequest::getResponseHeader(const QString& name) const
{
if (responseHeaders.isEmpty()) {
return Undefined();
@@ -469,7 +469,7 @@
return String(responseHeaders.mid(headerLinePos + matchLength, endOfLine - (headerLinePos + matchLength)).stripWhiteSpace());
}
-Value XMLHttpRequest::getStatus() const
+ValueImp *XMLHttpRequest::getStatus() const
{
if (responseHeaders.isEmpty()) {
return Undefined();
@@ -495,7 +495,7 @@
return Number(code);
}
-Value XMLHttpRequest::getStatusText() const
+ValueImp *XMLHttpRequest::getStatusText() const
{
if (responseHeaders.isEmpty()) {
return Undefined();
@@ -652,15 +652,15 @@
QPtrDictIterator<XMLHttpRequest>(*requests).current()->abort();
}
-Value XMLHttpRequestProtoFunc::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *XMLHttpRequestProtoFunc::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (!thisObj.inherits(&XMLHttpRequest::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&XMLHttpRequest::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
- XMLHttpRequest *request = static_cast<XMLHttpRequest *>(thisObj.imp());
+ XMLHttpRequest *request = static_cast<XMLHttpRequest *>(thisObj);
switch (id) {
case XMLHttpRequest::Abort: {
@@ -679,7 +679,7 @@
return Undefined();
}
- return request->getResponseHeader(args[0].toString(exec).qstring());
+ return request->getResponseHeader(args[0]->toString(exec).qstring());
}
case XMLHttpRequest::Open:
{
@@ -687,20 +687,20 @@
return Undefined();
}
- QString method = args[0].toString(exec).qstring();
- KURL url = KURL(Window::retrieveActive(exec)->part()->xmlDocImpl()->completeURL(args[1].toString(exec).qstring()));
+ QString method = args[0]->toString(exec).qstring();
+ KURL url = KURL(Window::retrieveActive(exec)->part()->xmlDocImpl()->completeURL(args[1]->toString(exec).qstring()));
bool async = true;
if (args.size() >= 3) {
- async = args[2].toBoolean(exec);
+ async = args[2]->toBoolean(exec);
}
if (args.size() >= 4) {
- url.setUser(args[3].toString(exec).qstring());
+ url.setUser(args[3]->toString(exec).qstring());
}
if (args.size() >= 5) {
- url.setPass(args[4].toString(exec).qstring());
+ url.setPass(args[4]->toString(exec).qstring());
}
request->open(method, url, async);
@@ -720,14 +720,14 @@
QString body;
if (args.size() >= 1) {
- if (args[0].toObject(exec).inherits(&DOMDocument::info)) {
- DocumentImpl *doc = static_cast<DocumentImpl *>(static_cast<DOMDocument *>(args[0].toObject(exec).imp())->impl());
+ if (args[0]->toObject(exec)->inherits(&DOMDocument::info)) {
+ DocumentImpl *doc = static_cast<DocumentImpl *>(static_cast<DOMDocument *>(args[0]->toObject(exec))->impl());
body = doc->toString().string();
// FIXME: also need to set content type, including encoding!
} else {
// converting certain values (like null) to object can set an exception
exec->clearException();
- body = args[0].toString(exec).qstring();
+ body = args[0]->toString(exec).qstring();
}
}
@@ -740,7 +740,7 @@
return Undefined();
}
- request->setRequestHeader(args[0].toString(exec).qstring(), args[1].toString(exec).qstring());
+ request->setRequestHeader(args[0]->toString(exec).qstring(), args[1]->toString(exec).qstring());
return Undefined();
}
@@ -748,7 +748,7 @@
if (args.size() != 1) {
return Undefined();
}
- request->MIMETypeOverride = args[0].toString(exec).qstring();
+ request->MIMETypeOverride = args[0]->toString(exec).qstring();
return Undefined();
}
}
1.18 +8 -8 WebCore/khtml/ecma/xmlhttprequest.h
Index: xmlhttprequest.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/xmlhttprequest.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- xmlhttprequest.h 7 Aug 2005 06:17:46 -0000 1.17
+++ xmlhttprequest.h 8 Aug 2005 04:07:42 -0000 1.18
@@ -56,7 +56,7 @@
XMLHttpRequestConstructorImp(ExecState *exec, DOM::DocumentImpl *d);
~XMLHttpRequestConstructorImp();
virtual bool implementsConstruct() const;
- virtual Object construct(ExecState *exec, const List &args);
+ virtual ObjectImp *construct(ExecState *exec, const List &args);
private:
khtml::SharedPtr<DOM::DocumentImpl> doc;
};
@@ -66,9 +66,9 @@
XMLHttpRequest(ExecState *, DOM::DocumentImpl *d);
~XMLHttpRequest();
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- Value getValueProperty(ExecState *exec, int token) const;
- virtual void put(ExecState *exec, const Identifier &propertyName, const Value& value, int attr = None);
- void putValueProperty(ExecState *exec, int token, const Value& value, int /*attr*/);
+ ValueImp *getValueProperty(ExecState *exec, int token) const;
+ virtual void put(ExecState *exec, const Identifier &propertyName, ValueImp *value, int attr = None);
+ void putValueProperty(ExecState *exec, int token, ValueImp *value, int /*attr*/);
virtual bool toBoolean(ExecState *) const { return true; }
virtual void mark();
@@ -84,8 +84,8 @@
friend class XMLHttpRequestProtoFunc;
friend class XMLHttpRequestQObject;
- Value getStatusText() const;
- Value getStatus() const;
+ ValueImp *getStatusText() const;
+ ValueImp *getStatus() const;
bool urlMatchesDocumentDomain(const KURL&) const;
XMLHttpRequestQObject *qObject;
@@ -106,8 +106,8 @@
void send(const QString& _body);
void abort();
void setRequestHeader(const QString& name, const QString &value);
- Value getAllResponseHeaders() const;
- Value getResponseHeader(const QString& name) const;
+ ValueImp *getAllResponseHeaders() const;
+ ValueImp *getResponseHeader(const QString& name) const;
void changeState(XMLHttpRequestState newState);
1.5 +7 -7 WebCore/khtml/ecma/xmlserializer.cpp
Index: xmlserializer.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/xmlserializer.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- xmlserializer.cpp 19 Jul 2005 19:52:49 -0000 1.4
+++ xmlserializer.cpp 8 Aug 2005 04:07:42 -0000 1.5
@@ -53,9 +53,9 @@
return true;
}
-Object XMLSerializerConstructorImp::construct(ExecState *exec, const List &)
+ObjectImp *XMLSerializerConstructorImp::construct(ExecState *exec, const List &)
{
- return Object(new XMLSerializer(exec));
+ return new XMLSerializer(exec);
}
const ClassInfo XMLSerializer::info = { "XMLSerializer", 0, &XMLSerializerTable, 0 };
@@ -70,10 +70,10 @@
setPrototype(XMLSerializerProto::self(exec));
}
-Value XMLSerializerProtoFunc::call(ExecState *exec, Object &thisObj, const List &args)
+ValueImp *XMLSerializerProtoFunc::callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args)
{
- if (!thisObj.inherits(&XMLSerializer::info)) {
- Object err = Error::create(exec,TypeError);
+ if (!thisObj->inherits(&XMLSerializer::info)) {
+ ObjectImp *err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
@@ -85,11 +85,11 @@
return Undefined();
}
- if (!args[0].toObject(exec).inherits(&DOMDocument::info)) {
+ if (!args[0]->toObject(exec)->inherits(&DOMDocument::info)) {
return Undefined();
}
- DocumentImpl *doc = static_cast<DocumentImpl *>(static_cast<DOMDocument *>(args[0].toObject(exec).imp())->impl());
+ DocumentImpl *doc = static_cast<DocumentImpl *>(static_cast<DOMDocument *>(args[0]->toObject(exec))->impl());
return getStringOrNull(doc->toString().string());
}
}
1.3 +1 -1 WebCore/khtml/ecma/xmlserializer.h
Index: xmlserializer.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/xmlserializer.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- xmlserializer.h 12 May 2005 17:11:21 -0000 1.2
+++ xmlserializer.h 8 Aug 2005 04:07:42 -0000 1.3
@@ -31,7 +31,7 @@
public:
XMLSerializerConstructorImp(ExecState *);
virtual bool implementsConstruct() const;
- virtual Object construct(ExecState *exec, const List &args);
+ virtual ObjectImp *construct(ExecState *exec, const List &args);
};
class XMLSerializer : public DOMObject {
1.5 +3 -3 WebCore/kwq/DOMUtility.mm
Index: DOMUtility.mm
===================================================================
RCS file: /cvs/root/WebCore/kwq/DOMUtility.mm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DOMUtility.mm 12 May 2005 17:11:22 -0000 1.4
+++ DOMUtility.mm 8 Aug 2005 04:07:46 -0000 1.5
@@ -41,10 +41,10 @@
namespace KJS {
-void *ScriptInterpreter::createObjcInstanceForValue(ExecState *exec, const Object &value, const Bindings::RootObject *origin, const Bindings::RootObject *current)
+void *ScriptInterpreter::createObjcInstanceForValue(ExecState *exec, ObjectImp *value, const Bindings::RootObject *origin, const Bindings::RootObject *current)
{
- if (value.inherits(&DOMNode::info)) {
- DOMNode *imp = static_cast<DOMNode *>(value.imp());
+ if (value->inherits(&DOMNode::info)) {
+ DOMNode *imp = static_cast<DOMNode *>(value);
id newObjcNode = createObjCDOMNode(imp->impl());
[newObjcNode _initializeWithObjectImp:imp originExecutionContext:origin executionContext:current];
return newObjcNode;
1.658 +3 -3 WebCore/kwq/KWQKHTMLPart.mm
Index: KWQKHTMLPart.mm
===================================================================
RCS file: /cvs/root/WebCore/kwq/KWQKHTMLPart.mm,v
retrieving revision 1.657
retrieving revision 1.658
diff -u -r1.657 -r1.658
--- KWQKHTMLPart.mm 1 Aug 2005 21:23:42 -0000 1.657
+++ KWQKHTMLPart.mm 8 Aug 2005 04:07:46 -0000 1.658
@@ -1418,7 +1418,7 @@
{
if (!_bindingRoot) {
_bindingRoot = new KJS::Bindings::RootObject(0); // The root gets deleted by JavaScriptCore.
- KJS::ObjectImp *win = static_cast<KJS::ObjectImp *>(KJS::Window::retrieveWindow(this));
+ KJS::ObjectImp *win = KJS::Window::retrieveWindow(this);
_bindingRoot->setRootObjectImp (win);
_bindingRoot->setInterpreter (KJSProxy::proxy(this)->interpreter());
addPluginRootObject (_bindingRoot);
@@ -1429,7 +1429,7 @@
WebScriptObject *KWQKHTMLPart::windowScriptObject()
{
if (!_windowScriptObject) {
- KJS::ObjectImp *win = static_cast<KJS::ObjectImp *>(KJS::Window::retrieveWindow(this));
+ KJS::ObjectImp *win = KJS::Window::retrieveWindow(this);
_windowScriptObject = KWQRetainNSRelease([[WebScriptObject alloc] _initWithObjectImp:win originExecutionContext:bindingRootObject() executionContext:bindingRootObject()]);
}
@@ -1439,7 +1439,7 @@
NPObject *KWQKHTMLPart::windowScriptNPObject()
{
if (!_windowScriptNPObject) {
- KJS::ObjectImp *win = static_cast<KJS::ObjectImp *>(KJS::Window::retrieveWindow(this));
+ KJS::ObjectImp *win = KJS::Window::retrieveWindow(this);
_windowScriptNPObject = _NPN_CreateScriptObject (0, win, bindingRootObject(), bindingRootObject());
}
1.408 +1 -1 WebCore/kwq/WebCoreBridge.mm
Index: WebCoreBridge.mm
===================================================================
RCS file: /cvs/root/WebCore/kwq/WebCoreBridge.mm,v
retrieving revision 1.407
retrieving revision 1.408
diff -u -r1.407 -r1.408
--- WebCoreBridge.mm 30 Jul 2005 02:33:10 -0000 1.407
+++ WebCoreBridge.mm 8 Aug 2005 04:07:46 -0000 1.408
@@ -2268,7 +2268,7 @@
{
KWQKHTMLPart *part = [self part];
RootObject *root = new RootObject(aView); // The root gets deleted by JavaScriptCore.
- root->setRootObjectImp(static_cast<ObjectImp *>(Window::retrieveWindow(part)));
+ root->setRootObjectImp(Window::retrieveWindow(part));
root->setInterpreter(KJSProxy::proxy(part)->interpreter());
part->addPluginRootObject(root);
return root;
1.2 +22 -18 WebCore/kwq/WebCoreScriptDebugger.mm
Index: WebCoreScriptDebugger.mm
===================================================================
RCS file: /cvs/root/WebCore/kwq/WebCoreScriptDebugger.mm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- WebCoreScriptDebugger.mm 30 Jul 2005 03:00:34 -0000 1.1
+++ WebCoreScriptDebugger.mm 8 Aug 2005 04:07:46 -0000 1.2
@@ -48,7 +48,7 @@
- (WebCoreScriptCallFrame *)_initWithGlobalObject:(WebScriptObject *)globalObj caller:(WebCoreScriptCallFrame *)caller state:(ExecState *)state;
- (void)_setWrapper:(id)wrapper;
-- (id)_convertValueToObjcValue:(Value)value;
+- (id)_convertValueToObjcValue:(ValueImp *)value;
@end
@@ -91,7 +91,7 @@
}
return true;
}
- virtual bool callEvent(ExecState *state, int sid, int lineno, Object &func, const List &args) {
+ virtual bool callEvent(ExecState *state, int sid, int lineno, ObjectImp *func, const List &args) {
if (!_nested) {
_nested = true;
_current = [_objc _enterFrame:state];
@@ -108,7 +108,7 @@
}
return true;
}
- virtual bool returnEvent(ExecState *state, int sid, int lineno, Object &func) {
+ virtual bool returnEvent(ExecState *state, int sid, int lineno, ObjectImp *func) {
if (!_nested) {
_nested = true;
[[_objc delegate] leavingFrame:_current sourceId:sid line:lineno];
@@ -148,6 +148,12 @@
[super dealloc];
}
+- (void)finalize
+{
+ delete _debugger;
+ [super finalize];
+}
+
- (id<WebScriptDebugger>)delegate
{
return _delegate;
@@ -203,13 +209,13 @@
_wrapper = wrapper; // (already retained)
}
-- (id)_convertValueToObjcValue:(Value)value
+- (id)_convertValueToObjcValue:(ValueImp *)value
{
- if (value.isNull()) {
+ if (!value) {
return nil;
}
- if (value.type() == ObjectType && value.imp() == [_globalObj _imp]) {
+ if (value == [_globalObj _imp]) {
return _globalObj;
}
@@ -259,8 +265,7 @@
NSMutableArray *scopes = [[NSMutableArray alloc] init];
while (!chain.isEmpty()) {
- Object scope(chain.top());
- [scopes addObject:[self _convertValueToObjcValue:scope]];
+ [scopes addObject:[self _convertValueToObjcValue:chain.top()]];
chain.pop();
}
@@ -309,14 +314,14 @@
ExecState *state = _state;
Interpreter *interp = state->interpreter();
- Object globObj = interp->globalObject();
+ ObjectImp *globObj = interp->globalObject();
// find "eval"
- Object eval;
+ ObjectImp *eval = NULL;
if (state->context().imp()) { // "eval" won't work without context (i.e. at global scope)
- Object o = Object::dynamicCast(globObj.get(state, "eval"));
- if (!o.isNull() && o.implementsCall()) {
- eval = o;
+ ValueImp *v = globObj->get(state, "eval");
+ if (v->isObject() && static_cast<ObjectImp *>(v)->implementsCall()) {
+ eval = static_cast<ObjectImp *>(v);
}
else {
// no "eval" - fallback operates on global exec state
@@ -324,17 +329,16 @@
}
}
- Value savedException = state->exception();
+ ValueImp *savedException = state->exception();
state->clearException();
// evaluate
- Value result;
- if (!eval.isNull()) {
+ ValueImp *result;
+ if (eval) {
Interpreter::lock();
- Object dummy;
List args;
args.append(String(code));
- result = eval.call(state, dummy, args);
+ result = eval->call(state, NULL, args);
Interpreter::unlock();
}
else {
More information about the webkit-changes
mailing list