<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>30579</bug_id>
          
          <creation_ts>2009-10-20 10:15:49 -0700</creation_ts>
          <short_desc>Redundant String ref/deref calls in V8 bindings</short_desc>
          <delta_ts>2009-10-21 10:21:11 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebCore Misc.</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>Enhancement</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jens Alfke">jens</reporter>
          <assigned_to name="Jens Alfke">jens</assigned_to>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>156182</commentid>
    <comment_count>0</comment_count>
    <who name="Jens Alfke">jens</who>
    <bug_when>2009-10-20 10:15:49 -0700</bug_when>
    <thetext>There are unnecessary extra ref/derefs of WebCore::StringImps in the V8/WebCore bindings. This happens because the trivial inline function &apos;toString&apos; defined in V8Binding.h, which is supposed to be a no-op, actually isn&apos;t:

    inline String toString(const String&amp; string)
    {
        return string;
    }

GCC generates both a String constructor and destructor call as a result of inlining this, which each 
generate code. This can be fixed by changing the result type to &quot;const String&amp;&quot;, after which the 
function truly is a no-op. 

This simple change shaves 97kbytes off of a release Mac build of Chromium, and will have some benefit in performance (though I haven&apos;t benchmarked it.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>156184</commentid>
    <comment_count>1</comment_count>
    <who name="Jens Alfke">jens</who>
    <bug_when>2009-10-20 10:17:05 -0700</bug_when>
    <thetext>Previously reported against Chromium as http://code.google.com/p/chromium/issues/detail?id=25252</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>156185</commentid>
    <comment_count>2</comment_count>
      <attachid>41511</attachid>
    <who name="Jens Alfke">jens</who>
    <bug_when>2009-10-20 10:17:34 -0700</bug_when>
    <thetext>Created attachment 41511
patch 1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>156222</commentid>
    <comment_count>3</comment_count>
      <attachid>41511</attachid>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2009-10-20 11:47:51 -0700</bug_when>
    <thetext>Comment on attachment 41511
patch 1

Needs a ChangeLog.  Otherwise this looks fine.  I trust you can add one when you commit.  :)  If you&apos;re not a committer, please post a new patch w/ ChangeLog.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>156516</commentid>
    <comment_count>4</comment_count>
    <who name="Jens Alfke">jens</who>
    <bug_when>2009-10-21 10:21:11 -0700</bug_when>
    <thetext>Patch was landed yesterday as http://trac.webkit.org/changeset/49890</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>41511</attachid>
            <date>2009-10-20 10:17:34 -0700</date>
            <delta_ts>2009-10-20 11:47:51 -0700</delta_ts>
            <desc>patch 1</desc>
            <filename>toString.patch</filename>
            <type>text/plain</type>
            <size>465</size>
            <attacher name="Jens Alfke">jens</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYkNvcmUvYmluZGluZ3MvdjgvVjhCaW5kaW5nLmgKPT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gV2Vi
Q29yZS9iaW5kaW5ncy92OC9WOEJpbmRpbmcuaAkocmV2aXNpb24gNDk3NjEpCisrKyBXZWJDb3Jl
L2JpbmRpbmdzL3Y4L1Y4QmluZGluZy5oCSh3b3JraW5nIGNvcHkpCkBAIC02MSw3ICs2MSw3IEBA
IG5hbWVzcGFjZSBXZWJDb3JlIHsKICAgICAgICAgcmV0dXJuIHY4Tm9uU3RyaW5nVmFsdWVUb0F0
b21pY1dlYkNvcmVTdHJpbmcodmFsdWUpOwogICAgIH0KIAotICAgIGlubGluZSBTdHJpbmcgdG9T
dHJpbmcoY29uc3QgU3RyaW5nJiBzdHJpbmcpCisgICAgaW5saW5lIGNvbnN0IFN0cmluZyYgdG9T
dHJpbmcoY29uc3QgU3RyaW5nJiBzdHJpbmcpCiAgICAgewogICAgICAgICByZXR1cm4gc3RyaW5n
OwogICAgIH0K
</data>
<flag name="review"
          id="22924"
          type_id="1"
          status="+"
          setter="eric"
    />
    <flag name="commit-queue"
          id="22929"
          type_id="3"
          status="-"
          setter="eric"
    />
          </attachment>
      

    </bug>

</bugzilla>