1 /*
2  * Copyright 2016 WebAssembly Community Group participants
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "asmjs/shared-constants.h"
18 
19 namespace wasm {
20 
21 cashew::IString GLOBAL("global");
22 cashew::IString NAN_("NaN");
23 cashew::IString INFINITY_("Infinity");
24 cashew::IString NAN__("nan");
25 cashew::IString INFINITY__("infinity");
26 cashew::IString TOPMOST("topmost");
27 cashew::IString INT8ARRAY("Int8Array");
28 cashew::IString INT16ARRAY("Int16Array");
29 cashew::IString INT32ARRAY("Int32Array");
30 cashew::IString UINT8ARRAY("Uint8Array");
31 cashew::IString UINT16ARRAY("Uint16Array");
32 cashew::IString UINT32ARRAY("Uint32Array");
33 cashew::IString FLOAT32ARRAY("Float32Array");
34 cashew::IString FLOAT64ARRAY("Float64Array");
35 cashew::IString ARRAY_BUFFER("ArrayBuffer");
36 cashew::IString ASM_MODULE("asmModule");
37 cashew::IString IMPOSSIBLE_CONTINUE("impossible-continue");
38 cashew::IString MATH("Math");
39 cashew::IString IMUL("imul");
40 cashew::IString CLZ32("clz32");
41 cashew::IString FROUND("fround");
42 cashew::IString ASM2WASM("asm2wasm");
43 cashew::IString MIN("min");
44 cashew::IString MAX("max");
45 cashew::IString F64_REM("f64-rem");
46 cashew::IString F64_TO_INT("f64-to-int");
47 cashew::IString F64_TO_UINT("f64-to-uint");
48 cashew::IString F64_TO_INT64("f64-to-int64");
49 cashew::IString F64_TO_UINT64("f64-to-uint64");
50 cashew::IString F32_TO_INT("f32-to-int");
51 cashew::IString F32_TO_UINT("f32-to-uint");
52 cashew::IString F32_TO_INT64("f32-to-int64");
53 cashew::IString F32_TO_UINT64("f32-to-uint64");
54 cashew::IString I32S_DIV("i32s-div");
55 cashew::IString I32U_DIV("i32u-div");
56 cashew::IString I32S_REM("i32s-rem");
57 cashew::IString I32U_REM("i32u-rem");
58 cashew::IString GLOBAL_MATH("global.Math");
59 cashew::IString ABS("abs");
60 cashew::IString FLOOR("floor");
61 cashew::IString CEIL("ceil");
62 cashew::IString SQRT("sqrt");
63 cashew::IString POW("pow");
64 cashew::IString I32_TEMP("asm2wasm_i32_temp");
65 cashew::IString DEBUGGER("debugger");
66 cashew::IString BUFFER("buffer");
67 cashew::IString ENV("env");
68 cashew::IString STACKTOP("STACKTOP");
69 cashew::IString STACK_MAX("STACK_MAX");
70 cashew::IString INSTRUMENT("instrument");
71 cashew::IString MATH_IMUL("Math_imul");
72 cashew::IString MATH_ABS("Math_abs");
73 cashew::IString MATH_CEIL("Math_ceil");
74 cashew::IString MATH_CLZ32("Math_clz32");
75 cashew::IString MATH_FLOOR("Math_floor");
76 cashew::IString MATH_TRUNC("Math_trunc");
77 cashew::IString MATH_SQRT("Math_sqrt");
78 cashew::IString MATH_MIN("Math_min");
79 cashew::IString MATH_MAX("Math_max");
80 cashew::IString WASM_CTZ32("__wasm_ctz_i32");
81 cashew::IString WASM_CTZ64("__wasm_ctz_i64");
82 cashew::IString WASM_CLZ32("__wasm_clz_i32");
83 cashew::IString WASM_CLZ64("__wasm_clz_i64");
84 cashew::IString WASM_POPCNT32("__wasm_popcnt_i32");
85 cashew::IString WASM_POPCNT64("__wasm_popcnt_i64");
86 cashew::IString WASM_ROTL32("__wasm_rotl_i32");
87 cashew::IString WASM_ROTL64("__wasm_rotl_i64");
88 cashew::IString WASM_ROTR32("__wasm_rotr_i32");
89 cashew::IString WASM_ROTR64("__wasm_rotr_i64");
90 cashew::IString WASM_MEMORY_GROW("__wasm_memory_grow");
91 cashew::IString WASM_MEMORY_SIZE("__wasm_memory_size");
92 cashew::IString WASM_FETCH_HIGH_BITS("__wasm_fetch_high_bits");
93 cashew::IString INT64_TO_32_HIGH_BITS("i64toi32_i32$HIGH_BITS");
94 cashew::IString WASM_NEAREST_F32("__wasm_nearest_f32");
95 cashew::IString WASM_NEAREST_F64("__wasm_nearest_f64");
96 cashew::IString WASM_TRUNC_F32("__wasm_trunc_f32");
97 cashew::IString WASM_TRUNC_F64("__wasm_trunc_f64");
98 cashew::IString WASM_I64_MUL("__wasm_i64_mul");
99 cashew::IString WASM_I64_SDIV("__wasm_i64_sdiv");
100 cashew::IString WASM_I64_UDIV("__wasm_i64_udiv");
101 cashew::IString WASM_I64_SREM("__wasm_i64_srem");
102 cashew::IString WASM_I64_UREM("__wasm_i64_urem");
103 
104 cashew::IString ASM_FUNC("asmFunc");
105 cashew::IString ABORT_FUNC("abort");
106 cashew::IString FUNCTION_TABLE("FUNCTION_TABLE");
107 cashew::IString NO_RESULT("wasm2js$noresult"); // no result at all
108 // result in an expression, no temp var
109 cashew::IString EXPRESSION_RESULT("wasm2js$expresult");
110 
111 namespace ABI {
112 namespace wasm2js {
113 
114 cashew::IString SCRATCH_LOAD_I32("wasm2js_scratch_load_i32");
115 cashew::IString SCRATCH_STORE_I32("wasm2js_scratch_store_i32");
116 cashew::IString SCRATCH_LOAD_F32("wasm2js_scratch_load_f32");
117 cashew::IString SCRATCH_STORE_F32("wasm2js_scratch_store_f32");
118 cashew::IString SCRATCH_LOAD_F64("wasm2js_scratch_load_f64");
119 cashew::IString SCRATCH_STORE_F64("wasm2js_scratch_store_f64");
120 cashew::IString MEMORY_INIT("wasm2js_memory_init");
121 cashew::IString MEMORY_FILL("wasm2js_memory_fill");
122 cashew::IString MEMORY_COPY("wasm2js_memory_copy");
123 cashew::IString DATA_DROP("wasm2js_data_drop");
124 cashew::IString ATOMIC_WAIT_I32("wasm2js_atomic_wait_i32");
125 cashew::IString ATOMIC_RMW_I64("wasm2js_atomic_rmw_i64");
126 cashew::IString GET_STASHED_BITS("wasm2js_get_stashed_bits");
127 
128 } // namespace wasm2js
129 } // namespace ABI
130 
131 } // namespace wasm
132