Commit d3d8d71f authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

[csa][cleanup] TNodify TryGetIntPtrOrSmiConstantValue

Also remove ParameterMode since it is not needed.

Bug: v8:9708, v8:6949
Change-Id: If82cd5ffb89502e3feed7f5af613182df668080e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2370639Reviewed-by: 's avatarDan Elphick <delphick@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69541}
parent d02564fc
...@@ -287,22 +287,22 @@ TNode<RawPtrT> CodeStubAssembler::IntPtrOrSmiConstant<RawPtrT>(int value) { ...@@ -287,22 +287,22 @@ TNode<RawPtrT> CodeStubAssembler::IntPtrOrSmiConstant<RawPtrT>(int value) {
return ReinterpretCast<RawPtrT>(IntPtrConstant(value)); return ReinterpretCast<RawPtrT>(IntPtrConstant(value));
} }
bool CodeStubAssembler::TryGetIntPtrOrSmiConstantValue(Node* maybe_constant, bool CodeStubAssembler::TryGetIntPtrOrSmiConstantValue(
int* value, TNode<Smi> maybe_constant, int* value) {
ParameterMode mode) {
int32_t int32_constant;
if (mode == INTPTR_PARAMETERS) {
if (ToInt32Constant(maybe_constant, &int32_constant)) {
*value = int32_constant;
return true;
}
} else {
DCHECK_EQ(mode, SMI_PARAMETERS);
Smi smi_constant; Smi smi_constant;
if (ToSmiConstant(maybe_constant, &smi_constant)) { if (ToSmiConstant(maybe_constant, &smi_constant)) {
*value = Smi::ToInt(smi_constant); *value = Smi::ToInt(smi_constant);
return true; return true;
} }
return false;
}
bool CodeStubAssembler::TryGetIntPtrOrSmiConstantValue(
TNode<IntPtrT> maybe_constant, int* value) {
int32_t int32_constant;
if (ToInt32Constant(maybe_constant, &int32_constant)) {
*value = int32_constant;
return true;
} }
return false; return false;
} }
...@@ -3883,9 +3883,6 @@ TNode<FixedArray> CodeStubAssembler::ExtractToFixedArray( ...@@ -3883,9 +3883,6 @@ TNode<FixedArray> CodeStubAssembler::ExtractToFixedArray(
} }
} }
const ParameterMode parameter_mode =
std::is_same<TIndex, Smi>::value ? SMI_PARAMETERS : INTPTR_PARAMETERS;
BIND(&new_space_check); BIND(&new_space_check);
{ {
bool handle_old_space = !FLAG_young_generation_large_objects; bool handle_old_space = !FLAG_young_generation_large_objects;
...@@ -3897,8 +3894,7 @@ TNode<FixedArray> CodeStubAssembler::ExtractToFixedArray( ...@@ -3897,8 +3894,7 @@ TNode<FixedArray> CodeStubAssembler::ExtractToFixedArray(
} else { } else {
int constant_count; int constant_count;
handle_old_space = handle_old_space =
!TryGetIntPtrOrSmiConstantValue(count, &constant_count, !TryGetIntPtrOrSmiConstantValue(count, &constant_count) ||
parameter_mode) ||
(constant_count > (constant_count >
FixedArray::GetMaxLengthForNewSpaceAllocation(PACKED_ELEMENTS)); FixedArray::GetMaxLengthForNewSpaceAllocation(PACKED_ELEMENTS));
} }
......
...@@ -548,8 +548,9 @@ class V8_EXPORT_PRIVATE CodeStubAssembler ...@@ -548,8 +548,9 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
template <typename TIndex> template <typename TIndex>
TNode<TIndex> IntPtrOrSmiConstant(int value); TNode<TIndex> IntPtrOrSmiConstant(int value);
bool TryGetIntPtrOrSmiConstantValue(Node* maybe_constant, int* value, bool TryGetIntPtrOrSmiConstantValue(TNode<Smi> maybe_constant, int* value);
ParameterMode mode); bool TryGetIntPtrOrSmiConstantValue(TNode<IntPtrT> maybe_constant,
int* value);
// Round the 32bits payload of the provided word up to the next power of two. // Round the 32bits payload of the provided word up to the next power of two.
TNode<IntPtrT> IntPtrRoundUpToPowerOfTwo32(TNode<IntPtrT> value); TNode<IntPtrT> IntPtrRoundUpToPowerOfTwo32(TNode<IntPtrT> value);
......
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