Closed lexaknyazev closed 8 years ago
@rakudrama
For some reason it looks like HLocalGet and HLocalSet do not have any side effects so they are pure, so the SsaInstructionMerger thinks it can move them. In this case for bar before instruction merging:
B3
v7 LocalGet : v2.i [null|subclass=Object]
v8 LocalGet : v2.i [null|subclass=Object]
U71 OneShotInterceptor : u13.+(v8, i9)([null|subclass=Object]) Union of [[exact=JSString], [subclass=JSNumber]] ! ?
c12 LocalSet : v2.i to U71 [empty]
s23 Stringify : v7 [exact=JSString] ! ?
s24 StringConcat : s69 + s23 [exact=JSString] ?
s26 StringConcat : s24 + s19 [exact=JSString] ?
s28 Stringify : U71 [exact=JSString] ! ?
s29 StringConcat : s26 + s28 [exact=JSString] ?
c38 Goto : (B4) [empty]
And after:
B3
v8 LocalGet : v2.i [null|subclass=Object]
U71 OneShotInterceptor : u13.+(v8, i9)([null|subclass=Object]) Union of [[exact=JSString], [subclass=JSNumber]] ! ?
c12 LocalSet : v2.i to U71 [empty]
v7 LocalGet : v2.i [null|subclass=Object]
s23 Stringify : v7 [exact=JSString] ! ?
s24 StringConcat : s69 + s23 [exact=JSString] ?
s26 StringConcat : s24 + s19 [exact=JSString] ?
s28 Stringify : U71 [exact=JSString] ! ?
s29 StringConcat : s26 + s28 [exact=JSString] ?
c38 Goto : (B4) [empty]
You can see that v7 got moved below c12.
Is there any chance for this issue to be fixed in 1.16?
@mit-mit @johnniwinther
Fix available: https://codereview.chromium.org/1914623002
@whesse I guess we should merge this even though there is no merge request yet?
We won't be able to get this in today before we snap the 1.16 stable build, so the fix will go into the next 1.17 dev build.
I have found a problem with the fix, so I will revert it and get it right. Sorry, Alexey, it must be 1.17.
You can work around the bug by lifting code into closures: https://dartpad.dartlang.org/165c53f9de621e249ede0f32fcdb9aca
It is a good idea to put as little code as possible in a function that contains try-catch since most JavaScript engines don't bother to optimize such functions.
On Mon, Apr 25, 2016 at 4:25 AM, Michael Thomsen notifications@github.com wrote:
We won't be able to get this in today before we snap the 1.16 stable build, so the fix will go into the nex 1.17 dev build.
— You are receiving this because you were assigned. Reply to this email directly or view it on GitHub https://github.com/dart-lang/sdk/issues/26243#issuecomment-214272660
The revised fix was committed.
Looks like
try-catch
block affects order of operations in parameter lists. For example: https://dartpad.dartlang.org/1bfecc33644e9f722fdc60425a499c62Dart2JS:
DartVM: