diff --git a/src/builtins/builtins-async-generator-gen.cc b/src/builtins/builtins-async-generator-gen.cc index 2ed7e8c83e..dccce1907f 100644 --- a/src/builtins/builtins-async-generator-gen.cc +++ b/src/builtins/builtins-async-generator-gen.cc @@ -498,8 +498,8 @@ TF_BUILTIN(AsyncGeneratorResolve, AsyncGeneratorBuiltinsAssembler) { // Let iteratorResult be CreateIterResultObject(value, done). const TNode iter_result = Allocate(JSIteratorResult::kSize); { - TNode map = LoadContextElement(LoadNativeContext(context), - Context::ITERATOR_RESULT_MAP_INDEX); + TNode map = CAST(LoadContextElement( + LoadNativeContext(context), Context::ITERATOR_RESULT_MAP_INDEX)); StoreMapNoWriteBarrier(iter_result, map); StoreObjectFieldRoot(iter_result, JSIteratorResult::kPropertiesOrHashOffset, RootIndex::kEmptyFixedArray); diff --git a/src/builtins/builtins-collections-gen.cc b/src/builtins/builtins-collections-gen.cc index b664505a23..8749f68c96 100644 --- a/src/builtins/builtins-collections-gen.cc +++ b/src/builtins/builtins-collections-gen.cc @@ -45,7 +45,7 @@ class BaseCollectionsAssembler : public CodeStubAssembler { // possible. void AddConstructorEntries(Variant variant, TNode context, TNode native_context, - TNode collection, + TNode collection, TNode initial_entries); // Fast path for adding constructor entries. Assumes the entries are a fast @@ -172,7 +172,7 @@ void BaseCollectionsAssembler::AddConstructorEntry( void BaseCollectionsAssembler::AddConstructorEntries( Variant variant, TNode context, TNode native_context, - TNode collection, TNode initial_entries) { + TNode collection, TNode initial_entries) { TVARIABLE(BoolT, use_fast_loop, IsFastJSArrayWithNoCustomIteration(context, initial_entries)); TNode at_least_space_for = @@ -185,8 +185,8 @@ void BaseCollectionsAssembler::AddConstructorEntries( TNode table = AllocateTable(variant, at_least_space_for); StoreObjectField(collection, GetTableOffset(variant), table); GotoIf(IsNullOrUndefined(initial_entries), &exit); - GotoIfInitialAddFunctionModified(variant, CAST(native_context), - CAST(collection), &slow_loop); + GotoIfInitialAddFunctionModified(variant, CAST(native_context), collection, + &slow_loop); Branch(use_fast_loop.value(), &fast_loop, &slow_loop); } BIND(&fast_loop); @@ -212,7 +212,7 @@ void BaseCollectionsAssembler::AddConstructorEntries( // Check that add/set function has not been modified. Label if_not_modified(this), if_modified(this); GotoIfInitialAddFunctionModified(variant, CAST(native_context), - CAST(collection), &if_modified); + collection, &if_modified); Goto(&if_not_modified); BIND(&if_modified); Unreachable(); @@ -728,7 +728,7 @@ class CollectionsBuiltinsAssembler : public BaseCollectionsAssembler { // |iterable| is an iterator, it will update the state of the iterator to // 'exhausted'. TNode SetOrSetIteratorToList(TNode context, - TNode iterable); + TNode iterable); void BranchIfMapIteratorProtectorValid(Label* if_true, Label* if_false); void BranchIfSetIteratorProtectorValid(Label* if_true, Label* if_false); @@ -826,8 +826,8 @@ TNode CollectionsBuiltinsAssembler::AllocateJSCollectionIterator( const TNode table = LoadObjectField(collection, JSCollection::kTableOffset); const TNode native_context = LoadNativeContext(context); - const TNode iterator_map = - LoadContextElement(native_context, map_index); + const TNode iterator_map = + CAST(LoadContextElement(native_context, map_index)); const TNode iterator = AllocateInNewSpace(IteratorType::kHeaderSize); StoreMapNoWriteBarrier(iterator, iterator_map); @@ -1167,17 +1167,17 @@ TF_BUILTIN(MapIteratorToList, CollectionsBuiltinsAssembler) { } TNode CollectionsBuiltinsAssembler::SetOrSetIteratorToList( - TNode context, TNode iterable) { + TNode context, TNode iterable) { TVARIABLE(OrderedHashSet, var_table); Label if_set(this), if_iterator(this), copy(this); - const TNode instance_type = LoadInstanceType(CAST(iterable)); + const TNode instance_type = LoadInstanceType(iterable); Branch(InstanceTypeEqual(instance_type, JS_SET_TYPE), &if_set, &if_iterator); BIND(&if_set); { // {iterable} is a JSSet. - var_table = CAST(LoadObjectField(CAST(iterable), JSSet::kTableOffset)); + var_table = CAST(LoadObjectField(iterable, JSSet::kTableOffset)); Goto(©); } @@ -1249,7 +1249,7 @@ TNode CollectionsBuiltinsAssembler::SetOrSetIteratorToList( TF_BUILTIN(SetOrSetIteratorToList, CollectionsBuiltinsAssembler) { TNode context = CAST(Parameter(Descriptor::kContext)); - TNode object = CAST(Parameter(Descriptor::kSource)); + TNode object = CAST(Parameter(Descriptor::kSource)); Return(SetOrSetIteratorToList(context, object)); } @@ -2057,14 +2057,14 @@ TF_BUILTIN(MapPrototypeValues, CollectionsBuiltinsAssembler) { TF_BUILTIN(MapIteratorPrototypeNext, CollectionsBuiltinsAssembler) { const char* const kMethodName = "Map Iterator.prototype.next"; - const TNode receiver = CAST(Parameter(Descriptor::kReceiver)); + const TNode maybe_receiver = CAST(Parameter(Descriptor::kReceiver)); const TNode context = CAST(Parameter(Descriptor::kContext)); - // Ensure that the {receiver} is actually a JSMapIterator. + // Ensure that {maybe_receiver} is actually a JSMapIterator. Label if_receiver_valid(this), if_receiver_invalid(this, Label::kDeferred); - GotoIf(TaggedIsSmi(receiver), &if_receiver_invalid); + GotoIf(TaggedIsSmi(maybe_receiver), &if_receiver_invalid); const TNode receiver_instance_type = - LoadInstanceType(CAST(receiver)); + LoadInstanceType(CAST(maybe_receiver)); GotoIf( InstanceTypeEqual(receiver_instance_type, JS_MAP_KEY_VALUE_ITERATOR_TYPE), &if_receiver_valid); @@ -2074,8 +2074,9 @@ TF_BUILTIN(MapIteratorPrototypeNext, CollectionsBuiltinsAssembler) { &if_receiver_valid, &if_receiver_invalid); BIND(&if_receiver_invalid); ThrowTypeError(context, MessageTemplate::kIncompatibleMethodReceiver, - StringConstant(kMethodName), receiver); + StringConstant(kMethodName), maybe_receiver); BIND(&if_receiver_valid); + TNode receiver = CAST(maybe_receiver); // Check if the {receiver} is exhausted. TVARIABLE(Oddball, var_done, TrueConstant()); @@ -2087,7 +2088,7 @@ TF_BUILTIN(MapIteratorPrototypeNext, CollectionsBuiltinsAssembler) { TNode table; TNode index; std::tie(table, index) = - TransitionAndUpdate(CAST(receiver)); + TransitionAndUpdate(receiver); // Read the next entry from the {table}, skipping holes. TNode entry_key; @@ -2279,14 +2280,14 @@ TF_BUILTIN(SetPrototypeValues, CollectionsBuiltinsAssembler) { TF_BUILTIN(SetIteratorPrototypeNext, CollectionsBuiltinsAssembler) { const char* const kMethodName = "Set Iterator.prototype.next"; - const TNode receiver = CAST(Parameter(Descriptor::kReceiver)); + const TNode maybe_receiver = CAST(Parameter(Descriptor::kReceiver)); const TNode context = CAST(Parameter(Descriptor::kContext)); - // Ensure that the {receiver} is actually a JSSetIterator. + // Ensure that {maybe_receiver} is actually a JSSetIterator. Label if_receiver_valid(this), if_receiver_invalid(this, Label::kDeferred); - GotoIf(TaggedIsSmi(receiver), &if_receiver_invalid); + GotoIf(TaggedIsSmi(maybe_receiver), &if_receiver_invalid); const TNode receiver_instance_type = - LoadInstanceType(CAST(receiver)); + LoadInstanceType(CAST(maybe_receiver)); GotoIf(InstanceTypeEqual(receiver_instance_type, JS_SET_VALUE_ITERATOR_TYPE), &if_receiver_valid); Branch( @@ -2294,9 +2295,11 @@ TF_BUILTIN(SetIteratorPrototypeNext, CollectionsBuiltinsAssembler) { &if_receiver_valid, &if_receiver_invalid); BIND(&if_receiver_invalid); ThrowTypeError(context, MessageTemplate::kIncompatibleMethodReceiver, - StringConstant(kMethodName), receiver); + StringConstant(kMethodName), maybe_receiver); BIND(&if_receiver_valid); + TNode receiver = CAST(maybe_receiver); + // Check if the {receiver} is exhausted. TVARIABLE(Oddball, var_done, TrueConstant()); TVARIABLE(Object, var_value, UndefinedConstant()); @@ -2307,7 +2310,7 @@ TF_BUILTIN(SetIteratorPrototypeNext, CollectionsBuiltinsAssembler) { TNode table; TNode index; std::tie(table, index) = - TransitionAndUpdate(CAST(receiver)); + TransitionAndUpdate(receiver); // Read the next entry from the {table}, skipping holes. TNode entry_key; diff --git a/src/builtins/builtins-constructor-gen.cc b/src/builtins/builtins-constructor-gen.cc index 1f2d7d3c5a..6d903a8204 100644 --- a/src/builtins/builtins-constructor-gen.cc +++ b/src/builtins/builtins-constructor-gen.cc @@ -733,8 +733,8 @@ TF_BUILTIN(NumberConstructor, ConstructorBuiltinsAssembler) { // from the current frame here in order to reduce register pressure on the // fast path. TNode target = LoadTargetFromFrame(); - TNode result = - CallBuiltin(Builtins::kFastNewObject, context, target, new_target); + TNode result = CAST( + CallBuiltin(Builtins::kFastNewObject, context, target, new_target)); StoreObjectField(result, JSPrimitiveWrapper::kValueOffset, n_value); args.PopAndReturn(result); } diff --git a/src/builtins/builtins-conversion-gen.cc b/src/builtins/builtins-conversion-gen.cc index fabf534749..4d0fead861 100644 --- a/src/builtins/builtins-conversion-gen.cc +++ b/src/builtins/builtins-conversion-gen.cc @@ -429,8 +429,8 @@ TF_BUILTIN(ToObject, CodeStubAssembler) { TNode native_context = LoadNativeContext(context); TNode constructor = CAST(LoadContextElement( native_context, constructor_function_index_var.value())); - TNode initial_map = - LoadObjectField(constructor, JSFunction::kPrototypeOrInitialMapOffset); + TNode initial_map = LoadObjectField( + constructor, JSFunction::kPrototypeOrInitialMapOffset); TNode js_primitive_wrapper = Allocate(JSPrimitiveWrapper::kHeaderSize); StoreMapNoWriteBarrier(js_primitive_wrapper, initial_map); diff --git a/src/builtins/builtins-promise-gen.cc b/src/builtins/builtins-promise-gen.cc index 23d4bac0d3..8288c1903c 100644 --- a/src/builtins/builtins-promise-gen.cc +++ b/src/builtins/builtins-promise-gen.cc @@ -30,8 +30,8 @@ TNode PromiseBuiltinsAssembler::AllocateJSPromise( const TNode promise_fun = CAST(LoadContextElement(native_context, Context::PROMISE_FUNCTION_INDEX)); CSA_ASSERT(this, IsFunctionWithPrototypeSlotMap(LoadMap(promise_fun))); - const TNode promise_map = - LoadObjectField(promise_fun, JSFunction::kPrototypeOrInitialMapOffset); + const TNode promise_map = LoadObjectField( + promise_fun, JSFunction::kPrototypeOrInitialMapOffset); const TNode promise = Allocate(JSPromise::kSizeWithEmbedderFields); StoreMapNoWriteBarrier(promise, promise_map); diff --git a/src/codegen/code-stub-assembler.cc b/src/codegen/code-stub-assembler.cc index 6ce982b19e..03e5aa2b2d 100644 --- a/src/codegen/code-stub-assembler.cc +++ b/src/codegen/code-stub-assembler.cc @@ -2822,16 +2822,16 @@ void CodeStubAssembler::StoreHeapNumberValue(SloppyTNode object, MachineRepresentation::kFloat64); } -void CodeStubAssembler::StoreObjectField(Node* object, int offset, - Node* value) { +void CodeStubAssembler::StoreObjectField(TNode object, int offset, + TNode value) { DCHECK_NE(HeapObject::kMapOffset, offset); // Use StoreMap instead. OptimizedStoreField(MachineRepresentation::kTagged, UncheckedCast(object), offset, value); } -void CodeStubAssembler::StoreObjectField(Node* object, Node* offset, - Node* value) { +void CodeStubAssembler::StoreObjectField(TNode object, Node* offset, + TNode value) { int const_offset; if (ToInt32Constant(offset, &const_offset)) { StoreObjectField(object, const_offset, value); @@ -2872,24 +2872,23 @@ void CodeStubAssembler::StoreMap(TNode object, TNode map) { OptimizedStoreMap(object, map); } -void CodeStubAssembler::StoreMapNoWriteBarrier(Node* object, +void CodeStubAssembler::StoreMapNoWriteBarrier(TNode object, RootIndex map_root_index) { - StoreMapNoWriteBarrier(object, LoadRoot(map_root_index)); + StoreMapNoWriteBarrier(object, CAST(LoadRoot(map_root_index))); } -void CodeStubAssembler::StoreMapNoWriteBarrier(Node* object, Node* map) { - CSA_SLOW_ASSERT(this, IsMap(map)); +void CodeStubAssembler::StoreMapNoWriteBarrier(TNode object, + TNode map) { OptimizedStoreFieldAssertNoWriteBarrier(MachineRepresentation::kTaggedPointer, - UncheckedCast(object), - HeapObject::kMapOffset, map); + object, HeapObject::kMapOffset, map); } -void CodeStubAssembler::StoreObjectFieldRoot(Node* object, int offset, - RootIndex root_index) { +void CodeStubAssembler::StoreObjectFieldRoot(TNode object, + int offset, RootIndex root_index) { if (RootsTable::IsImmortalImmovable(root_index)) { - return StoreObjectFieldNoWriteBarrier(object, offset, LoadRoot(root_index)); + StoreObjectFieldNoWriteBarrier(object, offset, LoadRoot(root_index)); } else { - return StoreObjectField(object, offset, LoadRoot(root_index)); + StoreObjectField(object, offset, LoadRoot(root_index)); } } @@ -5028,7 +5027,7 @@ TNode CodeStubAssembler::GrowElementsCapacity( CopyFixedArrayElements(from_kind, elements, to_kind, new_elements, capacity, new_capacity, SKIP_WRITE_BARRIER, mode); - StoreObjectField(object, JSObject::kElementsOffset, new_elements); + StoreObjectField(CAST(object), JSObject::kElementsOffset, new_elements); Comment("] GrowElementsCapacity"); return new_elements; } @@ -12441,8 +12440,8 @@ TNode CodeStubAssembler::AllocateJSIteratorResult( SloppyTNode done) { CSA_ASSERT(this, IsBoolean(done)); TNode native_context = LoadNativeContext(context); - TNode map = - LoadContextElement(native_context, Context::ITERATOR_RESULT_MAP_INDEX); + TNode map = CAST( + LoadContextElement(native_context, Context::ITERATOR_RESULT_MAP_INDEX)); TNode result = Allocate(JSIteratorResult::kSize); StoreMapNoWriteBarrier(result, map); StoreObjectFieldRoot(result, JSIteratorResult::kPropertiesOrHashOffset, @@ -12466,16 +12465,16 @@ TNode CodeStubAssembler::AllocateJSIteratorResultForEntry( StoreObjectFieldNoWriteBarrier(elements, FixedArray::kLengthOffset, length); StoreFixedArrayElement(elements, 0, key); StoreFixedArrayElement(elements, 1, value); - TNode array_map = LoadContextElement( - native_context, Context::JS_ARRAY_PACKED_ELEMENTS_MAP_INDEX); + TNode array_map = CAST(LoadContextElement( + native_context, Context::JS_ARRAY_PACKED_ELEMENTS_MAP_INDEX)); TNode array = InnerAllocate(elements, elements_size); StoreMapNoWriteBarrier(array, array_map); StoreObjectFieldRoot(array, JSArray::kPropertiesOrHashOffset, RootIndex::kEmptyFixedArray); StoreObjectFieldNoWriteBarrier(array, JSArray::kElementsOffset, elements); StoreObjectFieldNoWriteBarrier(array, JSArray::kLengthOffset, length); - TNode iterator_map = - LoadContextElement(native_context, Context::ITERATOR_RESULT_MAP_INDEX); + TNode iterator_map = CAST( + LoadContextElement(native_context, Context::ITERATOR_RESULT_MAP_INDEX)); TNode result = InnerAllocate(array, JSArray::kHeaderSize); StoreMapNoWriteBarrier(result, iterator_map); StoreObjectFieldRoot(result, JSIteratorResult::kPropertiesOrHashOffset, diff --git a/src/codegen/code-stub-assembler.h b/src/codegen/code-stub-assembler.h index bd21417a93..4924585dea 100644 --- a/src/codegen/code-stub-assembler.h +++ b/src/codegen/code-stub-assembler.h @@ -1536,8 +1536,10 @@ class V8_EXPORT_PRIVATE CodeStubAssembler void StoreHeapNumberValue(SloppyTNode object, SloppyTNode value); // Store a field to an object on the heap. - void StoreObjectField(Node* object, int offset, Node* value); - void StoreObjectField(Node* object, Node* offset, Node* value); + void StoreObjectField(TNode object, int offset, + TNode value); + void StoreObjectField(TNode object, Node* offset, + TNode value); void StoreObjectFieldNoWriteBarrier( Node* object, int offset, Node* value, MachineRepresentation rep = MachineRepresentation::kTagged); @@ -1562,9 +1564,11 @@ class V8_EXPORT_PRIVATE CodeStubAssembler // Store the Map of an HeapObject. void StoreMap(TNode object, TNode map); - void StoreMapNoWriteBarrier(Node* object, RootIndex map_root_index); - void StoreMapNoWriteBarrier(Node* object, Node* map); - void StoreObjectFieldRoot(Node* object, int offset, RootIndex root); + void StoreMapNoWriteBarrier(TNode object, + RootIndex map_root_index); + void StoreMapNoWriteBarrier(TNode object, TNode map); + void StoreObjectFieldRoot(TNode object, int offset, + RootIndex root); // Store an array element to a FixedArray. void StoreFixedArrayElement( TNode object, int index, SloppyTNode value, diff --git a/src/interpreter/interpreter-generator.cc b/src/interpreter/interpreter-generator.cc index 3cb14d3bc3..c37e169e96 100644 --- a/src/interpreter/interpreter-generator.cc +++ b/src/interpreter/interpreter-generator.cc @@ -795,7 +795,8 @@ IGNITION_HANDLER(StaModuleVariable, InterpreterAssembler) { module, SourceTextModule::kRegularExportsOffset); // The actual array index is (cell_index - 1). TNode export_index = IntPtrSub(cell_index, IntPtrConstant(1)); - TNode cell = LoadFixedArrayElement(regular_exports, export_index); + TNode cell = + CAST(LoadFixedArrayElement(regular_exports, export_index)); StoreObjectField(cell, Cell::kValueOffset, value); Goto(&end); }