builtins-descriptors.h 2.67 KB
Newer Older
1 2 3 4 5 6 7 8
// 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_BUILTINS_BUILTINS_DESCRIPTORS_H_
#define V8_BUILTINS_BUILTINS_DESCRIPTORS_H_

#include "src/builtins/builtins.h"
9
#include "src/codegen/interface-descriptors.h"
10
#include "src/compiler/code-assembler.h"
11
#include "src/objects/shared-function-info.h"
12 13 14 15 16

namespace v8 {
namespace internal {

// Define interface descriptors for builtins with JS linkage.
17
#define DEFINE_TFJ_INTERFACE_DESCRIPTOR(Name, Argc, ...)                \
18 19
  struct Builtin_##Name##_InterfaceDescriptor {                         \
    enum ParameterIndices {                                             \
20
      kJSTarget = compiler::CodeAssembler::kTargetParameterIndex,       \
21 22 23 24 25 26 27 28
      ##__VA_ARGS__,                                                    \
      kJSNewTarget,                                                     \
      kJSActualArgumentsCount,                                          \
      kContext,                                                         \
      kParameterCount,                                                  \
    };                                                                  \
    static_assert((Argc) == static_cast<uint16_t>(kParameterCount - 4), \
                  "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
  using Builtin_##Name##_InterfaceDescriptor = InterfaceDescriptor##Descriptor;
35

36
#define DEFINE_TFS_INTERFACE_DESCRIPTOR(Name, ...) \
37
  using Builtin_##Name##_InterfaceDescriptor = Name##Descriptor;
38

39
// Define interface descriptors for IC handlers/dispatchers.
40
#define DEFINE_TFH_INTERFACE_DESCRIPTOR(Name, InterfaceDescriptor) \
41
  using Builtin_##Name##_InterfaceDescriptor = InterfaceDescriptor##Descriptor;
42

43
#define DEFINE_ASM_INTERFACE_DESCRIPTOR(Name, InterfaceDescriptor) \
44
  using Builtin_##Name##_InterfaceDescriptor = InterfaceDescriptor##Descriptor;
45

46
BUILTIN_LIST(IGNORE_BUILTIN, DEFINE_TFJ_INTERFACE_DESCRIPTOR,
47
             DEFINE_TFC_INTERFACE_DESCRIPTOR, DEFINE_TFS_INTERFACE_DESCRIPTOR,
48 49
             DEFINE_TFH_INTERFACE_DESCRIPTOR, IGNORE_BUILTIN,
             DEFINE_ASM_INTERFACE_DESCRIPTOR)
50 51

#undef DEFINE_TFJ_INTERFACE_DESCRIPTOR
52
#undef DEFINE_TFC_INTERFACE_DESCRIPTOR
53 54
#undef DEFINE_TFS_INTERFACE_DESCRIPTOR
#undef DEFINE_TFH_INTERFACE_DESCRIPTOR
55
#undef DEFINE_ASM_INTERFACE_DESCRIPTOR
56 57 58 59 60

}  // namespace internal
}  // namespace v8

#endif  // V8_BUILTINS_BUILTINS_DESCRIPTORS_H_