-
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.
[vm/compiler] Generate non-speculative Unbox instructions for Phis
TEST=runtime/tests/vm/dart/regress_flutter83094_test.dart Issue flutter/flutter#83094 Change-Id: Ib4eebc993e06f6925f11bd18e5f29f22ba3c6322 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201363 Reviewed-by: Martin Kustermann <[email protected]> Commit-Queue: Alexander Markov <[email protected]>
- Loading branch information
1 parent
ee0952d
commit a3767f7
Showing
4 changed files
with
88 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright (c) 2021, 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. | ||
|
||
// Verifies that compiler doesn't crash due to incompatible types | ||
// when unboxing input of a Phi. | ||
// Regression test for https://github.com/flutter/flutter/issues/83094. | ||
|
||
import 'package:expect/expect.dart'; | ||
|
||
class A { | ||
@pragma('vm:never-inline') | ||
double getMaxIntrinsicWidth() => 1.toDouble(); | ||
} | ||
|
||
A _leading = A(); | ||
|
||
@pragma('vm:never-inline') | ||
double computeMaxIntrinsicWidth(double height, double horizontalPadding) { | ||
final leadingWidth = | ||
_leading == null ? 0 : _leading.getMaxIntrinsicWidth() as int; | ||
return horizontalPadding + leadingWidth; | ||
} | ||
|
||
main() { | ||
Expect.throws(() => computeMaxIntrinsicWidth(1, 2)); | ||
} |
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,27 @@ | ||
// Copyright (c) 2021, 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. | ||
|
||
// Verifies that compiler doesn't crash due to incompatible types | ||
// when unboxing input of a Phi. | ||
// Regression test for https://github.com/flutter/flutter/issues/83094. | ||
|
||
import 'package:expect/expect.dart'; | ||
|
||
class A { | ||
@pragma('vm:never-inline') | ||
double getMaxIntrinsicWidth() => 1.toDouble(); | ||
} | ||
|
||
A _leading = A(); | ||
|
||
@pragma('vm:never-inline') | ||
double computeMaxIntrinsicWidth(double height, double horizontalPadding) { | ||
final leadingWidth = | ||
_leading == null ? 0 : _leading.getMaxIntrinsicWidth() as int; | ||
return horizontalPadding + leadingWidth; | ||
} | ||
|
||
main() { | ||
Expect.throws(() => computeMaxIntrinsicWidth(1, 2)); | ||
} |
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