[vm/compiler] Check BoxInt64 overflow via the overflow flag on ARM64.

This saves one instruction for every BoxInt64 overflow check, reducing
the instructions size for Flutter benchmarks by between 0.26% and 1.03%
(0.26% for Flutter Gallery).

Also add OVERFLOW and NO_OVERFLOW condition aliases to arm and arm64.

Change-Id: I82990419b448f21a22ea2cc7a15a9497d3275943
Cq-Do-Not-Cancel-Tryjobs: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145860
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
This commit is contained in:
Aske Simon Christensen
2020-05-20 14:05:40 +00:00
committed by commit-bot@chromium.org
parent 71c10c4c9c
commit 81ad24322c
6 changed files with 13 additions and 6 deletions
+3
View File
@@ -679,6 +679,9 @@ inline D bit_copy(const S& source) {
#define PATH_MAX MAX_PATH
#endif
// Undefine math.h definition which clashes with our condition names.
#undef OVERFLOW
} // namespace dart
#endif // RUNTIME_PLATFORM_GLOBALS_H_
+4 -3
View File
@@ -3984,10 +3984,11 @@ void BoxInt64Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
return;
}
ASSERT(kSmiTag == 0);
__ LslImmediate(out, in, kSmiTagSize);
__ adds(out, in, compiler::Operand(in)); // SmiTag
compiler::Label done;
__ cmp(in, compiler::Operand(out, ASR, kSmiTagSize));
__ b(&done, EQ);
// If the value doesn't fit in a smi, the tagging changes the sign,
// which causes the overflow flag to be set.
__ b(&done, NO_OVERFLOW);
Register temp = locs()->temp(0).reg();
+2
View File
@@ -4194,6 +4194,8 @@ void BoxInt64Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
if (!ValueFitsSmi()) {
const Register temp = locs()->temp(0).reg();
compiler::Label done;
// If the value doesn't fit in a smi, the tagging changes the sign,
// which causes the overflow flag to be set.
__ j(NO_OVERFLOW, &done);
BoxAllocationSlowPath::Allocate(compiler, this, compiler->mint_class(), out,
temp);
+2
View File
@@ -524,6 +524,8 @@ enum Condition {
UNSIGNED_LESS_EQUAL = LS,
UNSIGNED_GREATER = HI,
UNSIGNED_GREATER_EQUAL = CS,
OVERFLOW = VS,
NO_OVERFLOW = VC,
kInvalidCondition = 16
};
+2
View File
@@ -374,6 +374,8 @@ enum Condition {
UNSIGNED_LESS_EQUAL = LS,
UNSIGNED_GREATER = HI,
UNSIGNED_GREATER_EQUAL = CS,
OVERFLOW = VS,
NO_OVERFLOW = VC,
kInvalidCondition = 16
};
-3
View File
@@ -17,9 +17,6 @@
#undef near
#endif // defined(_WIN32)
// The following #defines are invalidated.
#undef OVERFLOW // From math.h conflicts in constants_ia32.h
namespace dart {
// Smi value range is from -(2^N) to (2^N)-1.
// N=30 (32-bit build) or N=62 (64-bit build).