Commit 6192ecb0 authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

[CSA] TNodify methods related to stores and loads

Bug: v8:6949
Change-Id: I8f0de9e202f41c78e24c4d73c54b198a52122dac
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1784296
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Reviewed-by: 's avatarMythri Alle <mythria@chromium.org>
Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63580}
parent a35a7059
......@@ -234,7 +234,8 @@ void InterpreterAssembler::GotoIfHasContextExtensionUpToDepth(
}
}
TNode<IntPtrT> InterpreterAssembler::RegisterLocation(Node* reg_index) {
TNode<IntPtrT> InterpreterAssembler::RegisterLocation(
TNode<IntPtrT> reg_index) {
return Signed(WordPoisonOnSpeculation(
IntPtrAdd(GetInterpretedFramePointer(), RegisterFrameOffset(reg_index))));
}
......@@ -243,11 +244,11 @@ TNode<IntPtrT> InterpreterAssembler::RegisterLocation(Register reg) {
return RegisterLocation(IntPtrConstant(reg.ToOperand()));
}
TNode<IntPtrT> InterpreterAssembler::RegisterFrameOffset(Node* index) {
return Signed(TimesSystemPointerSize(index));
TNode<IntPtrT> InterpreterAssembler::RegisterFrameOffset(TNode<IntPtrT> index) {
return TimesSystemPointerSize(index);
}
TNode<Object> InterpreterAssembler::LoadRegister(Node* reg_index) {
TNode<Object> InterpreterAssembler::LoadRegister(TNode<IntPtrT> reg_index) {
return LoadFullTagged(GetInterpretedFramePointer(),
RegisterFrameOffset(reg_index),
LoadSensitivity::kCritical);
......@@ -283,7 +284,7 @@ std::pair<TNode<Object>, TNode<Object>>
InterpreterAssembler::LoadRegisterPairAtOperandIndex(int operand_index) {
DCHECK_EQ(OperandType::kRegPair,
Bytecodes::GetOperandType(bytecode_, operand_index));
Node* first_reg_index =
TNode<IntPtrT> first_reg_index =
BytecodeOperandReg(operand_index, LoadSensitivity::kSafe);
TNode<IntPtrT> second_reg_index = NextRegister(first_reg_index);
return std::make_pair(LoadRegister(first_reg_index),
......@@ -302,7 +303,7 @@ InterpreterAssembler::GetRegisterListAtOperandIndex(int operand_index) {
return RegListNodePair(base_reg, reg_count);
}
Node* InterpreterAssembler::LoadRegisterFromRegisterList(
TNode<Object> InterpreterAssembler::LoadRegisterFromRegisterList(
const RegListNodePair& reg_list, int index) {
TNode<IntPtrT> location = RegisterLocationInRegisterList(reg_list, index);
// Location is already poisoned on speculation, so no need to poison here.
......@@ -319,29 +320,30 @@ TNode<IntPtrT> InterpreterAssembler::RegisterLocationInRegisterList(
return Signed(IntPtrSub(reg_list.base_reg_location(), offset));
}
void InterpreterAssembler::StoreRegister(Node* value, Register reg) {
void InterpreterAssembler::StoreRegister(TNode<Object> value, Register reg) {
StoreFullTaggedNoWriteBarrier(
GetInterpretedFramePointer(),
IntPtrConstant(reg.ToOperand() * kSystemPointerSize), value);
}
void InterpreterAssembler::StoreRegister(Node* value, Node* reg_index) {
void InterpreterAssembler::StoreRegister(TNode<Object> value,
TNode<IntPtrT> reg_index) {
StoreFullTaggedNoWriteBarrier(GetInterpretedFramePointer(),
RegisterFrameOffset(reg_index), value);
}
void InterpreterAssembler::StoreRegisterAtOperandIndex(Node* value,
void InterpreterAssembler::StoreRegisterAtOperandIndex(TNode<Object> value,
int operand_index) {
StoreRegister(value,
BytecodeOperandReg(operand_index, LoadSensitivity::kSafe));
}
void InterpreterAssembler::StoreRegisterPairAtOperandIndex(Node* value1,
Node* value2,
void InterpreterAssembler::StoreRegisterPairAtOperandIndex(TNode<Object> value1,
TNode<Object> value2,
int operand_index) {
DCHECK_EQ(OperandType::kRegOutPair,
Bytecodes::GetOperandType(bytecode_, operand_index));
Node* first_reg_index =
TNode<IntPtrT> first_reg_index =
BytecodeOperandReg(operand_index, LoadSensitivity::kSafe);
StoreRegister(value1, first_reg_index);
TNode<IntPtrT> second_reg_index = NextRegister(first_reg_index);
......@@ -349,10 +351,11 @@ void InterpreterAssembler::StoreRegisterPairAtOperandIndex(Node* value1,
}
void InterpreterAssembler::StoreRegisterTripleAtOperandIndex(
Node* value1, Node* value2, Node* value3, int operand_index) {
TNode<Object> value1, TNode<Object> value2, TNode<Object> value3,
int operand_index) {
DCHECK_EQ(OperandType::kRegOutTriple,
Bytecodes::GetOperandType(bytecode_, operand_index));
Node* first_reg_index =
TNode<IntPtrT> first_reg_index =
BytecodeOperandReg(operand_index, LoadSensitivity::kSafe);
StoreRegister(value1, first_reg_index);
TNode<IntPtrT> second_reg_index = NextRegister(first_reg_index);
......@@ -361,7 +364,7 @@ void InterpreterAssembler::StoreRegisterTripleAtOperandIndex(
StoreRegister(value3, third_reg_index);
}
TNode<IntPtrT> InterpreterAssembler::NextRegister(Node* reg_index) {
TNode<IntPtrT> InterpreterAssembler::NextRegister(TNode<IntPtrT> reg_index) {
// Register indexes are negative, so the next index is minus one.
return Signed(IntPtrAdd(reg_index, IntPtrConstant(-1)));
}
......@@ -1647,7 +1650,7 @@ TNode<FixedArray> InterpreterAssembler::ExportParametersAndRegisterFile(
}
{
TVARIABLE(WordT, var_index);
TVARIABLE(IntPtrT, var_index);
var_index = IntPtrConstant(0);
// Iterate over parameters and write them into the array.
......@@ -1660,11 +1663,11 @@ TNode<FixedArray> InterpreterAssembler::ExportParametersAndRegisterFile(
Goto(&loop);
BIND(&loop);
{
TNode<WordT> index = var_index.value();
TNode<IntPtrT> index = var_index.value();
GotoIfNot(UintPtrLessThan(index, formal_parameter_count_intptr),
&done_loop);
TNode<WordT> reg_index = IntPtrSub(reg_base, index);
TNode<IntPtrT> reg_index = IntPtrSub(reg_base, index);
TNode<Object> value = LoadRegister(reg_index);
StoreFixedArrayElement(array, index, value);
......@@ -1679,21 +1682,21 @@ TNode<FixedArray> InterpreterAssembler::ExportParametersAndRegisterFile(
// Iterate over register file and write values into array.
// The mapping of register to array index must match that used in
// BytecodeGraphBuilder::VisitResumeGenerator.
TVARIABLE(WordT, var_index);
TVARIABLE(IntPtrT, var_index);
var_index = IntPtrConstant(0);
Label loop(this, &var_index), done_loop(this);
Goto(&loop);
BIND(&loop);
{
TNode<WordT> index = var_index.value();
TNode<IntPtrT> index = var_index.value();
GotoIfNot(UintPtrLessThan(index, register_count), &done_loop);
TNode<WordT> reg_index =
TNode<IntPtrT> reg_index =
IntPtrSub(IntPtrConstant(Register(0).ToOperand()), index);
TNode<Object> value = LoadRegister(reg_index);
TNode<WordT> array_index =
TNode<IntPtrT> array_index =
IntPtrAdd(formal_parameter_count_intptr, index);
StoreFixedArrayElement(array, array_index, value);
......
......@@ -118,19 +118,20 @@ class V8_EXPORT_PRIVATE InterpreterAssembler : public CodeStubAssembler {
compiler::TNode<Object> LoadRegisterAtOperandIndex(int operand_index);
std::pair<compiler::TNode<Object>, compiler::TNode<Object>>
LoadRegisterPairAtOperandIndex(int operand_index);
void StoreRegister(compiler::Node* value, Register reg);
void StoreRegisterAtOperandIndex(compiler::Node* value, int operand_index);
void StoreRegisterPairAtOperandIndex(compiler::Node* value1,
compiler::Node* value2,
void StoreRegister(compiler::TNode<Object> value, Register reg);
void StoreRegisterAtOperandIndex(compiler::TNode<Object> value,
int operand_index);
void StoreRegisterPairAtOperandIndex(compiler::TNode<Object> value1,
compiler::TNode<Object> value2,
int operand_index);
void StoreRegisterTripleAtOperandIndex(compiler::Node* value1,
compiler::Node* value2,
compiler::Node* value3,
void StoreRegisterTripleAtOperandIndex(compiler::TNode<Object> value1,
compiler::TNode<Object> value2,
compiler::TNode<Object> value3,
int operand_index);
RegListNodePair GetRegisterListAtOperandIndex(int operand_index);
Node* LoadRegisterFromRegisterList(const RegListNodePair& reg_list,
int index);
TNode<Object> LoadRegisterFromRegisterList(const RegListNodePair& reg_list,
int index);
TNode<IntPtrT> RegisterLocationInRegisterList(const RegListNodePair& reg_list,
int index);
......@@ -295,10 +296,11 @@ class V8_EXPORT_PRIVATE InterpreterAssembler : public CodeStubAssembler {
// Operations on registers.
compiler::TNode<IntPtrT> RegisterLocation(Register reg);
compiler::TNode<IntPtrT> RegisterLocation(compiler::Node* reg_index);
compiler::TNode<IntPtrT> NextRegister(compiler::Node* reg_index);
compiler::TNode<Object> LoadRegister(Node* reg_index);
void StoreRegister(compiler::Node* value, compiler::Node* reg_index);
compiler::TNode<IntPtrT> RegisterLocation(compiler::TNode<IntPtrT> reg_index);
compiler::TNode<IntPtrT> NextRegister(compiler::TNode<IntPtrT> reg_index);
compiler::TNode<Object> LoadRegister(compiler::TNode<IntPtrT> reg_index);
void StoreRegister(compiler::TNode<Object> value,
compiler::TNode<IntPtrT> reg_index);
// Saves and restores interpreter bytecode offset to the interpreter stack
// frame when performing a call.
......@@ -317,7 +319,7 @@ class V8_EXPORT_PRIVATE InterpreterAssembler : public CodeStubAssembler {
void UpdateInterruptBudget(compiler::Node* weight, bool backward);
// Returns the offset of register |index| relative to RegisterFilePointer().
compiler::TNode<IntPtrT> RegisterFrameOffset(compiler::Node* index);
compiler::TNode<IntPtrT> RegisterFrameOffset(compiler::TNode<IntPtrT> index);
// Returns the offset of an operand relative to the current bytecode offset.
compiler::Node* OperandOffset(int operand_index);
......
......@@ -1713,8 +1713,8 @@ IGNITION_HANDLER(CallRuntimeForPair, InterpreterAssembler) {
TNode<Context> context = GetContext();
Node* result_pair = CallRuntimeN(function_id, context, args, 2);
// Store the results in <first_return> and <first_return + 1>
Node* result0 = Projection(0, result_pair);
Node* result1 = Projection(1, result_pair);
TNode<Object> result0 = CAST(Projection(0, result_pair));
TNode<Object> result1 = CAST(Projection(1, result_pair));
StoreRegisterPairAtOperandIndex(result0, result1, 3);
Dispatch();
}
......@@ -3094,8 +3094,8 @@ IGNITION_HANDLER(ForInPrepare, InterpreterAssembler) {
UpdateFeedback(feedback, maybe_feedback_vector, vector_index);
// Construct the cache info triple.
Node* cache_type = enumerator;
Node* cache_array = enum_keys;
TNode<Map> cache_type = map_enumerator;
TNode<FixedArray> cache_array = enum_keys;
TNode<Smi> cache_length = SmiTag(Signed(enum_length));
StoreRegisterTripleAtOperandIndex(cache_type, cache_array, cache_length, 0);
Dispatch();
......@@ -3111,8 +3111,8 @@ IGNITION_HANDLER(ForInPrepare, InterpreterAssembler) {
vector_index);
// Construct the cache info triple.
Node* cache_type = array_enumerator;
Node* cache_array = array_enumerator;
TNode<FixedArray> cache_type = array_enumerator;
TNode<FixedArray> cache_array = array_enumerator;
TNode<Smi> cache_length = LoadFixedArrayBaseLength(array_enumerator);
StoreRegisterTripleAtOperandIndex(cache_type, cache_array, cache_length, 0);
Dispatch();
......
......@@ -146,22 +146,24 @@ Node* IntrinsicsGenerator::IsInstanceType(Node* input, int type) {
Node* IntrinsicsGenerator::IsJSReceiver(
const InterpreterAssembler::RegListNodePair& args, Node* context) {
Node* input = __ LoadRegisterFromRegisterList(args, 0);
TNode<Object> input = __ LoadRegisterFromRegisterList(args, 0);
TNode<Oddball> result = __ Select<Oddball>(
__ TaggedIsSmi(input), [=] { return __ FalseConstant(); },
[=] { return __ SelectBooleanConstant(__ IsJSReceiver(input)); });
[=] {
return __ SelectBooleanConstant(__ IsJSReceiver(__ CAST(input)));
});
return result;
}
Node* IntrinsicsGenerator::IsArray(
const InterpreterAssembler::RegListNodePair& args, Node* context) {
Node* input = __ LoadRegisterFromRegisterList(args, 0);
TNode<Object> input = __ LoadRegisterFromRegisterList(args, 0);
return IsInstanceType(input, JS_ARRAY_TYPE);
}
Node* IntrinsicsGenerator::IsSmi(
const InterpreterAssembler::RegListNodePair& args, Node* context) {
Node* input = __ LoadRegisterFromRegisterList(args, 0);
TNode<Object> input = __ LoadRegisterFromRegisterList(args, 0);
return __ SelectBooleanConstant(__ TaggedIsSmi(input));
}
......@@ -229,7 +231,7 @@ Node* IntrinsicsGenerator::ToObject(
Node* IntrinsicsGenerator::Call(
const InterpreterAssembler::RegListNodePair& args, Node* context) {
// First argument register contains the function target.
Node* function = __ LoadRegisterFromRegisterList(args, 0);
TNode<Object> function = __ LoadRegisterFromRegisterList(args, 0);
// The arguments for the target function are from the second runtime call
// argument.
......@@ -260,10 +262,10 @@ Node* IntrinsicsGenerator::CreateAsyncFromSyncIterator(
InterpreterAssembler::Variable return_value(assembler_,
MachineRepresentation::kTagged);
Node* sync_iterator = __ LoadRegisterFromRegisterList(args, 0);
TNode<Object> sync_iterator = __ LoadRegisterFromRegisterList(args, 0);
__ GotoIf(__ TaggedIsSmi(sync_iterator), &not_receiver);
__ GotoIfNot(__ IsJSReceiver(sync_iterator), &not_receiver);
__ GotoIfNot(__ IsJSReceiver(__ CAST(sync_iterator)), &not_receiver);
TNode<Object> const next =
__ GetProperty(context, sync_iterator, factory()->next_string());
......@@ -302,7 +304,8 @@ Node* IntrinsicsGenerator::CreateJSGeneratorObject(
Node* IntrinsicsGenerator::GeneratorGetResumeMode(
const InterpreterAssembler::RegListNodePair& args, Node* context) {
Node* generator = __ LoadRegisterFromRegisterList(args, 0);
TNode<JSGeneratorObject> generator =
__ CAST(__ LoadRegisterFromRegisterList(args, 0));
TNode<Object> const value =
__ LoadObjectField(generator, JSGeneratorObject::kResumeModeOffset);
......@@ -311,7 +314,8 @@ Node* IntrinsicsGenerator::GeneratorGetResumeMode(
Node* IntrinsicsGenerator::GeneratorClose(
const InterpreterAssembler::RegListNodePair& args, Node* context) {
Node* generator = __ LoadRegisterFromRegisterList(args, 0);
TNode<JSGeneratorObject> generator =
__ CAST(__ LoadRegisterFromRegisterList(args, 0));
__ StoreObjectFieldNoWriteBarrier(
generator, JSGeneratorObject::kContinuationOffset,
__ SmiConstant(JSGeneratorObject::kGeneratorClosed));
......
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