[cleanup] Drop Runtime_IsValidSmi

It only had one callsite, and that callsite was useless:
%IsValidSmi(two_31) has never returned {true} on any
configuration we have ever shipped.

Bug: v8:10933
Change-Id: I09cdfd7bbd7960d1ec460ad4bd9f0d21e47f7393
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2434746
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70285}
This commit is contained in:
Jakob Kummerow 2020-10-02 14:41:48 +02:00 committed by Commit Bot
parent f3861a8723
commit 896627dbef
4 changed files with 18 additions and 33 deletions

View File

@ -13,15 +13,6 @@
namespace v8 {
namespace internal {
RUNTIME_FUNCTION(Runtime_IsValidSmi) {
SealHandleScope shs(isolate);
DCHECK_EQ(1, args.length());
CONVERT_NUMBER_CHECKED(int32_t, number, Int32, args[0]);
return isolate->heap()->ToBoolean(Smi::IsValid(number));
}
RUNTIME_FUNCTION(Runtime_StringToNumber) {
HandleScope handle_scope(isolate);
DCHECK_EQ(1, args.length());

View File

@ -276,7 +276,6 @@ namespace internal {
F(GetHoleNaNLower, 0, 1) \
F(GetHoleNaNUpper, 0, 1) \
I(IsSmi, 1, 1) \
F(IsValidSmi, 1, 1) \
F(MaxSmi, 0, 1) \
F(NumberToStringSlow, 1, 1) \
F(StringParseFloat, 1, 1) \

View File

@ -73,16 +73,14 @@ assertUnoptimized(mul_by_2);
// Deopt on overflow.
// 2^30 is a smi boundary on arm and ia32.
// -2^30 is in Smi range on most configurations, +2^30 is not.
var two_30 = 1 << 30;
// 2^31 is a smi boundary on arm64 and x64.
var two_31 = 2 * two_30;
assertEquals(two_30, mul_by_neg_1(-two_30));
// TODO(rmcilroy): replace after r16361 with: if (%IsValidSmi(two_31)) {
if (true) {
assertEquals(two_31, mul_by_neg_1(-two_31));
assertUnoptimized(mul_by_neg_1);
} else {
assertEquals(two_30, mul_by_neg_1(-two_30));
assertUnoptimized(mul_by_neg_1);
}
// For good measure, check that overflowing int32 range (or Smi range
// without pointer compression) works too.
var two_31 = two_30 * 2;
assertEquals(two_31, mul_by_neg_1(-two_31));
// One of the two situations deoptimized the code.
assertUnoptimized(mul_by_neg_1);

View File

@ -53,17 +53,14 @@ mul2(-1, 2);
mul2(-1, 2);
%OptimizeFunctionOnNextCall(mul2);
// 2^30 is a smi boundary on arm and ia32.
// -2^30 is in Smi range on most configurations, +2^30 is not.
var two_30 = 1 << 30;
// 2^31 is a smi boundary on x64.
var two_31 = 2 * two_30;
assertEquals(two_30, mul2(-two_30, -1));
if (%IsValidSmi(two_31)) {
// Deopt on two_31 on x64.
assertEquals(two_31, mul2(-two_31, -1));
assertUnoptimized(mul2);
} else {
// Deopt on two_30 on ia32.
assertEquals(two_30, mul2(-two_30, -1));
assertUnoptimized(mul2);
}
// For good measure, check that overflowing int32 range (or Smi range
// without pointer compression) works too.
var two_31 = two_30 * 2;
assertEquals(two_31, mul2(-two_31, -1));
// One of the two situations deoptimized the code.
assertUnoptimized(mul2);