[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:
committed by
commit-bot@chromium.org
parent
71c10c4c9c
commit
81ad24322c
@@ -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_
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -524,6 +524,8 @@ enum Condition {
|
||||
UNSIGNED_LESS_EQUAL = LS,
|
||||
UNSIGNED_GREATER = HI,
|
||||
UNSIGNED_GREATER_EQUAL = CS,
|
||||
OVERFLOW = VS,
|
||||
NO_OVERFLOW = VC,
|
||||
|
||||
kInvalidCondition = 16
|
||||
};
|
||||
|
||||
@@ -374,6 +374,8 @@ enum Condition {
|
||||
UNSIGNED_LESS_EQUAL = LS,
|
||||
UNSIGNED_GREATER = HI,
|
||||
UNSIGNED_GREATER_EQUAL = CS,
|
||||
OVERFLOW = VS,
|
||||
NO_OVERFLOW = VC,
|
||||
|
||||
kInvalidCondition = 16
|
||||
};
|
||||
|
||||
@@ -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).
|
||||
|
||||
Reference in New Issue
Block a user