From 8121a2b095703dbf1903b7884fc8bb4c867360bd Mon Sep 17 00:00:00 2001
From: Jakob Kummerow <jkummerow@chromium.org>
Date: Wed, 26 Jan 2022 11:47:02 +0100
Subject: [PATCH] [wasm][cleanup] Replace SmiConstant with NumberConstant

The existing NumberConstant helper subsumes the recently introduced
SmiConstant (because it produces Smis when it can), so there is no
need for the latter.

Change-Id: Ia49d2c9298c6e75a6465b3b6a68745f4de899671
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3416240
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78798}
---
 src/compiler/wasm-compiler.cc | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/src/compiler/wasm-compiler.cc b/src/compiler/wasm-compiler.cc
index ae27b513b0..4ae67f38f9 100644
--- a/src/compiler/wasm-compiler.cc
+++ b/src/compiler/wasm-compiler.cc
@@ -230,13 +230,6 @@ class WasmGraphAssembler : public GraphAssembler {
     return graph()->NewNode(mcgraph()->common()->NumberConstant(value));
   }
 
-  Node* SmiConstant(Tagged_t value) {
-    Address tagged_value = Internals::IntToSmi(static_cast<int>(value));
-    return kTaggedSize == kInt32Size
-               ? Int32Constant(static_cast<int32_t>(tagged_value))
-               : Int64Constant(static_cast<int64_t>(tagged_value));
-  }
-
   // Helper functions for dealing with HeapObjects.
   // Rule of thumb: if access to a given field in an object is required in
   // at least two places, put a helper function here.
@@ -5637,13 +5630,13 @@ Node* WasmGraphBuilder::ArrayInitFromData(const wasm::ArrayType* type,
       gasm_->Uint32Constant(data_segment), offset, length, rtt);
   TrapIfTrue(wasm::kTrapArrayTooLarge,
              gasm_->TaggedEqual(
-                 array, gasm_->SmiConstant(
+                 array, gasm_->NumberConstant(
                             wasm::kArrayInitFromDataArrayTooLargeErrorCode)),
              position);
   TrapIfTrue(
       wasm::kTrapDataSegmentOutOfBounds,
       gasm_->TaggedEqual(
-          array, gasm_->SmiConstant(
+          array, gasm_->NumberConstant(
                      wasm::kArrayInitFromDataSegmentOutOfBoundsErrorCode)),
       position);
   return array;