<?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>96980</bug_id>
          
          <creation_ts>2012-09-17 23:02:04 -0700</creation_ts>
          <short_desc>Use WTF::HasTrivialDestructor instead of compiler-specific versions in JSC::NeedsDestructor</short_desc>
          <delta_ts>2012-09-18 09:25:02 -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>JavaScriptCore</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>96546</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Mark Hahnenberg">mhahnenberg</reporter>
          <assigned_to name="Mark Hahnenberg">mhahnenberg</assigned_to>
          <cc>benjamin</cc>
    
    <cc>webkit.review.bot</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>722501</commentid>
    <comment_count>0</comment_count>
    <who name="Mark Hahnenberg">mhahnenberg</who>
    <bug_when>2012-09-17 23:02:04 -0700</bug_when>
    <thetext>We should avoid re-inventing the wheel and just use all the good stuff WTF gives to use for free.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>722514</commentid>
    <comment_count>1</comment_count>
      <attachid>164499</attachid>
    <who name="Mark Hahnenberg">mhahnenberg</who>
    <bug_when>2012-09-17 23:37:02 -0700</bug_when>
    <thetext>Created attachment 164499
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>722521</commentid>
    <comment_count>2</comment_count>
      <attachid>164499</attachid>
    <who name="Benjamin Poulain">benjamin</who>
    <bug_when>2012-09-17 23:48:09 -0700</bug_when>
    <thetext>Comment on attachment 164499
Patch

Looks good to me.
Why not get rid of NeedsDestructor entirely and use HasTrivialDestructor at the two call sites?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>722524</commentid>
    <comment_count>3</comment_count>
    <who name="Mark Hahnenberg">mhahnenberg</who>
    <bug_when>2012-09-17 23:51:12 -0700</bug_when>
    <thetext>(In reply to comment #2)
&gt; (From update of attachment 164499 [details])
&gt; Looks good to me.
&gt; Why not get rid of NeedsDestructor entirely and use HasTrivialDestructor at the two call sites?

A couple reasons. This is more descriptive of what it means in a JSC-related context. I&apos;m also planning on using it a lot more in a future patch (actually, in a patch that just got rolled out :-/ ). Several classes will override their default value in the patch, so it&apos;ll be useful to have a separate template for specializing on those classes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>722845</commentid>
    <comment_count>4</comment_count>
      <attachid>164499</attachid>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2012-09-18 09:12:48 -0700</bug_when>
    <thetext>Comment on attachment 164499
Patch

Clearing flags on attachment: 164499

Committed r128900: &lt;http://trac.webkit.org/changeset/128900&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>722846</commentid>
    <comment_count>5</comment_count>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2012-09-18 09:12:50 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>722858</commentid>
    <comment_count>6</comment_count>
      <attachid>164499</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2012-09-18 09:25:02 -0700</bug_when>
    <thetext>Comment on attachment 164499
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=164499&amp;action=review

I know this already landed, but I have a few thoughts.

&gt; Source/JavaScriptCore/ChangeLog:9
&gt; +        (JSC):

Strange stray line in change log.

&gt; Source/JavaScriptCore/runtime/JSCell.h:314
&gt; +        static const bool value = !WTF::HasTrivialDestructor&lt;T&gt;::value;

Surprising that you have to specify WTF:: explicitly. Normally the WTF header would have a &quot;using WTF::HasTrivialDestructor&quot; at the bottom of the header file so you would not need it.

&gt; Source/WTF/ChangeLog:9
&gt; +        (WTF):

Another strange stray line left in change log.

&gt; Source/WTF/wtf/TypeTraits.h:256
&gt; -#if defined(_MSC_VER) &amp;&amp; (_MSC_VER &gt;= 1400) &amp;&amp; !defined(__INTEL_COMPILER)
&gt; +#if COMPILER(CLANG) || (defined(_MSC_VER) &amp;&amp; (_MSC_VER &gt;= 1400) &amp;&amp; !defined(__INTEL_COMPILER))
&gt;      // VC8 (VS2005) and later have built-in compiler support for HasTrivialConstructor / HasTrivialDestructor,
&gt;      // but for some unexplained reason it doesn&apos;t work on built-in types.

The comment is now out of sync with the #if statement. Maybe it’s OK, but I think it’s starting to get confusing. The specializations of HasTrivialConstructor/Destructor are there for two reasons:

1) To make the template return true for built-in types even on compilers that don’t support __has_trivial_constructor/destructor.
2) To work around the problem in Visual Studio.

But this comment does not make that clear.

Useful comments would make clear that:

- This #if statement should be improved over time so we use __has_trivial_constructor/destructor every where it works well enough.
- The specializations are needed for the Microsoft compiler to work around a bug in its __has_trivial_constructor/destructor.
- This code will conservatively give use false for HasTrivialConstructor/Destructor in compilers that don’t support __has_trivial_constructor/destructor, which is OK although less optimal.

Having the comment about the Microsoft compiler inside the #if makes it quite confusing.

This file also does a number of strange things, indicating it was written by someone unfamiliar with WebKit coding style:

- It omits spaces after false_type and true_type and before &quot;{&quot;.
- It uses the name signed int for int, and signed short for short, and many others like that.

And it’s far more complicated than it needs to be:

- It lists all the built-in types separately, but this is unneeded since we have other templates that answer the question “is this a built in type” and can be used here.
- It does not use the standard techniques to strip const and volatile from the type and so has to have 4 specializations for every built in type.

And it also doesn’t seem to have regression tests.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>164499</attachid>
            <date>2012-09-17 23:37:02 -0700</date>
            <delta_ts>2012-09-18 09:25:02 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-96980-20120917233629.patch</filename>
            <type>text/plain</type>
            <size>3167</size>
            <attacher name="Mark Hahnenberg">mhahnenberg</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9KYXZhU2NyaXB0Q29yZS9DaGFuZ2VMb2cKPT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gU291
cmNlL0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwkocmV2aXNpb24gMTI4ODUyKQorKysgU291cmNl
L0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwkod29ya2luZyBjb3B5KQpAQCAtMSwzICsxLDE0IEBA
CisyMDEyLTA5LTE3ICBNYXJrIEhhaG5lbmJlcmcgIDxtaGFobmVuYmVyZ0BhcHBsZS5jb20+CisK
KyAgICAgICAgVXNlIFdURjo6SGFzVHJpdmlhbERlc3RydWN0b3IgaW5zdGVhZCBvZiBjb21waWxl
ci1zcGVjaWZpYyB2ZXJzaW9ucyBpbiBKU0M6Ok5lZWRzRGVzdHJ1Y3RvcgorICAgICAgICBodHRw
czovL2J1Z3Mud2Via2l0Lm9yZy9zaG93X2J1Zy5jZ2k/aWQ9OTY5ODAKKworICAgICAgICBSZXZp
ZXdlZCBieSBOT0JPRFkgKE9PUFMhKS4KKworICAgICAgICAqIHJ1bnRpbWUvSlNDZWxsLmg6Cisg
ICAgICAgIChKU0MpOgorICAgICAgICAoTmVlZHNEZXN0cnVjdG9yKToKKwogMjAxMi0wOS0xNyAg
Q3NhYmEgT3N6dHJvZ29uw6FjICA8b3NzeUB3ZWJraXQub3JnPgogCiAgICAgICAgIFVucmV2aWV3
ZWQsIHJvbGxpbmc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