<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - Implement WebAssembly module parser"
href="https://bugs.webkit.org/show_bug.cgi?id=147293#c7">Comment # 7</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - Implement WebAssembly module parser"
href="https://bugs.webkit.org/show_bug.cgi?id=147293">bug 147293</a>
from <span class="vcard"><a class="email" href="mailto:sukolsak@gmail.com" title="Sukolsak Sakshuwong <sukolsak@gmail.com>"> <span class="fn">Sukolsak Sakshuwong</span></a>
</span></b>
<pre>Thank you for the review.
(In reply to <a href="show_bug.cgi?id=147293#c3">comment #3</a>)
<span class="quote">> Comment on <span class="bz_obsolete"><a href="attachment.cgi?id=257558&action=diff" name="attach_257558" title="Patch">attachment 257558</a> <a href="attachment.cgi?id=257558&action=edit" title="Patch">[details]</a></span>
> Patch
>
> View in context:
> <a href="https://bugs.webkit.org/attachment.cgi?id=257558&action=review">https://bugs.webkit.org/attachment.cgi?id=257558&action=review</a>
>
> r=me with some mixups
>
> > Source/JavaScriptCore/parser/SourceProvider.h:90
> > +#if ENABLE(WEBASSEMBLY)
> > + virtual bool isStringSource() const override
> > + {
> > + return true;
> > + }
> > +#endif
>
> SourceProvider has a subclass named "StringSourceProvider". This function is
> too easily confused with that class.
>
> For now, I think you should remove this function. Instead of performing an
> isStringSource() check, I think you should just go with the [WebAssembly
> Source] source string you've provided. In the future, we'll have to see what
> the spec says about toString on a WebAssembly function.</span >
I originally named it isStringSourceProvider() but renamed it to isStringSource() after realizing that OpaqueJSScript was another subclass of SourceProvider that should have this method return true.
The reason I used this method was that SourceCode::toUTF8() returns "m_provider->source().impl()->utf8ForRange(m_startChar, m_endChar - m_startChar)". This will crash if source() is "[WebAssembly source]" and m_startChar and m_endChar are out of range. Come to think of it, maybe I shouldn't have m_startChar and m_endChar out of range in the first place.
<span class="quote">> > Source/JavaScriptCore/wasm/WASMFormat.h:33
> > +static const uint32_t wasmMagicNumber = 0x6d736177;
>
> This file should be named WASMMagicNumber.h.</span >
This file will have more constants and enums that define the WASM file format. It will be very similar to <<a href="https://github.com/WebAssembly/polyfill-prototype-1/blob/master/src/shared.h">https://github.com/WebAssembly/polyfill-prototype-1/blob/master/src/shared.h</a>> Should I rename it to WASMMagicNumber.h for now? Or maybe WASMConstants.h?</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>