Changeset 248729 in webkit
- Timestamp:
- Aug 15, 2019, 10:49:38 AM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r248728 r248729 1 2019-08-15 Robin Morisset <rmorisset@apple.com> 2 3 [WHLSL] Trivial clean-up of the MSL code generated 4 https://bugs.webkit.org/show_bug.cgi?id=200525 5 6 Reviewed by Darin Adler. 7 8 Emit simpler code for ternary expressions 9 Remove duplicate {} around functions 10 11 No new tests as it is covered by the existing ones. 12 13 * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp: 14 (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit): 15 1 16 2019-08-15 Youenn Fablet <youenn@apple.com> 2 17 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp
r248650 r248729 248 248 m_stringBuilder.flexibleAppend(m_typeNamer.mangledNameForType(*parameter->type()), ' ', parameterName); 249 249 } 250 m_stringBuilder.append(") {\n");250 m_stringBuilder.append(")\n"); 251 251 checkErrorAndVisit(functionDefinition.block()); 252 252 ASSERT(m_stack.isEmpty()); 253 m_stringBuilder.append( "}\n");253 m_stringBuilder.append('\n'); 254 254 } 255 255 } … … 680 680 checkErrorAndVisit(ternaryExpression.predicate()); 681 681 auto check = takeLastValue(); 682 683 auto variableName = generateNextVariableName();684 m_stringBuilder.flexibleAppend(685 m_typeNamer.mangledNameForType(ternaryExpression.resolvedType()), ' ', variableName, ";\n"686 "if (", check, ") {\n"687 );688 682 checkErrorAndVisit(ternaryExpression.bodyExpression()); 689 m_stringBuilder.flexibleAppend( 690 variableName, " = ", takeLastValue(), ";\n" 691 "} else {\n" 692 ); 683 auto body = takeLastValue(); 693 684 checkErrorAndVisit(ternaryExpression.elseExpression()); 694 m_stringBuilder.flexibleAppend(695 variableName, " = ", takeLastValue(), ";\n" 696 "}\n"697 );685 auto elseBody = takeLastValue(); 686 687 auto variableName = generateNextVariableName(); 688 m_stringBuilder.flexibleAppend(m_typeNamer.mangledNameForType(ternaryExpression.resolvedType()), ' ', variableName, " = ", check, " ? ", body, " : ", elseBody, ";\n"); 698 689 appendRightValue(ternaryExpression, variableName); 699 690 }
Note:
See TracChangeset
for help on using the changeset viewer.