Changeset 208821 in webkit for trunk/Source/JavaScriptCore/wasm/generateWasmValidateInlinesHeader.py
- Timestamp:
- Nov 16, 2016, 3:34:39 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/wasm/generateWasmValidateInlinesHeader.py
r208238 r208821 61 61 op = opcodes[name] 62 62 return """ 63 case UnaryOpType::""" + toCpp(name) + """: { 64 if (value != """ + cppType(op["parameter"][0]) + """) { 65 m_errorMessage = makeString(\"""" + name + """ expects the value to be of type: ", toString(""" + cppType(op["parameter"][0]) + """), " but got a value with type: ", toString(value)); 66 return false; 67 } 63 template<> bool Validate::addOp<OpType::""" + toCpp(name) + """>(ExpressionType value, ExpressionType& result) 64 { 65 if (value != """ + cppType(op["parameter"][0]) + """) { 66 m_errorMessage = makeString(\"""" + name + """ expects the value to be of type: ", toString(""" + cppType(op["parameter"][0]) + """), " but got a value with type: ", toString(value)); 67 return false; 68 } 68 69 69 result = """ + cppType(op["return"][0]) + """; 70 return true; 71 }""" 70 result = """ + cppType(op["return"][0]) + """; 71 return true; 72 } 73 """ 72 74 73 75 … … 75 77 op = opcodes[name] 76 78 return """ 77 case BinaryOpType::""" + toCpp(name) + """: { 78 if (left != """ + cppType(op["parameter"][0]) + """) { 79 m_errorMessage = makeString(\"""" + name + """ expects the left value to be of type: ", toString(""" + cppType(op["parameter"][0]) + """), " but got a value with type: ", toString(left)); 80 return false; 81 } 79 template<> bool Validate::addOp<OpType::""" + toCpp(name) + """>(ExpressionType left, ExpressionType right, ExpressionType& result) 80 { 81 if (left != """ + cppType(op["parameter"][0]) + """) { 82 m_errorMessage = makeString(\"""" + name + """ expects the left value to be of type: ", toString(""" + cppType(op["parameter"][0]) + """), " but got a value with type: ", toString(left)); 83 return false; 84 } 82 85 83 84 85 86 86 if (right != """ + cppType(op["parameter"][1]) + """) { 87 m_errorMessage = makeString(\"""" + name + """ expects the right value to be of type: ", toString(""" + cppType(op["parameter"][0]) + """), " but got a value with type: ", toString(right)); 88 return false; 89 } 87 90 88 89 90 }""" 91 91 result = """ + cppType(op["return"][0]) + """; 92 return true; 93 } 94 """ 92 95 93 96 def loadMacro(name): … … 123 126 124 127 125 unary Cases = "".join([op for op in wasm.opcodeIterator(isUnary, unaryMacro)])126 binary Cases = "".join([op for op in wasm.opcodeIterator(isBinary, binaryMacro)])128 unarySpecializations = "".join([op for op in wasm.opcodeIterator(isUnary, unaryMacro)]) 129 binarySpecializations = "".join([op for op in wasm.opcodeIterator(isBinary, binaryMacro)]) 127 130 loadCases = "".join([op for op in wasm.opcodeIterator(lambda op: op["category"] == "memory" and len(op["return"]) == 1, loadMacro)]) 128 131 storeCases = "".join([op for op in wasm.opcodeIterator(lambda op: op["category"] == "memory" and len(op["return"]) == 0, storeMacro)]) … … 137 140 namespace JSC { namespace Wasm { 138 141 139 bool Validate::unaryOp(UnaryOpType op, ExpressionType value, ExpressionType& result) 140 { 141 switch (op) { 142 """ + unaryCases + """ 143 } 144 } 145 146 bool Validate::binaryOp(BinaryOpType op, ExpressionType left, ExpressionType right, ExpressionType& result) 147 { 148 switch (op) { 149 """ + binaryCases + """ 150 } 151 } 142 """ + unarySpecializations + binarySpecializations + """ 152 143 153 144 bool Validate::load(LoadOpType op, ExpressionType pointer, ExpressionType& result, uint32_t)
Note:
See TracChangeset
for help on using the changeset viewer.