[WASM] Initial infrastructure

- New module ":compiler:backend.wasm"
    - Initial compiler infra (driver, phaser, context)
    - Subset of Wasm AST
    - Skeleton of IR -> Wasm AST
    - Wasm AST -> WAT transformer

- Testing infra

- SpiderMonkey jsshell tool
This commit is contained in:
Svyatoslav Kuzmich
2019-08-07 14:27:18 +03:00
parent 812083ee05
commit 6e6ffa12a6
106 changed files with 6418 additions and 584 deletions
+45
View File
@@ -0,0 +1,45 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
const runtime = {
/**
* kotlin.String#plus(other: Any?): String
* @return {string}
*/
String_plus(str1, str2) {
if (typeof str1 != "string") throw `Illegal argument str1: ${str1}`;
return str1 + String(str2);
},
/**
* @return {number}
*/
String_getLength(str) {
if (typeof str != "string") throw `Illegal argument x: ${str}`;
return str.length;
},
/**
* @return {number}
*/
String_getChar(str, index) {
if (typeof str != "string") throw `Illegal argument str: ${str}`;
if (typeof index != "number") throw `Illegal argument index: ${index}`;
return str.charCodeAt(index);
},
/**
* @return {number}
*/
String_compareTo(str1, str2) {
if (str1 > str2) return 1;
if (str1 < str2) return -1;
return 0;
},
String_getLiteral(index) {
return runtime.stringLiterals[index];
}
};