Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (156486 => 156487)
--- trunk/Source/_javascript_Core/ChangeLog 2013-09-26 19:14:28 UTC (rev 156486)
+++ trunk/Source/_javascript_Core/ChangeLog 2013-09-26 19:23:11 UTC (rev 156487)
@@ -1,3 +1,36 @@
+2013-09-26 Anders Carlsson <[email protected]>
+
+ Stop using PassWeak
+ https://bugs.webkit.org/show_bug.cgi?id=121968
+
+ Reviewed by Sam Weinig.
+
+ * heap/Weak.h:
+ Remove all knowledge of PassWeak.
+
+ (JSC::Weak::Weak):
+ These constructors don't need to be explicit.
+
+ * heap/WeakInlines.h:
+ (JSC::weakAdd):
+ Change Value to be an rvalue reference and use std::forward.
+
+ * jit/JITThunks.cpp:
+ (JSC::JITThunks::hostFunctionStub):
+ Remove PassWeak.
+
+ * runtime/RegExpCache.cpp:
+ (JSC::RegExpCache::lookupOrCreate):
+ Use Weak instead of PassWeak.
+
+ * runtime/SimpleTypedArrayController.cpp:
+ Change add and set to take Weak by value and std::move into place.
+
+ * runtime/WeakGCMap.h:
+ (JSC::WeakGCMap::get):
+ (JSC::WeakGCMap::set):
+ (JSC::WeakGCMap::add):
+
2013-09-26 Commit Queue <[email protected]>
Unreviewed, rolling out r156474.
Modified: trunk/Source/_javascript_Core/heap/Weak.h (156486 => 156487)
--- trunk/Source/_javascript_Core/heap/Weak.h 2013-09-26 19:14:28 UTC (rev 156486)
+++ trunk/Source/_javascript_Core/heap/Weak.h 2013-09-26 19:23:11 UTC (rev 156487)
@@ -31,7 +31,6 @@
namespace JSC {
-template<typename T> class PassWeak;
class WeakImpl;
class WeakHandleOwner;
@@ -46,19 +45,18 @@
{
}
- explicit Weak(std::nullptr_t)
+ Weak(std::nullptr_t)
: m_impl(0)
{
}
- explicit Weak(T*, WeakHandleOwner* = 0, void* context = 0);
+ Weak(T*, WeakHandleOwner* = 0, void* context = 0);
enum HashTableDeletedValueTag { HashTableDeletedValue };
bool isHashTableDeletedValue() const;
Weak(HashTableDeletedValueTag);
Weak(Weak&&);
- template<typename U> Weak(const PassWeak<U>&);
~Weak()
{
@@ -68,8 +66,7 @@
void swap(Weak&);
Weak& operator=(Weak&&);
- Weak& operator=(const PassWeak<T>&);
-
+
bool operator!() const;
T* operator->() const;
T& operator*() const;
@@ -81,7 +78,6 @@
typedef void* (Weak::*UnspecifiedBoolType);
operator UnspecifiedBoolType*() const;
- PassWeak<T> release();
WeakImpl* leakImpl() WARN_UNUSED_RETURN;
void clear()
{
Modified: trunk/Source/_javascript_Core/heap/WeakInlines.h (156486 => 156487)
--- trunk/Source/_javascript_Core/heap/WeakInlines.h 2013-09-26 19:14:28 UTC (rev 156486)
+++ trunk/Source/_javascript_Core/heap/WeakInlines.h 2013-09-26 19:23:11 UTC (rev 156487)
@@ -48,11 +48,6 @@
{
}
-template<typename T> template<typename U> inline Weak<T>::Weak(const PassWeak<U>& other)
- : m_impl(other.leakImpl())
-{
-}
-
template<typename T> inline Weak<T>::Weak(Weak&& other)
: m_impl(other.leakImpl())
{
@@ -68,13 +63,6 @@
std::swap(m_impl, other.m_impl);
}
-template<typename T> inline Weak<T>& Weak<T>::operator=(const PassWeak<T>& o)
-{
- clear();
- m_impl = o.leakImpl();
- return *this;
-}
-
template<typename T> inline auto Weak<T>::operator=(Weak&& other) -> Weak&
{
Weak weak = std::move(other);
@@ -116,13 +104,6 @@
return reinterpret_cast<UnspecifiedBoolType*>(!!*this);
}
-template<typename T> inline PassWeak<T> Weak<T>::release()
-{
- PassWeak<T> tmp = adoptWeak<T>(m_impl);
- m_impl = 0;
- return tmp;
-}
-
template<typename T> inline WeakImpl* Weak<T>::leakImpl()
{
WeakImpl* impl = m_impl;
@@ -142,10 +123,10 @@
// This function helps avoid modifying a weak table while holding an iterator into it. (Object allocation
// can run a finalizer that modifies the table. We avoid that by requiring a pre-constructed object as our value.)
-template<typename Map, typename Key, typename Value> inline void weakAdd(Map& map, const Key& key, Value value)
+template<typename Map, typename Key, typename Value> inline void weakAdd(Map& map, const Key& key, Value&& value)
{
ASSERT(!map.get(key));
- map.set(key, value); // The table may still have a zombie for value.
+ map.set(key, std::forward<Value>(value)); // The table may still have a zombie for value.
}
template<typename Map, typename Key, typename Value> inline void weakRemove(Map& map, const Key& key, Value value)
Modified: trunk/Source/_javascript_Core/jit/JITThunks.cpp (156486 => 156487)
--- trunk/Source/_javascript_Core/jit/JITThunks.cpp 2013-09-26 19:14:28 UTC (rev 156486)
+++ trunk/Source/_javascript_Core/jit/JITThunks.cpp 2013-09-26 19:23:11 UTC (rev 156487)
@@ -81,7 +81,7 @@
return nativeExecutable;
NativeExecutable* nativeExecutable = NativeExecutable::create(*vm, JIT::compileCTINativeCall(vm, function), function, MacroAssemblerCodeRef::createSelfManagedCodeRef(ctiNativeConstruct(vm)), constructor, NoIntrinsic);
- weakAdd(*m_hostFunctionStubMap, std::make_pair(function, constructor), PassWeak<NativeExecutable>(nativeExecutable));
+ weakAdd(*m_hostFunctionStubMap, std::make_pair(function, constructor), nativeExecutable);
return nativeExecutable;
}
@@ -102,7 +102,7 @@
code = JIT::compileCTINativeCall(vm, function);
NativeExecutable* nativeExecutable = NativeExecutable::create(*vm, code, function, MacroAssemblerCodeRef::createSelfManagedCodeRef(ctiNativeConstruct(vm)), callHostFunctionAsConstructor, intrinsic);
- weakAdd(*m_hostFunctionStubMap, std::make_pair(function, &callHostFunctionAsConstructor), PassWeak<NativeExecutable>(nativeExecutable));
+ weakAdd(*m_hostFunctionStubMap, std::make_pair(function, &callHostFunctionAsConstructor), nativeExecutable);
return nativeExecutable;
}
Modified: trunk/Source/_javascript_Core/runtime/RegExpCache.cpp (156486 => 156487)
--- trunk/Source/_javascript_Core/runtime/RegExpCache.cpp 2013-09-26 19:14:28 UTC (rev 156486)
+++ trunk/Source/_javascript_Core/runtime/RegExpCache.cpp 2013-09-26 19:23:11 UTC (rev 156487)
@@ -46,7 +46,7 @@
m_vm->addRegExpToTrace(regExp);
#endif
- weakAdd(m_weakCache, key, PassWeak<RegExp>(regExp, this));
+ weakAdd(m_weakCache, key, Weak<RegExp>(regExp, this));
return regExp;
}
Modified: trunk/Source/_javascript_Core/runtime/SimpleTypedArrayController.cpp (156486 => 156487)
--- trunk/Source/_javascript_Core/runtime/SimpleTypedArrayController.cpp 2013-09-26 19:14:28 UTC (rev 156486)
+++ trunk/Source/_javascript_Core/runtime/SimpleTypedArrayController.cpp 2013-09-26 19:23:11 UTC (rev 156487)
@@ -29,7 +29,6 @@
#include "ArrayBuffer.h"
#include "JSArrayBuffer.h"
#include "Operations.h"
-#include "PassWeak.h"
namespace JSC {
Modified: trunk/Source/_javascript_Core/runtime/WeakGCMap.h (156486 => 156487)
--- trunk/Source/_javascript_Core/runtime/WeakGCMap.h 2013-09-26 19:14:28 UTC (rev 156486)
+++ trunk/Source/_javascript_Core/runtime/WeakGCMap.h 2013-09-26 19:23:11 UTC (rev 156487)
@@ -34,13 +34,11 @@
// A HashMap with Weak<JSCell> values, which automatically removes values once they're garbage collected.
-template<typename KeyArg, typename RawMappedArg, typename HashArg = typename DefaultHash<KeyArg>::Hash,
+template<typename KeyArg, typename ValueArg, typename HashArg = typename DefaultHash<KeyArg>::Hash,
typename KeyTraitsArg = HashTraits<KeyArg>>
class WeakGCMap {
- typedef Weak<RawMappedArg> MappedType;
- typedef HashMap<KeyArg, MappedType, HashArg, KeyTraitsArg> HashMapType;
- typedef HashTraits<MappedType> MappedTraits;
- typedef typename MappedTraits::PassInType MappedPassInType;
+ typedef Weak<ValueArg> ValueType;
+ typedef HashMap<KeyArg, ValueType, HashArg, KeyTraitsArg> HashMapType;
public:
typedef typename HashMapType::KeyType KeyType;
@@ -53,24 +51,24 @@
{
}
- RawMappedArg* get(const KeyType& key) const
+ ValueArg* get(const KeyType& key) const
{
return m_map.get(key);
}
- AddResult set(const KeyType& key, MappedPassInType value)
+ AddResult set(const KeyType& key, ValueType value)
{
gcMapIfNeeded();
- return m_map.set(key, value);
+ return m_map.set(key, std::move(value));
}
- AddResult add(const KeyType& key, MappedPassInType value)
+ AddResult add(const KeyType& key, ValueType value)
{
gcMapIfNeeded();
AddResult addResult = m_map.add(key, nullptr);
if (!addResult.iterator->value) { // New value or found a zombie value.
addResult.isNewEntry = true;
- addResult.iterator->value = value;
+ addResult.iterator->value = std::move(value);
}
return addResult;
}
Modified: trunk/Source/WebCore/ChangeLog (156486 => 156487)
--- trunk/Source/WebCore/ChangeLog 2013-09-26 19:14:28 UTC (rev 156486)
+++ trunk/Source/WebCore/ChangeLog 2013-09-26 19:23:11 UTC (rev 156487)
@@ -1,3 +1,32 @@
+2013-09-26 Anders Carlsson <[email protected]>
+
+ Stop using PassWeak
+ https://bugs.webkit.org/show_bug.cgi?id=121968
+
+ Reviewed by Sam Weinig.
+
+ Update for _javascript_Core changes.
+
+ * bindings/js/JSDOMBinding.h:
+ (WebCore::setInlineCachedWrapper):
+ (WebCore::cacheWrapper):
+ * bindings/js/JSEventListener.cpp:
+ (WebCore::JSEventListener::JSEventListener):
+ * bindings/js/JSEventListener.h:
+ (WebCore::JSEventListener::setWrapper):
+ (WebCore::JSEventListener::jsFunction):
+ * bindings/js/JSMutationCallback.cpp:
+ (WebCore::JSMutationCallback::JSMutationCallback):
+ * bindings/js/JSNodeFilterCondition.cpp:
+ (WebCore::JSNodeFilterCondition::JSNodeFilterCondition):
+ * bindings/js/ScriptWrappableInlines.h:
+ (WebCore::ScriptWrappable::setWrapper):
+ * bindings/js/WebCoreTypedArrayController.cpp:
+ * bridge/jsc/BridgeJSC.cpp:
+ (JSC::Bindings::Instance::createRuntimeObject):
+ * bridge/runtime_root.cpp:
+ (JSC::Bindings::RootObject::addRuntimeObject):
+
2013-09-25 Sam Weinig <[email protected]>
Pass a JSC::VM& to JS bindings object creation functions, rather than a JSC::ExecState*
Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.h (156486 => 156487)
--- trunk/Source/WebCore/bindings/js/JSDOMBinding.h 2013-09-26 19:14:28 UTC (rev 156486)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.h 2013-09-26 19:23:11 UTC (rev 156487)
@@ -152,7 +152,7 @@
{
if (!world->isNormal())
return false;
- domObject->m_wrapper = JSC::PassWeak<JSC::JSArrayBuffer>(wrapper, wrapperOwner, context);
+ domObject->m_wrapper = JSC::Weak<JSC::JSArrayBuffer>(wrapper, wrapperOwner, context);
return true;
}
@@ -185,8 +185,7 @@
void* context = wrapperContext(world, domObject);
if (setInlineCachedWrapper(world, domObject, wrapper, owner, context))
return;
- JSC::PassWeak<JSC::JSObject> passWeak(wrapper, owner, context);
- weakAdd(world->m_wrappers, (void*)domObject, passWeak);
+ weakAdd(world->m_wrappers, (void*)domObject, JSC::Weak<JSC::JSObject>(wrapper, owner, context));
}
template <typename DOMClass, typename WrapperClass> inline void uncacheWrapper(DOMWrapperWorld* world, DOMClass* domObject, WrapperClass* wrapper)
Modified: trunk/Source/WebCore/bindings/js/JSEventListener.cpp (156486 => 156487)
--- trunk/Source/WebCore/bindings/js/JSEventListener.cpp 2013-09-26 19:14:28 UTC (rev 156486)
+++ trunk/Source/WebCore/bindings/js/JSEventListener.cpp 2013-09-26 19:23:11 UTC (rev 156487)
@@ -47,7 +47,7 @@
{
if (wrapper) {
JSC::Heap::writeBarrier(wrapper, function);
- m_jsFunction = JSC::PassWeak<JSC::JSObject>(function);
+ m_jsFunction = function;
} else
ASSERT(!function);
#if ENABLE(INSPECTOR)
Modified: trunk/Source/WebCore/bindings/js/JSEventListener.h (156486 => 156487)
--- trunk/Source/WebCore/bindings/js/JSEventListener.h 2013-09-26 19:14:28 UTC (rev 156486)
+++ trunk/Source/WebCore/bindings/js/JSEventListener.h 2013-09-26 19:23:11 UTC (rev 156487)
@@ -22,7 +22,6 @@
#include "EventListener.h"
#include "JSDOMWindow.h"
-#include <heap/PassWeak.h>
#include <heap/StrongInlines.h>
#include <heap/Weak.h>
#include <heap/WeakInlines.h>
@@ -57,7 +56,7 @@
DOMWrapperWorld* isolatedWorld() const { return m_isolatedWorld.get(); }
JSC::JSObject* wrapper() const { return m_wrapper.get(); }
- void setWrapper(JSC::VM&, JSC::JSObject* wrapper) const { m_wrapper = JSC::PassWeak<JSC::JSObject>(wrapper); }
+ void setWrapper(JSC::VM&, JSC::JSObject* wrapper) const { m_wrapper = JSC::Weak<JSC::JSObject>(wrapper); }
private:
virtual JSC::JSObject* initializeJSFunction(ScriptExecutionContext*) const;
@@ -86,7 +85,7 @@
if (!m_jsFunction) {
JSC::JSObject* function = initializeJSFunction(scriptExecutionContext);
JSC::Heap::writeBarrier(m_wrapper.get(), function);
- m_jsFunction = JSC::PassWeak<JSC::JSObject>(function);
+ m_jsFunction = function;
}
// Verify that we have a valid wrapper protecting our function from
Modified: trunk/Source/WebCore/bindings/js/JSMutationCallback.cpp (156486 => 156487)
--- trunk/Source/WebCore/bindings/js/JSMutationCallback.cpp 2013-09-26 19:14:28 UTC (rev 156486)
+++ trunk/Source/WebCore/bindings/js/JSMutationCallback.cpp 2013-09-26 19:23:11 UTC (rev 156487)
@@ -42,7 +42,7 @@
JSMutationCallback::JSMutationCallback(JSObject* callback, JSDOMGlobalObject* globalObject)
: ActiveDOMCallback(globalObject->scriptExecutionContext())
- , m_callback(PassWeak<JSObject>(callback))
+ , m_callback(callback)
, m_isolatedWorld(globalObject->world())
{
}
Modified: trunk/Source/WebCore/bindings/js/JSNodeFilterCondition.cpp (156486 => 156487)
--- trunk/Source/WebCore/bindings/js/JSNodeFilterCondition.cpp 2013-09-26 19:14:28 UTC (rev 156486)
+++ trunk/Source/WebCore/bindings/js/JSNodeFilterCondition.cpp 2013-09-26 19:23:11 UTC (rev 156487)
@@ -32,7 +32,7 @@
using namespace JSC;
JSNodeFilterCondition::JSNodeFilterCondition(VM&, NodeFilter* owner, JSValue filter)
- : m_filter(filter.isObject() ? PassWeak<JSObject>(jsCast<JSObject*>(filter), &m_weakOwner, owner) : nullptr)
+ : m_filter(filter.isObject() ? Weak<JSObject>(jsCast<JSObject*>(filter), &m_weakOwner, owner) : nullptr)
{
}
Modified: trunk/Source/WebCore/bindings/js/ScriptWrappableInlines.h (156486 => 156487)
--- trunk/Source/WebCore/bindings/js/ScriptWrappableInlines.h 2013-09-26 19:14:28 UTC (rev 156486)
+++ trunk/Source/WebCore/bindings/js/ScriptWrappableInlines.h 2013-09-26 19:23:11 UTC (rev 156487)
@@ -46,7 +46,7 @@
inline void ScriptWrappable::setWrapper(JSDOMWrapper* wrapper, JSC::WeakHandleOwner* wrapperOwner, void* context)
{
ASSERT(!m_wrapper);
- m_wrapper = JSC::PassWeak<JSDOMWrapper>(wrapper, wrapperOwner, context);
+ m_wrapper = JSC::Weak<JSDOMWrapper>(wrapper, wrapperOwner, context);
}
inline void ScriptWrappable::clearWrapper(JSDOMWrapper* wrapper)
Modified: trunk/Source/WebCore/bindings/js/WebCoreTypedArrayController.cpp (156486 => 156487)
--- trunk/Source/WebCore/bindings/js/WebCoreTypedArrayController.cpp 2013-09-26 19:14:28 UTC (rev 156486)
+++ trunk/Source/WebCore/bindings/js/WebCoreTypedArrayController.cpp 2013-09-26 19:23:11 UTC (rev 156487)
@@ -28,7 +28,6 @@
#include "JSDOMBinding.h"
#include "JSDOMGlobalObject.h"
-#include <heap/PassWeak.h>
#include <runtime/ArrayBuffer.h>
#include <runtime/JSArrayBuffer.h>
#include <runtime/Operations.h>
Modified: trunk/Source/WebCore/bridge/jsc/BridgeJSC.cpp (156486 => 156487)
--- trunk/Source/WebCore/bridge/jsc/BridgeJSC.cpp 2013-09-26 19:14:28 UTC (rev 156486)
+++ trunk/Source/WebCore/bridge/jsc/BridgeJSC.cpp 2013-09-26 19:23:11 UTC (rev 156487)
@@ -82,7 +82,7 @@
JSLockHolder lock(exec);
RuntimeObject* newObject = newRuntimeObject(exec);
- m_runtimeObject = PassWeak<RuntimeObject>(newObject);
+ m_runtimeObject = newObject;
m_rootObject->addRuntimeObject(exec->vm(), newObject);
return newObject;
}
Modified: trunk/Source/WebCore/bridge/runtime_root.cpp (156486 => 156487)
--- trunk/Source/WebCore/bridge/runtime_root.cpp 2013-09-26 19:14:28 UTC (rev 156486)
+++ trunk/Source/WebCore/bridge/runtime_root.cpp 2013-09-26 19:23:11 UTC (rev 156487)
@@ -188,7 +188,7 @@
void RootObject::addRuntimeObject(VM&, RuntimeObject* object)
{
ASSERT(m_isValid);
- weakAdd(m_runtimeObjects, object, JSC::PassWeak<RuntimeObject>(object, this));
+ weakAdd(m_runtimeObjects, object, JSC::Weak<RuntimeObject>(object, this));
}
void RootObject::removeRuntimeObject(RuntimeObject* object)
Modified: trunk/Source/WebKit2/ChangeLog (156486 => 156487)
--- trunk/Source/WebKit2/ChangeLog 2013-09-26 19:14:28 UTC (rev 156486)
+++ trunk/Source/WebKit2/ChangeLog 2013-09-26 19:23:11 UTC (rev 156487)
@@ -1,3 +1,15 @@
+2013-09-26 Anders Carlsson <[email protected]>
+
+ Stop using PassWeak
+ https://bugs.webkit.org/show_bug.cgi?id=121968
+
+ Reviewed by Sam Weinig.
+
+ Update for _javascript_Core changes.
+
+ * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
+ (WebKit::NPRuntimeObjectMap::getOrCreateJSObject):
+
2013-09-25 Jer Noble <[email protected]>
[WK2] Crash at at com.apple.WebKit2: WebKit::VoidCallback::invalidate + 46
Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp (156486 => 156487)
--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp 2013-09-26 19:14:28 UTC (rev 156486)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp 2013-09-26 19:23:11 UTC (rev 156487)
@@ -108,7 +108,7 @@
return jsNPObject;
JSNPObject* jsNPObject = JSNPObject::create(globalObject, this, npObject);
- weakAdd(m_jsNPObjects, npObject, JSC::PassWeak<JSNPObject>(jsNPObject, this, npObject));
+ weakAdd(m_jsNPObjects, npObject, JSC::Weak<JSNPObject>(jsNPObject, this, npObject));
return jsNPObject;
}