diff options
author | deanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-21 16:24:04 +0000 |
---|---|---|
committer | deanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-21 16:24:04 +0000 |
commit | 36bbf7a7721021c992757d60a68a73d7751c8509 (patch) | |
tree | 5e612f8e05c2e7e2cf7714f4b8e53bb77d3f38fd /webkit | |
parent | c92f7054a61cd6c42a72ff8966c96b7995fc2fe1 (diff) | |
download | chromium_src-36bbf7a7721021c992757d60a68a73d7751c8509.zip chromium_src-36bbf7a7721021c992757d60a68a73d7751c8509.tar.gz chromium_src-36bbf7a7721021c992757d60a68a73d7751c8509.tar.bz2 |
Save ~150k on a Linux release build by not inlining DOMWrapperToNode.
Creates DOMWrapperToNodeHelper to preform the actual work (in the .cpp) and DOMWrapperToNode just does the cast.
This function has a lot of callers from the generated bindings, and I am skeptical an extra call instruction will hurt.
25740168 /tmp/chrome.after
25902672 /tmp/chrome.before
Review URL: http://codereview.chromium.org/88029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14105 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/port/bindings/v8/v8_proxy.cpp | 14 | ||||
-rw-r--r-- | webkit/port/bindings/v8/v8_proxy.h | 12 |
2 files changed, 17 insertions, 9 deletions
diff --git a/webkit/port/bindings/v8/v8_proxy.cpp b/webkit/port/bindings/v8/v8_proxy.cpp index e2b71d6..b9ea99b 100644 --- a/webkit/port/bindings/v8/v8_proxy.cpp +++ b/webkit/port/bindings/v8/v8_proxy.cpp @@ -2408,6 +2408,20 @@ v8::Handle<v8::Object> V8Proxy::LookupDOMWrapper( } +// static +void* V8Proxy::DOMWrapperToNodeHelper(v8::Handle<v8::Value> value) { + ASSERT(MaybeDOMWrapper(value)); + + v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(value); + + ASSERT(GetDOMWrapperType(object) == V8ClassIndex::NODE); + + v8::Handle<v8::Value> wrapper = + object->GetInternalField(V8Custom::kDOMWrapperObjectIndex); + return ExtractCPointer<Node>(wrapper); +} + + PassRefPtr<NodeFilter> V8Proxy::ToNativeNodeFilter(v8::Handle<v8::Value> filter) { // A NodeFilter is used when walking through a DOM tree or iterating tree diff --git a/webkit/port/bindings/v8/v8_proxy.h b/webkit/port/bindings/v8/v8_proxy.h index 8f44a10..1a7c13d 100644 --- a/webkit/port/bindings/v8/v8_proxy.h +++ b/webkit/port/bindings/v8/v8_proxy.h @@ -348,17 +348,11 @@ class V8Proxy { // A help function extract a node type pointer from a DOM wrapper. // Wrapped pointer must be cast to Node* first. + static void* DOMWrapperToNodeHelper(v8::Handle<v8::Value> value); + template <class C> static C* DOMWrapperToNode(v8::Handle<v8::Value> value) { - ASSERT(MaybeDOMWrapper(value)); - - v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(value); - - ASSERT(GetDOMWrapperType(object) == V8ClassIndex::NODE); - - v8::Handle<v8::Value> wrapper = - object->GetInternalField(V8Custom::kDOMWrapperObjectIndex); - return static_cast<C*>(ExtractCPointer<Node>(wrapper)); + return static_cast<C*>(DOMWrapperToNodeHelper(value)); } template<typename T> |