Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 841f77f24a8929071d7299612bfbc78177afa3e0
      
https://github.com/WebKit/WebKit/commit/841f77f24a8929071d7299612bfbc78177afa3e0
  Author: Yusuke Suzuki <[email protected]>
  Date:   2022-12-17 (Sat, 17 Dec 2022)

  Changed paths:
    M Source/JavaScriptCore/CMakeLists.txt
    M Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
    M Source/JavaScriptCore/bytecode/BytecodeList.rb
    M Source/JavaScriptCore/llint/WebAssembly.asm
    A Source/JavaScriptCore/wasm/WasmLLIntBuiltin.h
    M Source/JavaScriptCore/wasm/WasmLLIntGenerator.cpp
    M Source/JavaScriptCore/wasm/WasmSlowPaths.cpp
    M Source/JavaScriptCore/wasm/WasmSlowPaths.h
    M Source/JavaScriptCore/wasm/WasmTypeDefinition.cpp
    M Source/JavaScriptCore/wasm/WasmTypeDefinition.h

  Log Message:
  -----------
  [JSC] Add call_builtin wasm opcode
https://bugs.webkit.org/show_bug.cgi?id=249520
rdar://103471989

Reviewed by Mark Lam.

This patch adds call_builtin Wasm opcode to save Wasm opcode space.
There are many Wasm opcodes which are just calling a function because of 
opcode's complexity.
We should represent it as a form of "call_builtin" instead and reduce # of 
opcodes.

In LLIntGenerator, we materialize call_builtin like what we materialize a 
normal call.
And instead of passing functionIndex, we pass builtinIndex. And then, 
call_builtin
slowpath offers a way to retrieve arguments from call's format so that we can 
pass arbitrary
number of values and we can return arbitrary number of values.

The definition of calling convension is following to wasm's call. And we use 
pre-defined
function signatures to materialize them correctly in LLIntGenerator.

* Source/JavaScriptCore/CMakeLists.txt:
* Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:
* Source/JavaScriptCore/bytecode/BytecodeList.rb:
* Source/JavaScriptCore/llint/WebAssembly.asm:
* Source/JavaScriptCore/wasm/WasmLLIntBuiltin.h: Added.
* Source/JavaScriptCore/wasm/WasmLLIntGenerator.cpp:
(JSC::Wasm::LLIntGenerator::callInformationForCaller):
(JSC::Wasm::LLIntGenerator::addConstantWithoutPush):
(JSC::Wasm::LLIntGenerator::addConstant):
(JSC::Wasm::LLIntGenerator::addElemDrop):
(JSC::Wasm::LLIntGenerator::addTableSize):
(JSC::Wasm::LLIntGenerator::addTableCopy):
(JSC::Wasm::LLIntGenerator::addCallBuiltin):
(JSC::Wasm::LLIntGenerator::addCurrentMemory):
(JSC::Wasm::LLIntGenerator::addMemoryInit):
(JSC::Wasm::LLIntGenerator::addDataDrop):
(JSC::Wasm::LLIntGenerator::addMemoryFill):
(JSC::Wasm::LLIntGenerator::addMemoryCopy):
* Source/JavaScriptCore/wasm/WasmSlowPaths.cpp:
(JSC::LLInt::jsrSize):
(JSC::LLInt::fprSize):
(JSC::LLInt::WASM_SLOW_PATH_DECL):
* Source/JavaScriptCore/wasm/WasmSlowPaths.h:
* Source/JavaScriptCore/wasm/WasmTypeDefinition.cpp:
(JSC::Wasm::TypeInformation::typeDefinitionForLLIntBuiltin):
(JSC::Wasm::TypeInformation::TypeInformation):
* Source/JavaScriptCore/wasm/WasmTypeDefinition.h:

Canonical link: https://commits.webkit.org/258047@main


_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to