<?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>96028</bug_id>
          
          <creation_ts>2012-09-06 14:47:45 -0700</creation_ts>
          <short_desc>equalIgnoringCase of two StringImpls doesn&apos;t handle 8 bit strings</short_desc>
          <delta_ts>2012-09-07 10:46:41 -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>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>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Saboff">msaboff</reporter>
          <assigned_to name="Michael Saboff">msaboff</assigned_to>
          <cc>benjamin</cc>
    
    <cc>webkit.review.bot</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>713733</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2012-09-06 14:47:45 -0700</bug_when>
    <thetext>equalIgnoringCase(StringImpl*, StringImpl*) is implemented by calling CaseFoldingHash::equal(a, b) which always up converts 8 bit strings.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>713771</commentid>
    <comment_count>1</comment_count>
      <attachid>162606</attachid>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2012-09-06 15:35:46 -0700</bug_when>
    <thetext>Created attachment 162606
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>713773</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2012-09-06 15:39:50 -0700</bug_when>
    <thetext>SunSpider and V8 Performance results of posted patch. Seems neutral.


Benchmark report for SunSpider and V8Real on msaboff-pro (MacPro5,1).

VMs tested:
&quot;BaseLine&quot; at /Volumes/Data/src/webkit.baseline/WebKitBuild/Release/DumpRenderTree (r127525)
&quot;96028&quot; at /Volumes/Data/src/webkit/WebKitBuild/Release/DumpRenderTree (r127762)

Collected 12 samples per benchmark/VM, with 4 VM invocations per benchmark. Emitted a call to gc() between
sample measurements. Used 1 benchmark iteration per VM invocation for warm-up. Used the jsc-specific
preciseTime() function to get microsecond-level timing. Reporting benchmark execution times with 95% confidence
intervals in milliseconds.

                                         BaseLine                   96028                                       
SunSpider:
   3d-cube                            8.6759+-0.4965     ?      8.6795+-0.4975        ?
   3d-morph                           8.1207+-0.0540     ?      8.2320+-0.1022        ? might be 1.0137x slower
   3d-raytrace                       12.4447+-0.3669     ?     12.7408+-0.2827        ? might be 1.0238x slower
   access-binary-trees                2.3152+-0.4143     ?      2.3615+-0.4420        ? might be 1.0200x slower
   access-fannkuch                    6.9096+-0.0546            6.8998+-0.0728        
   access-nbody                       4.1547+-0.0387     ?      4.3159+-0.1864        ? might be 1.0388x slower
   access-nsieve                      3.4240+-0.0603            3.4100+-0.0361        
   bitops-3bit-bits-in-byte           1.3655+-0.0132     ?      1.3787+-0.0229        ?
   bitops-bits-in-byte                5.7560+-0.0294     ?      5.7835+-0.0546        ?
   bitops-bitwise-and                 2.3053+-0.0559            2.1998+-0.1298          might be 1.0480x faster
   bitops-nsieve-bits                 3.5439+-0.0450            3.5358+-0.0341        
   controlflow-recursive              2.5098+-0.0199            2.4791+-0.0399          might be 1.0124x faster
   crypto-aes                         9.7697+-0.5576            9.7663+-0.5242        
   crypto-md5                         3.9863+-0.1273            3.9119+-0.1399          might be 1.0190x faster
   crypto-sha1                        3.2103+-0.0622            3.1315+-0.0479          might be 1.0252x faster
   date-format-tofte                 14.9243+-1.1552           14.1839+-0.6570          might be 1.0522x faster
   date-format-xparb                 12.1777+-0.6900           11.5475+-0.2127          might be 1.0546x faster
   math-cordic                        4.2617+-0.0855     ?      4.2981+-0.0387        ?
   math-partial-sums                 10.3130+-0.2316           10.1840+-0.0735          might be 1.0127x faster
   math-spectral-norm                 3.0180+-0.0339            3.0162+-0.0184        
   regexp-dna                        10.4587+-0.3506     ?     10.4712+-0.3430        ?
   string-base64                      5.5117+-0.0758     ?      5.8878+-0.5140        ? might be 1.0682x slower
   string-fasta                       8.1848+-0.2835     ?      8.3168+-0.2465        ? might be 1.0161x slower
   string-tagcloud                   13.7753+-0.2121           13.6639+-0.2892        
   string-unpack-code                23.5257+-0.5769           23.2775+-0.4931          might be 1.0107x faster
   string-validate-input              8.8146+-0.5770            8.7567+-0.5374        

   &lt;arithmetic&gt; *                     7.4407+-0.1668            7.4012+-0.1276          might be 1.0053x faster
   &lt;geometric&gt;                        5.9266+-0.1177            5.9129+-0.1067          might be 1.0023x faster
   &lt;harmonic&gt;                         4.6557+-0.0864            4.6442+-0.0923          might be 1.0025x faster

                                         BaseLine                   96028                                       
V8Real:
   encrypt                           0.40173+-0.00063    ?     0.40197+-0.00114       ?
   decrypt                           6.93700+-0.01300    ?     6.94133+-0.01487       ?
   deltablue                x2       0.56658+-0.00450    ?     0.56968+-0.00429       ?
   earley                            1.23068+-0.00589    ^     1.21994+-0.00352       ^ definitely 1.0088x faster
   boyer                            13.66712+-0.05575    ?    13.67038+-0.05082       ?
   raytrace                 x2       4.55525+-0.03219    ?     4.55528+-0.02875       ?
   regexp                   x2      26.79253+-0.07617         26.62287+-0.09437       
   richards                 x2       0.26984+-0.00132          0.26955+-0.00128       
   splay                    x2       0.74498+-0.00724          0.74428+-0.00661       
   navier-stokes            x2      12.73651+-0.01486    ?    12.73830+-0.00966       ?

   &lt;arithmetic&gt;                      7.09799+-0.01237          7.07710+-0.01179         might be 1.0030x faster
   &lt;geometric&gt; *                     2.42901+-0.00434          2.42707+-0.00476         might be 1.0008x faster
   &lt;harmonic&gt;                        0.89800+-0.00301    ?     0.89814+-0.00259       ? might be 1.0002x slower

                                         BaseLine                   96028                                       
All benchmarks:
   &lt;arithmetic&gt;                       7.3101+-0.1044            7.2777+-0.0809          might be 1.0045x faster
   &lt;geometric&gt;                        4.2188+-0.0531            4.2116+-0.0481          might be 1.0017x faster
   &lt;harmonic&gt;                         1.7945+-0.0108            1.7936+-0.0104          might be 1.0005x faster

                                         BaseLine                   96028                                       
Geomean of preferred means:
   &lt;scaled-result&gt;                   13.4420+-0.1556           13.4016+-0.1194          might be 1.0030x faster</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>714008</commentid>
    <comment_count>3</comment_count>
      <attachid>162606</attachid>
    <who name="Benjamin Poulain">benjamin</who>
    <bug_when>2012-09-06 19:15:20 -0700</bug_when>
    <thetext>Comment on attachment 162606
Patch

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

&gt; Source/WTF/wtf/text/StringHash.h:66
&gt; -            if (b-&gt;is8Bit()) {
&gt; -                // We know that a is 8 bit and b is 16 bit.
&gt; +            if (b-&gt;is8Bit())
&gt;                  return WTF::equal(a-&gt;characters16(), b-&gt;characters8(), aLength);

Nice comment indeed :)

&gt; Source/WTF/wtf/text/StringHash.h:135
&gt;              return WTF::Unicode::umemcasecmp(a-&gt;characters(), b-&gt;characters(), length) == 0;

For clarity, I would also use equalIgnoringCase here.

And characters() could be characters16().</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>714571</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2012-09-07 09:01:58 -0700</bug_when>
    <thetext>(In reply to comment #3)
&gt; (From update of attachment 162606 [details])
&gt; View in context: https://bugs.webkit.org/attachment.cgi?id=162606&amp;action=review
&gt; 
&gt; &gt; Source/WTF/wtf/text/StringHash.h:66
&gt; &gt; -            if (b-&gt;is8Bit()) {
&gt; &gt; -                // We know that a is 8 bit and b is 16 bit.
&gt; &gt; +            if (b-&gt;is8Bit())
&gt; &gt;                  return WTF::equal(a-&gt;characters16(), b-&gt;characters8(), aLength);
&gt; 
&gt; Nice comment indeed :)
&gt; 
&gt; &gt; Source/WTF/wtf/text/StringHash.h:135
&gt; &gt;              return WTF::Unicode::umemcasecmp(a-&gt;characters(), b-&gt;characters(), length) == 0;
&gt; 
&gt; For clarity, I would also use equalIgnoringCase here.
&gt; 
&gt; And characters() could be characters16().

WTF::equalIgnoringCase(UChar*, UChar*) is currently a static inline StringImpl.cpp that calls umemcasecmp().  I moved it to StringImpl.h and changed StringHash.h to call it (with characters16()).  Want a new patch or you fine with this change?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>714694</commentid>
    <comment_count>5</comment_count>
    <who name="Benjamin Poulain">benjamin</who>
    <bug_when>2012-09-07 10:29:09 -0700</bug_when>
    <thetext>&gt; WTF::equalIgnoringCase(UChar*, UChar*) is currently a static inline StringImpl.cpp that calls umemcasecmp().  I moved it to StringImpl.h and changed StringHash.h to call it (with characters16()).  Want a new patch or you fine with this change?

I did not know equalIgnoringCase() was only in the cpp file.
Your change sounds good, no need for another review.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>714723</commentid>
    <comment_count>6</comment_count>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2012-09-07 10:46:41 -0700</bug_when>
    <thetext>Committed r127887: &lt;http://trac.webkit.org/changeset/127887&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>162606</attachid>
            <date>2012-09-06 15:35:46 -0700</date>
            <delta_ts>2012-09-06 19:15:20 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>96028.patch</filename>
            <type>text/plain</type>
            <size>2457</size>
            <attacher name="Michael Saboff">msaboff</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XVEYvQ2hhbmdlTG9nCj09PT09PT09P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
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0K
LS0tIFNvdXJjZS9XVEYvd3RmL3RleHQvU3RyaW5nSGFzaC5oCShyZXZpc2lvbiAxMjc3NjIpCisr
KyBTb3VyY2UvV1RGL3d0Zi90ZXh0L1N0cmluZ0hhc2guaAkod29ya2luZyBjb3B5KQpAQCAtNTYs
MTkgKzU2LDE0IEBAIG5hbWVzcGFjZSBXVEYgewogICAgICAgICAgICAgICAgIHJldHVybiBmYWxz
ZTsKIAogICAgICAgICAgICAgaWYgKGEtPmlzOEJpdCgpKSB7Ci0gICAgICAgICAgICAgICAgaWYg
KGItPmlzOEJpdCgpKSB7Ci0gICAgICAgICAgICAgICAgICAgIC8vIEJvdGggYSAmIGIgYXJlIDgg
Yml0LgorICAgICAgICAgICAgICAgIGlmIChiLT5pczhCaXQoKSkKICAgICAgICAgICAgICAgICAg
ICAgcmV0dXJuIFdURjo6ZXF1YWwoYS0+Y2hhcmFjdGVyczgoKSwgYi0+Y2hhcmFjdGVyczgoKSwg
YUxlbmd0aCk7Ci0gICAgICAgICAgICAgICAgfQogCi0gICAgICAgICAgICAgICAgLy8gV2Uga25v
dyB0aGF0IGEgaXMgOCBiaXQgJiBiIGlzIDE2IGJpdC4KICAgICAgICAgICAgICAgICByZXR1cm4g
V1RGOjplcXVhbChhLT5jaGFyYWN0ZXJzOCgpLCBiLT5jaGFyYWN0ZXJzMTYoKSwgYUxlbmd0aCk7
CiAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgIGlmIChiLT5pczhCaXQoKSkgewotICAgICAg
ICAgICAgICAgIC8vIFdlIGtub3cgdGhhdCBhIGlzIDggYml0IGFuZCBiIGlzIDE2IGJpdC4KKyAg
ICAgICAgICAgIGlmIChiLT5pczhCaXQoKSkKICAgICAgICAgICAgICAgICByZXR1cm4gV1RGOjpl
cXVhbChhLT5jaGFyYWN0ZXJzMTYoKSwgYi0+Y2hhcmFjdGVyczgoKSwgYUxlbmd0aCk7Ci0gICAg
ICAgICAgICB9CiAKICAgICAgICAgICAgIHJldHVybiBXVEY6OmVxdWFsKGEtPmNoYXJhY3RlcnMx
NigpLCBiLT5jaGFyYWN0ZXJzMTYoKSwgYUxlbmd0aCk7CiAgICAgICAgIH0KQEAgLTEyNiw2ICsx
MjEsMTcgQEAgbmFtZXNwYWNlIFdURiB7CiAgICAgICAgICAgICB1bnNpZ25lZCBsZW5ndGggPSBh
LT5sZW5ndGgoKTsKICAgICAgICAgICAgIGlmIChsZW5ndGggIT0gYi0+bGVuZ3RoKCkpCiAgICAg
ICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworCisgICAgICAgICAgICBpZiAoYS0+aXM4Qml0KCkp
IHsKKyAgICAgICAgICAgICAgICBpZiAoYi0+aXM4Qml0KCkpCisgICAgICAgICAgICAgICAgICAg
IHJldHVybiBlcXVhbElnbm9yaW5nQ2FzZShhLT5jaGFyYWN0ZXJzOCgpLCBiLT5jaGFyYWN0ZXJz
OCgpLCBsZW5ndGgpOworCisgICAgICAgICAgICAgICAgcmV0dXJuIGVxdWFsSWdub3JpbmdDYXNl
KGItPmNoYXJhY3RlcnMxNigpLCBhLT5jaGFyYWN0ZXJzOCgpLCBsZW5ndGgpOworICAgICAgICAg
ICAgfQorCisgICAgICAgICAgICBpZiAoYi0+aXM4Qml0KCkpCisgICAgICAgICAgICAgICAgcmV0
dXJuIGVxdWFsSWdub3JpbmdDYXNlKGEtPmNoYXJhY3RlcnMxNigpLCBiLT5jaGFyYWN0ZXJzOCgp
LCBsZW5ndGgpOworCiAgICAgICAgICAgICByZXR1cm4gV1RGOjpVbmljb2RlOjp1bWVtY2FzZWNt
cChhLT5jaGFyYWN0ZXJzKCksIGItPmNoYXJhY3RlcnMoKSwgbGVuZ3RoKSA9PSAwOwogICAgICAg
ICB9CiAK
</data>
<flag name="review"
          id="173769"
          type_id="1"
          status="+"
          setter="benjamin"
    />
    <flag name="commit-queue"
          id="173770"
          type_id="3"
          status="-"
          setter="benjamin"
    />
          </attachment>
      

    </bug>

</bugzilla>