[webkit-reviews] review granted: [Bug 169187] WebAssembly: Make WebAssembly.instantiate/compile truly asynchronous : [Attachment 305602] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Mar 28 14:32:18 PDT 2017


Saam Barati <sbarati at apple.com> has granted Keith Miller
<keith_miller at apple.com>'s request for review:
Bug 169187: WebAssembly: Make WebAssembly.instantiate/compile truly
asynchronous
https://bugs.webkit.org/show_bug.cgi?id=169187

Attachment 305602: Patch

https://bugs.webkit.org/attachment.cgi?id=305602&action=review




--- Comment #24 from Saam Barati <sbarati at apple.com> ---
Comment on attachment 305602
  --> https://bugs.webkit.org/attachment.cgi?id=305602
Patch

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

r=me with comments

> Source/JavaScriptCore/ChangeLog:30
> +	   WebAssembly.instantiate() then new WebAssembly() on the same

typo: "new WebAssembly()" => "new WebAssembly.Instance()"

> Source/JavaScriptCore/wasm/JSWebAssembly.cpp:155
> +    // FIXME: This reparses the module header, which shouldn't be necessary.

Please file a bug and link it here.

> Source/JavaScriptCore/wasm/WasmPlan.cpp:327
> +

please revert

> Source/JavaScriptCore/wasm/WasmWorklist.cpp:69
> +    void attemptToRemoveCompilationPlan(const AbstractLocker&)
> +    {
> +	   auto& queue = worklist.m_queue;
> +
> +	   if (queue.empty())
> +	       return;
> +
> +	   if (queue.top().plan == element.plan)
> +	       queue.pop();
> +    }

This function looks error prone. Why not just have something that straight up
removes the plan from the queue?
What if something is enqueued w/ higher priority, and element.plan is no longer
at the top of the queue?

> Source/JavaScriptCore/wasm/WasmWorklist.cpp:85
> +	       if (!queue.top().plan->hasBeenPrepared())
> +		   queue.pop();

Style nit: I think this is a tad easier to to read if you just return
PollResult::Work after pop().

> Source/JavaScriptCore/wasm/WasmWorklist.cpp:119
> +	   // FIXME: this should check in at some occasionally to see if there
are new, higher priority e.g. synchronous, plans that need to be run.

Please file a bug and link to it here.

> Source/JavaScriptCore/wasm/WasmWorklist.cpp:133
> +void Worklist::QueueElement::nextPriority()

Style nit: Maybe call this something that indicates it's mutating the priority.
Maybe, "setToNextPriority"?

> Source/JavaScriptCore/wasm/WasmWorklist.cpp:240
> +    LockHolder locker(*m_lock);

Why do we need to hold the lock here?

> Source/JavaScriptCore/wasm/WasmWorklist.cpp:268
> +
> +

style: remove extra white space.

> Source/JavaScriptCore/wasm/js/JSWebAssemblyCodeBlock.cpp:49
> +    module()->m_codeBlocks[static_cast<size_t>(mode)].set(vm, this, this);

Shouldn't this be a write barrier with the module as the owner?
Why not have a Module::setCodeBlock(Mode, CodeBlock*) function?


More information about the webkit-reviews mailing list