Changeset 234001 in webkit
- Timestamp:
- Jul 19, 2018 1:42:20 PM (6 years ago)
- Location:
- trunk/Tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r233988 r234001 1 2018-07-19 Thomas Denney <tdenney@apple.com> 2 3 [WHLSL] The interpreter doesn't support boolean short-circuiting 4 https://bugs.webkit.org/show_bug.cgi?id=187779 5 6 Reviewed by Alex Christensen. 7 8 * WebGPUShadingLanguageRI/Evaluator.js: 9 (Evaluator.prototype.visitLogicalExpression): RHS is only evaluated when necessary 10 * WebGPUShadingLanguageRI/Test.js: 11 (tests.booleanShortcircuiting): Adds 4 tests for the evaluation of logical expresions 12 1 13 2018-07-19 Dean Jackson <dino@apple.com> 2 14 -
trunk/Tools/WebGPUShadingLanguageRI/Evaluator.js
r222413 r234001 178 178 { 179 179 let lhs = node.left.visit(this).loadValue(); 180 let rhs = node.right.visit(this).loadValue();181 180 let result; 182 181 switch (node.text) { 183 182 case "&&": 184 result = lhs && rhs;183 result = lhs && node.right.visit(this).loadValue(); 185 184 break; 186 185 case "||": 187 result = lhs || rhs;186 result = lhs || node.right.visit(this).loadValue(); 188 187 break; 189 188 default: -
trunk/Tools/WebGPUShadingLanguageRI/Test.js
r222751 r234001 3825 3825 } 3826 3826 3827 tests.booleanShortcircuiting = function() 3828 { 3829 let program = doPrep(` 3830 bool set(thread int* ptr, int value, bool retValue) 3831 { 3832 *ptr = value; 3833 return retValue; 3834 } 3835 3836 int andTrue() 3837 { 3838 int x; 3839 bool y = set(&x, 1, true) && set(&x, 2, false); 3840 return x; 3841 } 3842 3843 int andFalse() 3844 { 3845 int x; 3846 bool y = set(&x, 1, false) && set(&x, 2, false); 3847 return x; 3848 } 3849 3850 int orTrue() 3851 { 3852 int x; 3853 bool y = set(&x, 1, true) || set(&x, 2, false); 3854 return x; 3855 } 3856 3857 int orFalse() 3858 { 3859 int x; 3860 bool y = set(&x, 1, false) || set(&x, 2, false); 3861 return x; 3862 } 3863 `); 3864 3865 checkInt(program, callFunction(program, "andTrue", [], []), 2); 3866 checkInt(program, callFunction(program, "andFalse", [], []), 1); 3867 checkInt(program, callFunction(program, "orTrue", [], []), 1); 3868 checkInt(program, callFunction(program, "orFalse", [], []), 2); 3869 } 3870 3827 3871 tests.typedefArray = function() 3828 3872 {
Note: See TracChangeset
for help on using the changeset viewer.