<?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>49613</bug_id>
          
          <creation_ts>2010-11-16 12:52:10 -0800</creation_ts>
          <short_desc>[V8] ASSERT(WTF::isMainThread()) fails in V8Binding::int32ToWebCoreString in workers</short_desc>
          <delta_ts>2010-11-18 17:32:26 -0800</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>PC</rep_platform>
          <op_sys>OS X 10.5</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="Kinuko Yasuda">kinuko</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>antonm</cc>
    
    <cc>japhet</cc>
    
    <cc>michaeln</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>309883</commentid>
    <comment_count>0</comment_count>
    <who name="Kinuko Yasuda">kinuko</who>
    <bug_when>2010-11-16 12:52:10 -0800</bug_when>
    <thetext>ASSERT(WTF::isMainThread()) fails in V8Binding::int32ToWebCoreString in workers.

In worker case, javascript is executed by a worker thread but not by the main thread so this assertion always fails.
For example, running the following test in chromium hits the assertion failure.
fast/workers/storage/execute-sql-args-worker.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>309888</commentid>
    <comment_count>1</comment_count>
      <attachid>74028</attachid>
    <who name="Kinuko Yasuda">kinuko</who>
    <bug_when>2010-11-16 12:57:59 -0800</bug_when>
    <thetext>Created attachment 74028
Proposing patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>309892</commentid>
    <comment_count>2</comment_count>
      <attachid>74028</attachid>
    <who name="Nate Chapin">japhet</who>
    <bug_when>2010-11-16 13:10:32 -0800</bug_when>
    <thetext>Comment on attachment 74028
Proposing patch

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

Other than the style nits, this looks ok.  However, I&apos;d appreciate it if you waited for antonm to agree before committing :)

&gt; WebCore/bindings/v8/V8Binding.cpp:390
&gt;      } else
&gt; -        webCoreString = String::number(value);
&gt; +      webCoreString = String::number(value);

Indent 4.

&gt; WebCore/bindings/v8/V8Binding.cpp:399
&gt; +    if (WTF::isMainThread())
&gt; +      return int32ToWebCoreStringFast(value);

Indent 4.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>310137</commentid>
    <comment_count>3</comment_count>
      <attachid>74028</attachid>
    <who name="anton muhin">antonm</who>
    <bug_when>2010-11-16 23:19:33 -0800</bug_when>
    <thetext>Comment on attachment 74028
Proposing patch

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

&gt; WebCore/bindings/v8/V8Binding.cpp:398
&gt; +    if (WTF::isMainThread())

Please, check by running http://dromaeo.com/?dom performance implications.

I haven&apos;t looked into this code for some time, but WTF::isMainThread apparently used to be pretty expensive.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>310351</commentid>
    <comment_count>4</comment_count>
    <who name="Nate Chapin">japhet</who>
    <bug_when>2010-11-17 09:57:25 -0800</bug_when>
    <thetext>(In reply to comment #3)
&gt; (From update of attachment 74028 [details])
&gt; View in context: https://bugs.webkit.org/attachment.cgi?id=74028&amp;action=review
&gt; 
&gt; &gt; WebCore/bindings/v8/V8Binding.cpp:398
&gt; &gt; +    if (WTF::isMainThread())
&gt; 
&gt; Please, check by running http://dromaeo.com/?dom performance implications.
&gt; 
&gt; I haven&apos;t looked into this code for some time, but WTF::isMainThread apparently used to be pretty expensive.

IIRC, globalObjectPrototypeIsDOMWindow() in V8DOMWrapper.cpp is a fairly cheap check for whether we&apos;re in a worker context or not.  Should we try to generalize that and put it somewhere public?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>310680</commentid>
    <comment_count>5</comment_count>
    <who name="Kinuko Yasuda">kinuko</who>
    <bug_when>2010-11-17 19:50:15 -0800</bug_when>
    <thetext>I ran the dromaeo test with and w/o this patch (on my local linux box).
I didn&apos;t re-run the test more than twice for each, but the results looked ok/good to me, i.e. there doesn&apos;t seem a visible performance impact.

Before (w/o this patch):

http://dromaeo.com/?id=123148 
1441.23runs/s (Total)
http://dromaeo.com/?id=123179 
1418.11runs/s (Total)

After (with this patch):

http://dromaeo.com/?id=123150 
1437.06runs/s (Total)
http://dromaeo.com/?id=123177 
1426.23runs/s (Total)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>310725</commentid>
    <comment_count>6</comment_count>
    <who name="anton muhin">antonm</who>
    <bug_when>2010-11-17 23:27:33 -0800</bug_when>
    <thetext>Thank you very much, Kinuko!

(In reply to comment #5)
&gt; I ran the dromaeo test with and w/o this patch (on my local linux box).
&gt; I didn&apos;t re-run the test more than twice for each, but the results looked ok/good to me, i.e. there doesn&apos;t seem a visible performance impact.
&gt; 
&gt; Before (w/o this patch):
&gt; 
&gt; http://dromaeo.com/?id=123148 
&gt; 1441.23runs/s (Total)
&gt; http://dromaeo.com/?id=123179 
&gt; 1418.11runs/s (Total)
&gt; 
&gt; After (with this patch):
&gt; 
&gt; http://dromaeo.com/?id=123150 
&gt; 1437.06runs/s (Total)
&gt; http://dromaeo.com/?id=123177 
&gt; 1426.23runs/s (Total)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>311205</commentid>
    <comment_count>7</comment_count>
    <who name="Kinuko Yasuda">kinuko</who>
    <bug_when>2010-11-18 17:32:26 -0800</bug_when>
    <thetext>Committed r72354: &lt;http://trac.webkit.org/changeset/72354&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>74028</attachid>
            <date>2010-11-16 12:57:59 -0800</date>
            <delta_ts>2010-11-16 23:19:32 -0800</delta_ts>
            <desc>Proposing patch</desc>
            <filename>bug-49613-20101116125758.patch</filename>
            <type>text/plain</type>
            <size>2250</size>
            <attacher name="Kinuko Yasuda">kinuko</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1dlYkNvcmUvQ2hhbmdlTG9nIGIvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXgg
M2Y4YTRlOWMwOTkxOTUxMTM2M2ZiOGVjYWIyZjg4YjlhMWY3YTM2NS4uMDE0NzVkNmEzZmM5MzVl
ZDI5MWQxZDZkZTM3OGRlZTAyYTA0MmRmOSAxMDA2NDQKLS0tIGEvV2ViQ29yZS9DaGFuZ2VMb2cK
KysrIGIvV2ViQ29yZS9DaGFuZ2VMb2cKQEAgLTEsMyArMSwxOCBAQAorMjAxMC0xMS0xNiAgS2lu
dWtvIFlhc3VkYSAgPGtpbnVrb0BjaHJvbWl1bS5vcmc+CisKKyAgICAgICAgUmV2aWV3ZWQgYnkg
Tk9CT0RZIChPT1BTISkuCisKKyAgICAgICAgW1Y4XSBBU1NFUlQoV1RGOjppc01haW5UaHJlYWQo
KSkgZmFpbHMgaW4gVjhCaW5kaW5nOjppbnQzMlRvV2ViQ29yZVN0cmluZyBpbiB3b3JrZXJzCisg
ICAgICAgIGh0dHBzOi8vYnVncy53ZWJraXQub3JnL3Nob3dfYnVnLmNnaT9pZD00OTYxMworCisg
ICAgICAgIE5vIG5ldyB0ZXN0cy4gUnVubmluZyBleGlzdGluZyB3b3JrZXIgdGVzdHMgbGlrZQor
ICAgICAgICBmYXN0L3dvcmtlcnMvc3RvcmFnZS9leGVjdXRlLXNxbC1hcmdzLXdvcmtlci5odG1s
IGluIGNocm9taXVtCisgICAgICAgI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h2ODo6SGFuZGxlPHY4OjpWYWx1ZT4gb2JqZWN0KQogewogICAgIEFT
U0VSVCghb2JqZWN0LT5Jc1N0cmluZygpKTsK
</data>
<flag name="review"
          id="64569"
          type_id="1"
          status="+"
          setter="japhet"
    />
    <flag name="commit-queue"
          id="64570"
          type_id="3"
          status="-"
          setter="japhet"
    />
          </attachment>
      

    </bug>

</bugzilla>