mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 08:24:39 +00:00
[vm] Fix representation for constant used for ShiftLeft binary op.
The constant has to be boxed value, can't be unboxed. Fixes=dartbug.com/55003 TEST=regress_55003_test Change-Id: Ia4d61364f54f8a08a0fe621cc1b4fb5597b1836e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/355304 Commit-Queue: Alexander Aprelev <aam@google.com> Reviewed-by: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
parent
84e6764dca
commit
d4a9866520
17
runtime/tests/vm/dart/regress_55003_test.dart
Normal file
17
runtime/tests/vm/dart/regress_55003_test.dart
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
int var64 = -1;
|
||||||
|
num var68 = 2;
|
||||||
|
|
||||||
|
@pragma("vm:always-consider-inlining")
|
||||||
|
Set<bool>? foo0_1() {
|
||||||
|
return <bool>{
|
||||||
|
(8 <= (((var64 + -90) * 9223372034707292160) % var68)),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
foo0_1();
|
||||||
|
}
|
|
@ -2443,7 +2443,7 @@ Definition* BinaryIntegerOpInstr::Canonicalize(FlowGraph* flow_graph) {
|
||||||
} else if ((rhs > 0) && Utils::IsPowerOfTwo(rhs)) {
|
} else if ((rhs > 0) && Utils::IsPowerOfTwo(rhs)) {
|
||||||
const int64_t shift_amount = Utils::ShiftForPowerOfTwo(rhs);
|
const int64_t shift_amount = Utils::ShiftForPowerOfTwo(rhs);
|
||||||
ConstantInstr* constant_shift_amount = flow_graph->GetConstant(
|
ConstantInstr* constant_shift_amount = flow_graph->GetConstant(
|
||||||
Smi::Handle(Smi::New(shift_amount)), representation());
|
Smi::Handle(Smi::New(shift_amount)), kTagged);
|
||||||
BinaryIntegerOpInstr* shift = BinaryIntegerOpInstr::Make(
|
BinaryIntegerOpInstr* shift = BinaryIntegerOpInstr::Make(
|
||||||
representation(), Token::kSHL, left()->CopyWithType(),
|
representation(), Token::kSHL, left()->CopyWithType(),
|
||||||
new Value(constant_shift_amount), GetDeoptId(), can_overflow(),
|
new Value(constant_shift_amount), GetDeoptId(), can_overflow(),
|
||||||
|
|
Loading…
Reference in a new issue