RESOLVED FIXED198079
[WHLSL] ReadModifyWriteExpression always has a result and new value expression
https://bugs.webkit.org/show_bug.cgi?id=198079
Summary [WHLSL] ReadModifyWriteExpression always has a result and new value expression
Saam Barati
Reported 2019-05-21 11:47:11 PDT
we branch on it being there in Visitor. Seems unnecessary, since we always set it after we create a ReadModifyWriteExpression. We should probably make it a ctor parameter.
Attachments
patch (9.80 KB, patch)
2019-05-23 17:26 PDT, Saam Barati
mmaxfield: review+
patch for landing (9.85 KB, patch)
2019-05-24 00:34 PDT, Saam Barati
no flags
Saam Barati
Comment 1 2019-05-21 11:48:21 PDT
Same with newValueExpression
Saam Barati
Comment 2 2019-05-21 11:52:26 PDT
Spoke with Myles. We should assert it's non-null. We can't make it an argument to ctor though because of some circular references.
Saam Barati
Comment 3 2019-05-23 17:26:37 PDT
Myles C. Maxfield
Comment 4 2019-05-23 18:48:34 PDT
Comment on attachment 370533 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=370533&action=review > Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h:90 > - Expression* newValueExpression() { return m_newValueExpression ? &*m_newValueExpression : nullptr; } > - Expression* resultExpression() { return m_resultExpression ? &*m_resultExpression : nullptr; } > + Expression& newValueExpression() { ASSERT(m_newValueExpression); return *m_newValueExpression; } > + Expression& resultExpression() { ASSERT(m_resultExpression); return *m_resultExpression; } I think it's better style to break this up into two lines Expression& newValueExpression() { ASSERT(m_newValueExpression); return *m_newValueExpression; } > Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h:97 > + m_newValueExpression.reset(); Is this line necessary? > Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h:103 > + m_resultExpression.reset(); Is this line necessary?
Saam Barati
Comment 5 2019-05-24 00:34:12 PDT
Comment on attachment 370533 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=370533&action=review Thanks for the review. >> Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h:90 >> + Expression& resultExpression() { ASSERT(m_resultExpression); return *m_resultExpression; } > > I think it's better style to break this up into two lines > > Expression& newValueExpression() > { > ASSERT(m_newValueExpression); > return *m_newValueExpression; > } Will do >> Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h:97 >> + m_newValueExpression.reset(); > > Is this line necessary? Strictly speaking, no, given the context this is called in. However, it felt a bit odd to leave the optional engaged even after moving the contents of a UniqueRef out of it.
Saam Barati
Comment 6 2019-05-24 00:34:49 PDT
Created attachment 370567 [details] patch for landing
WebKit Commit Bot
Comment 7 2019-05-24 01:19:13 PDT
Comment on attachment 370567 [details] patch for landing Clearing flags on attachment: 370567 Committed r245745: <https://trac.webkit.org/changeset/245745>
WebKit Commit Bot
Comment 8 2019-05-24 01:19:15 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 9 2019-05-24 01:20:25 PDT
Myles C. Maxfield
Comment 10 2019-05-24 09:43:33 PDT
*** Bug 198170 has been marked as a duplicate of this bug. ***
Note You need to log in before you can comment on or make changes to this bug.