Skip to content

Commit

Permalink
[V8] Replace toWebCoreString()/toWebCoreAtomicString() in CodeGenerat…
Browse files Browse the repository at this point in the history
…orV8.pm with V8StringResource

https://bugs.webkit.org/show_bug.cgi?id=103391

Reviewed by Adam Barth.

This is an incremental effort for fixing bug 103331.
I confirmed that this patch causes no performance regression
for the micro benchmarks (https://bugs.webkit.org/attachment.cgi?id=176178).

No tests. No change in behavior.

* bindings/scripts/CodeGeneratorV8.pm:
(GenerateNormalAttrSetter):
(GenerateEventListenerCallback):
* bindings/scripts/test/V8/V8TestEventTarget.cpp:
(WebCore::TestEventTargetV8Internal::addEventListenerCallback):
(WebCore::TestEventTargetV8Internal::removeEventListenerCallback):
* bindings/scripts/test/V8/V8TestObj.cpp:
(WebCore::TestObjV8Internal::addEventListenerCallback):
(WebCore::TestObjV8Internal::removeEventListenerCallback):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@135922 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
[email protected] committed Nov 27, 2012
1 parent a62ca72 commit 9eabbcf
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 7 deletions.
23 changes: 23 additions & 0 deletions Source/WebCore/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
2012-11-27 Kentaro Hara <[email protected]>

[V8] Replace toWebCoreString()/toWebCoreAtomicString() in CodeGeneratorV8.pm with V8StringResource
https://bugs.webkit.org/show_bug.cgi?id=103391

Reviewed by Adam Barth.

This is an incremental effort for fixing bug 103331.
I confirmed that this patch causes no performance regression
for the micro benchmarks (https://bugs.webkit.org/attachment.cgi?id=176178).

No tests. No change in behavior.

* bindings/scripts/CodeGeneratorV8.pm:
(GenerateNormalAttrSetter):
(GenerateEventListenerCallback):
* bindings/scripts/test/V8/V8TestEventTarget.cpp:
(WebCore::TestEventTargetV8Internal::addEventListenerCallback):
(WebCore::TestEventTargetV8Internal::removeEventListenerCallback):
* bindings/scripts/test/V8/V8TestObj.cpp:
(WebCore::TestObjV8Internal::addEventListenerCallback):
(WebCore::TestObjV8Internal::removeEventListenerCallback):

2012-11-27 Alexandru Chiculita <[email protected]>

[CSS Regions] Elements using transforms are not repainted correctly when rendered in a region
Expand Down
7 changes: 4 additions & 3 deletions Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1222,8 +1222,8 @@ END
my $namespace = $codeGenerator->NamespaceForAttributeName($interfaceName, $contentAttributeName);
AddToImplIncludes("${namespace}.h");
push(@implContentDecls, " Element* imp = V8Element::toNative(info.Holder());\n");
push(@implContentDecls, " AtomicString v = toWebCoreAtomicStringWithNullCheck(value);\n");
push(@implContentDecls, " imp->setAttribute(${namespace}::${contentAttributeName}Attr, v);\n");
push(@implContentDecls, " V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck>, stringResource, value);\n");
push(@implContentDecls, " imp->setAttribute(${namespace}::${contentAttributeName}Attr, stringResource);\n");
push(@implContentDecls, "}\n\n");
push(@implContentDecls, "#endif // ${conditionalString}\n\n") if $conditionalString;
return;
Expand Down Expand Up @@ -1374,7 +1374,8 @@ static v8::Handle<v8::Value> ${functionName}EventListenerCallback(const v8::Argu
INC_STATS("DOM.${interfaceName}.${functionName}EventListener()");
RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(args[1], false, ListenerFind${lookupType});
if (listener) {
V8${interfaceName}::toNative(args.Holder())->${functionName}EventListener(toWebCoreAtomicString(args[0]), listener${passRefPtrHandling}, args[2]->BooleanValue());
V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<WithNullCheck>, stringResource, args[0]);
V8${interfaceName}::toNative(args.Holder())->${functionName}EventListener(stringResource, listener${passRefPtrHandling}, args[2]->BooleanValue());
END
if ($requiresHiddenDependency) {
push(@implContentDecls, <<END);
Expand Down
6 changes: 4 additions & 2 deletions Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ static v8::Handle<v8::Value> addEventListenerCallback(const v8::Arguments& args)
INC_STATS("DOM.TestEventTarget.addEventListener()");
RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(args[1], false, ListenerFindOrCreate);
if (listener) {
V8TestEventTarget::toNative(args.Holder())->addEventListener(toWebCoreAtomicString(args[0]), listener, args[2]->BooleanValue());
V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<WithNullCheck>, stringResource, args[0]);
V8TestEventTarget::toNative(args.Holder())->addEventListener(stringResource, listener, args[2]->BooleanValue());
createHiddenDependency(args.Holder(), args[1], V8TestEventTarget::eventListenerCacheIndex);
}
return v8Undefined();
Expand All @@ -76,7 +77,8 @@ static v8::Handle<v8::Value> removeEventListenerCallback(const v8::Arguments& ar
INC_STATS("DOM.TestEventTarget.removeEventListener()");
RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(args[1], false, ListenerFindOnly);
if (listener) {
V8TestEventTarget::toNative(args.Holder())->removeEventListener(toWebCoreAtomicString(args[0]), listener.get(), args[2]->BooleanValue());
V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<WithNullCheck>, stringResource, args[0]);
V8TestEventTarget::toNative(args.Holder())->removeEventListener(stringResource, listener.get(), args[2]->BooleanValue());
removeHiddenDependency(args.Holder(), args[1], V8TestEventTarget::eventListenerCacheIndex);
}
return v8Undefined();
Expand Down
6 changes: 4 additions & 2 deletions Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1203,7 +1203,8 @@ static v8::Handle<v8::Value> addEventListenerCallback(const v8::Arguments& args)
INC_STATS("DOM.TestObj.addEventListener()");
RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(args[1], false, ListenerFindOrCreate);
if (listener) {
V8TestObj::toNative(args.Holder())->addEventListener(toWebCoreAtomicString(args[0]), listener, args[2]->BooleanValue());
V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<WithNullCheck>, stringResource, args[0]);
V8TestObj::toNative(args.Holder())->addEventListener(stringResource, listener, args[2]->BooleanValue());
createHiddenDependency(args.Holder(), args[1], V8TestObj::eventListenerCacheIndex);
}
return v8Undefined();
Expand All @@ -1214,7 +1215,8 @@ static v8::Handle<v8::Value> removeEventListenerCallback(const v8::Arguments& ar
INC_STATS("DOM.TestObj.removeEventListener()");
RefPtr<EventListener> listener = V8DOMWrapper::getEventListener(args[1], false, ListenerFindOnly);
if (listener) {
V8TestObj::toNative(args.Holder())->removeEventListener(toWebCoreAtomicString(args[0]), listener.get(), args[2]->BooleanValue());
V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<WithNullCheck>, stringResource, args[0]);
V8TestObj::toNative(args.Holder())->removeEventListener(stringResource, listener.get(), args[2]->BooleanValue());
removeHiddenDependency(args.Holder(), args[1], V8TestObj::eventListenerCacheIndex);
}
return v8Undefined();
Expand Down

0 comments on commit 9eabbcf

Please sign in to comment.