Ignore:
Timestamp:
Dec 8, 2016, 10:52:51 PM (9 years ago)
Author:
[email protected]
Message:

WebAssembly: JSC::link* shouldn't need a CodeBlock
https://bugs.webkit.org/show_bug.cgi?id=165591

Reviewed by Keith Miller.

JSTests:

test that wasm -> JS works, including the IC

  • wasm/js-api/test_Instance.js:

(const.wasmModuleWhichImportJS):
(MonomorphicImport):
(Polyphic2Import):
(Polyphic3Import):
(VirtualImport):

Source/JavaScriptCore:

Allow linking without a CodeBlock, which WebAssembly's wasm -> JS stubs does. This needs to work for polymorphic and virtual calls. This patch adds corresponding tests for this.

  • assembler/LinkBuffer.cpp:

(JSC::shouldDumpDisassemblyFor): don't look at the tier option if there isn't a CodeBlock, only look at the global one. This is a WebAssembly function, so the tier information is irrelevant.

  • jit/Repatch.cpp:

(JSC::isWebAssemblyToJSCallee): this is used in the link* functions below
(JSC::linkFor):
(JSC::linkVirtualFor):
(JSC::linkPolymorphicCall):

  • runtime/Options.h: add an option to change the maximum number of polymorphic calls in stubs from wasm to JS, which will come in handy when we try to tune performance or try merging some of the WebAssembly stubs
  • wasm/WasmBinding.cpp:

(JSC::Wasm::importStubGenerator): remove the breakpoint since the code now works

  • wasm/js/WebAssemblyToJSCallee.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/wasm/WasmBinding.cpp

    r209560 r209597  
    5050
    5151    jit.emitFunctionPrologue();
    52     jit.breakpoint(); // FIXME make calling to JavaScript work. https://bugs.webkit.org/show_bug.cgi?id=165591
    5352    jit.store64(JIT::TrustedImm32(0), JIT::Address(GPRInfo::callFrameRegister, CallFrameSlot::codeBlock * static_cast<int>(sizeof(Register)))); // FIXME Stop using 0 as codeBlocks. https://bugs.webkit.org/show_bug.cgi?id=165321
    5453    jit.storePtr(JIT::TrustedImmPtr(vm->webAssemblyToJSCallee.get()), JIT::Address(GPRInfo::callFrameRegister, CallFrameSlot::callee * static_cast<int>(sizeof(Register))));
Note: See TracChangeset for help on using the changeset viewer.