• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_BUILTINS_BUILTINS_CALL_GEN_H_
6 #define V8_BUILTINS_BUILTINS_CALL_GEN_H_
7 
8 #include "src/codegen/code-stub-assembler.h"
9 
10 namespace v8 {
11 namespace internal {
12 
13 class CallOrConstructBuiltinsAssembler : public CodeStubAssembler {
14  public:
CallOrConstructBuiltinsAssembler(compiler::CodeAssemblerState * state)15   explicit CallOrConstructBuiltinsAssembler(compiler::CodeAssemblerState* state)
16       : CodeStubAssembler(state) {}
17 
18   void CallOrConstructWithArrayLike(TNode<Object> target,
19                                     base::Optional<TNode<Object>> new_target,
20                                     TNode<Object> arguments_list,
21                                     TNode<Context> context);
22   void CallOrConstructDoubleVarargs(TNode<Object> target,
23                                     base::Optional<TNode<Object>> new_target,
24                                     TNode<FixedDoubleArray> elements,
25                                     TNode<Int32T> length,
26                                     TNode<Int32T> args_count,
27                                     TNode<Context> context, TNode<Int32T> kind);
28   void CallOrConstructWithSpread(TNode<Object> target,
29                                  base::Optional<TNode<Object>> new_target,
30                                  TNode<Object> spread, TNode<Int32T> args_count,
31                                  TNode<Context> context);
32 
33   template <class Descriptor>
34   void CallReceiver(Builtin id, base::Optional<TNode<Object>> = base::nullopt);
35   template <class Descriptor>
36   void CallReceiver(Builtin id, TNode<Int32T> argc, TNode<UintPtrT> slot,
37                     base::Optional<TNode<Object>> = base::nullopt);
38 
39   enum class CallFunctionTemplateMode : uint8_t {
40     kCheckAccess,
41     kCheckCompatibleReceiver,
42     kCheckAccessAndCompatibleReceiver,
43   };
44 
45   void CallFunctionTemplate(CallFunctionTemplateMode mode,
46                             TNode<FunctionTemplateInfo> function_template_info,
47                             TNode<IntPtrT> argc, TNode<Context> context);
48 
49   void BuildConstruct(TNode<Object> target, TNode<Object> new_target,
50                       TNode<Int32T> argc, const LazyNode<Context>& context,
51                       const LazyNode<HeapObject>& feedback_vector,
52                       TNode<UintPtrT> slot, UpdateFeedbackMode mode);
53 
54   void BuildConstructWithSpread(TNode<Object> target, TNode<Object> new_target,
55                                 TNode<Object> spread, TNode<Int32T> argc,
56                                 const LazyNode<Context>& context,
57                                 const LazyNode<HeapObject>& feedback_vector,
58                                 TNode<UintPtrT> slot, UpdateFeedbackMode mode);
59 
60  private:
61   TNode<JSReceiver> GetCompatibleReceiver(TNode<JSReceiver> receiver,
62                                           TNode<HeapObject> signature,
63                                           TNode<Context> context);
64 };
65 
66 }  // namespace internal
67 }  // namespace v8
68 
69 #endif  // V8_BUILTINS_BUILTINS_CALL_GEN_H_
70