Commit 09af9adf authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

[CSA][cleanup] TNodify the binary op assembler

Bug: v8:6949, v8:9396
Change-Id: I4c9382079190379661a26fbe6e1f4f6040a56d08
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1792902
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63658}
parent 67180425
This diff is collapsed.
......@@ -17,42 +17,48 @@ class CodeAssemblerState;
class BinaryOpAssembler : public CodeStubAssembler {
public:
using Node = compiler::Node;
explicit BinaryOpAssembler(compiler::CodeAssemblerState* state)
: CodeStubAssembler(state) {}
Node* Generate_AddWithFeedback(Node* context, Node* lhs, Node* rhs,
Node* slot_id, Node* feedback_vector,
bool rhs_is_smi);
TNode<Object> Generate_AddWithFeedback(
TNode<Context> context, TNode<Object> left, TNode<Object> right,
TNode<UintPtrT> slot, TNode<HeapObject> maybe_feedback_vector,
bool rhs_is_smi);
Node* Generate_SubtractWithFeedback(Node* context, Node* lhs, Node* rhs,
Node* slot_id, Node* feedback_vector,
bool rhs_is_smi);
TNode<Object> Generate_SubtractWithFeedback(
TNode<Context> context, TNode<Object> left, TNode<Object> right,
TNode<UintPtrT> slot, TNode<HeapObject> maybe_feedback_vector,
bool rhs_is_smi);
Node* Generate_MultiplyWithFeedback(Node* context, Node* lhs, Node* rhs,
Node* slot_id, Node* feedback_vector,
bool rhs_is_smi);
TNode<Object> Generate_MultiplyWithFeedback(
TNode<Context> context, TNode<Object> left, TNode<Object> right,
TNode<UintPtrT> slot, TNode<HeapObject> maybe_feedback_vector,
bool rhs_is_smi);
Node* Generate_DivideWithFeedback(Node* context, Node* dividend,
Node* divisor, Node* slot_id,
Node* feedback_vector, bool rhs_is_smi);
TNode<Object> Generate_DivideWithFeedback(
TNode<Context> context, TNode<Object> dividend, TNode<Object> divisor,
TNode<UintPtrT> slot, TNode<HeapObject> maybe_feedback_vector,
bool rhs_is_smi);
Node* Generate_ModulusWithFeedback(Node* context, Node* dividend,
Node* divisor, Node* slot_id,
Node* feedback_vector, bool rhs_is_smi);
TNode<Object> Generate_ModulusWithFeedback(
TNode<Context> context, TNode<Object> dividend, TNode<Object> divisor,
TNode<UintPtrT> slot, TNode<HeapObject> maybe_feedback_vector,
bool rhs_is_smi);
Node* Generate_ExponentiateWithFeedback(Node* context, Node* dividend,
Node* divisor, Node* slot_id,
Node* feedback_vector,
bool rhs_is_smi);
TNode<Object> Generate_ExponentiateWithFeedback(
TNode<Context> context, TNode<Object> base, TNode<Object> exponent,
TNode<UintPtrT> slot, TNode<HeapObject> maybe_feedback_vector,
bool rhs_is_smi);
private:
using SmiOperation = std::function<Node*(Node*, Node*, Variable*)>;
using FloatOperation = std::function<Node*(Node*, Node*)>;
Node* Generate_BinaryOperationWithFeedback(
Node* context, Node* lhs, Node* rhs, Node* slot_id, Node* feedback_vector,
using SmiOperation =
std::function<TNode<Object>(TNode<Smi>, TNode<Smi>, TVariable<Smi>*)>;
using FloatOperation =
std::function<TNode<Float64T>(TNode<Float64T>, TNode<Float64T>)>;
TNode<Object> Generate_BinaryOperationWithFeedback(
TNode<Context> context, TNode<Object> left, TNode<Object> right,
TNode<UintPtrT> slot, TNode<HeapObject> maybe_feedback_vector,
const SmiOperation& smiOperation, const FloatOperation& floatOperation,
Operation op, bool rhs_is_smi);
};
......
......@@ -832,20 +832,21 @@ class InterpreterBinaryOpAssembler : public InterpreterAssembler {
OperandScale operand_scale)
: InterpreterAssembler(state, bytecode, operand_scale) {}
using BinaryOpGenerator =
Node* (BinaryOpAssembler::*)(Node* context, Node* left, Node* right,
Node* slot, Node* vector, bool lhs_is_smi);
using BinaryOpGenerator = TNode<Object> (BinaryOpAssembler::*)(
TNode<Context> context, TNode<Object> left, TNode<Object> right,
TNode<UintPtrT> slot, TNode<HeapObject> maybe_feedback_vector,
bool rhs_is_smi);
void BinaryOpWithFeedback(BinaryOpGenerator generator) {
TNode<Object> lhs = LoadRegisterAtOperandIndex(0);
TNode<Object> rhs = GetAccumulator();
TNode<Context> context = GetContext();
TNode<IntPtrT> slot_index = Signed(BytecodeOperandIdx(1));
TNode<UintPtrT> slot_index = BytecodeOperandIdx(1);
TNode<HeapObject> maybe_feedback_vector = LoadFeedbackVector();
BinaryOpAssembler binop_asm(state());
Node* result = (binop_asm.*generator)(context, lhs, rhs, slot_index,
maybe_feedback_vector, false);
TNode<Object> result = (binop_asm.*generator)(context, lhs, rhs, slot_index,
maybe_feedback_vector, false);
SetAccumulator(result);
Dispatch();
}
......@@ -854,12 +855,12 @@ class InterpreterBinaryOpAssembler : public InterpreterAssembler {
TNode<Object> lhs = GetAccumulator();
TNode<Smi> rhs = BytecodeOperandImmSmi(0);
TNode<Context> context = GetContext();
TNode<IntPtrT> slot_index = Signed(BytecodeOperandIdx(1));
TNode<UintPtrT> slot_index = BytecodeOperandIdx(1);
TNode<HeapObject> maybe_feedback_vector = LoadFeedbackVector();
BinaryOpAssembler binop_asm(state());
Node* result = (binop_asm.*generator)(context, lhs, rhs, slot_index,
maybe_feedback_vector, true);
TNode<Object> result = (binop_asm.*generator)(context, lhs, rhs, slot_index,
maybe_feedback_vector, true);
SetAccumulator(result);
Dispatch();
}
......
......@@ -18,7 +18,8 @@ namespace internal {
using compiler::CodeAssemblerTester;
using compiler::FunctionTester;
using compiler::Node;
using compiler::TNode;
template <typename T>
using TNode = compiler::TNode<T>;
namespace {
......
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