Commit a389f161 authored by Camillo Bruni's avatar Camillo Bruni Committed by Commit Bot

[CSA] Cleanup: Use SmiConstant(int) wherever possible

Change-Id: Iedd1ce0d790c0c1fd69b92657d6a9866f346cedd
Reviewed-on: https://chromium-review.googlesource.com/565563Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46528}
parent 39e335c7
......@@ -2169,7 +2169,7 @@ TF_BUILTIN(ArrayIteratorPrototypeNext, CodeStubAssembler) {
GotoIfNot(SmiBelow(index, length), &set_done);
Node* one = SmiConstant(Smi::FromInt(1));
Node* one = SmiConstant(1);
StoreObjectFieldNoWriteBarrier(iterator, JSArrayIterator::kNextIndexOffset,
SmiAdd(index, one));
......@@ -2221,7 +2221,7 @@ TF_BUILTIN(ArrayIteratorPrototypeNext, CodeStubAssembler) {
BIND(&holey_object_values);
{
// Check the array_protector cell, and take the slow path if it's invalid.
Node* invalid = SmiConstant(Smi::FromInt(Isolate::kProtectorInvalid));
Node* invalid = SmiConstant(Isolate::kProtectorInvalid);
Node* cell = LoadRoot(Heap::kArrayProtectorRootIndex);
Node* cell_value = LoadObjectField(cell, PropertyCell::kValueOffset);
GotoIf(WordEqual(cell_value, invalid), &generic_values);
......@@ -2236,7 +2236,7 @@ TF_BUILTIN(ArrayIteratorPrototypeNext, CodeStubAssembler) {
BIND(&holey_double_values);
{
// Check the array_protector cell, and take the slow path if it's invalid.
Node* invalid = SmiConstant(Smi::FromInt(Isolate::kProtectorInvalid));
Node* invalid = SmiConstant(Isolate::kProtectorInvalid);
Node* cell = LoadRoot(Heap::kArrayProtectorRootIndex);
Node* cell_value = LoadObjectField(cell, PropertyCell::kValueOffset);
GotoIf(WordEqual(cell_value, invalid), &generic_values);
......@@ -2294,8 +2294,7 @@ TF_BUILTIN(ArrayIteratorPrototypeNext, CodeStubAssembler) {
Int32Constant(JS_GENERIC_ARRAY_KEY_ITERATOR_TYPE)),
&done);
Node* invalid =
SmiConstant(Smi::FromInt(Isolate::kProtectorInvalid));
Node* invalid = SmiConstant(Isolate::kProtectorInvalid);
Node* cell = LoadRoot(Heap::kFastArrayIterationProtectorRootIndex);
StoreObjectFieldNoWriteBarrier(cell, Cell::kValueOffset, invalid);
Goto(&done);
......@@ -2489,7 +2488,7 @@ TF_BUILTIN(ArrayIteratorPrototypeNext, CodeStubAssembler) {
Heap::kEmptyFixedArrayRootIndex);
StoreObjectFieldNoWriteBarrier(entry, JSArray::kElementsOffset, elements);
StoreObjectFieldNoWriteBarrier(entry, JSArray::kLengthOffset,
SmiConstant(Smi::FromInt(2)));
SmiConstant(2));
var_value.Bind(entry);
Goto(&allocate_iterator_result);
......
......@@ -200,7 +200,7 @@ void CallOrConstructBuiltinsAssembler::CallOrConstructWithArrayLike(
DCHECK(isolate()->heap()->array_protector()->IsPropertyCell());
Branch(
WordEqual(LoadObjectField(protector_cell, PropertyCell::kValueOffset),
SmiConstant(Smi::FromInt(Isolate::kProtectorValid))),
SmiConstant(Isolate::kProtectorValid)),
&if_done, &if_runtime);
}
......@@ -337,7 +337,7 @@ void CallOrConstructBuiltinsAssembler::CallOrConstructWithSpread(
DCHECK(isolate()->heap()->array_iterator_protector()->IsPropertyCell());
GotoIfNot(
WordEqual(LoadObjectField(protector_cell, PropertyCell::kValueOffset),
SmiConstant(Smi::FromInt(Isolate::kProtectorValid))),
SmiConstant(Isolate::kProtectorValid)),
&if_runtime);
// Check that the map of the initial array iterator hasn't changed.
......@@ -368,7 +368,7 @@ void CallOrConstructBuiltinsAssembler::CallOrConstructWithSpread(
DCHECK(isolate()->heap()->array_protector()->IsPropertyCell());
Branch(
WordEqual(LoadObjectField(protector_cell, PropertyCell::kValueOffset),
SmiConstant(Smi::FromInt(Isolate::kProtectorValid))),
SmiConstant(Isolate::kProtectorValid)),
&if_done, &if_runtime);
}
......
......@@ -166,7 +166,7 @@ Node* ConstructorBuiltinsAssembler::EmitFastNewClosure(Node* shared_info,
// Cell is empty or code is marked for deopt, clear the optimized code slot.
BIND(&clear_optimized_code);
StoreFixedArrayElement(literals, FeedbackVector::kOptimizedCodeIndex,
SmiConstant(Smi::kZero), SKIP_WRITE_BARRIER);
SmiConstant(0), SKIP_WRITE_BARRIER);
Goto(&optimized_code_ok);
BIND(&optimized_code_ok);
......@@ -464,7 +464,7 @@ Node* ConstructorBuiltinsAssembler::EmitFastCloneShallowArray(
allocation_site =
allocation_site_mode == TRACK_ALLOCATION_SITE ? allocation_site : nullptr;
Node* zero = SmiConstant(Smi::kZero);
Node* zero = SmiConstant(0);
GotoIf(SmiEqual(capacity, zero), &zero_capacity);
Node* elements_map = LoadMap(boilerplate_elements);
......@@ -541,11 +541,10 @@ void ConstructorBuiltinsAssembler::CreateFastCloneShallowArrayBuiltin(
BIND(&call_runtime);
{
Comment("call runtime");
Node* flags =
SmiConstant(Smi::FromInt(ArrayLiteral::kShallowElements |
(allocation_site_mode == TRACK_ALLOCATION_SITE
? 0
: ArrayLiteral::kDisableMementos)));
Node* flags = SmiConstant(ArrayLiteral::kShallowElements |
(allocation_site_mode == TRACK_ALLOCATION_SITE
? 0
: ArrayLiteral::kDisableMementos));
Return(CallRuntime(Runtime::kCreateArrayLiteral, context, closure,
literal_index, constant_elements, flags));
}
......@@ -647,8 +646,7 @@ Node* ConstructorBuiltinsAssembler::EmitFastCloneShallowObject(
memento, AllocationMemento::kAllocationSiteOffset, allocation_site);
Node* memento_create_count = LoadObjectField(
allocation_site, AllocationSite::kPretenureCreateCountOffset);
memento_create_count =
SmiAdd(memento_create_count, SmiConstant(Smi::FromInt(1)));
memento_create_count = SmiAdd(memento_create_count, SmiConstant(1));
StoreObjectFieldNoWriteBarrier(allocation_site,
AllocationSite::kPretenureCreateCountOffset,
memento_create_count);
......
......@@ -337,7 +337,7 @@ TF_BUILTIN(ToLength, CodeStubAssembler) {
Return(NumberConstant(kMaxSafeInteger));
BIND(&return_zero);
Return(SmiConstant(Smi::kZero));
Return(SmiConstant(0));
}
}
......
......@@ -50,7 +50,7 @@ void DateBuiltinsAssembler::Generate_DatePrototype_GetField(Node* context,
BIND(&stamp_mismatch);
}
Node* field_index_smi = SmiConstant(Smi::FromInt(field_index));
Node* field_index_smi = SmiConstant(field_index);
Node* function =
ExternalConstant(ExternalReference::get_date_field_function(isolate()));
Node* result = CallCFunction2(
......
......@@ -111,7 +111,7 @@ void ForInBuiltinsAssembler::CheckPrototypeEnumCache(Node* receiver, Node* map,
// For all objects but the receiver, check that the cache is empty.
current_map.Bind(LoadMap(current_js_object.value()));
Node* enum_length = EnumLength(current_map.value());
Node* zero_constant = SmiConstant(Smi::kZero);
Node* zero_constant = SmiConstant(0);
Branch(WordEqual(enum_length, zero_constant), &loop, use_runtime);
}
}
......@@ -127,8 +127,7 @@ void ForInBuiltinsAssembler::CheckEnumCache(Node* receiver, Label* use_cache,
// Check if the enum length field is properly initialized, indicating that
// there is an enum cache.
{
Node* invalid_enum_cache_sentinel =
SmiConstant(Smi::FromInt(kInvalidEnumCacheSentinel));
Node* invalid_enum_cache_sentinel = SmiConstant(kInvalidEnumCacheSentinel);
Node* enum_length = EnumLength(map);
Branch(WordEqual(enum_length, invalid_enum_cache_sentinel),
&check_dict_receiver, &check_empty_prototype);
......
......@@ -189,7 +189,7 @@ class DeletePropertyBaseAssembler : public CodeStubAssembler {
StoreValueByKeyIndex<NameDictionary>(properties, key_index, filler,
SKIP_WRITE_BARRIER);
StoreDetailsByKeyIndex<NameDictionary>(properties, key_index,
SmiConstant(Smi::kZero));
SmiConstant(0));
// Update bookkeeping information (see NameDictionary::ElementRemoved).
Node* nof = GetNumberOfElements<NameDictionary>(properties);
......
......@@ -59,8 +59,8 @@ TF_BUILTIN(MathAbs, CodeStubAssembler) {
} else {
// Check if {x} is already positive.
Label if_xispositive(this), if_xisnotpositive(this);
BranchIfSmiLessThanOrEqual(SmiConstant(Smi::FromInt(0)), x,
&if_xispositive, &if_xisnotpositive);
BranchIfSmiLessThanOrEqual(SmiConstant(0), x, &if_xispositive,
&if_xisnotpositive);
BIND(&if_xispositive);
{
......@@ -421,7 +421,7 @@ TF_BUILTIN(MathRandom, CodeStubAssembler) {
// Cached random numbers are exhausted if index is 0. Go to slow path.
Label if_cached(this);
GotoIf(SmiAbove(smi_index.value(), SmiConstant(Smi::kZero)), &if_cached);
GotoIf(SmiAbove(smi_index.value(), SmiConstant(0)), &if_cached);
// Cache exhausted, populate the cache. Return value is the new index.
smi_index.Bind(CallRuntime(Runtime::kGenerateRandomNumbers, context));
......@@ -429,7 +429,7 @@ TF_BUILTIN(MathRandom, CodeStubAssembler) {
// Compute next index by decrement.
BIND(&if_cached);
Node* new_smi_index = SmiSub(smi_index.value(), SmiConstant(Smi::FromInt(1)));
Node* new_smi_index = SmiSub(smi_index.value(), SmiConstant(1));
StoreContextElement(native_context, Context::MATH_RANDOM_INDEX_INDEX,
new_smi_index);
......@@ -462,10 +462,10 @@ TF_BUILTIN(MathSign, CodeStubAssembler) {
Return(ChangeFloat64ToTagged(x_value));
BIND(&if_xisnegative);
Return(SmiConstant(Smi::FromInt(-1)));
Return(SmiConstant(-1));
BIND(&if_xispositive);
Return(SmiConstant(Smi::FromInt(1)));
Return(SmiConstant(1));
}
// ES6 #sec-math.sin
......
......@@ -273,8 +273,8 @@ TF_BUILTIN(NumberParseInt, CodeStubAssembler) {
// Check if {radix} is treated as 10 (i.e. undefined, 0 or 10).
Label if_radix10(this), if_generic(this, Label::kDeferred);
GotoIf(WordEqual(radix, UndefinedConstant()), &if_radix10);
GotoIf(WordEqual(radix, SmiConstant(Smi::FromInt(10))), &if_radix10);
GotoIf(WordEqual(radix, SmiConstant(Smi::FromInt(0))), &if_radix10);
GotoIf(WordEqual(radix, SmiConstant(10)), &if_radix10);
GotoIf(WordEqual(radix, SmiConstant(0)), &if_radix10);
Goto(&if_generic);
BIND(&if_radix10);
......
......@@ -34,7 +34,7 @@ void PromiseBuiltinsAssembler::PromiseInit(Node* promise) {
SmiConstant(0));
for (int i = 0; i < v8::Promise::kEmbedderFieldCount; i++) {
int offset = JSPromise::kSize + i * kPointerSize;
StoreObjectFieldNoWriteBarrier(promise, offset, SmiConstant(Smi::kZero));
StoreObjectFieldNoWriteBarrier(promise, offset, SmiConstant(0));
}
}
......@@ -69,7 +69,7 @@ Node* PromiseBuiltinsAssembler::AllocateAndSetJSPromise(Node* context,
SmiConstant(0));
for (int i = 0; i < v8::Promise::kEmbedderFieldCount; i++) {
int offset = JSPromise::kSize + i * kPointerSize;
StoreObjectFieldNoWriteBarrier(instance, offset, SmiConstant(Smi::kZero));
StoreObjectFieldNoWriteBarrier(instance, offset, SmiConstant(0));
}
Label out(this);
......
......@@ -52,7 +52,7 @@ void RegExpBuiltinsAssembler::SlowStoreLastIndex(Node* context, Node* regexp,
// Store through runtime.
// TODO(ishell): Use SetPropertyStub here once available.
Node* const name = HeapConstant(isolate()->factory()->lastIndex_string());
Node* const language_mode = SmiConstant(Smi::FromInt(STRICT));
Node* const language_mode = SmiConstant(STRICT);
CallRuntime(Runtime::kSetProperty, context, regexp, name, value,
language_mode);
}
......@@ -587,7 +587,7 @@ Node* RegExpBuiltinsAssembler::RegExpPrototypeExecBodyWithoutResult(
Label* if_didnotmatch, const bool is_fastpath) {
Node* const null = NullConstant();
Node* const int_zero = IntPtrConstant(0);
Node* const smi_zero = SmiConstant(Smi::kZero);
Node* const smi_zero = SmiConstant(0);
if (is_fastpath) {
CSA_ASSERT(this, IsFastRegExpNoPrototype(context, regexp));
......@@ -755,7 +755,7 @@ Node* RegExpBuiltinsAssembler::ThrowIfNotJSReceiver(
// The {value} is not a compatible receiver for this method.
BIND(&throw_exception);
{
Node* const message_id = SmiConstant(Smi::FromInt(msg_template));
Node* const message_id = SmiConstant(msg_template);
Node* const method_name_str = HeapConstant(
isolate()->factory()->NewStringFromAsciiChecked(method_name, TENURED));
......@@ -1413,8 +1413,7 @@ TF_BUILTIN(RegExpPrototypeSourceGetter, RegExpBuiltinsAssembler) {
BIND(&if_isnotprototype);
{
Node* const message_id =
SmiConstant(Smi::FromInt(MessageTemplate::kRegExpNonRegExp));
Node* const message_id = SmiConstant(MessageTemplate::kRegExpNonRegExp);
Node* const method_name_str =
HeapConstant(isolate->factory()->NewStringFromAsciiChecked(
"RegExp.prototype.source"));
......@@ -1427,9 +1426,9 @@ TF_BUILTIN(RegExpPrototypeSourceGetter, RegExpBuiltinsAssembler) {
// Fast-path implementation for flag checks on an unmodified JSRegExp instance.
Node* RegExpBuiltinsAssembler::FastFlagGetter(Node* const regexp,
JSRegExp::Flag flag) {
Node* const smi_zero = SmiConstant(Smi::kZero);
Node* const smi_zero = SmiConstant(0);
Node* const flags = LoadObjectField(regexp, JSRegExp::kFlagsOffset);
Node* const mask = SmiConstant(Smi::FromInt(flag));
Node* const mask = SmiConstant(flag);
Node* const is_flag_set = WordNotEqual(SmiAnd(flags, mask), smi_zero);
return is_flag_set;
......@@ -1533,7 +1532,7 @@ void RegExpBuiltinsAssembler::FlagGetter(Node* context, Node* receiver,
BIND(&if_isprototype);
{
if (counter != -1) {
Node* const counter_smi = SmiConstant(Smi::FromInt(counter));
Node* const counter_smi = SmiConstant(counter);
CallRuntime(Runtime::kIncrementUseCounter, context, counter_smi);
}
Return(UndefinedConstant());
......@@ -1541,8 +1540,7 @@ void RegExpBuiltinsAssembler::FlagGetter(Node* context, Node* receiver,
BIND(&if_isnotprototype);
{
Node* const message_id =
SmiConstant(Smi::FromInt(MessageTemplate::kRegExpNonRegExp));
Node* const message_id = SmiConstant(MessageTemplate::kRegExpNonRegExp);
Node* const method_name_str = HeapConstant(
isolate->factory()->NewStringFromAsciiChecked(method_name));
CallRuntime(Runtime::kThrowTypeError, context, message_id,
......@@ -1932,7 +1930,7 @@ void RegExpBuiltinsAssembler::RegExpPrototypeMatchBody(Node* const context,
Node* const null = NullConstant();
Node* const int_zero = IntPtrConstant(0);
Node* const smi_zero = SmiConstant(Smi::kZero);
Node* const smi_zero = SmiConstant(0);
Node* const is_global =
FlagGetter(context, regexp, JSRegExp::kGlobal, is_fastpath);
......@@ -2110,7 +2108,7 @@ void RegExpBuiltinsAssembler::RegExpPrototypeSearchBodyFast(
Node* const previous_last_index = FastLoadLastIndex(regexp);
// Ensure last index is 0.
FastStoreLastIndex(regexp, SmiConstant(Smi::kZero));
FastStoreLastIndex(regexp, SmiConstant(0));
// Call exec.
Label if_didnotmatch(this);
......@@ -2143,7 +2141,7 @@ void RegExpBuiltinsAssembler::RegExpPrototypeSearchBodySlow(
Isolate* const isolate = this->isolate();
Node* const smi_zero = SmiConstant(Smi::kZero);
Node* const smi_zero = SmiConstant(0);
// Grab the initial value of last index.
Node* const previous_last_index = SlowLoadLastIndex(context, regexp);
......@@ -2589,7 +2587,7 @@ Node* RegExpBuiltinsAssembler::ReplaceGlobalCallableFastPath(
Node* const undefined = UndefinedConstant();
Node* const int_zero = IntPtrConstant(0);
Node* const int_one = IntPtrConstant(1);
Node* const smi_zero = SmiConstant(Smi::kZero);
Node* const smi_zero = SmiConstant(0);
Node* const native_context = LoadNativeContext(context);
......@@ -2639,7 +2637,7 @@ Node* RegExpBuiltinsAssembler::ReplaceGlobalCallableFastPath(
Label if_hasexplicitcaptures(this), if_noexplicitcaptures(this),
create_result(this);
Branch(SmiEqual(num_capture_registers, SmiConstant(Smi::FromInt(2))),
Branch(SmiEqual(num_capture_registers, SmiConstant(2)),
&if_noexplicitcaptures, &if_hasexplicitcaptures);
BIND(&if_noexplicitcaptures);
......@@ -2795,7 +2793,7 @@ Node* RegExpBuiltinsAssembler::ReplaceSimpleStringFastPath(
// string replacement.
Node* const int_zero = IntPtrConstant(0);
Node* const smi_zero = SmiConstant(Smi::kZero);
Node* const smi_zero = SmiConstant(0);
CSA_ASSERT(this, IsFastRegExp(context, regexp));
CSA_ASSERT(this, IsString(replace_string));
......
......@@ -126,7 +126,7 @@ void StringBuiltinsAssembler::ConvertAndBoundsCheckStartArgument(
Node* context, Variable* var_start, Node* start, Node* string_length) {
Node* const start_int =
ToInteger(context, start, CodeStubAssembler::kTruncateMinusZero);
Node* const zero = SmiConstant(Smi::kZero);
Node* const zero = SmiConstant(0);
Label done(this);
Label if_issmi(this), if_isheapnumber(this, Label::kDeferred);
......@@ -1492,7 +1492,7 @@ TF_BUILTIN(StringPrototypeSubstr, StringBuiltinsAssembler) {
VARIABLE(var_start, MachineRepresentation::kTagged);
VARIABLE(var_length, MachineRepresentation::kTagged);
Node* const zero = SmiConstant(Smi::kZero);
Node* const zero = SmiConstant(0);
// Check that {receiver} is coercible to Object and convert it to a String.
Node* const string =
......@@ -1593,7 +1593,7 @@ compiler::Node* StringBuiltinsAssembler::ToSmiBetweenZeroAnd(Node* context,
BIND(&if_isoutofbounds);
{
Node* const zero = SmiConstant(Smi::kZero);
Node* const zero = SmiConstant(0);
var_result.Bind(
SelectTaggedConstant(SmiLessThan(value_int, zero), zero, limit));
Goto(&out);
......@@ -1606,7 +1606,7 @@ compiler::Node* StringBuiltinsAssembler::ToSmiBetweenZeroAnd(Node* context,
CSA_ASSERT(this, IsHeapNumber(value_int));
Node* const float_zero = Float64Constant(0.);
Node* const smi_zero = SmiConstant(Smi::kZero);
Node* const smi_zero = SmiConstant(0);
Node* const value_float = LoadHeapNumberValue(value_int);
var_result.Bind(SelectTaggedConstant(
Float64LessThan(value_float, float_zero), smi_zero, limit));
......@@ -1711,7 +1711,7 @@ TF_BUILTIN(StringPrototypeIterator, CodeStubAssembler) {
Heap::kEmptyFixedArrayRootIndex);
StoreObjectFieldNoWriteBarrier(iterator, JSStringIterator::kStringOffset,
string);
Node* index = SmiConstant(Smi::kZero);
Node* index = SmiConstant(0);
StoreObjectFieldNoWriteBarrier(iterator, JSStringIterator::kNextIndexOffset,
index);
Return(iterator);
......@@ -1731,7 +1731,7 @@ compiler::Node* StringBuiltinsAssembler::LoadSurrogatePairAt(
GotoIf(Word32NotEqual(Word32And(var_result.value(), Int32Constant(0xFC00)),
Int32Constant(0xD800)),
&return_result);
Node* next_index = SmiAdd(index, SmiConstant(Smi::FromInt(1)));
Node* next_index = SmiAdd(index, SmiConstant(1));
GotoIfNot(SmiLessThan(next_index, length), &return_result);
var_trail.Bind(StringCharCodeAt(string, next_index));
......@@ -1850,8 +1850,7 @@ Node* StringBuiltinsAssembler::ConcatenateSequentialStrings(
}
VARIABLE(current_arg, MachineType::PointerRepresentation(), first_arg_ptr);
VARIABLE(str_index, MachineRepresentation::kTaggedSigned,
SmiConstant(Smi::kZero));
VARIABLE(str_index, MachineRepresentation::kTaggedSigned, SmiConstant(0));
Label loop(this, {&current_arg, &str_index}), done(this);
......@@ -1874,9 +1873,9 @@ Node* StringBuiltinsAssembler::ConcatenateSequentialStrings(
CSA_ASSERT(this, IsSequentialStringInstanceType(
LoadInstanceType(current_string.value())));
Node* current_length = LoadStringLength(current_string.value());
CopyStringCharacters(current_string.value(), result,
SmiConstant(Smi::kZero), str_index.value(),
current_length, encoding, encoding, SMI_PARAMETERS);
CopyStringCharacters(current_string.value(), result, SmiConstant(0),
str_index.value(), current_length, encoding,
encoding, SMI_PARAMETERS);
str_index.Bind(SmiAdd(str_index.value(), current_length));
current_arg.Bind(
IntPtrSub(current_arg.value(), IntPtrConstant(kPointerSize)));
......@@ -1911,8 +1910,7 @@ Node* StringBuiltinsAssembler::ConcatenateStrings(Node* context,
VARIABLE(current_arg, MachineType::PointerRepresentation(), first_arg_ptr);
VARIABLE(current_string, MachineRepresentation::kTagged,
Load(MachineType::AnyTagged(), current_arg.value()));
VARIABLE(total_length, MachineRepresentation::kTaggedSigned,
SmiConstant(Smi::kZero));
VARIABLE(total_length, MachineRepresentation::kTaggedSigned, SmiConstant(0));
VARIABLE(result, MachineRepresentation::kTagged);
Node* string_encoding = Word32And(LoadInstanceType(current_string.value()),
......@@ -2057,7 +2055,7 @@ Node* StringBuiltinsAssembler::ConcatenateStrings(Node* context,
Node* string_length = LoadStringLength(current_string);
// Skip concatenating empty string.
GotoIf(SmiEqual(string_length, SmiConstant(Smi::kZero)), &done_cons);
GotoIf(SmiEqual(string_length, SmiConstant(0)), &done_cons);
total_length.Bind(SmiAdd(total_length.value(), string_length));
......
......@@ -112,7 +112,7 @@ void TypedArrayBuiltinsAssembler::SetupTypedArray(Node* holder, Node* length,
StoreObjectField(holder, JSArrayBufferView::kByteLengthOffset, byte_length);
for (int offset = JSTypedArray::kSize;
offset < JSTypedArray::kSizeWithEmbedderFields; offset += kPointerSize) {
StoreObjectField(holder, offset, SmiConstant(Smi::kZero));
StoreObjectField(holder, offset, SmiConstant(0));
}
}
......@@ -227,7 +227,7 @@ TF_BUILTIN(TypedArrayInitialize, TypedArrayBuiltinsAssembler) {
// - Set backing_store to null/Smi(0).
// - Set all embedder fields to Smi(0).
StoreObjectFieldNoWriteBarrier(buffer, JSArrayBuffer::kBitFieldSlot,
SmiConstant(Smi::kZero));
SmiConstant(0));
int32_t bitfield_value = (1 << JSArrayBuffer::IsExternal::kShift) |
(1 << JSArrayBuffer::IsNeuterable::kShift);
StoreObjectFieldNoWriteBarrier(buffer, JSArrayBuffer::kBitFieldOffset,
......@@ -237,10 +237,10 @@ TF_BUILTIN(TypedArrayInitialize, TypedArrayBuiltinsAssembler) {
StoreObjectFieldNoWriteBarrier(buffer, JSArrayBuffer::kByteLengthOffset,
byte_length);
StoreObjectFieldNoWriteBarrier(buffer, JSArrayBuffer::kBackingStoreOffset,
SmiConstant(Smi::kZero));
SmiConstant(0));
for (int i = 0; i < v8::ArrayBuffer::kEmbedderFieldCount; i++) {
int offset = JSArrayBuffer::kSize + i * kPointerSize;
StoreObjectFieldNoWriteBarrier(buffer, offset, SmiConstant(Smi::kZero));
StoreObjectFieldNoWriteBarrier(buffer, offset, SmiConstant(0));
}
StoreObjectField(holder, JSArrayBufferView::kBufferOffset, buffer);
......@@ -701,8 +701,7 @@ void TypedArrayBuiltinsAssembler::GenerateTypedArrayPrototypeIterationMethod(
Goto(&throw_typeerror);
BIND(&if_receiverisneutered);
var_message.Bind(
SmiConstant(Smi::FromInt(MessageTemplate::kDetachedOperation)));
var_message.Bind(SmiConstant(MessageTemplate::kDetachedOperation));
Goto(&throw_typeerror);
BIND(&throw_typeerror);
......
......@@ -173,7 +173,7 @@ Node* CodeStubAssembler::StaleRegisterConstant() {
Node* CodeStubAssembler::IntPtrOrSmiConstant(int value, ParameterMode mode) {
if (mode == SMI_PARAMETERS) {
return SmiConstant(Smi::FromInt(value));
return SmiConstant(value);
} else {
DCHECK_EQ(INTPTR_PARAMETERS, mode);
return IntPtrConstant(value);
......@@ -441,7 +441,7 @@ Node* CodeStubAssembler::SmiFromWord32(Node* value) {
Node* CodeStubAssembler::SmiTag(Node* value) {
int32_t constant_value;
if (ToInt32Constant(value, constant_value) && Smi::IsValid(constant_value)) {
return SmiConstant(Smi::FromInt(constant_value));
return SmiConstant(constant_value);
}
return BitcastWordToTaggedSigned(WordShl(value, SmiShiftBitsConstant()));
}
......@@ -1751,7 +1751,7 @@ Node* CodeStubAssembler::AllocateSeqOneByteString(int length,
DCHECK(Heap::RootIsImmortalImmovable(Heap::kOneByteStringMapRootIndex));
StoreMapNoWriteBarrier(result, Heap::kOneByteStringMapRootIndex);
StoreObjectFieldNoWriteBarrier(result, SeqOneByteString::kLengthOffset,
SmiConstant(Smi::FromInt(length)));
SmiConstant(length));
// Initialize both used and unused parts of hash field slot at once.
StoreObjectFieldNoWriteBarrier(result, SeqOneByteString::kHashFieldSlot,
IntPtrConstant(String::kEmptyHashField),
......@@ -1763,7 +1763,7 @@ Node* CodeStubAssembler::IsZeroOrFixedArray(Node* object) {
Label out(this);
VARIABLE(var_result, MachineRepresentation::kWord32, Int32Constant(1));
GotoIf(WordEqual(object, SmiConstant(Smi::kZero)), &out);
GotoIf(WordEqual(object, SmiConstant(0)), &out);
GotoIf(IsFixedArray(object), &out);
var_result.Bind(Int32Constant(0));
......@@ -1838,7 +1838,7 @@ Node* CodeStubAssembler::AllocateSeqTwoByteString(int length,
DCHECK(Heap::RootIsImmortalImmovable(Heap::kStringMapRootIndex));
StoreMapNoWriteBarrier(result, Heap::kStringMapRootIndex);
StoreObjectFieldNoWriteBarrier(result, SeqTwoByteString::kLengthOffset,
SmiConstant(Smi::FromInt(length)));
SmiConstant(length));
// Initialize both used and unused parts of hash field slot at once.
StoreObjectFieldNoWriteBarrier(result, SeqTwoByteString::kHashFieldSlot,
IntPtrConstant(String::kEmptyHashField),
......@@ -2044,8 +2044,7 @@ Node* CodeStubAssembler::AllocateRegExpResult(Node* context, Node* length,
CSA_ASSERT(this, IsString(input));
#ifdef DEBUG
Node* const max_length =
SmiConstant(Smi::FromInt(JSArray::kInitialMaxFastElementArray));
Node* const max_length = SmiConstant(JSArray::kInitialMaxFastElementArray);
CSA_ASSERT(this, SmiLessThanOrEqual(length, max_length));
#endif // DEBUG
......@@ -2713,7 +2712,7 @@ void CodeStubAssembler::InitializeAllocationMemento(Node* base_allocation,
if (FLAG_allocation_site_pretenuring) {
Node* count = LoadObjectField(allocation_site,
AllocationSite::kPretenureCreateCountOffset);
Node* incremented_count = SmiAdd(count, SmiConstant(Smi::FromInt(1)));
Node* incremented_count = SmiAdd(count, SmiConstant(1));
StoreObjectFieldNoWriteBarrier(allocation_site,
AllocationSite::kPretenureCreateCountOffset,
incremented_count);
......@@ -3671,7 +3670,7 @@ Node* CodeStubAssembler::AllocAndCopyStringCharacters(Node* context, Node* from,
Label end(this), one_byte_sequential(this), two_byte_sequential(this);
Variable var_result(this, MachineRepresentation::kTagged);
Node* const smi_zero = SmiConstant(Smi::kZero);
Node* const smi_zero = SmiConstant(0);
Branch(IsOneByteStringInstanceType(from_instance_type), &one_byte_sequential,
&two_byte_sequential);
......@@ -3741,7 +3740,7 @@ Node* CodeStubAssembler::SubString(Node* context, Node* string, Node* from,
// A real substring (substr_length < string_length).
Label single_char(this);
GotoIf(SmiEqual(substr_length, SmiConstant(Smi::FromInt(1))), &single_char);
GotoIf(SmiEqual(substr_length, SmiConstant(1)), &single_char);
// TODO(jgruber): Add an additional case for substring of length == 0?
......@@ -3760,8 +3759,7 @@ Node* CodeStubAssembler::SubString(Node* context, Node* string, Node* from,
Label next(this);
// Short slice. Copy instead of slicing.
GotoIf(SmiLessThan(substr_length,
SmiConstant(Smi::FromInt(SlicedString::kMinLength))),
GotoIf(SmiLessThan(substr_length, SmiConstant(SlicedString::kMinLength)),
&next);
// Allocate new sliced string.
......@@ -3837,7 +3835,7 @@ Node* CodeStubAssembler::SubString(Node* context, Node* string, Node* from,
}
// Equal length - check if {from, to} == {0, str.length}.
GotoIf(SmiAbove(from, SmiConstant(Smi::kZero)), &runtime);
GotoIf(SmiAbove(from, SmiConstant(0)), &runtime);
// Return the original string (substr_length == string_length).
......@@ -4145,11 +4143,10 @@ Node* CodeStubAssembler::StringAdd(Node* context, Node* left, Node* right,
// One-byte sequential string case
Node* new_string =
AllocateSeqOneByteString(context, new_length, SMI_PARAMETERS);
CopyStringCharacters(var_left.value(), new_string, SmiConstant(Smi::kZero),
SmiConstant(Smi::kZero), left_length,
String::ONE_BYTE_ENCODING, String::ONE_BYTE_ENCODING,
SMI_PARAMETERS);
CopyStringCharacters(var_right.value(), new_string, SmiConstant(Smi::kZero),
CopyStringCharacters(var_left.value(), new_string, SmiConstant(0),
SmiConstant(0), left_length, String::ONE_BYTE_ENCODING,
String::ONE_BYTE_ENCODING, SMI_PARAMETERS);
CopyStringCharacters(var_right.value(), new_string, SmiConstant(0),
left_length, right_length, String::ONE_BYTE_ENCODING,
String::ONE_BYTE_ENCODING, SMI_PARAMETERS);
result.Bind(new_string);
......@@ -4160,14 +4157,13 @@ Node* CodeStubAssembler::StringAdd(Node* context, Node* left, Node* right,
// Two-byte sequential string case
new_string =
AllocateSeqTwoByteString(context, new_length, SMI_PARAMETERS);
CopyStringCharacters(var_left.value(), new_string,
SmiConstant(Smi::kZero), SmiConstant(Smi::kZero),
left_length, String::TWO_BYTE_ENCODING,
String::TWO_BYTE_ENCODING, SMI_PARAMETERS);
CopyStringCharacters(var_right.value(), new_string,
SmiConstant(Smi::kZero), left_length, right_length,
CopyStringCharacters(var_left.value(), new_string, SmiConstant(0),
SmiConstant(0), left_length,
String::TWO_BYTE_ENCODING, String::TWO_BYTE_ENCODING,
SMI_PARAMETERS);
CopyStringCharacters(var_right.value(), new_string, SmiConstant(0),
left_length, right_length, String::TWO_BYTE_ENCODING,
String::TWO_BYTE_ENCODING, SMI_PARAMETERS);
result.Bind(new_string);
Goto(&done_native);
}
......@@ -4606,7 +4602,7 @@ Node* CodeStubAssembler::ToUint32(Node* context, Node* input) {
BIND(&return_zero);
{
var_result.Bind(SmiConstant(Smi::kZero));
var_result.Bind(SmiConstant(0));
Goto(&out);
}
}
......@@ -4807,7 +4803,7 @@ Node* CodeStubAssembler::ToInteger(Node* context, Node* input,
}
BIND(&return_zero);
var_arg.Bind(SmiConstant(Smi::kZero));
var_arg.Bind(SmiConstant(0));
Goto(&out);
}
......@@ -8852,7 +8848,7 @@ Node* CodeStubAssembler::NumberInc(Node* value) {
BIND(&if_issmi);
{
// Try fast Smi addition first.
Node* one = SmiConstant(Smi::FromInt(1));
Node* one = SmiConstant(1);
Node* pair = IntPtrAddWithOverflow(BitcastTaggedToWord(value),
BitcastTaggedToWord(one));
Node* overflow = Projection(1, pair);
......@@ -8903,7 +8899,7 @@ Node* CodeStubAssembler::NumberDec(Node* value) {
BIND(&if_issmi);
{
// Try fast Smi addition first.
Node* one = SmiConstant(Smi::FromInt(1));
Node* one = SmiConstant(1);
Node* pair = IntPtrSubWithOverflow(BitcastTaggedToWord(value),
BitcastTaggedToWord(one));
Node* overflow = Projection(1, pair);
......@@ -9067,11 +9063,10 @@ Node* CodeStubAssembler::CreateArrayIterator(Node* array, Node* array_map,
// here, and take the slow path if any fail.
Node* protector_cell = LoadRoot(Heap::kArrayProtectorRootIndex);
DCHECK(isolate()->heap()->array_protector()->IsPropertyCell());
GotoIfNot(
WordEqual(
LoadObjectField(protector_cell, PropertyCell::kValueOffset),
SmiConstant(Smi::FromInt(Isolate::kProtectorValid))),
&if_isslow);
GotoIfNot(WordEqual(LoadObjectField(protector_cell,
PropertyCell::kValueOffset),
SmiConstant(Isolate::kProtectorValid)),
&if_isslow);
Node* native_context = LoadNativeContext(context);
......@@ -9157,7 +9152,7 @@ Node* CodeStubAssembler::AllocateJSArrayIterator(Node* array, Node* array_map,
StoreObjectFieldNoWriteBarrier(iterator,
JSArrayIterator::kIteratedObjectOffset, array);
StoreObjectFieldNoWriteBarrier(iterator, JSArrayIterator::kNextIndexOffset,
SmiConstant(Smi::FromInt(0)));
SmiConstant(0));
StoreObjectFieldNoWriteBarrier(
iterator, JSArrayIterator::kIteratedObjectMapOffset, array_map);
return iterator;
......
......@@ -917,17 +917,16 @@ TF_STUB(ArrayNoArgumentConstructorStub, CodeStubAssembler) {
Node* array =
AllocateJSArray(elements_kind, array_map,
IntPtrConstant(JSArray::kPreallocatedArrayElements),
SmiConstant(Smi::kZero), allocation_site);
SmiConstant(0), allocation_site);
Return(array);
}
TF_STUB(InternalArrayNoArgumentConstructorStub, CodeStubAssembler) {
Node* array_map = LoadObjectField(Parameter(Descriptor::kFunction),
JSFunction::kPrototypeOrInitialMapOffset);
Node* array =
AllocateJSArray(stub->elements_kind(), array_map,
IntPtrConstant(JSArray::kPreallocatedArrayElements),
SmiConstant(Smi::kZero));
Node* array = AllocateJSArray(
stub->elements_kind(), array_map,
IntPtrConstant(JSArray::kPreallocatedArrayElements), SmiConstant(0));
Return(array);
}
......@@ -958,11 +957,10 @@ void ArrayConstructorAssembler::GenerateConstructor(
if (IsFastPackedElementsKind(elements_kind)) {
Label abort(this, Label::kDeferred);
Branch(SmiEqual(array_size, SmiConstant(Smi::kZero)), &small_smi_size,
&abort);
Branch(SmiEqual(array_size, SmiConstant(0)), &small_smi_size, &abort);
BIND(&abort);
Node* reason = SmiConstant(Smi::FromInt(kAllocatingNonEmptyPackedArray));
Node* reason = SmiConstant(kAllocatingNonEmptyPackedArray);
TailCallRuntime(Runtime::kAbort, context, reason);
} else {
int element_size =
......@@ -971,8 +969,7 @@ void ArrayConstructorAssembler::GenerateConstructor(
(kMaxRegularHeapObjectSize - FixedArray::kHeaderSize - JSArray::kSize -
AllocationMemento::kSize) /
element_size;
Branch(SmiAboveOrEqual(array_size,
SmiConstant(Smi::FromInt(max_fast_elements))),
Branch(SmiAboveOrEqual(array_size, SmiConstant(max_fast_elements)),
&call_runtime, &small_smi_size);
}
......
......@@ -249,7 +249,7 @@ void AccessorAssembler::HandleLoadICSmiHandlerCase(
DCHECK(isolate()->heap()->array_protector()->IsPropertyCell());
GotoIfNot(
WordEqual(LoadObjectField(protector_cell, PropertyCell::kValueOffset),
SmiConstant(Smi::FromInt(Isolate::kProtectorValid))),
SmiConstant(Isolate::kProtectorValid)),
miss);
exit_point->Return(UndefinedConstant());
}
......@@ -407,8 +407,7 @@ void AccessorAssembler::HandleLoadICProtoHandlerCase(
GotoIf(WordEqual(validity_cell, IntPtrConstant(0)),
&validity_cell_check_done);
Node* cell_value = LoadObjectField(validity_cell, Cell::kValueOffset);
GotoIf(WordNotEqual(cell_value,
SmiConstant(Smi::FromInt(Map::kPrototypeChainValid))),
GotoIf(WordNotEqual(cell_value, SmiConstant(Map::kPrototypeChainValid)),
miss);
Goto(&validity_cell_check_done);
......@@ -711,8 +710,7 @@ void AccessorAssembler::HandleStoreICElementHandlerCase(
Comment("HandleStoreICElementHandlerCase");
Node* validity_cell = LoadObjectField(handler, Tuple2::kValue1Offset);
Node* cell_value = LoadObjectField(validity_cell, Cell::kValueOffset);
GotoIf(WordNotEqual(cell_value,
SmiConstant(Smi::FromInt(Map::kPrototypeChainValid))),
GotoIf(WordNotEqual(cell_value, SmiConstant(Map::kPrototypeChainValid)),
miss);
Node* code_handler = LoadObjectField(handler, Tuple2::kValue2Offset);
......@@ -741,8 +739,7 @@ void AccessorAssembler::HandleStoreICProtoHandler(
GotoIf(WordEqual(validity_cell, IntPtrConstant(0)),
&validity_cell_check_done);
Node* cell_value = LoadObjectField(validity_cell, Cell::kValueOffset);
GotoIf(WordNotEqual(cell_value,
SmiConstant(Smi::FromInt(Map::kPrototypeChainValid))),
GotoIf(WordNotEqual(cell_value, SmiConstant(Map::kPrototypeChainValid)),
miss);
Goto(&validity_cell_check_done);
......
......@@ -866,8 +866,7 @@ void KeyedStoreGenericAssembler::EmitGenericPropertyStore(
BIND(&not_callable);
{
if (language_mode == STRICT) {
Node* message =
SmiConstant(Smi::FromInt(MessageTemplate::kNoSetterInCallback));
Node* message = SmiConstant(MessageTemplate::kNoSetterInCallback);
TailCallRuntime(Runtime::kThrowTypeError, p->context, message, p->name,
var_accessor_holder.value());
} else {
......@@ -880,8 +879,7 @@ void KeyedStoreGenericAssembler::EmitGenericPropertyStore(
BIND(&readonly);
{
if (language_mode == STRICT) {
Node* message =
SmiConstant(Smi::FromInt(MessageTemplate::kStrictReadOnlyProperty));
Node* message = SmiConstant(MessageTemplate::kStrictReadOnlyProperty);
Node* type = Typeof(p->receiver);
TailCallRuntime(Runtime::kThrowTypeError, p->context, message, p->name,
type, p->receiver);
......
......@@ -1413,7 +1413,7 @@ IGNITION_HANDLER(Inc, InterpreterAssembler) {
BIND(&if_issmi);
{
// Try fast Smi addition first.
Node* one = SmiConstant(Smi::FromInt(1));
Node* one = SmiConstant(1);
Node* pair = IntPtrAddWithOverflow(BitcastTaggedToWord(value),
BitcastTaggedToWord(one));
Node* overflow = Projection(1, pair);
......@@ -1538,7 +1538,7 @@ IGNITION_HANDLER(Dec, InterpreterAssembler) {
BIND(&if_issmi);
{
// Try fast Smi subtraction first.
Node* one = SmiConstant(Smi::FromInt(1));
Node* one = SmiConstant(1);
Node* pair = IntPtrSubWithOverflow(BitcastTaggedToWord(value),
BitcastTaggedToWord(one));
Node* overflow = Projection(1, pair);
......@@ -3236,7 +3236,7 @@ IGNITION_HANDLER(ForInContinue, InterpreterAssembler) {
IGNITION_HANDLER(ForInStep, InterpreterAssembler) {
Node* index_reg = BytecodeOperandReg(0);
Node* index = LoadRegister(index_reg);
Node* one = SmiConstant(Smi::FromInt(1));
Node* one = SmiConstant(1);
Node* result = SmiAdd(index, one);
SetAccumulator(result);
Dispatch();
......
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