Commit 0165432e authored by Sigurd Schneider's avatar Sigurd Schneider Committed by Commit Bot

[cleanup] Rename Word to Int32/IntPtr depending on context

Bug: v8:7310
Change-Id: I3b9832c7090d5c4b2f425f85095b0d7bae29fbfd
Reviewed-on: https://chromium-review.googlesource.com/934321
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51519}
parent 97adad01
......@@ -44,7 +44,7 @@ ArgumentsBuiltinsAssembler::GetArgumentsFrameAndCount(Node* function,
Node* formal_parameter_count =
LoadObjectField(shared, SharedFunctionInfo::kFormalParameterCountOffset,
MachineType::Int32());
formal_parameter_count = Word32ToParameter(formal_parameter_count, mode);
formal_parameter_count = Int32ToParameter(formal_parameter_count, mode);
argument_count.Bind(formal_parameter_count);
Node* marker_or_function = LoadBufferObject(
......
......@@ -2185,7 +2185,7 @@ TF_BUILTIN(ArrayFrom, ArrayPopulatorAssembler) {
TF_BUILTIN(ArrayOf, ArrayPopulatorAssembler) {
TNode<Int32T> argc =
UncheckedCast<Int32T>(Parameter(BuiltinDescriptor::kArgumentsCount));
TNode<Smi> length = SmiFromWord32(argc);
TNode<Smi> length = SmiFromInt32(argc);
TNode<Context> context = CAST(Parameter(BuiltinDescriptor::kContext));
......
......@@ -168,7 +168,7 @@ void CallOrConstructBuiltinsAssembler::CallOrConstructWithArrayLike(
Node* elements_length = LoadFixedArrayBaseLength(elements);
GotoIfNot(WordEqual(length, elements_length), &if_runtime);
var_elements.Bind(elements);
var_length.Bind(SmiToWord32(length));
var_length.Bind(SmiToInt32(length));
Goto(&if_done);
}
......
......@@ -2157,7 +2157,7 @@ void WeakCollectionsBuiltinsAssembler::AddEntry(
// See HashTableBase::ElementAdded().
StoreFixedArrayElement(table, ObjectHashTable::kNumberOfElementsIndex,
SmiFromWord(number_of_elements), SKIP_WRITE_BARRIER);
SmiFromIntPtr(number_of_elements), SKIP_WRITE_BARRIER);
}
TNode<Object> WeakCollectionsBuiltinsAssembler::AllocateTable(
......@@ -2181,7 +2181,7 @@ TNode<Object> WeakCollectionsBuiltinsAssembler::AllocateTable(
StoreFixedArrayElement(table, ObjectHashTable::kNumberOfDeletedElementsIndex,
SmiConstant(0), SKIP_WRITE_BARRIER);
StoreFixedArrayElement(table, ObjectHashTable::kCapacityIndex,
SmiFromWord(capacity), SKIP_WRITE_BARRIER);
SmiFromIntPtr(capacity), SKIP_WRITE_BARRIER);
TNode<IntPtrT> start = KeyIndexFromEntry(IntPtrConstant(0));
FillFixedArrayWithValue(HOLEY_ELEMENTS, table, start, length,
......@@ -2323,9 +2323,9 @@ void WeakCollectionsBuiltinsAssembler::RemoveEntry(
// See HashTableBase::ElementRemoved().
TNode<IntPtrT> number_of_deleted = LoadNumberOfDeleted(table, 1);
StoreFixedArrayElement(table, ObjectHashTable::kNumberOfElementsIndex,
SmiFromWord(number_of_elements), SKIP_WRITE_BARRIER);
SmiFromIntPtr(number_of_elements), SKIP_WRITE_BARRIER);
StoreFixedArrayElement(table, ObjectHashTable::kNumberOfDeletedElementsIndex,
SmiFromWord(number_of_deleted), SKIP_WRITE_BARRIER);
SmiFromIntPtr(number_of_deleted), SKIP_WRITE_BARRIER);
}
TNode<BoolT> WeakCollectionsBuiltinsAssembler::ShouldRehash(
......
......@@ -409,7 +409,7 @@ Node* ConstructorBuiltinsAssembler::EmitCreateEmptyArrayLiteral(
BIND(&create_empty_array);
CSA_ASSERT(this, IsAllocationSite(allocation_site.value()));
Node* kind = SmiToWord32(CAST(
Node* kind = SmiToInt32(CAST(
LoadObjectField(allocation_site.value(),
AllocationSite::kTransitionInfoOrBoilerplateOffset)));
CSA_ASSERT(this, IsFastElementsKind(kind));
......
......@@ -73,8 +73,8 @@ TF_BUILTIN(GrowFastSmiOrObjectElements, CodeStubAssembler) {
TF_BUILTIN(NewArgumentsElements, CodeStubAssembler) {
Node* frame = Parameter(Descriptor::kFrame);
Node* length = SmiToWord(Parameter(Descriptor::kLength));
Node* mapped_count = SmiToWord(Parameter(Descriptor::kMappedCount));
Node* length = SmiToIntPtr(Parameter(Descriptor::kLength));
Node* mapped_count = SmiToIntPtr(Parameter(Descriptor::kMappedCount));
// Check if we can allocate in new space.
ElementsKind kind = PACKED_ELEMENTS;
......@@ -164,8 +164,8 @@ TF_BUILTIN(NewArgumentsElements, CodeStubAssembler) {
{
// Allocate in old space (or large object space).
TailCallRuntime(Runtime::kNewArgumentsElements, NoContextConstant(),
BitcastWordToTagged(frame), SmiFromWord(length),
SmiFromWord(mapped_count));
BitcastWordToTagged(frame), SmiFromIntPtr(length),
SmiFromIntPtr(mapped_count));
}
}
......@@ -202,7 +202,7 @@ class RecordWriteCodeStubAssembler : public CodeStubAssembler {
Node* mask;
GetMarkBit(object, &cell, &mask);
mask = TruncateWordToWord32(mask);
mask = TruncateIntPtrToInt32(mask);
Node* bits = Load(MachineType::Int32(), cell);
Node* bit_0 = Word32And(bits, mask);
......@@ -239,7 +239,7 @@ class RecordWriteCodeStubAssembler : public CodeStubAssembler {
Node* cell;
Node* mask;
GetMarkBit(object, &cell, &mask);
mask = TruncateWordToWord32(mask);
mask = TruncateIntPtrToInt32(mask);
// Non-white has 1 for the first bit, so we only need to check for the first
// bit.
return Word32Equal(Word32And(Load(MachineType::Int32(), cell), mask),
......
......@@ -268,7 +268,7 @@ TF_BUILTIN(MathClz32, CodeStubAssembler) {
BIND(&if_xissmi);
{
var_clz32_x.Bind(SmiToWord32(x));
var_clz32_x.Bind(SmiToInt32(x));
Goto(&do_clz32);
}
......
......@@ -906,8 +906,8 @@ TF_BUILTIN(Divide, NumberBuiltinsAssembler) {
}
BIND(&dividend_is_not_zero);
Node* untagged_divisor = SmiToWord32(divisor);
Node* untagged_dividend = SmiToWord32(dividend);
Node* untagged_divisor = SmiToInt32(divisor);
Node* untagged_dividend = SmiToInt32(dividend);
// Do floating point division if {dividend} is kMinInt (or kMinInt - 1
// if the Smi size is 31) and {divisor} is -1.
......@@ -931,7 +931,7 @@ TF_BUILTIN(Divide, NumberBuiltinsAssembler) {
Node* truncated = Int32Mul(untagged_result, untagged_divisor);
// Do floating point division if the remainder is not 0.
GotoIf(Word32NotEqual(untagged_dividend, truncated), &bailout);
Return(SmiFromWord32(untagged_result));
Return(SmiFromInt32(untagged_result));
// Bailout: convert {dividend} and {divisor} to double and do double
// division.
......
......@@ -312,7 +312,7 @@ TNode<JSArray> ObjectEntriesValuesBuiltinsAssembler::FastGetOwnValuesOrEntries(
// so, map will not be changed.
CSA_ASSERT(this, WordEqual(map, LoadMap(object)));
TNode<Uint32T> descriptor_index = TNode<Uint32T>::UncheckedCast(
TruncateWordToWord32(var_descriptor_number.value()));
TruncateIntPtrToInt32(var_descriptor_number.value()));
Node* next_key = DescriptorArrayGetKey(descriptors, descriptor_index);
// Skip Symbols.
......@@ -332,7 +332,7 @@ TNode<JSArray> ObjectEntriesValuesBuiltinsAssembler::FastGetOwnValuesOrEntries(
VARIABLE(var_property_value, MachineRepresentation::kTagged,
UndefinedConstant());
Node* descriptor_name_index = DescriptorArrayToKeyIndex(
TruncateWordToWord32(var_descriptor_number.value()));
TruncateIntPtrToInt32(var_descriptor_number.value()));
// Let value be ? Get(O, key).
LoadPropertyFromFastObject(object, map, descriptors,
......
......@@ -236,7 +236,7 @@ Node* PromiseBuiltinsAssembler::IsPromiseStatus(
Node* PromiseBuiltinsAssembler::PromiseStatus(Node* promise) {
STATIC_ASSERT(JSPromise::kStatusShift == 0);
Node* const flags = LoadObjectField(promise, JSPromise::kFlagsOffset);
return Word32And(SmiToWord32(flags), Int32Constant(JSPromise::kStatusMask));
return Word32And(SmiToInt32(flags), Int32Constant(JSPromise::kStatusMask));
}
void PromiseBuiltinsAssembler::PromiseSetStatus(
......
......@@ -468,7 +468,7 @@ Node* RegExpBuiltinsAssembler::RegExpExecInternal(Node* const context,
// Argument 1: Previous index.
MachineType arg1_type = type_int32;
Node* const arg1 = TruncateWordToWord32(int_last_index);
Node* const arg1 = TruncateIntPtrToInt32(int_last_index);
// Argument 2: Start of string data.
MachineType arg2_type = type_ptr;
......@@ -575,7 +575,7 @@ Node* RegExpBuiltinsAssembler::RegExpExecInternal(Node* const context,
[=, &var_to_offset](Node* offset) {
Node* const value = Load(MachineType::Int32(),
static_offsets_vector_address, offset);
Node* const smi_value = SmiFromWord32(value);
Node* const smi_value = SmiFromInt32(value);
StoreNoWriteBarrier(MachineRepresentation::kTagged, match_info,
var_to_offset.value(), smi_value);
Increment(&var_to_offset, kPointerSize);
......@@ -1452,7 +1452,7 @@ Node* RegExpBuiltinsAssembler::FastFlagGetter(Node* const regexp,
JSRegExp::Flag flag) {
Node* const flags = LoadObjectField(regexp, JSRegExp::kFlagsOffset);
Node* const mask = SmiConstant(flag);
return SmiToWord32(SmiAnd(flags, mask));
return SmiToInt32(SmiAnd(flags, mask));
}
// Load through the GetProperty stub.
......
......@@ -96,7 +96,7 @@ Node* SharedArrayBufferBuiltinsAssembler::ConvertTaggedAtomicIndexToWord32(
// don't currently have a TF implementation and forward to runtime functions
// instead; they expect the value has already been coerced to an integer.
*number_index = ToSmiIndex(CAST(tagged), CAST(context), &range_error);
var_result.Bind(SmiToWord32(*number_index));
var_result.Bind(SmiToInt32(*number_index));
Goto(&done);
BIND(&range_error);
......@@ -164,20 +164,20 @@ TF_BUILTIN(AtomicsLoad, SharedArrayBufferBuiltinsAssembler) {
arraysize(case_labels));
BIND(&i8);
Return(SmiFromWord32(
AtomicLoad(MachineType::Int8(), backing_store, index_word)));
Return(
SmiFromInt32(AtomicLoad(MachineType::Int8(), backing_store, index_word)));
BIND(&u8);
Return(SmiFromWord32(
Return(SmiFromInt32(
AtomicLoad(MachineType::Uint8(), backing_store, index_word)));
BIND(&i16);
Return(SmiFromWord32(
Return(SmiFromInt32(
AtomicLoad(MachineType::Int16(), backing_store, WordShl(index_word, 1))));
BIND(&u16);
Return(SmiFromWord32(AtomicLoad(MachineType::Uint16(), backing_store,
WordShl(index_word, 1))));
Return(SmiFromInt32(AtomicLoad(MachineType::Uint16(), backing_store,
WordShl(index_word, 1))));
BIND(&i32);
Return(ChangeInt32ToTagged(
......@@ -288,20 +288,20 @@ TF_BUILTIN(AtomicsExchange, SharedArrayBufferBuiltinsAssembler) {
arraysize(case_labels));
BIND(&i8);
Return(SmiFromWord32(AtomicExchange(MachineType::Int8(), backing_store,
index_word, value_word32)));
Return(SmiFromInt32(AtomicExchange(MachineType::Int8(), backing_store,
index_word, value_word32)));
BIND(&u8);
Return(SmiFromWord32(AtomicExchange(MachineType::Uint8(), backing_store,
index_word, value_word32)));
Return(SmiFromInt32(AtomicExchange(MachineType::Uint8(), backing_store,
index_word, value_word32)));
BIND(&i16);
Return(SmiFromWord32(AtomicExchange(MachineType::Int16(), backing_store,
WordShl(index_word, 1), value_word32)));
Return(SmiFromInt32(AtomicExchange(MachineType::Int16(), backing_store,
WordShl(index_word, 1), value_word32)));
BIND(&u16);
Return(SmiFromWord32(AtomicExchange(MachineType::Uint16(), backing_store,
WordShl(index_word, 1), value_word32)));
Return(SmiFromInt32(AtomicExchange(MachineType::Uint16(), backing_store,
WordShl(index_word, 1), value_word32)));
BIND(&i32);
Return(ChangeInt32ToTagged(AtomicExchange(MachineType::Int32(), backing_store,
......@@ -366,22 +366,22 @@ TF_BUILTIN(AtomicsCompareExchange, SharedArrayBufferBuiltinsAssembler) {
arraysize(case_labels));
BIND(&i8);
Return(SmiFromWord32(AtomicCompareExchange(MachineType::Int8(), backing_store,
index_word, old_value_word32,
new_value_word32)));
Return(SmiFromInt32(AtomicCompareExchange(MachineType::Int8(), backing_store,
index_word, old_value_word32,
new_value_word32)));
BIND(&u8);
Return(SmiFromWord32(
AtomicCompareExchange(MachineType::Uint8(), backing_store, index_word,
old_value_word32, new_value_word32)));
Return(SmiFromInt32(AtomicCompareExchange(MachineType::Uint8(), backing_store,
index_word, old_value_word32,
new_value_word32)));
BIND(&i16);
Return(SmiFromWord32(AtomicCompareExchange(
Return(SmiFromInt32(AtomicCompareExchange(
MachineType::Int16(), backing_store, WordShl(index_word, 1),
old_value_word32, new_value_word32)));
BIND(&u16);
Return(SmiFromWord32(AtomicCompareExchange(
Return(SmiFromInt32(AtomicCompareExchange(
MachineType::Uint16(), backing_store, WordShl(index_word, 1),
old_value_word32, new_value_word32)));
......@@ -463,22 +463,20 @@ void SharedArrayBufferBuiltinsAssembler::AtomicBinopBuiltinCommon(
arraysize(case_labels));
BIND(&i8);
Return(SmiFromWord32((this->*function)(MachineType::Int8(), backing_store,
index_word, value_word32)));
Return(SmiFromInt32((this->*function)(MachineType::Int8(), backing_store,
index_word, value_word32)));
BIND(&u8);
Return(SmiFromWord32((this->*function)(MachineType::Uint8(), backing_store,
index_word, value_word32)));
Return(SmiFromInt32((this->*function)(MachineType::Uint8(), backing_store,
index_word, value_word32)));
BIND(&i16);
Return(
SmiFromWord32((this->*function)(MachineType::Int16(), backing_store,
WordShl(index_word, 1), value_word32)));
Return(SmiFromInt32((this->*function)(MachineType::Int16(), backing_store,
WordShl(index_word, 1), value_word32)));
BIND(&u16);
Return(
SmiFromWord32((this->*function)(MachineType::Uint16(), backing_store,
WordShl(index_word, 1), value_word32)));
Return(SmiFromInt32((this->*function)(MachineType::Uint16(), backing_store,
WordShl(index_word, 1), value_word32)));
BIND(&i32);
Return(ChangeInt32ToTagged(
......
......@@ -539,7 +539,7 @@ TF_BUILTIN(StringCodePointAtUTF16, StringBuiltinsAssembler) {
LoadSurrogatePairAt(receiver, length, position, UnicodeEncoding::UTF16);
// And return it as TaggedSigned value.
// TODO(turbofan): Allow builtins to return values untagged.
TNode<Smi> result = SmiFromWord32(code);
TNode<Smi> result = SmiFromInt32(code);
Return(result);
}
......@@ -554,7 +554,7 @@ TF_BUILTIN(StringCodePointAtUTF32, StringBuiltinsAssembler) {
LoadSurrogatePairAt(receiver, length, position, UnicodeEncoding::UTF32);
// And return it as TaggedSigned value.
// TODO(turbofan): Allow builtins to return values untagged.
TNode<Smi> result = SmiFromWord32(code);
TNode<Smi> result = SmiFromInt32(code);
Return(result);
}
......@@ -697,7 +697,7 @@ TF_BUILTIN(StringPrototypeCharCodeAt, StringBuiltinsAssembler) {
[this](TNode<String> receiver, TNode<IntPtrT> length,
TNode<IntPtrT> index) {
Node* value = StringCharCodeAt(receiver, index);
return SmiFromWord32(value);
return SmiFromInt32(value);
});
}
......@@ -715,7 +715,7 @@ TF_BUILTIN(StringPrototypeCodePointAt, StringBuiltinsAssembler) {
// so we need to produce UTF32.
Node* value = LoadSurrogatePairAt(receiver, length, index,
UnicodeEncoding::UTF32);
return SmiFromWord32(value);
return SmiFromInt32(value);
});
}
......@@ -1258,7 +1258,7 @@ TF_BUILTIN(StringRepeat, StringBuiltinsAssembler) {
{
{
Label next(this);
GotoIfNot(SmiToWord32(SmiAnd(var_count.value(), SmiConstant(1))), &next);
GotoIfNot(SmiToInt32(SmiAnd(var_count.value(), SmiConstant(1))), &next);
var_result.Bind(CallStub(stringadd_callable, context, var_result.value(),
var_temp.value()));
Goto(&next);
......@@ -1590,8 +1590,8 @@ class StringPadAssembler : public StringBuiltinsAssembler {
BIND(&multi_char_fill);
{
TNode<Int32T> const fill_length_word32 =
TruncateWordToWord32(var_fill_length.value());
TNode<Int32T> const pad_length_word32 = SmiToWord32(pad_length);
TruncateIntPtrToInt32(var_fill_length.value());
TNode<Int32T> const pad_length_word32 = SmiToInt32(pad_length);
TNode<Int32T> const repetitions_word32 =
Int32Div(pad_length_word32, fill_length_word32);
TNode<Int32T> const remaining_word32 =
......@@ -1599,13 +1599,13 @@ class StringPadAssembler : public StringBuiltinsAssembler {
var_pad.Bind(CallBuiltin(Builtins::kStringRepeat, context,
var_fill_string.value(),
SmiFromWord32(repetitions_word32)));
SmiFromInt32(repetitions_word32)));
GotoIfNot(remaining_word32, &return_result);
{
Node* const remainder_string = CallBuiltin(
Builtins::kSubString, context, var_fill_string.value(),
SmiConstant(0), SmiFromWord32(remaining_word32));
SmiConstant(0), SmiFromInt32(remaining_word32));
var_pad.Bind(CallStub(stringadd_callable, context, var_pad.value(),
remainder_string));
Goto(&return_result);
......
......@@ -150,7 +150,7 @@ TF_BUILTIN(TypedArrayInitialize, TypedArrayBuiltinsAssembler) {
GotoIf(
SmiGreaterThan(byte_length, SmiConstant(V8_TYPED_ARRAY_MAX_SIZE_IN_HEAP)),
&allocate_off_heap);
TNode<IntPtrT> word_byte_length = SmiToWord(CAST(byte_length));
TNode<IntPtrT> word_byte_length = SmiToIntPtr(CAST(byte_length));
Goto(&allocate_on_heap);
BIND(&allocate_on_heap);
......@@ -1297,11 +1297,11 @@ TF_BUILTIN(TypedArrayPrototypeSlice, TypedArrayBuiltinsAssembler) {
TNode<IntPtrT> source_el_size = GetTypedArrayElementSize(source_el_kind);
TNode<IntPtrT> source_start_bytes =
IntPtrMul(SmiToWord(start_index), source_el_size);
IntPtrMul(SmiToIntPtr(start_index), source_el_size);
TNode<IntPtrT> source_start =
IntPtrAdd(source_data_ptr, source_start_bytes);
TNode<IntPtrT> count_bytes = IntPtrMul(SmiToWord(count), source_el_size);
TNode<IntPtrT> count_bytes = IntPtrMul(SmiToIntPtr(count), source_el_size);
#ifdef DEBUG
TNode<IntPtrT> target_byte_length =
......@@ -1326,7 +1326,7 @@ TF_BUILTIN(TypedArrayPrototypeSlice, TypedArrayBuiltinsAssembler) {
&if_bigint_mixed_types);
CallCCopyTypedArrayElementsSlice(
source, result_array, SmiToWord(start_index), SmiToWord(end_index));
source, result_array, SmiToIntPtr(start_index), SmiToIntPtr(end_index));
args.PopAndReturn(result_array);
}
......@@ -1397,7 +1397,7 @@ TF_BUILTIN(TypedArrayPrototypeSubArray, TypedArrayBuiltinsAssembler) {
LoadObjectField<Number>(source, JSTypedArray::kByteOffsetOffset);
// 15. Let beginByteOffset be srcByteOffset + beginIndex × elementSize.
TNode<Number> offset = SmiMul(var_begin.value(), SmiFromWord(element_size));
TNode<Number> offset = SmiMul(var_begin.value(), SmiFromIntPtr(element_size));
TNode<Number> begin_byte_offset = NumberAdd(source_byte_offset, offset);
// 16. Let argumentsList be « buffer, beginByteOffset, newLength ».
......
This diff is collapsed.
......@@ -126,18 +126,18 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
return ParameterRepresentation(OptimalParameterMode());
}
Node* ParameterToWord(Node* value, ParameterMode mode) {
Node* ParameterToIntPtr(Node* value, ParameterMode mode) {
if (mode == SMI_PARAMETERS) value = SmiUntag(value);
return value;
}
Node* WordToParameter(SloppyTNode<IntPtrT> value, ParameterMode mode) {
Node* IntPtrToParameter(SloppyTNode<IntPtrT> value, ParameterMode mode) {
if (mode == SMI_PARAMETERS) return SmiTag(value);
return value;
}
Node* Word32ToParameter(SloppyTNode<Int32T> value, ParameterMode mode) {
return WordToParameter(ChangeInt32ToIntPtr(value), mode);
Node* Int32ToParameter(SloppyTNode<Int32T> value, ParameterMode mode) {
return IntPtrToParameter(ChangeInt32ToIntPtr(value), mode);
}
TNode<Smi> ParameterToTagged(Node* value, ParameterMode mode) {
......@@ -223,17 +223,17 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
TNode<Smi> ConvertToRelativeIndex(TNode<Context> context, TNode<Object> index,
TNode<Smi> length);
// Tag a Word as a Smi value.
// Tag an IntPtr as a Smi value.
TNode<Smi> SmiTag(SloppyTNode<IntPtrT> value);
// Untag a Smi value as a Word.
// Untag a Smi value as an IntPtr.
TNode<IntPtrT> SmiUntag(SloppyTNode<Smi> value);
// Smi conversions.
TNode<Float64T> SmiToFloat64(SloppyTNode<Smi> value);
TNode<Smi> SmiFromWord(SloppyTNode<IntPtrT> value) { return SmiTag(value); }
TNode<Smi> SmiFromWord32(SloppyTNode<Int32T> value);
TNode<IntPtrT> SmiToWord(SloppyTNode<Smi> value) { return SmiUntag(value); }
TNode<Int32T> SmiToWord32(SloppyTNode<Smi> value);
TNode<Smi> SmiFromIntPtr(SloppyTNode<IntPtrT> value) { return SmiTag(value); }
TNode<Smi> SmiFromInt32(SloppyTNode<Int32T> value);
TNode<IntPtrT> SmiToIntPtr(SloppyTNode<Smi> value) { return SmiUntag(value); }
TNode<Int32T> SmiToInt32(SloppyTNode<Smi> value);
// Smi operations.
#define SMI_ARITHMETIC_BINOP(SmiOpName, IntPtrOpName) \
......@@ -396,7 +396,7 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
Smi::FromInt(false_value));
}
TNode<Int32T> TruncateWordToWord32(SloppyTNode<IntPtrT> value);
TNode<Int32T> TruncateIntPtrToInt32(SloppyTNode<IntPtrT> value);
// Check a value for smi-ness
TNode<BoolT> TaggedIsSmi(SloppyTNode<Object> a);
......@@ -1342,7 +1342,7 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
template <typename BitField>
TNode<Uint32T> DecodeWord32FromWord(SloppyTNode<WordT> word) {
return UncheckedCast<Uint32T>(
TruncateWordToWord32(Signed(DecodeWord<BitField>(word))));
TruncateIntPtrToInt32(Signed(DecodeWord<BitField>(word))));
}
// Decodes an unsigned (!) value from |word32| to an uint32 node.
......@@ -2242,15 +2242,15 @@ class ToDirectStringAssembler : public CodeStubAssembler {
EXPAND(CSA_ASSERT_GET_FIRST_STR(__VA_ARGS__)), __FILE__, \
__LINE__, CSA_ASSERT_STRINGIFY_EXTRA_VALUES(__VA_ARGS__))
#define CSA_ASSERT_JS_ARGC_OP(csa, Op, op, expected) \
(csa)->Assert( \
[&]() -> compiler::Node* { \
compiler::Node* const argc = \
(csa)->Parameter(Descriptor::kActualArgumentsCount); \
return (csa)->Op(argc, (csa)->Int32Constant(expected)); \
}, \
"argc " #op " " #expected, __FILE__, __LINE__, \
SmiFromWord32((csa)->Parameter(Descriptor::kActualArgumentsCount)), \
#define CSA_ASSERT_JS_ARGC_OP(csa, Op, op, expected) \
(csa)->Assert( \
[&]() -> compiler::Node* { \
compiler::Node* const argc = \
(csa)->Parameter(Descriptor::kActualArgumentsCount); \
return (csa)->Op(argc, (csa)->Int32Constant(expected)); \
}, \
"argc " #op " " #expected, __FILE__, __LINE__, \
SmiFromInt32((csa)->Parameter(Descriptor::kActualArgumentsCount)), \
"argc")
#define CSA_ASSERT_JS_ARGC_EQ(csa, expected) \
......
......@@ -1350,7 +1350,7 @@ void AccessorAssembler::ExtendPropertiesBackingStore(Node* object,
BIND(&if_smi_hash);
{
Node* hash = SmiToWord32(properties);
Node* hash = SmiToInt32(properties);
Node* encoded_hash =
Word32Shl(hash, Int32Constant(PropertyArray::HashField::kShift));
var_encoded_hash.Bind(encoded_hash);
......@@ -1368,7 +1368,7 @@ void AccessorAssembler::ExtendPropertiesBackingStore(Node* object,
Node* length_intptr = ChangeInt32ToIntPtr(
Word32And(length_and_hash_int32,
Int32Constant(PropertyArray::LengthField::kMask)));
Node* length = WordToParameter(length_intptr, mode);
Node* length = IntPtrToParameter(length_intptr, mode);
var_length.Bind(length);
Goto(&extend_store);
}
......@@ -1412,11 +1412,11 @@ void AccessorAssembler::ExtendPropertiesBackingStore(Node* object,
// TODO(gsathya): Clean up the type conversions by creating smarter
// helpers that do the correct op based on the mode.
Node* new_capacity_int32 =
TruncateWordToWord32(ParameterToWord(new_capacity, mode));
TruncateIntPtrToInt32(ParameterToIntPtr(new_capacity, mode));
Node* new_length_and_hash_int32 =
Word32Or(var_encoded_hash.value(), new_capacity_int32);
StoreObjectField(new_properties, PropertyArray::kLengthAndHashOffset,
SmiFromWord32(new_length_and_hash_int32));
SmiFromInt32(new_length_and_hash_int32));
StoreObjectField(object, JSObject::kPropertiesOrHashOffset, new_properties);
Comment("] Extend storage");
Goto(&done);
......@@ -1641,27 +1641,27 @@ void AccessorAssembler::EmitElementLoad(
{
Comment("UINT8_ELEMENTS"); // Handles UINT8_CLAMPED_ELEMENTS too.
Node* element = Load(MachineType::Uint8(), backing_store, intptr_index);
exit_point->Return(SmiFromWord32(element));
exit_point->Return(SmiFromInt32(element));
}
BIND(&int8_elements);
{
Comment("INT8_ELEMENTS");
Node* element = Load(MachineType::Int8(), backing_store, intptr_index);
exit_point->Return(SmiFromWord32(element));
exit_point->Return(SmiFromInt32(element));
}
BIND(&uint16_elements);
{
Comment("UINT16_ELEMENTS");
Node* index = WordShl(intptr_index, IntPtrConstant(1));
Node* element = Load(MachineType::Uint16(), backing_store, index);
exit_point->Return(SmiFromWord32(element));
exit_point->Return(SmiFromInt32(element));
}
BIND(&int16_elements);
{
Comment("INT16_ELEMENTS");
Node* index = WordShl(intptr_index, IntPtrConstant(1));
Node* element = Load(MachineType::Int16(), backing_store, index);
exit_point->Return(SmiFromWord32(element));
exit_point->Return(SmiFromInt32(element));
}
BIND(&uint32_elements);
{
......@@ -1726,13 +1726,13 @@ void AccessorAssembler::BranchIfStrictMode(Node* vector, Node* slot,
LoadObjectField(vector, FeedbackVector::kSharedFunctionInfoOffset);
Node* metadata =
LoadObjectField(sfi, SharedFunctionInfo::kFeedbackMetadataOffset);
Node* slot_int = SmiToWord32(slot);
Node* slot_int = SmiToInt32(slot);
// See VectorICComputer::index().
const int kItemsPerWord = FeedbackMetadata::VectorICComputer::kItemsPerWord;
Node* word_index = Int32Div(slot_int, Int32Constant(kItemsPerWord));
Node* word_offset = Int32Mod(slot_int, Int32Constant(kItemsPerWord));
Node* data = SmiToWord32(LoadFixedArrayElement(
Node* data = SmiToInt32(LoadFixedArrayElement(
metadata, ChangeInt32ToIntPtr(word_index),
FeedbackMetadata::kReservedIndexCount * kPointerSize, INTPTR_PARAMETERS));
// See VectorICComputer::decode().
......@@ -2017,7 +2017,7 @@ Node* AccessorAssembler::StubCachePrimaryOffset(Node* name, Node* map) {
// Using only the low bits in 64-bit mode is unlikely to increase the
// risk of collision even if the heap is spread over an area larger than
// 4Gb (and not at all if it isn't).
Node* map32 = TruncateWordToWord32(BitcastTaggedToWord(map));
Node* map32 = TruncateIntPtrToInt32(BitcastTaggedToWord(map));
// Base the offset on a simple combination of name and map.
Node* hash = Int32Add(hash_field, map32);
uint32_t mask = (StubCache::kPrimaryTableSize - 1)
......@@ -2029,8 +2029,8 @@ Node* AccessorAssembler::StubCacheSecondaryOffset(Node* name, Node* seed) {
// See v8::internal::StubCache::SecondaryOffset().
// Use the seed from the primary cache in the secondary cache.
Node* name32 = TruncateWordToWord32(BitcastTaggedToWord(name));
Node* hash = Int32Sub(TruncateWordToWord32(seed), name32);
Node* name32 = TruncateIntPtrToInt32(BitcastTaggedToWord(name));
Node* hash = Int32Sub(TruncateIntPtrToInt32(seed), name32);
hash = Int32Add(hash, Int32Constant(StubCache::kSecondaryMagic));
int32_t mask = (StubCache::kSecondaryTableSize - 1)
<< StubCache::kCacheIndexShift;
......
......@@ -581,7 +581,7 @@ Node* InterpreterAssembler::BytecodeOperandUImmWord(int operand_index) {
}
Node* InterpreterAssembler::BytecodeOperandUImmSmi(int operand_index) {
return SmiFromWord32(BytecodeOperandUImm(operand_index));
return SmiFromInt32(BytecodeOperandUImm(operand_index));
}
Node* InterpreterAssembler::BytecodeOperandImm(int operand_index) {
......@@ -597,7 +597,7 @@ Node* InterpreterAssembler::BytecodeOperandImmIntPtr(int operand_index) {
}
Node* InterpreterAssembler::BytecodeOperandImmSmi(int operand_index) {
return SmiFromWord32(BytecodeOperandImm(operand_index));
return SmiFromInt32(BytecodeOperandImm(operand_index));
}
Node* InterpreterAssembler::BytecodeOperandIdxInt32(int operand_index) {
......@@ -1321,7 +1321,7 @@ Node* InterpreterAssembler::Advance(Node* delta, bool backward) {
Node* InterpreterAssembler::Jump(Node* delta, bool backward) {
DCHECK(!Bytecodes::IsStarLookahead(bytecode_, operand_scale_));
UpdateInterruptBudget(TruncateWordToWord32(delta), backward);
UpdateInterruptBudget(TruncateIntPtrToInt32(delta), backward);
Node* new_bytecode_offset = Advance(delta, backward);
Node* target_bytecode = LoadBytecode(new_bytecode_offset);
return DispatchToBytecode(target_bytecode, new_bytecode_offset);
......@@ -1500,7 +1500,7 @@ void InterpreterAssembler::UpdateInterruptBudgetOnReturn() {
// of the first bytecode.
const int kFirstBytecodeOffset = BytecodeArray::kHeaderSize - kHeapObjectTag;
Node* profiling_weight = Int32Sub(TruncateWordToWord32(BytecodeOffset()),
Node* profiling_weight = Int32Sub(TruncateIntPtrToInt32(BytecodeOffset()),
Int32Constant(kFirstBytecodeOffset));
UpdateInterruptBudget(profiling_weight, true);
}
......
......@@ -618,7 +618,7 @@ IGNITION_HANDLER(StaDataPropertyInLiteral, InterpreterAssembler) {
Node* object = LoadRegisterAtOperandIndex(0);
Node* name = LoadRegisterAtOperandIndex(1);
Node* value = GetAccumulator();
Node* flags = SmiFromWord32(BytecodeOperandFlag(2));
Node* flags = SmiFromInt32(BytecodeOperandFlag(2));
Node* vector_index = SmiTag(BytecodeOperandIdx(3));
Node* feedback_vector = LoadFeedbackVector();
......@@ -942,7 +942,7 @@ class InterpreterBitwiseBinaryOpAssembler : public InterpreterAssembler {
&var_left_bigint, &var_left_feedback);
BIND(&do_smi_op);
Node* result =
BitwiseOp(var_left_word32.value(), SmiToWord32(right), bitwise_op);
BitwiseOp(var_left_word32.value(), SmiToInt32(right), bitwise_op);
Node* result_type = SelectSmiConstant(TaggedIsSmi(result),
BinaryOperationFeedback::kSignedSmall,
BinaryOperationFeedback::kNumber);
......@@ -2300,7 +2300,7 @@ IGNITION_HANDLER(CreateRegExpLiteral, InterpreterAssembler) {
Node* pattern = LoadConstantPoolEntryAtOperandIndex(0);
Node* feedback_vector = LoadFeedbackVector();
Node* slot_id = BytecodeOperandIdx(1);
Node* flags = SmiFromWord32(BytecodeOperandFlag(2));
Node* flags = SmiFromInt32(BytecodeOperandFlag(2));
Node* context = GetContext();
ConstructorBuiltinsAssembler constructor_assembler(state());
Node* result = constructor_assembler.EmitCreateRegExpLiteral(
......
......@@ -33,7 +33,7 @@ Node* UndefinedConstant(CodeAssembler& m) {
return m.LoadRoot(Heap::kUndefinedValueRootIndex);
}
Node* SmiFromWord32(CodeAssembler& m, Node* value) {
Node* SmiFromInt32(CodeAssembler& m, Node* value) {
value = m.ChangeInt32ToIntPtr(value);
return m.BitcastWordToTaggedSigned(
m.WordShl(value, kSmiShiftSize + kSmiTagSize));
......@@ -505,7 +505,7 @@ TEST(GotoIfExceptionMultiple) {
error.Bind(UndefinedConstant(m));
string = m.CallStub(to_string, context, second_value);
m.GotoIfException(string, &exception_handler2, &error);
m.Return(SmiFromWord32(m, return_value.value()));
m.Return(SmiFromInt32(m, return_value.value()));
// try { ToString(param3); return 7 & ~2; } catch (e) { return e; }
m.Bind(&exception_handler2);
......@@ -513,7 +513,7 @@ TEST(GotoIfExceptionMultiple) {
error.Bind(UndefinedConstant(m));
string = m.CallStub(to_string, context, third_value);
m.GotoIfException(string, &exception_handler3, &error);
m.Return(SmiFromWord32(
m.Return(SmiFromInt32(
m, m.Word32And(return_value.value(),
m.Word32Xor(m.Int32Constant(2), m.Int32Constant(-1)))));
......
......@@ -125,7 +125,7 @@ Handle<Code> BuildSetupFunction(Isolate* isolate,
tester.raw_assembler_for_testing()->machine()->I32x4Splat(),
__ Int32Constant(0));
for (int lane = 0; lane < 4; lane++) {
Node* lane_value = __ SmiToWord32(
Node* lane_value = __ SmiToInt32(
__ LoadFixedArrayElement(element, __ IntPtrConstant(lane)));
vector = tester.raw_assembler_for_testing()->AddNode(
tester.raw_assembler_for_testing()->machine()->I32x4ReplaceLane(
......@@ -216,7 +216,7 @@ Handle<Code> BuildTeardownFunction(Isolate* isolate,
Node* vector = __ LoadFixedArrayElement(result_array, i);
for (int lane = 0; lane < 4; lane++) {
Node* lane_value =
__ SmiFromWord32(tester.raw_assembler_for_testing()->AddNode(
__ SmiFromInt32(tester.raw_assembler_for_testing()->AddNode(
tester.raw_assembler_for_testing()
->machine()
->I32x4ExtractLane(lane),
......
......@@ -212,7 +212,7 @@ TEST(LoadHeapNumberValue) {
CodeAssemblerTester asm_tester(isolate);
CodeStubAssembler m(asm_tester.state());
Handle<HeapNumber> number = isolate->factory()->NewHeapNumber(1234);
m.Return(m.SmiFromWord32(m.Signed(
m.Return(m.SmiFromInt32(m.Signed(
m.ChangeFloat64ToUint32(m.LoadHeapNumberValue(m.HeapConstant(number))))));
FunctionTester ft(asm_tester.GenerateCode());
MaybeHandle<Object> result = ft.Call();
......@@ -224,7 +224,7 @@ TEST(LoadInstanceType) {
CodeAssemblerTester asm_tester(isolate);
CodeStubAssembler m(asm_tester.state());
Handle<HeapObject> undefined = isolate->factory()->undefined_value();
m.Return(m.SmiFromWord32(m.LoadInstanceType(m.HeapConstant(undefined))));
m.Return(m.SmiFromInt32(m.LoadInstanceType(m.HeapConstant(undefined))));
FunctionTester ft(asm_tester.GenerateCode());
MaybeHandle<Object> result = ft.Call();
CHECK_EQ(InstanceType::ODDBALL_TYPE,
......@@ -252,8 +252,8 @@ TEST(JSFunction) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeStubAssembler m(asm_tester.state());
m.Return(m.SmiFromWord32(m.Int32Add(m.SmiToWord32(m.Parameter(1)),
m.SmiToWord32(m.Parameter(2)))));
m.Return(m.SmiFromInt32(
m.Int32Add(m.SmiToInt32(m.Parameter(1)), m.SmiToInt32(m.Parameter(2)))));
FunctionTester ft(asm_tester.GenerateCode(), kNumParams);
......@@ -268,8 +268,8 @@ TEST(ComputeIntegerHash) {
const int kNumParams = 2;
CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeStubAssembler m(asm_tester.state());
m.Return(m.SmiFromWord32(m.ComputeIntegerHash(
m.SmiUntag(m.Parameter(0)), m.SmiToWord32(m.Parameter(1)))));
m.Return(m.SmiFromInt32(m.ComputeIntegerHash(m.SmiUntag(m.Parameter(0)),
m.SmiToInt32(m.Parameter(1)))));
FunctionTester ft(asm_tester.GenerateCode(), kNumParams);
......@@ -2611,7 +2611,7 @@ TEST(LoadJSArrayElementsMap) {
CodeStubAssembler m(asm_tester.state());
Node* context = m.Parameter(kNumParams + 2);
Node* native_context = m.LoadNativeContext(context);
Node* kind = m.SmiToWord32(m.Parameter(0));
Node* kind = m.SmiToInt32(m.Parameter(0));
m.Return(m.LoadJSArrayElementsMap(kind, native_context));
}
......@@ -2670,7 +2670,7 @@ TEST(GotoIfNotWhiteSpaceOrLineTerminator) {
{ // Returns true if whitespace, false otherwise.
Label if_not_whitespace(&m);
m.GotoIfNotWhiteSpaceOrLineTerminator(m.SmiToWord32(m.Parameter(0)),
m.GotoIfNotWhiteSpaceOrLineTerminator(m.SmiToInt32(m.Parameter(0)),
&if_not_whitespace);
m.Return(m.TrueConstant());
......@@ -2726,7 +2726,7 @@ TEST(IsNumberArrayIndex) {
CodeAssemblerTester asm_tester(isolate, kNumParams);
{
CodeStubAssembler m(asm_tester.state());
m.Return(m.SmiFromWord32(m.IsNumberArrayIndex(m.Parameter(0))));
m.Return(m.SmiFromInt32(m.IsNumberArrayIndex(m.Parameter(0))));
}
FunctionTester ft(asm_tester.GenerateCode(), kNumParams);
......
......@@ -552,7 +552,7 @@ static inline Matcher<Node*> IsChangeUint32ToWord(
return kPointerSize == 8 ? IsChangeUint32ToUint64(matcher) : matcher;
}
static inline Matcher<Node*> IsTruncateWordToWord32(
static inline Matcher<Node*> IsTruncateIntPtrToInt32(
const Matcher<Node*>& matcher) {
return kPointerSize == 8 ? IsTruncateInt64ToInt32(matcher) : matcher;
}
......
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