Search code examples
v8webassembly

How does V8 store the Section info of a WebAssembly module?


After the engine analyzing each byte of the binary WebAssembly module, how does it organize and store the section information? For instance, let's say the Type Section has several entities with a kind func_type, and each func_type also has many of its own fields. How does V8 store those info from the perspective of the c++ code and the overall engine?


Solution

  • The WasmModule class has a list (well, a std::vector) of function signatures, as well as other data read from the module's wire bytes; see here: https://cs.chromium.org/chromium/src/v8/src/wasm/wasm-module.h?sq=package:chromium&g=0&l=185. You can find most of the other class definitions further up in the same file.