Commit c09b66b8 authored by Peter Marshall's avatar Peter Marshall Committed by Commit Bot

[cleanup] Add types to CSA SmiMul.

Bug: v8:7109
Change-Id: Ib5a6040ad2f651761d1d59dfe7bffcfe1b5ce062
Reviewed-on: https://chromium-review.googlesource.com/803350
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49885}
parent 3c778f55
......@@ -190,7 +190,7 @@ TF_BUILTIN(TypedArrayInitializeWithBuffer, TypedArrayBuiltinsAssembler) {
TNode<Map> fixed_typed_map = LoadMapForType(holder);
// SmiMul returns a heap number in case of Smi overflow.
TNode<Number> byte_length = CAST(SmiMul(length, element_size));
TNode<Number> byte_length = SmiMul(length, element_size);
SetupTypedArray(holder, length, byte_offset, byte_length);
AttachBuffer(holder, buffer, fixed_typed_map, length, byte_offset);
......@@ -219,7 +219,7 @@ TF_BUILTIN(TypedArrayInitialize, TypedArrayBuiltinsAssembler) {
VARIABLE(var_total_size, MachineType::PointerRepresentation());
// SmiMul returns a heap number in case of Smi overflow.
TNode<Number> byte_length = CAST(SmiMul(length, element_size));
TNode<Number> byte_length = SmiMul(length, element_size);
SetupTypedArray(holder, length, byte_offset, byte_length);
......
......@@ -644,8 +644,9 @@ Node* CodeStubAssembler::SmiMod(Node* a, Node* b) {
return TNode<Object>::UncheckedCast(var_result.value());
}
Node* CodeStubAssembler::SmiMul(Node* a, Node* b) {
VARIABLE(var_result, MachineRepresentation::kTagged);
TNode<Number> CodeStubAssembler::SmiMul(SloppyTNode<Smi> a,
SloppyTNode<Smi> b) {
TVARIABLE(Number, var_result);
VARIABLE(var_lhs_float64, MachineRepresentation::kFloat64);
VARIABLE(var_rhs_float64, MachineRepresentation::kFloat64);
Label return_result(this, &var_result);
......@@ -670,7 +671,7 @@ Node* CodeStubAssembler::SmiMul(Node* a, Node* b) {
Branch(Word32Equal(answer, zero), &answer_zero, &answer_not_zero);
BIND(&answer_not_zero);
{
var_result.Bind(ChangeInt32ToTagged(answer));
var_result = ChangeInt32ToTagged(answer);
Goto(&return_result);
}
BIND(&answer_zero);
......@@ -681,12 +682,12 @@ Node* CodeStubAssembler::SmiMul(Node* a, Node* b) {
&if_should_be_zero);
BIND(&if_should_be_negative_zero);
{
var_result.Bind(MinusZeroConstant());
var_result = MinusZeroConstant();
Goto(&return_result);
}
BIND(&if_should_be_zero);
{
var_result.Bind(SmiConstant(0));
var_result = SmiConstant(0);
Goto(&return_result);
}
}
......@@ -696,13 +697,12 @@ Node* CodeStubAssembler::SmiMul(Node* a, Node* b) {
var_lhs_float64.Bind(SmiToFloat64(a));
var_rhs_float64.Bind(SmiToFloat64(b));
Node* value = Float64Mul(var_lhs_float64.value(), var_rhs_float64.value());
Node* result = AllocateHeapNumberWithValue(value);
var_result.Bind(result);
var_result = AllocateHeapNumberWithValue(value);
Goto(&return_result);
}
BIND(&return_result);
return var_result.value();
return var_result;
}
Node* CodeStubAssembler::TrySmiDiv(Node* dividend, Node* divisor,
......
......@@ -274,7 +274,7 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
// Computes a % b for Smi inputs a and b; result is not necessarily a Smi.
Node* SmiMod(Node* a, Node* b);
// Computes a * b for Smi inputs a and b; result is not necessarily a Smi.
Node* SmiMul(Node* a, Node* b);
TNode<Number> SmiMul(SloppyTNode<Smi> a, SloppyTNode<Smi> b);
// Tries to computes dividend / divisor for Smi inputs; branching to bailout
// if the division needs to be performed as a floating point operation.
Node* TrySmiDiv(Node* dividend, Node* divisor, Label* bailout);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment