[Webkit-unassigned] [Bug 222412] Add type method for WASM Global, Memory and Table JS API classes

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Mar 31 01:08:48 PDT 2021


https://bugs.webkit.org/show_bug.cgi?id=222412

Yusuke Suzuki <ysuzuki at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #424625|review?                     |review+
              Flags|                            |

--- Comment #17 from Yusuke Suzuki <ysuzuki at apple.com> ---
Comment on attachment 424625
  --> https://bugs.webkit.org/attachment.cgi?id=424625
Patch

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

r=me with comments

> Source/JavaScriptCore/wasm/js/JSWebAssemblyGlobal.cpp:96
> +    result->putDirect(vm, Identifier::fromString(vm, "mutable"), jsBoolean(isMutable));

Use

result->putDirect(vm, Identifier::fromString(vm, "mutable"), jsBoolean(m_global->mutability() == Wasm::GlobalInformation::Mutable));

> Source/JavaScriptCore/wasm/js/JSWebAssemblyGlobal.cpp:98
> +    Wasm::Type value = m_global->type();

valueType would be better.

> Source/JavaScriptCore/wasm/js/JSWebAssemblyGlobal.cpp:99
> +    JSString* valueStr = nullptr;

Use `valueString`.

> Source/JavaScriptCore/wasm/js/JSWebAssemblyMemory.cpp:154
> +    Wasm::MemorySharingMode shared = m_memory->sharingMode();
> +    if (shared == Wasm::MemorySharingMode::Default)
> +        result->putDirect(vm, Identifier::fromString(vm, "shared"), jsBoolean(false));
> +    else
> +        result->putDirect(vm, Identifier::fromString(vm, "shared"), jsBoolean(true));

Make it,

result->putDirect(vm, Identifier::fromString(vm, "shared"), jsBoolean(m_memory->sharingMode() == Wasm::MemorySharingMode::Shared));

> Source/JavaScriptCore/wasm/js/JSWebAssemblyTable.cpp:134
> +    JSString* elementStr = nullptr;

Use `elementString` instead. We like non-abbreviated names.

> Source/JavaScriptCore/wasm/js/JSWebAssemblyTable.cpp:138
> +        elementStr = jsNontrivialString(vm, "externref");

Let's make it switch to list things in a readable way.

JSString* elementString = nullptr;
switch (element) {
case Wasm::TableElementType::Funcref:
    elementString = jsNontrivialString(vm, "funcref");
    break;
case Wasm::TableElementType::Externref:
    elementString = jsNontrivialString(vm, "externref");
    break;
default:
    RELEASE_ASSERT_NOT_REACHED();
    break;
}

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210331/b18b0e58/attachment-0001.htm>


More information about the webkit-unassigned mailing list