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