// Copyright 2017 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef V8_IC_BINARY_OP_ASSEMBLER_H_ #define V8_IC_BINARY_OP_ASSEMBLER_H_ #include #include "src/codegen/code-stub-assembler.h" namespace v8 { namespace internal { namespace compiler { class CodeAssemblerState; } class BinaryOpAssembler : public CodeStubAssembler { public: explicit BinaryOpAssembler(compiler::CodeAssemblerState* state) : CodeStubAssembler(state) {} TNode Generate_AddWithFeedback( TNode context, TNode left, TNode right, TNode slot, TNode maybe_feedback_vector, bool rhs_known_smi); TNode Generate_SubtractWithFeedback( TNode context, TNode left, TNode right, TNode slot, TNode maybe_feedback_vector, bool rhs_known_smi); TNode Generate_MultiplyWithFeedback( TNode context, TNode left, TNode right, TNode slot, TNode maybe_feedback_vector, bool rhs_known_smi); TNode Generate_DivideWithFeedback( TNode context, TNode dividend, TNode divisor, TNode slot, TNode maybe_feedback_vector, bool rhs_known_smi); TNode Generate_ModulusWithFeedback( TNode context, TNode dividend, TNode divisor, TNode slot, TNode maybe_feedback_vector, bool rhs_known_smi); TNode Generate_ExponentiateWithFeedback( TNode context, TNode base, TNode exponent, TNode slot, TNode maybe_feedback_vector, bool rhs_known_smi); private: using SmiOperation = std::function(TNode, TNode, TVariable*)>; using FloatOperation = std::function(TNode, TNode)>; TNode Generate_BinaryOperationWithFeedback( TNode context, TNode left, TNode right, TNode slot, TNode maybe_feedback_vector, const SmiOperation& smiOperation, const FloatOperation& floatOperation, Operation op, bool rhs_known_smi); }; } // namespace internal } // namespace v8 #endif // V8_IC_BINARY_OP_ASSEMBLER_H_