Commit db377d02 authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

[builtins] Added TFH macro for IC handlers/dispatchers and simplified TFS macro.

BUG=v8:6116

Change-Id: I1487165550e938200ce49a022222892752feccae
Reviewed-on: https://chromium-review.googlesource.com/461819Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#44195}
parent 19f626f0
......@@ -25,14 +25,22 @@ namespace internal {
};
// Define interface descriptors for builtins with StubCall linkage.
#define DEFINE_TFS_INTERFACE_DESCRIPTOR(Name, Kind, Extra, \
InterfaceDescriptor, result_size) \
#define DEFINE_TFS_INTERFACE_DESCRIPTOR(Name, InterfaceDescriptor, \
result_size) \
typedef InterfaceDescriptor##Descriptor Builtin_##Name##_InterfaceDescriptor;
// Define interface descriptors for IC handlers/dispatchers.
#define DEFINE_TFH_INTERFACE_DESCRIPTOR(Name, Kind, Extra, \
InterfaceDescriptor) \
typedef InterfaceDescriptor##Descriptor Builtin_##Name##_InterfaceDescriptor;
BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, DEFINE_TFJ_INTERFACE_DESCRIPTOR,
DEFINE_TFS_INTERFACE_DESCRIPTOR, IGNORE_BUILTIN, IGNORE_BUILTIN)
DEFINE_TFS_INTERFACE_DESCRIPTOR, DEFINE_TFH_INTERFACE_DESCRIPTOR,
IGNORE_BUILTIN, IGNORE_BUILTIN)
#undef DEFINE_TFJ_INTERFACE_DESCRIPTOR
#undef DEFINE_TFS_INTERFACE_DESCRIPTOR
#undef DEFINE_TFH_INTERFACE_DESCRIPTOR
} // namespace internal
} // namespace v8
......
......@@ -5,6 +5,7 @@
#include "src/builtins/builtins.h"
#include "src/api.h"
#include "src/assembler-inl.h"
#include "src/builtins/builtins-descriptors.h"
#include "src/callable.h"
#include "src/code-events.h"
#include "src/compiler/code-assembler.h"
......@@ -141,24 +142,32 @@ void Builtins::SetUp(Isolate* isolate, bool create_heap_objects) {
code = BuildWithCodeStubAssemblerJS(isolate, &Generate_##Name, Argc, \
kBuiltinFlags, #Name); \
builtins_[index++] = code;
#define BUILD_TFS(Name, Kind, Extra, InterfaceDescriptor, result_size) \
#define BUILD_TFS(Name, InterfaceDescriptor, result_size) \
{ InterfaceDescriptor##Descriptor descriptor(isolate); } \
code = BuildWithCodeStubAssemblerCS(isolate, &Generate_##Name, \
CallDescriptors::InterfaceDescriptor, \
kBuiltinFlags, #Name, result_size); \
builtins_[index++] = code;
#define BUILD_TFH(Name, Kind, Extra, InterfaceDescriptor) \
{ InterfaceDescriptor##Descriptor descriptor(isolate); } \
/* Return size for IC builtins/handlers is always 1. */ \
code = BuildWithCodeStubAssemblerCS( \
isolate, &Generate_##Name, CallDescriptors::InterfaceDescriptor, \
Code::ComputeFlags(Code::Kind, Extra), #Name, result_size); \
Code::ComputeFlags(Code::Kind, Extra), #Name, 1); \
builtins_[index++] = code;
#define BUILD_ASM(Name) \
code = \
BuildWithMacroAssembler(isolate, Generate_##Name, kBuiltinFlags, #Name); \
builtins_[index++] = code;
BUILTIN_LIST(BUILD_CPP, BUILD_API, BUILD_TFJ, BUILD_TFS, BUILD_ASM,
BUILD_ASM);
BUILTIN_LIST(BUILD_CPP, BUILD_API, BUILD_TFJ, BUILD_TFS, BUILD_TFH,
BUILD_ASM, BUILD_ASM);
#undef BUILD_CPP
#undef BUILD_API
#undef BUILD_TFJ
#undef BUILD_TFS
#undef BUILD_TFH
#undef BUILD_ASM
CHECK_EQ(builtin_count, index);
for (int i = 0; i < builtin_count; i++) {
......@@ -278,13 +287,14 @@ Handle<Code> Builtins::OrdinaryToPrimitive(OrdinaryToPrimitiveHint hint) {
// static
Callable Builtins::CallableFor(Isolate* isolate, Name name) {
switch (name) {
#define CASE(Name, _, __, InterfaceDescriptor, ...) \
#define CASE(Name, ...) \
case k##Name: { \
Handle<Code> code(Code::cast(isolate->builtins()->builtins_[name])); \
auto descriptor = InterfaceDescriptor##Descriptor(isolate); \
auto descriptor = Builtin_##Name##_InterfaceDescriptor(isolate); \
return Callable(code, descriptor); \
}
BUILTIN_LIST_TFS(CASE)
BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, CASE, CASE,
IGNORE_BUILTIN, IGNORE_BUILTIN)
#undef CASE
default:
UNREACHABLE();
......@@ -331,7 +341,7 @@ bool Builtins::IsCpp(int index) {
return true;
#define BUILTIN_LIST_CPP(V) \
BUILTIN_LIST(V, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, \
IGNORE_BUILTIN, IGNORE_BUILTIN)
IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN)
BUILTIN_LIST_CPP(CASE)
#undef BUILTIN_LIST_CPP
#undef CASE
......@@ -350,7 +360,7 @@ bool Builtins::IsApi(int index) {
return true;
#define BUILTIN_LIST_API(V) \
BUILTIN_LIST(IGNORE_BUILTIN, V, IGNORE_BUILTIN, IGNORE_BUILTIN, \
IGNORE_BUILTIN, IGNORE_BUILTIN)
IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN)
BUILTIN_LIST_API(CASE);
#undef BUILTIN_LIST_API
#undef CASE
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment