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

[CSA] TNodify low-hanging fruits

There were a couple of low-hanging fruits in code-stub-assembler. Tried
to keep it short to avoid conflicts with other CLs.

Bug: v8:9810
Change-Id: If23e16019116c22ddd6282867d9dd0b2e65a23f0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1906570
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64890}
parent 509995d3
...@@ -1197,7 +1197,7 @@ void CodeStubAssembler::GotoIfForceSlowPath(Label* if_true) { ...@@ -1197,7 +1197,7 @@ void CodeStubAssembler::GotoIfForceSlowPath(Label* if_true) {
#ifdef V8_ENABLE_FORCE_SLOW_PATH #ifdef V8_ENABLE_FORCE_SLOW_PATH
const TNode<ExternalReference> force_slow_path_addr = const TNode<ExternalReference> force_slow_path_addr =
ExternalConstant(ExternalReference::force_slow_path(isolate())); ExternalConstant(ExternalReference::force_slow_path(isolate()));
Node* const force_slow = Load(MachineType::Uint8(), force_slow_path_addr); const TNode<Uint8T> force_slow = Load<Uint8T>(force_slow_path_addr);
GotoIf(force_slow, if_true); GotoIf(force_slow, if_true);
#endif #endif
...@@ -1485,8 +1485,8 @@ void CodeStubAssembler::BranchIfToBooleanIsTrue(SloppyTNode<Object> value, ...@@ -1485,8 +1485,8 @@ void CodeStubAssembler::BranchIfToBooleanIsTrue(SloppyTNode<Object> value,
BIND(&if_heapnumber); BIND(&if_heapnumber);
{ {
// Load the floating point value of {value}. // Load the floating point value of {value}.
Node* value_value = LoadObjectField( TNode<Float64T> value_value =
value_heapobject, HeapNumber::kValueOffset, MachineType::Float64()); LoadObjectField<Float64T>(value_heapobject, HeapNumber::kValueOffset);
// Check if the floating point {value} is neither 0.0, -0.0 nor NaN. // Check if the floating point {value} is neither 0.0, -0.0 nor NaN.
Branch(Float64LessThan(Float64Constant(0.0), Float64Abs(value_value)), Branch(Float64LessThan(Float64Constant(0.0), Float64Abs(value_value)),
...@@ -2695,8 +2695,7 @@ TNode<Context> CodeStubAssembler::LoadModuleContext( ...@@ -2695,8 +2695,7 @@ TNode<Context> CodeStubAssembler::LoadModuleContext(
Label context_found(this); Label context_found(this);
Variable* context_search_loop_variables[1] = {&cur_context}; Label context_search(this, &cur_context);
Label context_search(this, 1, context_search_loop_variables);
// Loop until cur_context->map() is module_map. // Loop until cur_context->map() is module_map.
Goto(&context_search); Goto(&context_search);
...@@ -2780,8 +2779,8 @@ void CodeStubAssembler::GotoIfPrototypeRequiresRuntimeLookup( ...@@ -2780,8 +2779,8 @@ void CodeStubAssembler::GotoIfPrototypeRequiresRuntimeLookup(
runtime); runtime);
} }
Node* CodeStubAssembler::LoadJSFunctionPrototype(TNode<JSFunction> function, TNode<HeapObject> CodeStubAssembler::LoadJSFunctionPrototype(
Label* if_bailout) { TNode<JSFunction> function, Label* if_bailout) {
CSA_ASSERT(this, IsFunctionWithPrototypeSlotMap(LoadMap(function))); CSA_ASSERT(this, IsFunctionWithPrototypeSlotMap(LoadMap(function)));
CSA_ASSERT(this, IsClearWord32<Map::HasNonInstancePrototypeBit>( CSA_ASSERT(this, IsClearWord32<Map::HasNonInstancePrototypeBit>(
LoadMapBitField(LoadMap(function)))); LoadMapBitField(LoadMap(function))));
...@@ -2802,16 +2801,16 @@ Node* CodeStubAssembler::LoadJSFunctionPrototype(TNode<JSFunction> function, ...@@ -2802,16 +2801,16 @@ Node* CodeStubAssembler::LoadJSFunctionPrototype(TNode<JSFunction> function,
TNode<BytecodeArray> CodeStubAssembler::LoadSharedFunctionInfoBytecodeArray( TNode<BytecodeArray> CodeStubAssembler::LoadSharedFunctionInfoBytecodeArray(
SloppyTNode<SharedFunctionInfo> shared) { SloppyTNode<SharedFunctionInfo> shared) {
TNode<Object> function_data = TNode<HeapObject> function_data = LoadObjectField<HeapObject>(
LoadObjectField(shared, SharedFunctionInfo::kFunctionDataOffset); shared, SharedFunctionInfo::kFunctionDataOffset);
VARIABLE(var_result, MachineRepresentation::kTagged, function_data); TVARIABLE(HeapObject, var_result, function_data);
Label done(this, &var_result); Label done(this, &var_result);
GotoIfNot(HasInstanceType(CAST(function_data), INTERPRETER_DATA_TYPE), &done); GotoIfNot(HasInstanceType(function_data, INTERPRETER_DATA_TYPE), &done);
TNode<Object> bytecode_array = LoadObjectField( TNode<BytecodeArray> bytecode_array = LoadObjectField<BytecodeArray>(
CAST(function_data), InterpreterData::kBytecodeArrayOffset); function_data, InterpreterData::kBytecodeArrayOffset);
var_result.Bind(bytecode_array); var_result = bytecode_array;
Goto(&done); Goto(&done);
BIND(&done); BIND(&done);
...@@ -3054,11 +3053,10 @@ void CodeStubAssembler::PossiblyGrowElementsCapacity( ...@@ -3054,11 +3053,10 @@ void CodeStubAssembler::PossiblyGrowElementsCapacity(
} }
TNode<Smi> CodeStubAssembler::BuildAppendJSArray(ElementsKind kind, TNode<Smi> CodeStubAssembler::BuildAppendJSArray(ElementsKind kind,
SloppyTNode<JSArray> array, TNode<JSArray> array,
CodeStubArguments* args, CodeStubArguments* args,
TVariable<IntPtrT>* arg_index, TVariable<IntPtrT>* arg_index,
Label* bailout) { Label* bailout) {
CSA_SLOW_ASSERT(this, IsJSArray(array));
Comment("BuildAppendJSArray: ", ElementsKindToString(kind)); Comment("BuildAppendJSArray: ", ElementsKindToString(kind));
Label pre_bailout(this); Label pre_bailout(this);
Label success(this); Label success(this);
...@@ -3121,13 +3119,14 @@ void CodeStubAssembler::TryStoreArrayElement(ElementsKind kind, ...@@ -3121,13 +3119,14 @@ void CodeStubAssembler::TryStoreArrayElement(ElementsKind kind,
StoreElement(elements, kind, index, value, mode); StoreElement(elements, kind, index, value, mode);
} }
void CodeStubAssembler::BuildAppendJSArray(ElementsKind kind, Node* array, void CodeStubAssembler::BuildAppendJSArray(ElementsKind kind,
Node* value, Label* bailout) { TNode<JSArray> array,
CSA_SLOW_ASSERT(this, IsJSArray(array)); TNode<Object> value,
Label* bailout) {
Comment("BuildAppendJSArray: ", ElementsKindToString(kind)); Comment("BuildAppendJSArray: ", ElementsKindToString(kind));
ParameterMode mode = OptimalParameterMode(); ParameterMode mode = OptimalParameterMode();
TVARIABLE(BInt, var_length, SmiToBInt(LoadFastJSArrayLength(array))); TVARIABLE(BInt, var_length, SmiToBInt(LoadFastJSArrayLength(array)));
VARIABLE(var_elements, MachineRepresentation::kTagged, LoadElements(array)); TVARIABLE(FixedArrayBase, var_elements, LoadElements(array));
// Resize the capacity of the fixed array if it doesn't fit. // Resize the capacity of the fixed array if it doesn't fit.
Node* growth = IntPtrOrSmiConstant(1, mode); Node* growth = IntPtrOrSmiConstant(1, mode);
...@@ -3282,7 +3281,7 @@ TNode<UintPtrT> CodeStubAssembler::LoadBigIntDigit(TNode<BigInt> bigint, ...@@ -3282,7 +3281,7 @@ TNode<UintPtrT> CodeStubAssembler::LoadBigIntDigit(TNode<BigInt> bigint,
TNode<ByteArray> CodeStubAssembler::AllocateByteArray(TNode<UintPtrT> length, TNode<ByteArray> CodeStubAssembler::AllocateByteArray(TNode<UintPtrT> length,
AllocationFlags flags) { AllocationFlags flags) {
Comment("AllocateByteArray"); Comment("AllocateByteArray");
VARIABLE(var_result, MachineRepresentation::kTagged); TVARIABLE(Object, var_result);
// Compute the ByteArray size and check if it fits into new space. // Compute the ByteArray size and check if it fits into new space.
Label if_lengthiszero(this), if_sizeissmall(this), Label if_lengthiszero(this), if_sizeissmall(this),
...@@ -3306,7 +3305,7 @@ TNode<ByteArray> CodeStubAssembler::AllocateByteArray(TNode<UintPtrT> length, ...@@ -3306,7 +3305,7 @@ TNode<ByteArray> CodeStubAssembler::AllocateByteArray(TNode<UintPtrT> length,
StoreMapNoWriteBarrier(result, RootIndex::kByteArrayMap); StoreMapNoWriteBarrier(result, RootIndex::kByteArrayMap);
StoreObjectFieldNoWriteBarrier(result, ByteArray::kLengthOffset, StoreObjectFieldNoWriteBarrier(result, ByteArray::kLengthOffset,
SmiTag(Signed(length))); SmiTag(Signed(length)));
var_result.Bind(result); var_result = result;
Goto(&if_join); Goto(&if_join);
} }
...@@ -3316,13 +3315,13 @@ TNode<ByteArray> CodeStubAssembler::AllocateByteArray(TNode<UintPtrT> length, ...@@ -3316,13 +3315,13 @@ TNode<ByteArray> CodeStubAssembler::AllocateByteArray(TNode<UintPtrT> length,
TNode<Object> result = TNode<Object> result =
CallRuntime(Runtime::kAllocateByteArray, NoContextConstant(), CallRuntime(Runtime::kAllocateByteArray, NoContextConstant(),
ChangeUintPtrToTagged(length)); ChangeUintPtrToTagged(length));
var_result.Bind(result); var_result = result;
Goto(&if_join); Goto(&if_join);
} }
BIND(&if_lengthiszero); BIND(&if_lengthiszero);
{ {
var_result.Bind(EmptyByteArrayConstant()); var_result = EmptyByteArrayConstant();
Goto(&if_join); Goto(&if_join);
} }
......
...@@ -1477,7 +1477,8 @@ class V8_EXPORT_PRIVATE CodeStubAssembler ...@@ -1477,7 +1477,8 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
void GotoIfPrototypeRequiresRuntimeLookup(TNode<JSFunction> function, void GotoIfPrototypeRequiresRuntimeLookup(TNode<JSFunction> function,
TNode<Map> map, Label* runtime); TNode<Map> map, Label* runtime);
// Load the "prototype" property of a JSFunction. // Load the "prototype" property of a JSFunction.
Node* LoadJSFunctionPrototype(TNode<JSFunction> function, Label* if_bailout); TNode<HeapObject> LoadJSFunctionPrototype(TNode<JSFunction> function,
Label* if_bailout);
TNode<BytecodeArray> LoadSharedFunctionInfoBytecodeArray( TNode<BytecodeArray> LoadSharedFunctionInfoBytecodeArray(
SloppyTNode<SharedFunctionInfo> shared); SloppyTNode<SharedFunctionInfo> shared);
...@@ -1677,12 +1678,12 @@ class V8_EXPORT_PRIVATE CodeStubAssembler ...@@ -1677,12 +1678,12 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
Label* bailout, Node* elements, Node* index, Label* bailout, Node* elements, Node* index,
Node* value); Node* value);
// Consumes args into the array, and returns tagged new length. // Consumes args into the array, and returns tagged new length.
TNode<Smi> BuildAppendJSArray(ElementsKind kind, SloppyTNode<JSArray> array, TNode<Smi> BuildAppendJSArray(ElementsKind kind, TNode<JSArray> array,
CodeStubArguments* args, CodeStubArguments* args,
TVariable<IntPtrT>* arg_index, Label* bailout); TVariable<IntPtrT>* arg_index, Label* bailout);
// Pushes value onto the end of array. // Pushes value onto the end of array.
void BuildAppendJSArray(ElementsKind kind, Node* array, Node* value, void BuildAppendJSArray(ElementsKind kind, TNode<JSArray> array,
Label* bailout); TNode<Object> value, Label* bailout);
void StoreFieldsNoWriteBarrier(TNode<IntPtrT> start_address, void StoreFieldsNoWriteBarrier(TNode<IntPtrT> start_address,
TNode<IntPtrT> end_address, TNode<IntPtrT> end_address,
......
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