Commit 0226a008 authored by Benedikt Meurer's avatar Benedikt Meurer Committed by Commit Bot

[cleanup] Make ChangeNumberToFloat64() require TNode<Number>.

This addresses a TODO and makes the CAST explicit at the use sites,
which in turn makes it easier to understand the implications there.

Bug: v8:9183
Change-Id: I5b285a5a0ba6b754b4de9d60ff6e18c2e807bf98
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1649569
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62079}
parent 0381794b
...@@ -3019,7 +3019,7 @@ void CodeStubAssembler::TryStoreArrayElement(ElementsKind kind, ...@@ -3019,7 +3019,7 @@ void CodeStubAssembler::TryStoreArrayElement(ElementsKind kind,
GotoIfNotNumber(value, bailout); GotoIfNotNumber(value, bailout);
} }
if (IsDoubleElementsKind(kind)) { if (IsDoubleElementsKind(kind)) {
value = ChangeNumberToFloat64(value); value = ChangeNumberToFloat64(CAST(value));
} }
StoreElement(elements, kind, index, value, mode); StoreElement(elements, kind, index, value, mode);
} }
...@@ -5750,10 +5750,7 @@ TNode<Uint32T> CodeStubAssembler::ChangeNumberToUint32(TNode<Number> value) { ...@@ -5750,10 +5750,7 @@ TNode<Uint32T> CodeStubAssembler::ChangeNumberToUint32(TNode<Number> value) {
return var_result.value(); return var_result.value();
} }
TNode<Float64T> CodeStubAssembler::ChangeNumberToFloat64( TNode<Float64T> CodeStubAssembler::ChangeNumberToFloat64(TNode<Number> value) {
SloppyTNode<Number> value) {
// TODO(tebbi): Remove assert once argument is TNode instead of SloppyTNode.
CSA_SLOW_ASSERT(this, IsNumber(value));
TVARIABLE(Float64T, result); TVARIABLE(Float64T, result);
Label smi(this); Label smi(this);
Label done(this, &result); Label done(this, &result);
......
...@@ -2103,7 +2103,7 @@ class V8_EXPORT_PRIVATE CodeStubAssembler ...@@ -2103,7 +2103,7 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
TNode<Number> ChangeUint32ToTagged(SloppyTNode<Uint32T> value); TNode<Number> ChangeUint32ToTagged(SloppyTNode<Uint32T> value);
TNode<Number> ChangeUintPtrToTagged(TNode<UintPtrT> value); TNode<Number> ChangeUintPtrToTagged(TNode<UintPtrT> value);
TNode<Uint32T> ChangeNumberToUint32(TNode<Number> value); TNode<Uint32T> ChangeNumberToUint32(TNode<Number> value);
TNode<Float64T> ChangeNumberToFloat64(SloppyTNode<Number> value); TNode<Float64T> ChangeNumberToFloat64(TNode<Number> value);
TNode<UintPtrT> TryNumberToUintPtr(TNode<Number> value, Label* if_negative); TNode<UintPtrT> TryNumberToUintPtr(TNode<Number> value, Label* if_negative);
TNode<UintPtrT> ChangeNonnegativeNumberToUintPtr(TNode<Number> value) { TNode<UintPtrT> ChangeNonnegativeNumberToUintPtr(TNode<Number> value) {
return TryNumberToUintPtr(value, nullptr); return TryNumberToUintPtr(value, nullptr);
......
...@@ -1207,7 +1207,7 @@ void AccessorAssembler::OverwriteExistingFastDataProperty( ...@@ -1207,7 +1207,7 @@ void AccessorAssembler::OverwriteExistingFastDataProperty(
&double_rep, &tagged_rep); &double_rep, &tagged_rep);
BIND(&double_rep); BIND(&double_rep);
{ {
TNode<Float64T> double_value = ChangeNumberToFloat64(value); TNode<Float64T> double_value = ChangeNumberToFloat64(CAST(value));
if (FLAG_unbox_double_fields) { if (FLAG_unbox_double_fields) {
if (do_transitioning_store) { if (do_transitioning_store) {
StoreMap(object, object_map); StoreMap(object, object_map);
...@@ -1275,7 +1275,7 @@ void AccessorAssembler::OverwriteExistingFastDataProperty( ...@@ -1275,7 +1275,7 @@ void AccessorAssembler::OverwriteExistingFastDataProperty(
Int32Constant(Representation::kDouble)), Int32Constant(Representation::kDouble)),
&cont); &cont);
{ {
Node* double_value = ChangeNumberToFloat64(value); Node* double_value = ChangeNumberToFloat64(CAST(value));
Node* mutable_heap_number = Node* mutable_heap_number =
AllocateMutableHeapNumberWithValue(double_value); AllocateMutableHeapNumberWithValue(double_value);
var_value.Bind(mutable_heap_number); var_value.Bind(mutable_heap_number);
...@@ -1301,7 +1301,7 @@ void AccessorAssembler::OverwriteExistingFastDataProperty( ...@@ -1301,7 +1301,7 @@ void AccessorAssembler::OverwriteExistingFastDataProperty(
{ {
Node* mutable_heap_number = Node* mutable_heap_number =
LoadPropertyArrayElement(properties, backing_store_index); LoadPropertyArrayElement(properties, backing_store_index);
TNode<Float64T> double_value = ChangeNumberToFloat64(value); TNode<Float64T> double_value = ChangeNumberToFloat64(CAST(value));
Label if_mutable(this); Label if_mutable(this);
GotoIfNot(IsPropertyDetailsConst(details), &if_mutable); GotoIfNot(IsPropertyDetailsConst(details), &if_mutable);
......
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