Initial implementation of WebAssembly function compiler
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Sep 2015 20:32:35 +0000 (20:32 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Sep 2015 20:32:35 +0000 (20:32 +0000)
commit36bfd71a808a51eeab7c4376d759cabad06e62c1
tree64bfbe2ea13b88e0269382be5965ccca111a6f6a
parentea5ba6a4f7a3742e4ac99bcbde7056659630c1d3
Initial implementation of WebAssembly function compiler
https://bugs.webkit.org/show_bug.cgi?id=148734

Patch by Sukolsak Sakshuwong <sukolsak@gmail.com> on 2015-09-03
Reviewed by Filip Pizlo.

This patch introduces WASMFunctionCompiler, a class for generating
baseline JIT code for WebAssembly functions. The source for each
WebAssembly function is parsed in two passes.
- The first pass is done by WASMFunctionSyntaxChecker when the
  WebAssembly module is initialized. It validates the syntax,
  determines the start and the end offsets in the source, and
  calculates the stack height of the function.
- The second pass is done by WASMFunctionCompiler when the function
  is about to be executed.
This patch doesn't calculate the correct stack height nor generate
the correct code. That will be done in a subsequent patch.

* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
* JavaScriptCore.xcodeproj/project.pbxproj:
* wasm/JSWASMModule.h:
(JSC::JSWASMModule::functionStartOffsetsInSource):
(JSC::JSWASMModule::functionStackHeights):
* wasm/WASMFunctionCompiler.h: Added.
(JSC::WASMFunctionCompiler::WASMFunctionCompiler):
(JSC::WASMFunctionCompiler::startFunction):
(JSC::WASMFunctionCompiler::endFunction):
(JSC::WASMFunctionCompiler::throwStackOverflowError):
(JSC::WASMFunctionCompiler::localAddress):
* wasm/WASMFunctionParser.cpp:
(JSC::WASMFunctionParser::checkSyntax):
(JSC::WASMFunctionParser::compile):
(JSC::WASMFunctionParser::parseFunction):
* wasm/WASMFunctionParser.h:
* wasm/WASMFunctionSyntaxChecker.h:
(JSC::WASMFunctionSyntaxChecker::startFunction):
(JSC::WASMFunctionSyntaxChecker::endFunction):
(JSC::WASMFunctionSyntaxChecker::stackHeight):
* wasm/WASMModuleParser.cpp:
(JSC::WASMModuleParser::parseFunctionDeclarationSection):
(JSC::WASMModuleParser::parseFunctionDefinition):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@189284 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj
Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters
Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
Source/JavaScriptCore/wasm/JSWASMModule.h
Source/JavaScriptCore/wasm/WASMFunctionCompiler.h [new file with mode: 0644]
Source/JavaScriptCore/wasm/WASMFunctionParser.cpp
Source/JavaScriptCore/wasm/WASMFunctionParser.h
Source/JavaScriptCore/wasm/WASMFunctionSyntaxChecker.h
Source/JavaScriptCore/wasm/WASMModuleParser.cpp