Line data Source code
1 : // Copyright 2017 the V8 project authors. All rights reserved.
2 : // Use of this source code is governed by a BSD-style license that can be
3 : // found in the LICENSE file.
4 :
5 : #ifndef V8_IC_BINARY_OP_ASSEMBLER_H_
6 : #define V8_IC_BINARY_OP_ASSEMBLER_H_
7 :
8 : #include <functional>
9 : #include "src/code-stub-assembler.h"
10 :
11 : namespace v8 {
12 : namespace internal {
13 :
14 : namespace compiler {
15 : class CodeAssemblerState;
16 : }
17 :
18 2016 : class BinaryOpAssembler : public CodeStubAssembler {
19 : public:
20 : using Node = compiler::Node;
21 :
22 : explicit BinaryOpAssembler(compiler::CodeAssemblerState* state)
23 2016 : : CodeStubAssembler(state) {}
24 :
25 : Node* Generate_AddWithFeedback(Node* context, Node* lhs, Node* rhs,
26 : Node* slot_id, Node* feedback_vector,
27 : bool rhs_is_smi);
28 :
29 : Node* Generate_SubtractWithFeedback(Node* context, Node* lhs, Node* rhs,
30 : Node* slot_id, Node* feedback_vector,
31 : bool rhs_is_smi);
32 :
33 : Node* Generate_MultiplyWithFeedback(Node* context, Node* lhs, Node* rhs,
34 : Node* slot_id, Node* feedback_vector,
35 : bool rhs_is_smi);
36 :
37 : Node* Generate_DivideWithFeedback(Node* context, Node* dividend,
38 : Node* divisor, Node* slot_id,
39 : Node* feedback_vector, bool rhs_is_smi);
40 :
41 : Node* Generate_ModulusWithFeedback(Node* context, Node* dividend,
42 : Node* divisor, Node* slot_id,
43 : Node* feedback_vector, bool rhs_is_smi);
44 :
45 : Node* Generate_ExponentiateWithFeedback(Node* context, Node* dividend,
46 : Node* divisor, Node* slot_id,
47 : Node* feedback_vector,
48 : bool rhs_is_smi);
49 :
50 : private:
51 : using SmiOperation = std::function<Node*(Node*, Node*, Variable*)>;
52 : using FloatOperation = std::function<Node*(Node*, Node*)>;
53 :
54 : Node* Generate_BinaryOperationWithFeedback(
55 : Node* context, Node* lhs, Node* rhs, Node* slot_id, Node* feedback_vector,
56 : const SmiOperation& smiOperation, const FloatOperation& floatOperation,
57 : Operation op, bool rhs_is_smi);
58 : };
59 :
60 : } // namespace internal
61 : } // namespace v8
62 :
63 : #endif // V8_IC_BINARY_OP_ASSEMBLER_H_
|