Changeset 204588 in webkit
- Timestamp:
- Aug 17, 2016 6:35:55 PM (8 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r204586 r204588 1 2016-08-17 Keith Miller <keith_miller@apple.com> 2 3 Add WASM support for i64 simple opcodes. 4 https://bugs.webkit.org/show_bug.cgi?id=160928 5 6 Reviewed by Michael Saboff. 7 8 This patch also removes the unsigned int32 mod operator, which is not supported by B3 yet. 9 10 * wasm/WASMB3IRGenerator.cpp: 11 (JSC::WASM::toB3Op): 12 (JSC::WASM::B3IRGenerator::unaryOp): 13 * wasm/WASMFunctionParser.h: 14 (JSC::WASM::WASMFunctionParser<Context>::parseExpression): 15 * wasm/WASMOps.h: 16 1 17 2016-08-17 JF Bastien <jfbastien@apple.com> 2 18 -
trunk/Source/JavaScriptCore/wasm/WASMB3IRGenerator.cpp
r204539 r204588 42 42 using namespace B3; 43 43 44 inline JSC::B3::Opcode toB3Op(WASMBinaryOpType op)44 inline B3::Opcode toB3Op(WASMBinaryOpType op) 45 45 { 46 46 switch (op) { … … 51 51 } 52 52 53 inline B3::Opcode toB3Op(WASMUnaryOpType op) 54 { 55 switch (op) { 56 #define CREATE_CASE(name, op, b3op) case WASMUnaryOpType::name: return b3op; 57 FOR_EACH_WASM_UNARY_OP(CREATE_CASE) 58 #undef CREATE_CASE 59 } 60 } 61 53 62 class B3IRGenerator { 54 63 public: … … 61 70 62 71 bool WARN_UNUSED_RETURN binaryOp(WASMBinaryOpType, ExpressionType left, ExpressionType right, ExpressionType& result); 72 bool WARN_UNUSED_RETURN unaryOp(WASMUnaryOpType, ExpressionType arg, ExpressionType& result); 63 73 64 74 bool WARN_UNUSED_RETURN addBlock(); … … 88 98 { 89 99 // TODO: Add locals. 100 } 101 102 bool B3IRGenerator::unaryOp(WASMUnaryOpType op, ExpressionType arg, ExpressionType& result) 103 { 104 result = m_currentBlock->appendNew<Value>(m_proc, toB3Op(op), Origin(), arg); 105 return true; 90 106 } 91 107 -
trunk/Source/JavaScriptCore/wasm/WASMFunctionParser.h
r204539 r204588 113 113 #define CREATE_CASE(name, id, b3op) case name: 114 114 FOR_EACH_WASM_BINARY_OP(CREATE_CASE) { 115 #undef CREATE_CASE116 115 ExpressionType left = m_expressionStack.takeLast(); 117 116 ExpressionType right = m_expressionStack.takeLast(); … … 122 121 return true; 123 122 } 123 124 FOR_EACH_WASM_UNARY_OP(CREATE_CASE) { 125 ExpressionType arg = m_expressionStack.takeLast(); 126 ExpressionType result; 127 if (!m_context.unaryOp(static_cast<WASMUnaryOpType>(op), arg, result)) 128 return false; 129 m_expressionStack.append(result); 130 return true; 131 } 132 #undef CREATE_CASE 124 133 125 134 case WASMOpType::I32Const: { -
trunk/Source/JavaScriptCore/wasm/WASMOps.h
r204539 r204588 40 40 macro(End, 0x0f, NA) 41 41 42 #define FOR_EACH_WASM_UNARY_OP(macro) 42 #define FOR_EACH_WASM_UNARY_OP(macro) \ 43 macro(I32Clz, 0x57, Clz) \ 44 /* macro(I32Ctz, 0x58) */ \ 45 /* macro(I32PopCnt, 0x59) */ \ 46 /* macro(I32Eqz, 0x5a) */ \ 47 macro(I64Clz, 0x72, Clz) \ 48 /* macro(I64Ctz, 0x73) */ \ 49 /* macro(I64PopCnt, 0x74) */ \ 50 /* macro(I64Eqz, 0xba) */ 43 51 44 52 #define FOR_EACH_WASM_BINARY_OP(macro) \ … … 49 57 /* macro(I32DivU, 0x44) */ \ 50 58 macro(I32RemS, 0x45, Mod) \ 51 macro(I32RemU, 0x46, Mod)\59 /* macro(I32RemU, 0x46, Mod) */ \ 52 60 macro(I32And, 0x47, BitAnd) \ 53 61 macro(I32Or, 0x48, BitOr) \ … … 68 76 macro(I32GtU, 0x55, Above) \ 69 77 macro(I32GeU, 0x56, AboveEqual) \ 78 macro(I64Add, 0x5b, Add) \ 79 macro(I64Sub, 0x5c, Sub) \ 80 macro(I64Mul, 0x5d, Mul) \ 81 macro(I64DivS, 0x5e, Div) \ 82 /* macro(I64DivU, 0x5f) */ \ 83 macro(I64RemS, 0x60, Mod) \ 84 /* macro(I64RemU, 0x61) */ \ 85 macro(I64And, 0x62, BitAnd) \ 86 macro(I64Or, 0x63, BitOr) \ 87 macro(I64Xor, 0x64, BitXor) \ 88 macro(I64Shl, 0x65, Shl) \ 89 macro(I64ShrU, 0x66, SShr) \ 90 macro(I64ShrS, 0x67, ZShr) \ 91 /* macro(I64RotR, 0xb8) */ \ 92 /* macro(I64RotL, 0xb9) */ \ 93 macro(I64Eq, 0x68, Equal) \ 94 macro(I64Ne, 0x69, NotEqual) \ 95 macro(I64LtS, 0x6a, LessThan) \ 96 macro(I64LeS, 0x6b, LessEqual) \ 97 macro(I64LtU, 0x6c, Below) \ 98 macro(I64LeU, 0x6d, BelowEqual) \ 99 70 100 71 101 #define FOR_EACH_WASM_OP(macro) \ … … 81 111 }; 82 112 83 84 85 113 enum class WASMBinaryOpType : uint8_t { 86 114 FOR_EACH_WASM_BINARY_OP(CREATE_ENUM_VALUE) 87 115 }; 116 117 enum class WASMUnaryOpType : uint8_t { 118 FOR_EACH_WASM_UNARY_OP(CREATE_ENUM_VALUE) 119 }; 120 121 #undef CREATE_ENUM_VALUE 88 122 89 123 } // namespace WASM … … 91 125 } // namespace JSC 92 126 93 #undef CREATE_ENUM_VALUE94 95 127 #endif // ENABLE(WEBASSEMBLY)
Note: See TracChangeset
for help on using the changeset viewer.