1 // Copyright 2017 the V8 project authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef V8_ASMJS_ASM_NAMES_H_ 6 #define V8_ASMJS_ASM_NAMES_H_ 7 8 // V(stdlib.Math.<name>, constant-value) 9 #define STDLIB_MATH_VALUE_LIST(V) \ 10 V(E, 2.718281828459045) \ 11 V(LN10, 2.302585092994046) \ 12 V(LN2, 0.6931471805599453) \ 13 V(LOG2E, 1.4426950408889634) \ 14 V(LOG10E, 0.4342944819032518) \ 15 V(PI, 3.141592653589793) \ 16 V(SQRT1_2, 0.7071067811865476) \ 17 V(SQRT2, 1.4142135623730951) 18 19 // V(stdlib.Math.<name>, Name, wasm-opcode, asm-js-type) 20 #define STDLIB_MATH_FUNCTION_MONOMORPHIC_LIST(V) \ 21 V(acos, Acos, kExprF64Acos, dq2d) \ 22 V(asin, Asin, kExprF64Asin, dq2d) \ 23 V(atan, Atan, kExprF64Atan, dq2d) \ 24 V(cos, Cos, kExprF64Cos, dq2d) \ 25 V(sin, Sin, kExprF64Sin, dq2d) \ 26 V(tan, Tan, kExprF64Tan, dq2d) \ 27 V(exp, Exp, kExprF64Exp, dq2d) \ 28 V(log, Log, kExprF64Log, dq2d) \ 29 V(atan2, Atan2, kExprF64Atan2, dqdq2d) \ 30 V(pow, Pow, kExprF64Pow, dqdq2d) \ 31 V(imul, Imul, kExprI32Mul, ii2s) \ 32 V(clz32, Clz32, kExprI32Clz, i2s) 33 34 // V(stdlib.Math.<name>, Name, unused, asm-js-type) 35 #define STDLIB_MATH_FUNCTION_CEIL_LIKE_LIST(V) \ 36 V(ceil, Ceil, x, ceil_like) \ 37 V(floor, Floor, x, ceil_like) \ 38 V(sqrt, Sqrt, x, ceil_like) 39 40 // V(stdlib.Math.<name>, Name, unused, asm-js-type) 41 #define STDLIB_MATH_FUNCTION_LIST(V) \ 42 V(min, Min, x, minmax) \ 43 V(max, Max, x, minmax) \ 44 V(abs, Abs, x, abs) \ 45 V(fround, Fround, x, fround) \ 46 STDLIB_MATH_FUNCTION_MONOMORPHIC_LIST(V) \ 47 STDLIB_MATH_FUNCTION_CEIL_LIKE_LIST(V) 48 49 // V(stdlib.<name>, wasm-load-type, wasm-store-type, wasm-type) 50 #define STDLIB_ARRAY_TYPE_LIST(V) \ 51 V(Int8Array, Mem8S, Mem8, I32) \ 52 V(Uint8Array, Mem8U, Mem8, I32) \ 53 V(Int16Array, Mem16S, Mem16, I32) \ 54 V(Uint16Array, Mem16U, Mem16, I32) \ 55 V(Int32Array, Mem, Mem, I32) \ 56 V(Uint32Array, Mem, Mem, I32) \ 57 V(Float32Array, Mem, Mem, F32) \ 58 V(Float64Array, Mem, Mem, F64) 59 60 #define STDLIB_OTHER_LIST(V) \ 61 V(Infinity) \ 62 V(NaN) \ 63 V(Math) 64 65 // clang-format off (for return) 66 #define KEYWORD_NAME_LIST(V) \ 67 V(arguments) \ 68 V(break) \ 69 V(case) \ 70 V(const) \ 71 V(continue) \ 72 V(default) \ 73 V(do) \ 74 V(else) \ 75 V(eval) \ 76 V(for) \ 77 V(function) \ 78 V(if) \ 79 V(new) \ 80 V(return ) \ 81 V(switch) \ 82 V(var) \ 83 V(while) 84 // clang-format on 85 86 // V(token-string, token-name) 87 #define LONG_SYMBOL_NAME_LIST(V) \ 88 V("<=", LE) \ 89 V(">=", GE) \ 90 V("==", EQ) \ 91 V("!=", NE) \ 92 V("<<", SHL) \ 93 V(">>", SAR) \ 94 V(">>>", SHR) \ 95 V("'use asm'", UseAsm) 96 97 // clang-format off 98 #define SIMPLE_SINGLE_TOKEN_LIST(V) \ 99 V('+') V('-') V('*') V('%') V('~') V('^') V('&') V('|') V('(') V(')') \ 100 V('[') V(']') V('{') V('}') V(':') V(';') V(',') V('?') 101 // clang-format on 102 103 // V(name, value, string-name) 104 #define SPECIAL_TOKEN_LIST(V) \ 105 V(kUninitialized, 0, "{uninitalized}") \ 106 V(kEndOfInput, -1, "{end of input}") \ 107 V(kParseError, -2, "{parse error}") \ 108 V(kUnsigned, -3, "{unsigned value}") \ 109 V(kDouble, -4, "{double value}") 110 111 #endif // V8_ASMJS_ASM_NAMES_H_ 112