-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[dart2js] Replace phi with controlling condition
Rewrite `phi(true, false)` to the controlling condition. This patchset comparison shows the general effect: https://dart-review.googlesource.com/c/sdk/+/340065/2..3/pkg/compiler/test/codegen/data/phi_to_condition_test.dart This change is a partial remedy for http://dartbug.com/54115 Issue: #54115 Change-Id: Ibcc5d17f6c4c8ad9600840ec106f84edcd008e4a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/340065 Reviewed-by: Nate Biggs <[email protected]> Commit-Queue: Stephen Adams <[email protected]>
- Loading branch information
Showing
3 changed files
with
105 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
@pragma('dart2js:never-inline') | ||
/*member: foo1:function(a, b) { | ||
var changed = a !== b; | ||
if (changed) | ||
A.log("changed"); | ||
return changed; | ||
}*/ | ||
foo1(int a, int b) { | ||
bool changed = false; | ||
if (a != b) { | ||
changed = true; | ||
log('changed'); | ||
} | ||
return changed; | ||
} | ||
|
||
@pragma('dart2js:never-inline') | ||
/*member: log:ignore*/ | ||
void log(String s) {} | ||
|
||
/*member: main:ignore*/ | ||
main() { | ||
foo1(1, 2); | ||
foo1(2, 1); | ||
} |