• 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_DESCRIPTORS_H_
6 #define V8_BUILTINS_BUILTINS_DESCRIPTORS_H_
7 
8 #include "src/builtins/builtins.h"
9 #include "src/compiler/code-assembler.h"
10 #include "src/interface-descriptors.h"
11 #include "src/objects/shared-function-info.h"
12 
13 namespace v8 {
14 namespace internal {
15 
16 // Define interface descriptors for builtins with JS linkage.
17 #define DEFINE_TFJ_INTERFACE_DESCRIPTOR(Name, Argc, ...)                \
18   struct Builtin_##Name##_InterfaceDescriptor {                         \
19     enum ParameterIndices {                                             \
20       kJSTarget = compiler::CodeAssembler::kTargetParameterIndex,       \
21       ##__VA_ARGS__,                                                    \
22       kJSNewTarget,                                                     \
23       kJSActualArgumentsCount,                                          \
24       kContext,                                                         \
25       kParameterCount,                                                  \
26     };                                                                  \
27     static_assert((Argc) == static_cast<uint16_t>(kParameterCount - 4), \
28                   "Inconsistent set of arguments");                     \
29     static_assert(kJSTarget == -1, "Unexpected kJSTarget index value"); \
30   };
31 
32 // Define interface descriptors for builtins with StubCall linkage.
33 #define DEFINE_TFC_INTERFACE_DESCRIPTOR(Name, InterfaceDescriptor, \
34                                         result_size)               \
35   typedef InterfaceDescriptor##Descriptor Builtin_##Name##_InterfaceDescriptor;
36 
37 #define DEFINE_TFS_INTERFACE_DESCRIPTOR(Name, ...) \
38   typedef Name##Descriptor Builtin_##Name##_InterfaceDescriptor;
39 
40 // Define interface descriptors for IC handlers/dispatchers.
41 #define DEFINE_TFH_INTERFACE_DESCRIPTOR(Name, InterfaceDescriptor) \
42   typedef InterfaceDescriptor##Descriptor Builtin_##Name##_InterfaceDescriptor;
43 
44 BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, DEFINE_TFJ_INTERFACE_DESCRIPTOR,
45              DEFINE_TFC_INTERFACE_DESCRIPTOR, DEFINE_TFS_INTERFACE_DESCRIPTOR,
46              DEFINE_TFH_INTERFACE_DESCRIPTOR, IGNORE_BUILTIN, IGNORE_BUILTIN)
47 
48 #undef DEFINE_TFJ_INTERFACE_DESCRIPTOR
49 #undef DEFINE_TFC_INTERFACE_DESCRIPTOR
50 #undef DEFINE_TFS_INTERFACE_DESCRIPTOR
51 #undef DEFINE_TFH_INTERFACE_DESCRIPTOR
52 
53 }  // namespace internal
54 }  // namespace v8
55 
56 #endif  // V8_BUILTINS_BUILTINS_DESCRIPTORS_H_
57