Diff
Modified: trunk/Source/WebCore/ChangeLog (110534 => 110535)
--- trunk/Source/WebCore/ChangeLog 2012-03-13 03:33:31 UTC (rev 110534)
+++ trunk/Source/WebCore/ChangeLog 2012-03-13 04:03:27 UTC (rev 110535)
@@ -1,3 +1,54 @@
+2012-03-12 Kentaro Hara <[email protected]>
+
+ [V8][Refactoring] Remove existingWrapper() from generated code
+ https://bugs.webkit.org/show_bug.cgi?id=80927
+
+ Reviewed by Adam Barth.
+
+ Currently wrap() calls existingWrapper(), and existingWrapper()
+ just calls getCachedWrapper(). We can remove existingWrapper() from the generated code.
+
+ Test: bindings/scripts/test/*
+
+ * bindings/scripts/CodeGeneratorV8.pm: Removed existingWrapper().
+ (GenerateHeader):
+ (GenerateNormalAttrGetter):
+
+ * bindings/scripts/test/V8/V8Float64Array.h: Updated run-bindings-tests results.
+ (V8Float64Array):
+ (WebCore::V8Float64Array::wrap):
+ * bindings/scripts/test/V8/V8TestActiveDOMObject.h:
+ (V8TestActiveDOMObject):
+ (WebCore::V8TestActiveDOMObject::wrap):
+ * bindings/scripts/test/V8/V8TestCustomNamedGetter.h:
+ (V8TestCustomNamedGetter):
+ (WebCore::V8TestCustomNamedGetter::wrap):
+ * bindings/scripts/test/V8/V8TestEventConstructor.h:
+ (V8TestEventConstructor):
+ (WebCore::V8TestEventConstructor::wrap):
+ * bindings/scripts/test/V8/V8TestEventTarget.h:
+ (V8TestEventTarget):
+ (WebCore::V8TestEventTarget::wrap):
+ * bindings/scripts/test/V8/V8TestInterface.h:
+ (V8TestInterface):
+ (WebCore::V8TestInterface::wrap):
+ * bindings/scripts/test/V8/V8TestMediaQueryListListener.h:
+ (V8TestMediaQueryListListener):
+ (WebCore::V8TestMediaQueryListListener::wrap):
+ * bindings/scripts/test/V8/V8TestNamedConstructor.h:
+ (V8TestNamedConstructor):
+ (WebCore::V8TestNamedConstructor::wrap):
+ * bindings/scripts/test/V8/V8TestObj.cpp:
+ (WebCore::TestObjInternal::readOnlyTestObjAttrAttrGetter):
+ (WebCore::TestObjInternal::cachedAttribute1AttrGetter):
+ (WebCore::TestObjInternal::cachedAttribute2AttrGetter):
+ * bindings/scripts/test/V8/V8TestObj.h:
+ (V8TestObj):
+ (WebCore::V8TestObj::wrap):
+ * bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.h:
+ (V8TestSerializedScriptValueInterface):
+ (WebCore::V8TestSerializedScriptValueInterface::wrap):
+
2012-03-12 Dana Jansens <[email protected]>
[chromium] Use tileRect instead of pointer derefs
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (110534 => 110535)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm 2012-03-13 03:33:31 UTC (rev 110534)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm 2012-03-13 04:03:27 UTC (rev 110535)
@@ -482,8 +482,6 @@
}
push(@headerContent, <<END);
- static v8::Handle<v8::Object> existingWrapper(${nativeType}*);
-
private:
static v8::Handle<v8::Object> wrapSlow(${nativeType}*);
};
@@ -491,20 +489,13 @@
END
push(@headerContent, <<END);
-ALWAYS_INLINE v8::Handle<v8::Object> ${className}::existingWrapper(${nativeType}* impl)
-{
-END
- my $getWrapper = IsNodeSubType($dataNode) ? "V8DOMWrapper::getCachedWrapper(impl)" : "${domMapFunction}.get(impl)";
- push(@headerContent, <<END);
- return ${getWrapper};
-}
-
v8::Handle<v8::Object> ${className}::wrap(${nativeType}* impl${forceNewObjectInput})
{
END
push(@headerContent, " if (!forceNewObject) {\n") if IsDOMNodeType($interfaceName);
+ my $getCachedWrapper = IsNodeSubType($dataNode) ? "V8DOMWrapper::getCachedWrapper(impl)" : "${domMapFunction}.get(impl)";
push(@headerContent, <<END);
- v8::Handle<v8::Object> wrapper = existingWrapper(impl);
+ v8::Handle<v8::Object> wrapper = $getCachedWrapper;
if (!wrapper.IsEmpty())
return wrapper;
END
@@ -995,7 +986,8 @@
# Check for a wrapper in the wrapper cache. If there is one, we know that a hidden reference has already
# been created. If we don't find a wrapper, we create both a wrapper and a hidden reference.
push(@implContentDecls, " RefPtr<$returnType> result = ${getterString};\n");
- push(@implContentDecls, " v8::Handle<v8::Value> wrapper = result.get() ? V8${returnType}::existingWrapper(result.get()) : v8::Handle<v8::Object>();\n");
+ my $domMapFunction = GetDomMapFunction($dataNode, $interfaceName);
+ push(@implContentDecls, " v8::Handle<v8::Value> wrapper = result.get() ? ${domMapFunction}.get(result.get()) : v8::Handle<v8::Object>();\n");
push(@implContentDecls, " if (wrapper.IsEmpty()) {\n");
push(@implContentDecls, " wrapper = toV8(result.get());\n");
push(@implContentDecls, " if (!wrapper.IsEmpty())\n");
Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.h (110534 => 110535)
--- trunk/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.h 2012-03-13 03:33:31 UTC (rev 110534)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.h 2012-03-13 04:03:27 UTC (rev 110535)
@@ -47,20 +47,13 @@
static WrapperTypeInfo info;
static v8::Handle<v8::Value> constructorCallback(const v8::Arguments&);
static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
- static v8::Handle<v8::Object> existingWrapper(Float64Array*);
-
private:
static v8::Handle<v8::Object> wrapSlow(Float64Array*);
};
-ALWAYS_INLINE v8::Handle<v8::Object> V8Float64Array::existingWrapper(Float64Array* impl)
-{
- return getDOMObjectMap().get(impl);
-}
-
v8::Handle<v8::Object> V8Float64Array::wrap(Float64Array* impl)
{
- v8::Handle<v8::Object> wrapper = existingWrapper(impl);
+ v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(impl);
if (!wrapper.IsEmpty())
return wrapper;
return V8Float64Array::wrapSlow(impl);
Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.h (110534 => 110535)
--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.h 2012-03-13 03:33:31 UTC (rev 110534)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.h 2012-03-13 04:03:27 UTC (rev 110535)
@@ -47,20 +47,13 @@
static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
static bool namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8::AccessType, v8::Local<v8::Value> data);
static bool indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::AccessType, v8::Local<v8::Value> data);
- static v8::Handle<v8::Object> existingWrapper(TestActiveDOMObject*);
-
private:
static v8::Handle<v8::Object> wrapSlow(TestActiveDOMObject*);
};
-ALWAYS_INLINE v8::Handle<v8::Object> V8TestActiveDOMObject::existingWrapper(TestActiveDOMObject* impl)
-{
- return getDOMObjectMap().get(impl);
-}
-
v8::Handle<v8::Object> V8TestActiveDOMObject::wrap(TestActiveDOMObject* impl)
{
- v8::Handle<v8::Object> wrapper = existingWrapper(impl);
+ v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(impl);
if (!wrapper.IsEmpty())
return wrapper;
return V8TestActiveDOMObject::wrapSlow(impl);
Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.h (110534 => 110535)
--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.h 2012-03-13 03:33:31 UTC (rev 110534)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.h 2012-03-13 04:03:27 UTC (rev 110535)
@@ -46,20 +46,13 @@
static WrapperTypeInfo info;
static v8::Handle<v8::Value> namedPropertyGetter(v8::Local<v8::String>, const v8::AccessorInfo&);
static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
- static v8::Handle<v8::Object> existingWrapper(TestCustomNamedGetter*);
-
private:
static v8::Handle<v8::Object> wrapSlow(TestCustomNamedGetter*);
};
-ALWAYS_INLINE v8::Handle<v8::Object> V8TestCustomNamedGetter::existingWrapper(TestCustomNamedGetter* impl)
-{
- return getDOMObjectMap().get(impl);
-}
-
v8::Handle<v8::Object> V8TestCustomNamedGetter::wrap(TestCustomNamedGetter* impl)
{
- v8::Handle<v8::Object> wrapper = existingWrapper(impl);
+ v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(impl);
if (!wrapper.IsEmpty())
return wrapper;
return V8TestCustomNamedGetter::wrapSlow(impl);
Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.h (110534 => 110535)
--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.h 2012-03-13 03:33:31 UTC (rev 110534)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.h 2012-03-13 04:03:27 UTC (rev 110535)
@@ -47,20 +47,13 @@
static WrapperTypeInfo info;
static v8::Handle<v8::Value> constructorCallback(const v8::Arguments&);
static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
- static v8::Handle<v8::Object> existingWrapper(TestEventConstructor*);
-
private:
static v8::Handle<v8::Object> wrapSlow(TestEventConstructor*);
};
-ALWAYS_INLINE v8::Handle<v8::Object> V8TestEventConstructor::existingWrapper(TestEventConstructor* impl)
-{
- return getDOMObjectMap().get(impl);
-}
-
v8::Handle<v8::Object> V8TestEventConstructor::wrap(TestEventConstructor* impl)
{
- v8::Handle<v8::Object> wrapper = existingWrapper(impl);
+ v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(impl);
if (!wrapper.IsEmpty())
return wrapper;
return V8TestEventConstructor::wrapSlow(impl);
Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.h (110534 => 110535)
--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.h 2012-03-13 03:33:31 UTC (rev 110534)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.h 2012-03-13 04:03:27 UTC (rev 110535)
@@ -48,20 +48,13 @@
static v8::Handle<v8::Value> namedPropertyGetter(v8::Local<v8::String>, const v8::AccessorInfo&);
static const int eventListenerCacheIndex = v8DefaultWrapperInternalFieldCount + 0;
static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 1;
- static v8::Handle<v8::Object> existingWrapper(TestEventTarget*);
-
private:
static v8::Handle<v8::Object> wrapSlow(TestEventTarget*);
};
-ALWAYS_INLINE v8::Handle<v8::Object> V8TestEventTarget::existingWrapper(TestEventTarget* impl)
-{
- return getDOMObjectMap().get(impl);
-}
-
v8::Handle<v8::Object> V8TestEventTarget::wrap(TestEventTarget* impl)
{
- v8::Handle<v8::Object> wrapper = existingWrapper(impl);
+ v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(impl);
if (!wrapper.IsEmpty())
return wrapper;
return V8TestEventTarget::wrapSlow(impl);
Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.h (110534 => 110535)
--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.h 2012-03-13 03:33:31 UTC (rev 110534)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.h 2012-03-13 04:03:27 UTC (rev 110535)
@@ -50,20 +50,13 @@
static v8::Handle<v8::Value> constructorCallback(const v8::Arguments&);
static v8::Handle<v8::Value> namedPropertySetter(v8::Local<v8::String>, v8::Local<v8::Value>, const v8::AccessorInfo&);
static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
- static v8::Handle<v8::Object> existingWrapper(TestInterface*);
-
private:
static v8::Handle<v8::Object> wrapSlow(TestInterface*);
};
-ALWAYS_INLINE v8::Handle<v8::Object> V8TestInterface::existingWrapper(TestInterface* impl)
-{
- return getActiveDOMObjectMap().get(impl);
-}
-
v8::Handle<v8::Object> V8TestInterface::wrap(TestInterface* impl)
{
- v8::Handle<v8::Object> wrapper = existingWrapper(impl);
+ v8::Handle<v8::Object> wrapper = getActiveDOMObjectMap().get(impl);
if (!wrapper.IsEmpty())
return wrapper;
return V8TestInterface::wrapSlow(impl);
Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.h (110534 => 110535)
--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.h 2012-03-13 03:33:31 UTC (rev 110534)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.h 2012-03-13 04:03:27 UTC (rev 110535)
@@ -45,20 +45,13 @@
static void visitDOMWrapper(DOMDataStore*, void*, v8::Persistent<v8::Object>);
static WrapperTypeInfo info;
static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
- static v8::Handle<v8::Object> existingWrapper(TestMediaQueryListListener*);
-
private:
static v8::Handle<v8::Object> wrapSlow(TestMediaQueryListListener*);
};
-ALWAYS_INLINE v8::Handle<v8::Object> V8TestMediaQueryListListener::existingWrapper(TestMediaQueryListListener* impl)
-{
- return getDOMObjectMap().get(impl);
-}
-
v8::Handle<v8::Object> V8TestMediaQueryListListener::wrap(TestMediaQueryListListener* impl)
{
- v8::Handle<v8::Object> wrapper = existingWrapper(impl);
+ v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(impl);
if (!wrapper.IsEmpty())
return wrapper;
return V8TestMediaQueryListListener::wrapSlow(impl);
Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.h (110534 => 110535)
--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.h 2012-03-13 03:33:31 UTC (rev 110534)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.h 2012-03-13 04:03:27 UTC (rev 110535)
@@ -52,20 +52,13 @@
static WrapperTypeInfo info;
static ActiveDOMObject* toActiveDOMObject(v8::Handle<v8::Object>);
static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
- static v8::Handle<v8::Object> existingWrapper(TestNamedConstructor*);
-
private:
static v8::Handle<v8::Object> wrapSlow(TestNamedConstructor*);
};
-ALWAYS_INLINE v8::Handle<v8::Object> V8TestNamedConstructor::existingWrapper(TestNamedConstructor* impl)
-{
- return getActiveDOMObjectMap().get(impl);
-}
-
v8::Handle<v8::Object> V8TestNamedConstructor::wrap(TestNamedConstructor* impl)
{
- v8::Handle<v8::Object> wrapper = existingWrapper(impl);
+ v8::Handle<v8::Object> wrapper = getActiveDOMObjectMap().get(impl);
if (!wrapper.IsEmpty())
return wrapper;
return V8TestNamedConstructor::wrapSlow(impl);
Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp (110534 => 110535)
--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp 2012-03-13 03:33:31 UTC (rev 110534)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp 2012-03-13 04:03:27 UTC (rev 110535)
@@ -96,7 +96,7 @@
INC_STATS("DOM.TestObj.readOnlyTestObjAttr._get");
TestObj* imp = V8TestObj::toNative(info.Holder());
RefPtr<TestObj> result = imp->readOnlyTestObjAttr();
- v8::Handle<v8::Value> wrapper = result.get() ? V8TestObj::existingWrapper(result.get()) : v8::Handle<v8::Object>();
+ v8::Handle<v8::Value> wrapper = result.get() ? getDOMObjectMap().get(result.get()) : v8::Handle<v8::Object>();
if (wrapper.IsEmpty()) {
wrapper = toV8(result.get());
if (!wrapper.IsEmpty())
@@ -793,7 +793,7 @@
INC_STATS("DOM.TestObj.cachedAttribute1._get");
TestObj* imp = V8TestObj::toNative(info.Holder());
RefPtr<any> result = imp->cachedAttribute1();
- v8::Handle<v8::Value> wrapper = result.get() ? V8any::existingWrapper(result.get()) : v8::Handle<v8::Object>();
+ v8::Handle<v8::Value> wrapper = result.get() ? getDOMObjectMap().get(result.get()) : v8::Handle<v8::Object>();
if (wrapper.IsEmpty()) {
wrapper = toV8(result.get());
if (!wrapper.IsEmpty())
@@ -807,7 +807,7 @@
INC_STATS("DOM.TestObj.cachedAttribute2._get");
TestObj* imp = V8TestObj::toNative(info.Holder());
RefPtr<any> result = imp->cachedAttribute2();
- v8::Handle<v8::Value> wrapper = result.get() ? V8any::existingWrapper(result.get()) : v8::Handle<v8::Object>();
+ v8::Handle<v8::Value> wrapper = result.get() ? getDOMObjectMap().get(result.get()) : v8::Handle<v8::Object>();
if (wrapper.IsEmpty()) {
wrapper = toV8(result.get());
if (!wrapper.IsEmpty())
Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.h (110534 => 110535)
--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.h 2012-03-13 03:33:31 UTC (rev 110534)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.h 2012-03-13 04:03:27 UTC (rev 110535)
@@ -51,20 +51,13 @@
static v8::Handle<v8::Value> customAttrAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo&);
static void customAttrAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value>, const v8::AccessorInfo&);
static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
- static v8::Handle<v8::Object> existingWrapper(TestObj*);
-
private:
static v8::Handle<v8::Object> wrapSlow(TestObj*);
};
-ALWAYS_INLINE v8::Handle<v8::Object> V8TestObj::existingWrapper(TestObj* impl)
-{
- return getDOMObjectMap().get(impl);
-}
-
v8::Handle<v8::Object> V8TestObj::wrap(TestObj* impl)
{
- v8::Handle<v8::Object> wrapper = existingWrapper(impl);
+ v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(impl);
if (!wrapper.IsEmpty())
return wrapper;
return V8TestObj::wrapSlow(impl);
Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.h (110534 => 110535)
--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.h 2012-03-13 03:33:31 UTC (rev 110534)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.h 2012-03-13 04:03:27 UTC (rev 110535)
@@ -48,20 +48,13 @@
static WrapperTypeInfo info;
static v8::Handle<v8::Value> constructorCallback(const v8::Arguments&);
static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
- static v8::Handle<v8::Object> existingWrapper(TestSerializedScriptValueInterface*);
-
private:
static v8::Handle<v8::Object> wrapSlow(TestSerializedScriptValueInterface*);
};
-ALWAYS_INLINE v8::Handle<v8::Object> V8TestSerializedScriptValueInterface::existingWrapper(TestSerializedScriptValueInterface* impl)
-{
- return getDOMObjectMap().get(impl);
-}
-
v8::Handle<v8::Object> V8TestSerializedScriptValueInterface::wrap(TestSerializedScriptValueInterface* impl)
{
- v8::Handle<v8::Object> wrapper = existingWrapper(impl);
+ v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(impl);
if (!wrapper.IsEmpty())
return wrapper;
return V8TestSerializedScriptValueInterface::wrapSlow(impl);