[vm, compiler] Don't clobber non-writable inputs in BinarySmiOp(>>>).

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/46797
Change-Id: Ia9494ddc1d39b83e2572b8b5a7f208da2540ccd1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210501
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Ryan Macnak
2021-08-18 23:19:55 +00:00
committed by commit-bot@chromium.org
parent 5e7b7dbcda
commit 37ea0f8cb4
2 changed files with 23 additions and 2 deletions
@@ -0,0 +1,21 @@
// 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.
// VMOptions=--optimization-counter-threshold=100
int var74 = -43;
@pragma("vm:never-inline")
foo(int var74) {
if (var74 >>> 0xC == 675872701) {
print("side-effect");
}
}
main() {
for (var i = 0; i < 200; i++) {
foo(43);
}
foo(-43);
}
+2 -2
View File
@@ -3541,8 +3541,8 @@ void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
const intptr_t kCountLimit = 0x3F;
intptr_t value = Smi::Cast(constant).Value();
ASSERT((value >= 0) && (value <= kCountLimit));
__ SmiUntag(left);
__ LsrImmediate(result, left, value);
__ SmiUntag(result, left);
__ LsrImmediate(result, result, value);
if (deopt != nullptr) {
__ SmiTagAndBranchIfOverflow(result, deopt);
} else {