[webkit-changes] [WebKit/WebKit] 6f23b5: Add in place interpreter optimizations

Daniel Liu noreply at github.com
Fri Aug 11 12:28:07 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 6f23b5f4342c809f33e206690b8bde942a9daa1d
      https://github.com/WebKit/WebKit/commit/6f23b5f4342c809f33e206690b8bde942a9daa1d
  Author: Daniel Liu <danlliu at umich.edu>
  Date:   2023-08-11 (Fri, 11 Aug 2023)

  Changed paths:
    M JSTests/wasm/ipint-tests/ipint-test-call-add12.js
    A JSTests/wasm/ipint-tests/ipint-test-local-large.js
    A JSTests/wasm/ipint-tests/ipint-test-nesting.js
    A JSTests/wasm/ipint-tests/ipint-test-return-minus.js
    M Source/JavaScriptCore/llint/InPlaceInterpreter.asm
    M Source/JavaScriptCore/wasm/WasmCallee.cpp
    M Source/JavaScriptCore/wasm/WasmCallee.h
    M Source/JavaScriptCore/wasm/WasmFunctionIPIntMetadataGenerator.cpp
    M Source/JavaScriptCore/wasm/WasmFunctionIPIntMetadataGenerator.h
    M Source/JavaScriptCore/wasm/WasmIPIntGenerator.cpp

  Log Message:
  -----------
  Add in place interpreter optimizations
https://bugs.webkit.org/show_bug.cgi?id=259798
rdar://113358427

Reviewed by Justin Michaud.

Added a variety of optimizations to improve the performance of the in-place interpreter:
- Added new mini-interpreters (mINT, uINT, and argumINT) to optimize the calling convention by not loading/storing registers pessimistically.
  - argumINT also allows locals to index directly using their original index.
- Added a "condensing" behavior that allows long runs of block/loop and end instructions to be skipped when interpreting by modifying metadata entries to jump past these groups of instructions.
- Transitioned to unaligned metadata, allowing almost all instructions to save bytes by compacting their metadata.
- Added compact forms for i32.const and local.get/set, which allow IPInt to read directly from the bytecode if the index is <128, saving 4B of metadata.

Scores 37.755 on JS2's Wasm tests, versus 34.926 for LLInt.

Startup time on UE4 Zen Garden: starts up 7.2% faster (220 ms vs 237 ms), while utilizing 9.1% less memory (421 MB vs 463 MB)

* JSTests/wasm/ipint-tests/ipint-test-nesting.js: Added.
(from.string_appeared_here.import.as.assert.from.string_appeared_here.let.wat.module.func.export.string_appeared_here.result.i32.block.result.i32.block.result.i32.block.result.i32.block.result.i32.block.result.i32.block.result.i32.block.result.i32.block.result.i32.block.result.i32.block.result.i32.block.result.i32.i32.const.3.br.5.block.param.i32.result.i32.block.result.i32.i32.const.2.i32.add.return.func.export.string_appeared_here.param.i32.result.i32.block.block.block.loop.block.loop.block.local.0.i32.const.1.i32.add.local.0.loop.block.nop.loop.loop.loop.local.0.local.0.local.0.return.async test):
* Source/JavaScriptCore/llint/InPlaceInterpreter.asm:
* Source/JavaScriptCore/wasm/WasmFunctionIPIntMetadataGenerator.cpp:
(JSC::Wasm::FunctionIPIntMetadataGenerator::addBlankSpace):
(JSC::Wasm::FunctionIPIntMetadataGenerator::addRawValue):
(JSC::Wasm::FunctionIPIntMetadataGenerator::addLEB128ConstantInt32AndLength):
(JSC::Wasm::FunctionIPIntMetadataGenerator::addLEB128ConstantAndLengthForType):
(JSC::Wasm::FunctionIPIntMetadataGenerator::addReturnData):
* Source/JavaScriptCore/wasm/WasmFunctionIPIntMetadataGenerator.h:
* Source/JavaScriptCore/wasm/WasmIPIntGenerator.cpp:
(JSC::Wasm::IPIntGenerator::condenseControlFlowInstructions):
(JSC::Wasm::IPIntGenerator::addBlock):
(JSC::Wasm::IPIntGenerator::addLoop):

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




More information about the webkit-changes mailing list