Commit 989a6f84 authored by darin@apple.com's avatar darin@apple.com

JavaScriptCore:

2008-10-19  Darin Adler  <darin@apple.com>

        Reviewed by Oliver Hunt.

        - next step of https://bugs.webkit.org/show_bug.cgi?id=21732
          improve performance by eliminating JSValue as a base class for JSCell

        Remove most uses of JSValue, which will be removed in a future patch.

        * VM/Machine.cpp:
        (JSC::fastToUInt32): Call toUInt32SlowCase function; no longer a member
        of JSValue.
        * kjs/JSNumberCell.h:
        (JSC::JSNumberCell::toInt32): Ditto.
        (JSC::JSNumberCell::toUInt32): Ditto.

        * kjs/JSValue.cpp:
        (JSC::toInt32SlowCase): Made a non-member function.
        (JSC::JSValue::toInt32SlowCase): Changed to call non-member function.
        (JSC::toUInt32SlowCase): More of the same.
        (JSC::JSValue::toUInt32SlowCase): Ditto.

        * kjs/JSValue.h: Moved static member function so they are no longer
        member functions at all.

        * VM/CTI.h: Removed forward declaration of JSValue.
        * VM/ExceptionHelpers.h: Ditto.
        * kjs/CallData.h: Ditto.
        * kjs/ConstructData.h: Ditto.
        * kjs/JSGlobalObjectFunctions.h: Ditto.
        * kjs/PropertyMap.h: Ditto.
        * kjs/StructureID.h: Ditto.
        * kjs/collector.h: Ditto.
        * kjs/completion.h: Ditto.

        * kjs/grammar.y:
        (JSC::makeBitwiseNotNode): Call new non-member toInt32 function.
        (JSC::makeLeftShiftNode): More of the same.
        (JSC::makeRightShiftNode): Ditto.

        * kjs/protect.h: Added a specialization for ProtectedPtr<JSValuePtr>
        so this can be used with JSValuePtr.

JavaScriptGlue:

2008-10-19  Darin Adler  <darin@apple.com>

        Reviewed by Oliver Hunt.

        - next step of https://bugs.webkit.org/show_bug.cgi?id=21732
          improve performance by eliminating JSValue as a base class for JSCell

        Remove most uses of JSValue, which will be removed in a future patch.

        * JSValueWrapper.h: Use JSValuePtr instead of JSValue*.

WebCore:

2008-10-19  Darin Adler  <darin@apple.com>

        Reviewed by Oliver Hunt.

        - next step of https://bugs.webkit.org/show_bug.cgi?id=21732
          improve performance by eliminating JSValue as a base class for JSCell

        Remove most uses of JSValue, which will be removed in a future patch.

        * bindings/js/JSCustomXPathNSResolver.h: Removed declaration of JSValue
        and used JSValuePtr instead.
        * bindings/js/JSEventTarget.h: Ditto.
        * bindings/js/JSNodeFilterCondition.h: Ditto.
        * bindings/js/ScheduledAction.h: Ditto.
        * bindings/js/ScriptController.h: Ditto.
        * bindings/objc/WebScriptObjectPrivate.h: Ditto.
        * bridge/c/c_utility.h: Ditto.
        * bridge/jni/jni_jsobject.h: Ditto.
        * bridge/jni/jni_utility.h: Ditto.
        * bridge/objc/WebScriptObject.h: Ditto.
        * dom/Traversal.h: Ditto.
        * inspector/InspectorController.cpp: Ditto.
        * inspector/JavaScriptProfile.h: Ditto.
        * inspector/JavaScriptProfileNode.h: Ditto.
        * loader/FrameLoader.h: Ditto.
        * page/Console.h: Ditto.
        * plugins/MimeTypeArray.h: Ditto.
        * plugins/Plugin.h: Ditto.
        * plugins/PluginArray.h: Ditto.
        * plugins/PluginView.cpp:
        (WebCore::getString): Ditto.
        (WebCore::PluginView::performRequest): Ditto.
        * plugins/gtk/PluginViewGtk.cpp: Ditto.
        * plugins/qt/PluginViewQt.cpp: Ditto.
        * plugins/win/PluginViewWin.cpp: Ditto.

        * bridge/qt/qt_class.cpp:
        (JSC::Bindings::QtClass::fallbackObject): Use JSValuePtr and JSObject*
        instead of JSValue*.
        * bridge/qt/qt_class.h: Ditto.
        * bridge/qt/qt_instance.cpp:
        (JSC::Bindings::QtInstance::mark): Ditto.
        (JSC::Bindings::QtInstance::invokeMethod): Ditto.
        (JSC::Bindings::QtInstance::defaultValue): Ditto.
        (JSC::Bindings::QtInstance::stringValue): Ditto.
        (JSC::Bindings::QtInstance::numberValue): Ditto.
        (JSC::Bindings::QtInstance::booleanValue): Ditto.
        (JSC::Bindings::QtInstance::valueOf): Ditto.
        (JSC::Bindings::QtField::valueFromInstance): Ditto.
        (JSC::Bindings::QtField::setValueToInstance): Ditto.
        * bridge/qt/qt_instance.h: Ditto.
        * bridge/qt/qt_runtime.cpp: Ditto.
        (JSC::Bindings::valueRealType): Ditto.
        (JSC::Bindings::convertValueToQVariant): Ditto.
        (JSC::Bindings::convertQVariantToValue): Ditto.
        (JSC::Bindings::findMethodIndex): Ditto.
        (JSC::Bindings::QtRuntimeMetaMethod::call): Ditto.
        (JSC::Bindings::QtRuntimeMetaMethod::lengthGetter): Ditto.
        (JSC::Bindings::QtRuntimeMetaMethod::connectGetter): Ditto.
        (JSC::Bindings::QtRuntimeMetaMethod::disconnectGetter): Ditto.
        (JSC::Bindings::QtRuntimeConnectionMethod::call): Ditto.
        (JSC::Bindings::QtRuntimeConnectionMethod::lengthGetter): Ditto.
        (JSC::Bindings::QtArray::setValueAt): Ditto.
        (JSC::Bindings::QtArray::valueAt): Ditto.
        * bridge/qt/qt_runtime.h: Ditto.

        * bridge/testqtbindings.cpp:
        (main): Use JSValuePtr.

WebKit/mac:

2008-10-19  Darin Adler  <darin@apple.com>

        Reviewed by Oliver Hunt.

        - next step of https://bugs.webkit.org/show_bug.cgi?id=21732
          improve performance by eliminating JSValue as a base class for JSCell

        Remove most uses of JSValue, which will be removed in a future patch.

        * WebView/WebFrame.mm:
        (-[WebFrame _stringByEvaluatingJavaScriptFromString:forceUserGesture:]):
        Use JSValuePtr instead of JSValue.
        * WebView/WebScriptDebugger.h: Removed declaration of JSValue.

WebKit/qt:

2008-10-19  Darin Adler  <darin@apple.com>

        Reviewed by Oliver Hunt.

        - next step of https://bugs.webkit.org/show_bug.cgi?id=21732
          improve performance by eliminating JSValue as a base class for JSCell

        Remove most uses of JSValue, which will be removed in a future patch.

        * Api/qwebframe.cpp:
        (QWebFrame::evaluateJavaScript): Use JSValuePtr.

WebKit/win:

2008-10-19  Darin Adler  <darin@apple.com>

        Reviewed by Oliver Hunt.

        - next step of https://bugs.webkit.org/show_bug.cgi?id=21732
          improve performance by eliminating JSValue as a base class for JSCell

        Remove most uses of JSValue, which will be removed in a future patch.

        * WebScriptCallFrame.cpp:
        (WebScriptCallFrame::jsValueToString): Use JSValuePtr.
        (WebScriptCallFrame::stringByEvaluatingJavaScriptFromString): Ditto.
        (WebScriptCallFrame::valueForVariable): Put more code inside and ifdef.
        (WebScriptCallFrame::valueByEvaluatingJavaScriptFromString): Ditto.
        * WebScriptCallFrame.h: Use JSValuePtr.

        * WebView.cpp:
        (WebView::stringByEvaluatingJavaScriptFromString): Use JSValuePtr.

WebKit/wx:

2008-10-19  Darin Adler  <darin@apple.com>

        Reviewed by Oliver Hunt.

        - next step of https://bugs.webkit.org/show_bug.cgi?id=21732
          improve performance by eliminating JSValue as a base class for JSCell

        Remove most uses of JSValue, which will be removed in a future patch.

        * WebFrame.cpp:
        (wxWebFrame::RunScript): Use JSValuePtr.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37706 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 5c465b09
2008-10-19 Darin Adler <darin@apple.com>
Reviewed by Oliver Hunt.
- next step of https://bugs.webkit.org/show_bug.cgi?id=21732
improve performance by eliminating JSValue as a base class for JSCell
Remove most uses of JSValue, which will be removed in a future patch.
* VM/Machine.cpp:
(JSC::fastToUInt32): Call toUInt32SlowCase function; no longer a member
of JSValue.
* kjs/JSNumberCell.h:
(JSC::JSNumberCell::toInt32): Ditto.
(JSC::JSNumberCell::toUInt32): Ditto.
* kjs/JSValue.cpp:
(JSC::toInt32SlowCase): Made a non-member function.
(JSC::JSValue::toInt32SlowCase): Changed to call non-member function.
(JSC::toUInt32SlowCase): More of the same.
(JSC::JSValue::toUInt32SlowCase): Ditto.
* kjs/JSValue.h: Moved static member function so they are no longer
member functions at all.
* VM/CTI.h: Removed forward declaration of JSValue.
* VM/ExceptionHelpers.h: Ditto.
* kjs/CallData.h: Ditto.
* kjs/ConstructData.h: Ditto.
* kjs/JSGlobalObjectFunctions.h: Ditto.
* kjs/PropertyMap.h: Ditto.
* kjs/StructureID.h: Ditto.
* kjs/collector.h: Ditto.
* kjs/completion.h: Ditto.
* kjs/grammar.y:
(JSC::makeBitwiseNotNode): Call new non-member toInt32 function.
(JSC::makeLeftShiftNode): More of the same.
(JSC::makeRightShiftNode): Ditto.
* kjs/protect.h: Added a specialization for ProtectedPtr<JSValuePtr>
so this can be used with JSValuePtr.
2008-10-18 Darin Adler <darin@apple.com> 2008-10-18 Darin Adler <darin@apple.com>
Reviewed by Oliver Hunt. Reviewed by Oliver Hunt.
......
...@@ -86,7 +86,6 @@ namespace JSC { ...@@ -86,7 +86,6 @@ namespace JSC {
class CodeBlock; class CodeBlock;
class JSPropertyNameIterator; class JSPropertyNameIterator;
class JSValue;
class Machine; class Machine;
class Register; class Register;
class RegisterFile; class RegisterFile;
......
...@@ -40,7 +40,6 @@ namespace JSC { ...@@ -40,7 +40,6 @@ namespace JSC {
class JSGlobalData; class JSGlobalData;
class JSNotAnObjectErrorStub; class JSNotAnObjectErrorStub;
class JSObject; class JSObject;
class JSValue;
class Node; class Node;
JSValuePtr createInterruptedExecutionException(JSGlobalData*); JSValuePtr createInterruptedExecutionException(JSGlobalData*);
......
...@@ -157,7 +157,7 @@ static ALWAYS_INLINE bool fastToUInt32(JSValuePtr value, uint32_t& arg) ...@@ -157,7 +157,7 @@ static ALWAYS_INLINE bool fastToUInt32(JSValuePtr value, uint32_t& arg)
if (JSImmediate::getTruncatedUInt32(value, arg)) if (JSImmediate::getTruncatedUInt32(value, arg))
return true; return true;
bool scratch; bool scratch;
arg = JSValue::toUInt32SlowCase(JSImmediate::getTruncatedInt32(value), scratch); arg = toUInt32SlowCase(JSImmediate::getTruncatedInt32(value), scratch);
return true; return true;
} else if (!JSImmediate::isImmediate(value) && Heap::isNumber(asCell(value))) } else if (!JSImmediate::isImmediate(value) && Heap::isNumber(asCell(value)))
arg = asNumberCell(value)->toUInt32(); arg = asNumberCell(value)->toUInt32();
......
...@@ -37,7 +37,6 @@ namespace JSC { ...@@ -37,7 +37,6 @@ namespace JSC {
class ExecState; class ExecState;
class FunctionBodyNode; class FunctionBodyNode;
class JSObject; class JSObject;
class JSValue;
class ScopeChainNode; class ScopeChainNode;
enum CallType { enum CallType {
......
...@@ -37,7 +37,6 @@ namespace JSC { ...@@ -37,7 +37,6 @@ namespace JSC {
class ExecState; class ExecState;
class FunctionBodyNode; class FunctionBodyNode;
class JSObject; class JSObject;
class JSValue;
class ScopeChainNode; class ScopeChainNode;
enum ConstructType { enum ConstructType {
......
...@@ -31,7 +31,6 @@ namespace JSC { ...@@ -31,7 +31,6 @@ namespace JSC {
class ArgList; class ArgList;
class ExecState; class ExecState;
class JSObject; class JSObject;
class JSValue;
// FIXME: These functions should really be in JSGlobalObject.cpp, but putting them there // FIXME: These functions should really be in JSGlobalObject.cpp, but putting them there
// is a 0.5% reduction. // is a 0.5% reduction.
......
...@@ -241,7 +241,7 @@ namespace JSC { ...@@ -241,7 +241,7 @@ namespace JSC {
if (m_value >= -2147483648.0 && m_value < 2147483648.0) if (m_value >= -2147483648.0 && m_value < 2147483648.0)
return static_cast<int32_t>(m_value); return static_cast<int32_t>(m_value);
bool scratch; bool scratch;
return JSValue::toInt32SlowCase(m_value, scratch); return JSC::toInt32SlowCase(m_value, scratch);
} }
inline uint32_t JSNumberCell::toUInt32() const inline uint32_t JSNumberCell::toUInt32() const
...@@ -249,7 +249,7 @@ namespace JSC { ...@@ -249,7 +249,7 @@ namespace JSC {
if (m_value >= 0.0 && m_value < 4294967296.0) if (m_value >= 0.0 && m_value < 4294967296.0)
return static_cast<uint32_t>(m_value); return static_cast<uint32_t>(m_value);
bool scratch; bool scratch;
return JSValue::toUInt32SlowCase(m_value, scratch); return JSC::toUInt32SlowCase(m_value, scratch);
} }
ALWAYS_INLINE JSValuePtr JSValue::toJSNumber(ExecState* exec) const ALWAYS_INLINE JSValuePtr JSValue::toJSNumber(ExecState* exec) const
......
...@@ -48,7 +48,7 @@ double JSValue::toIntegerPreserveNaN(ExecState* exec) const ...@@ -48,7 +48,7 @@ double JSValue::toIntegerPreserveNaN(ExecState* exec) const
return trunc(toNumber(exec)); return trunc(toNumber(exec));
} }
int32_t JSValue::toInt32SlowCase(double d, bool& ok) int32_t toInt32SlowCase(double d, bool& ok)
{ {
ok = true; ok = true;
...@@ -70,10 +70,10 @@ int32_t JSValue::toInt32SlowCase(double d, bool& ok) ...@@ -70,10 +70,10 @@ int32_t JSValue::toInt32SlowCase(double d, bool& ok)
int32_t JSValue::toInt32SlowCase(ExecState* exec, bool& ok) const int32_t JSValue::toInt32SlowCase(ExecState* exec, bool& ok) const
{ {
return JSValue::toInt32SlowCase(toNumber(exec), ok); return JSC::toInt32SlowCase(toNumber(exec), ok);
} }
uint32_t JSValue::toUInt32SlowCase(double d, bool& ok) uint32_t toUInt32SlowCase(double d, bool& ok)
{ {
ok = true; ok = true;
...@@ -93,7 +93,7 @@ uint32_t JSValue::toUInt32SlowCase(double d, bool& ok) ...@@ -93,7 +93,7 @@ uint32_t JSValue::toUInt32SlowCase(double d, bool& ok)
uint32_t JSValue::toUInt32SlowCase(ExecState* exec, bool& ok) const uint32_t JSValue::toUInt32SlowCase(ExecState* exec, bool& ok) const
{ {
return JSValue::toUInt32SlowCase(toNumber(exec), ok); return JSC::toUInt32SlowCase(toNumber(exec), ok);
} }
float JSValue::toFloat(ExecState* exec) const float JSValue::toFloat(ExecState* exec) const
......
...@@ -115,10 +115,6 @@ namespace JSC { ...@@ -115,10 +115,6 @@ namespace JSC {
uint32_t toUInt32(ExecState*) const; uint32_t toUInt32(ExecState*) const;
uint32_t toUInt32(ExecState*, bool& ok) const; uint32_t toUInt32(ExecState*, bool& ok) const;
// These are identical logic to above, and faster than jsNumber(number)->toInt32(exec)
static int32_t toInt32(double);
static uint32_t toUInt32(double);
// Floating point conversions. // Floating point conversions.
float toFloat(ExecState*) const; float toFloat(ExecState*) const;
...@@ -126,9 +122,6 @@ namespace JSC { ...@@ -126,9 +122,6 @@ namespace JSC {
void mark(); void mark();
bool marked() const; bool marked() const;
static int32_t toInt32SlowCase(double, bool& ok);
static uint32_t toUInt32SlowCase(double, bool& ok);
// Object operations, with the toObject operation included. // Object operations, with the toObject operation included.
JSValuePtr get(ExecState*, const Identifier& propertyName) const; JSValuePtr get(ExecState*, const Identifier& propertyName) const;
JSValuePtr get(ExecState*, const Identifier& propertyName, PropertySlot&) const; JSValuePtr get(ExecState*, const Identifier& propertyName, PropertySlot&) const;
...@@ -157,6 +150,12 @@ namespace JSC { ...@@ -157,6 +150,12 @@ namespace JSC {
uint32_t toUInt32SlowCase(ExecState*, bool& ok) const; uint32_t toUInt32SlowCase(ExecState*, bool& ok) const;
}; };
// These are identical logic to the JSValue functions above, and faster than jsNumber(number)->toInt32().
int32_t toInt32(double);
uint32_t toUInt32(double);
int32_t toInt32SlowCase(double, bool& ok);
uint32_t toUInt32SlowCase(double, bool& ok);
inline JSValue::JSValue() inline JSValue::JSValue()
{ {
} }
...@@ -223,7 +222,7 @@ namespace JSC { ...@@ -223,7 +222,7 @@ namespace JSC {
return toUInt32SlowCase(exec, ok); return toUInt32SlowCase(exec, ok);
} }
inline int32_t JSValue::toInt32(double val) inline int32_t toInt32(double val)
{ {
if (!(val >= -2147483648.0 && val < 2147483648.0)) { if (!(val >= -2147483648.0 && val < 2147483648.0)) {
bool ignored; bool ignored;
...@@ -232,7 +231,7 @@ namespace JSC { ...@@ -232,7 +231,7 @@ namespace JSC {
return static_cast<int32_t>(val); return static_cast<int32_t>(val);
} }
inline uint32_t JSValue::toUInt32(double val) inline uint32_t toUInt32(double val)
{ {
if (!(val >= 0.0 && val < 4294967296.0)) { if (!(val >= 0.0 && val < 4294967296.0)) {
bool ignored; bool ignored;
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
namespace JSC { namespace JSC {
class JSObject; class JSObject;
class JSValue;
class PropertyNameArray; class PropertyNameArray;
typedef JSValuePtr* PropertyStorage; typedef JSValuePtr* PropertyStorage;
......
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
namespace JSC { namespace JSC {
class JSValue;
class PropertyNameArray; class PropertyNameArray;
class PropertyNameArrayData; class PropertyNameArrayData;
class StructureIDChain; class StructureIDChain;
......
...@@ -43,7 +43,6 @@ namespace JSC { ...@@ -43,7 +43,6 @@ namespace JSC {
class CollectorBlock; class CollectorBlock;
class JSCell; class JSCell;
class JSGlobalData; class JSGlobalData;
class JSValue;
enum OperationInProgress { NoOperation, Allocation, Collection }; enum OperationInProgress { NoOperation, Allocation, Collection };
enum HeapType { PrimaryHeap, NumberHeap }; enum HeapType { PrimaryHeap, NumberHeap };
......
...@@ -27,8 +27,6 @@ ...@@ -27,8 +27,6 @@
namespace JSC { namespace JSC {
class JSValue;
enum ComplType { Normal, Break, Continue, ReturnValue, Throw, Interrupted }; enum ComplType { Normal, Break, Continue, ReturnValue, Throw, Interrupted };
/* /*
......
...@@ -1418,7 +1418,7 @@ static NumberNode* makeNumberNode(void* globalPtr, double d) ...@@ -1418,7 +1418,7 @@ static NumberNode* makeNumberNode(void* globalPtr, double d)
static ExpressionNode* makeBitwiseNotNode(void* globalPtr, ExpressionNode* expr) static ExpressionNode* makeBitwiseNotNode(void* globalPtr, ExpressionNode* expr)
{ {
if (expr->isNumber()) if (expr->isNumber())
return makeNumberNode(globalPtr, ~JSValue::toInt32(static_cast<NumberNode*>(expr)->value())); return makeNumberNode(globalPtr, ~toInt32(static_cast<NumberNode*>(expr)->value()));
return new BitwiseNotNode(GLOBAL_DATA, expr); return new BitwiseNotNode(GLOBAL_DATA, expr);
} }
...@@ -1469,14 +1469,14 @@ static ExpressionNode* makeSubNode(void* globalPtr, ExpressionNode* expr1, Expre ...@@ -1469,14 +1469,14 @@ static ExpressionNode* makeSubNode(void* globalPtr, ExpressionNode* expr1, Expre
static ExpressionNode* makeLeftShiftNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) static ExpressionNode* makeLeftShiftNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
{ {
if (expr1->isNumber() && expr2->isNumber()) if (expr1->isNumber() && expr2->isNumber())
return makeNumberNode(globalPtr, JSValue::toInt32(static_cast<NumberNode*>(expr1)->value()) << (JSValue::toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f)); return makeNumberNode(globalPtr, toInt32(static_cast<NumberNode*>(expr1)->value()) << (toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f));
return new LeftShiftNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments); return new LeftShiftNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments);
} }
static ExpressionNode* makeRightShiftNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) static ExpressionNode* makeRightShiftNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments)
{ {
if (expr1->isNumber() && expr2->isNumber()) if (expr1->isNumber() && expr2->isNumber())
return makeNumberNode(globalPtr, JSValue::toInt32(static_cast<NumberNode*>(expr1)->value()) >> (JSValue::toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f)); return makeNumberNode(globalPtr, toInt32(static_cast<NumberNode*>(expr1)->value()) >> (toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f));
return new RightShiftNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments); return new RightShiftNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments);
} }
......
...@@ -68,7 +68,7 @@ namespace JSC { ...@@ -68,7 +68,7 @@ namespace JSC {
operator T*() const { return m_ptr; } operator T*() const { return m_ptr; }
T* operator->() const { return m_ptr; } T* operator->() const { return m_ptr; }
bool operator!() const { return m_ptr == NULL; } bool operator!() const { return !m_ptr; }
ProtectedPtr& operator=(const ProtectedPtr&); ProtectedPtr& operator=(const ProtectedPtr&);
ProtectedPtr& operator=(T*); ProtectedPtr& operator=(T*);
...@@ -77,6 +77,23 @@ namespace JSC { ...@@ -77,6 +77,23 @@ namespace JSC {
T* m_ptr; T* m_ptr;
}; };
template <> class ProtectedPtr<JSValuePtr> {
public:
ProtectedPtr() { }
ProtectedPtr(JSValuePtr ptr) : m_ptr(ptr) { }
template <class U> ProtectedPtr(const ProtectedPtr<U>& ptr) : m_ptr(ptr) { }
JSValuePtr get() const { return m_ptr; }
operator JSValuePtr() const { return m_ptr; }
JSValue* operator->() const { return m_ptr; }
bool operator!() const { return !m_ptr; }
private:
ProtectedPtr<JSValue> m_ptr;
};
template <class T> ProtectedPtr<T>::ProtectedPtr(T* ptr) template <class T> ProtectedPtr<T>::ProtectedPtr(T* ptr)
: m_ptr(ptr) : m_ptr(ptr)
{ {
......
2008-10-19 Darin Adler <darin@apple.com>
Reviewed by Oliver Hunt.
- next step of https://bugs.webkit.org/show_bug.cgi?id=21732
improve performance by eliminating JSValue as a base class for JSCell
Remove most uses of JSValue, which will be removed in a future patch.
* JSValueWrapper.h: Use JSValuePtr instead of JSValue*.
2008-10-18 Darin Adler <darin@apple.com> 2008-10-18 Darin Adler <darin@apple.com>
Reviewed by Oliver Hunt. Reviewed by Oliver Hunt.
......
...@@ -35,15 +35,15 @@ ...@@ -35,15 +35,15 @@
class JSValueWrapper { class JSValueWrapper {
public: public:
JSValueWrapper(JSValue *inValue); JSValueWrapper(JSValuePtr);
virtual ~JSValueWrapper(); virtual ~JSValueWrapper();
static void GetJSObectCallBacks(JSObjectCallBacks& callBacks); static void GetJSObectCallBacks(JSObjectCallBacks& callBacks);
JSValue *GetValue(); JSValuePtr GetValue();
private: private:
ProtectedPtr<JSValue> fValue; ProtectedPtr<JSValuePtr> fValue;
static void JSObjectDispose(void *data); static void JSObjectDispose(void *data);
static CFArrayRef JSObjectCopyPropertyNames(void *data); static CFArrayRef JSObjectCopyPropertyNames(void *data);
......
2008-10-19 Darin Adler <darin@apple.com>
Reviewed by Oliver Hunt.
- next step of https://bugs.webkit.org/show_bug.cgi?id=21732
improve performance by eliminating JSValue as a base class for JSCell
Remove most uses of JSValue, which will be removed in a future patch.
* bindings/js/JSCustomXPathNSResolver.h: Removed declaration of JSValue
and used JSValuePtr instead.
* bindings/js/JSEventTarget.h: Ditto.
* bindings/js/JSNodeFilterCondition.h: Ditto.
* bindings/js/ScheduledAction.h: Ditto.
* bindings/js/ScriptController.h: Ditto.
* bindings/objc/WebScriptObjectPrivate.h: Ditto.
* bridge/c/c_utility.h: Ditto.
* bridge/jni/jni_jsobject.h: Ditto.
* bridge/jni/jni_utility.h: Ditto.
* bridge/objc/WebScriptObject.h: Ditto.
* dom/Traversal.h: Ditto.
* inspector/InspectorController.cpp: Ditto.
* inspector/JavaScriptProfile.h: Ditto.
* inspector/JavaScriptProfileNode.h: Ditto.
* loader/FrameLoader.h: Ditto.
* page/Console.h: Ditto.
* plugins/MimeTypeArray.h: Ditto.
* plugins/Plugin.h: Ditto.
* plugins/PluginArray.h: Ditto.
* plugins/PluginView.cpp:
(WebCore::getString): Ditto.
(WebCore::PluginView::performRequest): Ditto.
* plugins/gtk/PluginViewGtk.cpp: Ditto.
* plugins/qt/PluginViewQt.cpp: Ditto.
* plugins/win/PluginViewWin.cpp: Ditto.
* bridge/qt/qt_class.cpp:
(JSC::Bindings::QtClass::fallbackObject): Use JSValuePtr and JSObject*
instead of JSValue*.
* bridge/qt/qt_class.h: Ditto.
* bridge/qt/qt_instance.cpp:
(JSC::Bindings::QtInstance::mark): Ditto.
(JSC::Bindings::QtInstance::invokeMethod): Ditto.
(JSC::Bindings::QtInstance::defaultValue): Ditto.
(JSC::Bindings::QtInstance::stringValue): Ditto.
(JSC::Bindings::QtInstance::numberValue): Ditto.
(JSC::Bindings::QtInstance::booleanValue): Ditto.
(JSC::Bindings::QtInstance::valueOf): Ditto.
(JSC::Bindings::QtField::valueFromInstance): Ditto.
(JSC::Bindings::QtField::setValueToInstance): Ditto.
* bridge/qt/qt_instance.h: Ditto.
* bridge/qt/qt_runtime.cpp: Ditto.
(JSC::Bindings::valueRealType): Ditto.
(JSC::Bindings::convertValueToQVariant): Ditto.
(JSC::Bindings::convertQVariantToValue): Ditto.
(JSC::Bindings::findMethodIndex): Ditto.
(JSC::Bindings::QtRuntimeMetaMethod::call): Ditto.
(JSC::Bindings::QtRuntimeMetaMethod::lengthGetter): Ditto.
(JSC::Bindings::QtRuntimeMetaMethod::connectGetter): Ditto.
(JSC::Bindings::QtRuntimeMetaMethod::disconnectGetter): Ditto.
(JSC::Bindings::QtRuntimeConnectionMethod::call): Ditto.
(JSC::Bindings::QtRuntimeConnectionMethod::lengthGetter): Ditto.
(JSC::Bindings::QtArray::setValueAt): Ditto.
(JSC::Bindings::QtArray::valueAt): Ditto.
* bridge/qt/qt_runtime.h: Ditto.
* bridge/testqtbindings.cpp:
(main): Use JSValuePtr.
2008-10-18 Darin Adler <darin@apple.com> 2008-10-18 Darin Adler <darin@apple.com>
Reviewed by Oliver Hunt. Reviewed by Oliver Hunt.
......
...@@ -29,13 +29,13 @@ ...@@ -29,13 +29,13 @@
#if ENABLE(XPATH) #if ENABLE(XPATH)
#include "XPathNSResolver.h" #include "XPathNSResolver.h"
#include <kjs/JSValue.h>
#include <wtf/Forward.h> #include <wtf/Forward.h>
#include <wtf/RefPtr.h> #include <wtf/RefPtr.h>
namespace JSC { namespace JSC {
class ExecState; class ExecState;
class JSObject; class JSObject;
class JSValue;
} }
namespace WebCore { namespace WebCore {
...@@ -44,7 +44,7 @@ namespace WebCore { ...@@ -44,7 +44,7 @@ namespace WebCore {
class JSCustomXPathNSResolver : public XPathNSResolver { class JSCustomXPathNSResolver : public XPathNSResolver {
public: public:
static PassRefPtr<JSCustomXPathNSResolver> create(JSC::ExecState*, JSC::JSValue*); static PassRefPtr<JSCustomXPathNSResolver> create(JSC::ExecState*, JSC::JSValuePtr);
virtual ~JSCustomXPathNSResolver(); virtual ~JSCustomXPathNSResolver();
......
...@@ -26,8 +26,9 @@ ...@@ -26,8 +26,9 @@
#ifndef JSEventTarget_h #ifndef JSEventTarget_h
#define JSEventTarget_h #define JSEventTarget_h
#include <kjs/JSValue.h>
namespace JSC { namespace JSC {
class JSValue;
class ExecState; class ExecState;
} }
...@@ -35,7 +36,7 @@ namespace WebCore { ...@@ -35,7 +36,7 @@ namespace WebCore {
class EventTarget; class EventTarget;
JSC::JSValue* toJS(JSC::ExecState*, EventTarget*); JSC::JSValuePtr toJS(JSC::ExecState*, EventTarget*);
} // namespace WebCore } // namespace WebCore
......
...@@ -21,30 +21,27 @@ ...@@ -21,30 +21,27 @@
#define JSNodeFilterCondition_h #define JSNodeFilterCondition_h
#include "NodeFilterCondition.h" #include "NodeFilterCondition.h"
#include <kjs/JSValue.h>
#include <wtf/PassRefPtr.h> #include <wtf/PassRefPtr.h>
namespace JSC {
class JSValue;
}
namespace WebCore { namespace WebCore {
class Node; class Node;
class JSNodeFilterCondition : public NodeFilterCondition { class JSNodeFilterCondition : public NodeFilterCondition {
public: public:
static PassRefPtr<JSNodeFilterCondition> create(JSC::JSValue* filter) static PassRefPtr<JSNodeFilterCondition> create(JSC::JSValuePtr filter)
{ {
return adoptRef(new JSNodeFilterCondition(filter)); return adoptRef(new JSNodeFilterCondition(filter));
} }
private: private:
JSNodeFilterCondition(JSC::JSValue* filter); JSNodeFilterCondition(JSC::JSValuePtr filter);
virtual short acceptNode(JSC::ExecState*, Node*) const; virtual short acceptNode(JSC::ExecState*, Node*) const;
virtual void mark(); virtual void mark();
JSC::JSValue* m_filter; JSC::JSValuePtr m_filter;
}; };
} // namespace WebCore } // namespace WebCore
......
...@@ -43,8 +43,8 @@ namespace WebCore { ...@@ -43,8 +43,8 @@ namespace WebCore {
void execute(JSDOMWindowShell*); void execute(JSDOMWindowShell*);