Commit 6812fc0e authored by ggaren@apple.com's avatar ggaren@apple.com

2009-06-19 Geoffrey Garen <ggaren@apple.com>

        Reviewed by Maciej Stachowiak.
        
        An additional fix for Bug 26532: Native functions do not correctly unlink
        from optimised callsites when they're collected
        <https://bugs.webkit.org/show_bug.cgi?id=26532> | <rdar://problem/6625385>

        Use "NativeFunctionWrapper" instead of "PrototypeFunction" in cross-frame
        accessors, so the type of object you get to wrap a function is the same,
        regardless of whether the access to the function is cross-frame.
        
        This is faster and more idiomatic than what we had before. It also would
        have avoided Bug 26532 because it would have prevented a conflicting
        PrototypeFunction from being allocated to wrap postMessage, where a
        NativeFunctionWrapper had been allocated previously.
        
        * bindings/js/JSDOMBinding.cpp:
        (WebCore::objectToStringFunctionGetter):
        * bindings/js/JSDOMWindowCustom.cpp:
        (WebCore::nonCachingStaticFunctionGetter):
        * bindings/js/JSHistoryCustom.cpp:
        (WebCore::nonCachingStaticBackFunctionGetter):
        (WebCore::nonCachingStaticForwardFunctionGetter):
        (WebCore::nonCachingStaticGoFunctionGetter):
        * bindings/js/JSLocationCustom.cpp:
        (WebCore::nonCachingStaticReplaceFunctionGetter):
        (WebCore::nonCachingStaticReloadFunctionGetter):
        (WebCore::nonCachingStaticAssignFunctionGetter):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@44877 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8ac46ac1
2009-06-19 Geoffrey Garen <ggaren@apple.com>
Reviewed by Maciej Stachowiak.
An additional fix for Bug 26532: Native functions do not correctly unlink
from optimised callsites when they're collected
<https://bugs.webkit.org/show_bug.cgi?id=26532> | <rdar://problem/6625385>
Use "NativeFunctionWrapper" instead of "PrototypeFunction" in cross-frame
accessors, so the type of object you get to wrap a function is the same,
regardless of whether the access to the function is cross-frame.
This is faster and more idiomatic than what we had before. It also would
have avoided Bug 26532 because it would have prevented a conflicting
PrototypeFunction from being allocated to wrap postMessage, where a
NativeFunctionWrapper had been allocated previously.
* bindings/js/JSDOMBinding.cpp:
(WebCore::objectToStringFunctionGetter):
* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::nonCachingStaticFunctionGetter):
* bindings/js/JSHistoryCustom.cpp:
(WebCore::nonCachingStaticBackFunctionGetter):
(WebCore::nonCachingStaticForwardFunctionGetter):
(WebCore::nonCachingStaticGoFunctionGetter):
* bindings/js/JSLocationCustom.cpp:
(WebCore::nonCachingStaticReplaceFunctionGetter):
(WebCore::nonCachingStaticReloadFunctionGetter):
(WebCore::nonCachingStaticAssignFunctionGetter):
2009-06-19 Simon Fraser <simon.fraser@apple.com>
Reviewed by John Sullivan
......
......@@ -545,7 +545,7 @@ KURL completeURL(ExecState* exec, const String& relativeURL)
JSValue objectToStringFunctionGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot&)
{
return new (exec) PrototypeFunction(exec, 0, propertyName, objectProtoFuncToString);
return new (exec) NativeFunctionWrapper(exec, exec->lexicalGlobalObject()->prototypeFunctionStructure(), 0, propertyName, objectProtoFuncToString);
}
Structure* getCachedDOMStructure(JSDOMGlobalObject* globalObject, const ClassInfo* classInfo)
......
......@@ -99,7 +99,7 @@ void JSDOMWindow::mark()
template<NativeFunction nativeFunction, int length>
JSValue nonCachingStaticFunctionGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot&)
{
return new (exec) PrototypeFunction(exec, length, propertyName, nativeFunction);
return new (exec) NativeFunctionWrapper(exec, exec->lexicalGlobalObject()->prototypeFunctionStructure(), length, propertyName, nativeFunction);
}
static JSValue childFrameGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
......
......@@ -39,17 +39,17 @@ namespace WebCore {
static JSValue nonCachingStaticBackFunctionGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot&)
{
return new (exec) PrototypeFunction(exec, 0, propertyName, jsHistoryPrototypeFunctionBack);
return new (exec) NativeFunctionWrapper(exec, exec->lexicalGlobalObject()->prototypeFunctionStructure(), 0, propertyName, jsHistoryPrototypeFunctionBack);
}
static JSValue nonCachingStaticForwardFunctionGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot&)
{
return new (exec) PrototypeFunction(exec, 0, propertyName, jsHistoryPrototypeFunctionForward);
return new (exec) NativeFunctionWrapper(exec, exec->lexicalGlobalObject()->prototypeFunctionStructure(), 0, propertyName, jsHistoryPrototypeFunctionForward);
}
static JSValue nonCachingStaticGoFunctionGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot&)
{
return new (exec) PrototypeFunction(exec, 1, propertyName, jsHistoryPrototypeFunctionGo);
return new (exec) NativeFunctionWrapper(exec, exec->lexicalGlobalObject()->prototypeFunctionStructure(), 1, propertyName, jsHistoryPrototypeFunctionGo);
}
bool JSHistory::getOwnPropertySlotDelegate(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
......
......@@ -39,17 +39,17 @@ namespace WebCore {
static JSValue nonCachingStaticReplaceFunctionGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot&)
{
return new (exec) PrototypeFunction(exec, 1, propertyName, jsLocationPrototypeFunctionReplace);
return new (exec) NativeFunctionWrapper(exec, exec->lexicalGlobalObject()->prototypeFunctionStructure(), 1, propertyName, jsLocationPrototypeFunctionReplace);
}
static JSValue nonCachingStaticReloadFunctionGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot&)
{
return new (exec) PrototypeFunction(exec, 0, propertyName, jsLocationPrototypeFunctionReload);
return new (exec) NativeFunctionWrapper(exec, exec->lexicalGlobalObject()->prototypeFunctionStructure(), 0, propertyName, jsLocationPrototypeFunctionReload);
}
static JSValue nonCachingStaticAssignFunctionGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot&)
{
return new (exec) PrototypeFunction(exec, 1, propertyName, jsLocationPrototypeFunctionAssign);
return new (exec) NativeFunctionWrapper(exec, exec->lexicalGlobalObject()->prototypeFunctionStructure(), 1, propertyName, jsLocationPrototypeFunctionAssign);
}
bool JSLocation::getOwnPropertySlotDelegate(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment