[cleanup] Remove API builtins
The HandleApiCall uses BUILTIN_EXIT frames now instead of EXIT frames, so API calls show up in stack traces. We no longer need API builtins and this CL removes them and the corresponding C++ macros. Bug: v8:9183 Change-Id: Ifa2e842123ef7e96b2ff296116f46d5d799a63ad Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1617249 Commit-Queue: Simon Zünd <szuend@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Jakob Gruber <jgruber@chromium.org> Cr-Commit-Position: refs/heads/master@{#61723}
This commit is contained in:
parent
52a56becf0
commit
01575eb1f4
@ -15,8 +15,6 @@ namespace internal {
|
||||
|
||||
// CPP: Builtin in C++. Entered via BUILTIN_EXIT frame.
|
||||
// Args: name
|
||||
// API: Builtin in C++ for API callbacks. Entered via EXIT frame.
|
||||
// Args: name
|
||||
// TFJ: Builtin in Turbofan, with JS linkage (callable as Javascript function).
|
||||
// Args: name, arguments count, explicit argument names...
|
||||
// TFS: Builtin in Turbofan, with CodeStub linkage.
|
||||
@ -33,7 +31,7 @@ namespace internal {
|
||||
// TODO(jgruber): Remove DummyDescriptor once all ASM builtins have been
|
||||
// properly associated with their descriptor.
|
||||
|
||||
#define BUILTIN_LIST_BASE(CPP, API, TFJ, TFC, TFS, TFH, ASM) \
|
||||
#define BUILTIN_LIST_BASE(CPP, TFJ, TFC, TFS, TFH, ASM) \
|
||||
/* GC write barrirer */ \
|
||||
TFC(RecordWrite, RecordWrite) \
|
||||
TFC(EphemeronKeyBarrier, EphemeronKeyBarrier) \
|
||||
@ -1323,10 +1321,10 @@ namespace internal {
|
||||
CPP(StringPrototypeToUpperCase)
|
||||
#endif // V8_INTL_SUPPORT
|
||||
|
||||
#define BUILTIN_LIST(CPP, API, TFJ, TFC, TFS, TFH, BCH, ASM) \
|
||||
BUILTIN_LIST_BASE(CPP, API, TFJ, TFC, TFS, TFH, ASM) \
|
||||
BUILTIN_LIST_FROM_TORQUE(CPP, API, TFJ, TFC, TFS, TFH, ASM) \
|
||||
BUILTIN_LIST_INTL(CPP, TFJ, TFS) \
|
||||
#define BUILTIN_LIST(CPP, TFJ, TFC, TFS, TFH, BCH, ASM) \
|
||||
BUILTIN_LIST_BASE(CPP, TFJ, TFC, TFS, TFH, ASM) \
|
||||
BUILTIN_LIST_FROM_TORQUE(CPP, TFJ, TFC, TFS, TFH, ASM) \
|
||||
BUILTIN_LIST_INTL(CPP, TFJ, TFS) \
|
||||
BUILTIN_LIST_BYTECODE_HANDLERS(BCH)
|
||||
|
||||
// The exception thrown in the following builtins are caught
|
||||
@ -1376,25 +1374,25 @@ namespace internal {
|
||||
|
||||
#define IGNORE_BUILTIN(...)
|
||||
|
||||
#define BUILTIN_LIST_C(V) \
|
||||
BUILTIN_LIST(V, V, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, \
|
||||
#define BUILTIN_LIST_C(V) \
|
||||
BUILTIN_LIST(V, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, \
|
||||
IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN)
|
||||
|
||||
#define BUILTIN_LIST_A(V) \
|
||||
BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, \
|
||||
IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, V)
|
||||
IGNORE_BUILTIN, IGNORE_BUILTIN, V)
|
||||
|
||||
#define BUILTIN_LIST_TFS(V) \
|
||||
BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, \
|
||||
V, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN)
|
||||
#define BUILTIN_LIST_TFS(V) \
|
||||
BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, V, \
|
||||
IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN)
|
||||
|
||||
#define BUILTIN_LIST_TFJ(V) \
|
||||
BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, V, IGNORE_BUILTIN, \
|
||||
IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN)
|
||||
BUILTIN_LIST(IGNORE_BUILTIN, V, IGNORE_BUILTIN, IGNORE_BUILTIN, \
|
||||
IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN)
|
||||
|
||||
#define BUILTIN_LIST_TFC(V) \
|
||||
BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, V, \
|
||||
IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN)
|
||||
BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, V, IGNORE_BUILTIN, \
|
||||
IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN)
|
||||
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
@ -43,7 +43,7 @@ namespace internal {
|
||||
#define DEFINE_ASM_INTERFACE_DESCRIPTOR(Name, InterfaceDescriptor) \
|
||||
typedef InterfaceDescriptor##Descriptor Builtin_##Name##_InterfaceDescriptor;
|
||||
|
||||
BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, DEFINE_TFJ_INTERFACE_DESCRIPTOR,
|
||||
BUILTIN_LIST(IGNORE_BUILTIN, DEFINE_TFJ_INTERFACE_DESCRIPTOR,
|
||||
DEFINE_TFC_INTERFACE_DESCRIPTOR, DEFINE_TFS_INTERFACE_DESCRIPTOR,
|
||||
DEFINE_TFH_INTERFACE_DESCRIPTOR, IGNORE_BUILTIN,
|
||||
DEFINE_ASM_INTERFACE_DESCRIPTOR)
|
||||
|
@ -32,15 +32,13 @@ namespace {
|
||||
struct BuiltinMetadata {
|
||||
const char* name;
|
||||
Builtins::Kind kind;
|
||||
// For CPP and API builtins it's cpp_entry address and for TFJ it's a
|
||||
// For CPP builtins it's cpp_entry address and for TFJ it's a
|
||||
// parameter count.
|
||||
Address cpp_entry_or_parameter_count;
|
||||
};
|
||||
|
||||
#define DECL_CPP(Name, ...) \
|
||||
{#Name, Builtins::CPP, FUNCTION_ADDR(Builtin_##Name)},
|
||||
#define DECL_API(Name, ...) \
|
||||
{#Name, Builtins::API, FUNCTION_ADDR(Builtin_##Name)},
|
||||
#define DECL_TFJ(Name, Count, ...) \
|
||||
{#Name, Builtins::TFJ, static_cast<Address>(Count)},
|
||||
#define DECL_TFC(Name, ...) {#Name, Builtins::TFC, kNullAddress},
|
||||
@ -48,12 +46,9 @@ struct BuiltinMetadata {
|
||||
#define DECL_TFH(Name, ...) {#Name, Builtins::TFH, kNullAddress},
|
||||
#define DECL_BCH(Name, ...) {#Name, Builtins::BCH, kNullAddress},
|
||||
#define DECL_ASM(Name, ...) {#Name, Builtins::ASM, kNullAddress},
|
||||
const BuiltinMetadata builtin_metadata[] = {
|
||||
BUILTIN_LIST(DECL_CPP, DECL_API, DECL_TFJ, DECL_TFC, DECL_TFS, DECL_TFH,
|
||||
DECL_BCH, DECL_ASM)
|
||||
};
|
||||
const BuiltinMetadata builtin_metadata[] = {BUILTIN_LIST(
|
||||
DECL_CPP, DECL_TFJ, DECL_TFC, DECL_TFS, DECL_TFH, DECL_BCH, DECL_ASM)};
|
||||
#undef DECL_CPP
|
||||
#undef DECL_API
|
||||
#undef DECL_TFJ
|
||||
#undef DECL_TFC
|
||||
#undef DECL_TFS
|
||||
@ -145,8 +140,8 @@ Callable Builtins::CallableFor(Isolate* isolate, Name name) {
|
||||
key = Builtin_##Name##_InterfaceDescriptor::key(); \
|
||||
break; \
|
||||
}
|
||||
BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, CASE_OTHER,
|
||||
CASE_OTHER, CASE_OTHER, IGNORE_BUILTIN, CASE_OTHER)
|
||||
BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, CASE_OTHER, CASE_OTHER,
|
||||
CASE_OTHER, IGNORE_BUILTIN, CASE_OTHER)
|
||||
#undef CASE_OTHER
|
||||
default:
|
||||
Builtins::Kind kind = Builtins::KindOf(name);
|
||||
@ -196,7 +191,7 @@ void Builtins::PrintBuiltinSize() {
|
||||
|
||||
// static
|
||||
Address Builtins::CppEntryOf(int index) {
|
||||
DCHECK(Builtins::HasCppImplementation(index));
|
||||
DCHECK(Builtins::IsCpp(index));
|
||||
return builtin_metadata[index].cpp_entry_or_parameter_count;
|
||||
}
|
||||
|
||||
@ -332,7 +327,6 @@ const char* Builtins::KindNameOf(int index) {
|
||||
// clang-format off
|
||||
switch (kind) {
|
||||
case CPP: return "CPP";
|
||||
case API: return "API";
|
||||
case TFJ: return "TFJ";
|
||||
case TFC: return "TFC";
|
||||
case TFS: return "TFS";
|
||||
@ -347,12 +341,6 @@ const char* Builtins::KindNameOf(int index) {
|
||||
// static
|
||||
bool Builtins::IsCpp(int index) { return Builtins::KindOf(index) == CPP; }
|
||||
|
||||
// static
|
||||
bool Builtins::HasCppImplementation(int index) {
|
||||
Kind kind = Builtins::KindOf(index);
|
||||
return (kind == CPP || kind == API);
|
||||
}
|
||||
|
||||
// static
|
||||
bool Builtins::AllowDynamicFunction(Isolate* isolate, Handle<JSFunction> target,
|
||||
Handle<JSObject> target_global_proxy) {
|
||||
|
@ -47,7 +47,7 @@ class Builtins {
|
||||
enum Name : int32_t {
|
||||
#define DEF_ENUM(Name, ...) k##Name,
|
||||
BUILTIN_LIST(DEF_ENUM, DEF_ENUM, DEF_ENUM, DEF_ENUM, DEF_ENUM, DEF_ENUM,
|
||||
DEF_ENUM, DEF_ENUM)
|
||||
DEF_ENUM)
|
||||
#undef DEF_ENUM
|
||||
builtin_count,
|
||||
|
||||
@ -65,7 +65,7 @@ class Builtins {
|
||||
}
|
||||
|
||||
// The different builtin kinds are documented in builtins-definitions.h.
|
||||
enum Kind { CPP, API, TFJ, TFC, TFS, TFH, BCH, ASM };
|
||||
enum Kind { CPP, TFJ, TFC, TFS, TFH, BCH, ASM };
|
||||
|
||||
static BailoutId GetContinuationBailoutId(Name name);
|
||||
static Name GetBuiltinFromBailoutId(BailoutId);
|
||||
@ -102,7 +102,6 @@ class Builtins {
|
||||
static const char* KindNameOf(int index);
|
||||
|
||||
static bool IsCpp(int index);
|
||||
static bool HasCppImplementation(int index);
|
||||
|
||||
// True, iff the given code object is a builtin. Note that this does not
|
||||
// necessarily mean that its kind is Code::BUILTIN.
|
||||
@ -231,8 +230,8 @@ class Builtins {
|
||||
#define DECLARE_TF(Name, ...) \
|
||||
static void Generate_##Name(compiler::CodeAssemblerState* state);
|
||||
|
||||
BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, DECLARE_TF, DECLARE_TF,
|
||||
DECLARE_TF, DECLARE_TF, IGNORE_BUILTIN, DECLARE_ASM)
|
||||
BUILTIN_LIST(IGNORE_BUILTIN, DECLARE_TF, DECLARE_TF, DECLARE_TF, DECLARE_TF,
|
||||
IGNORE_BUILTIN, DECLARE_ASM)
|
||||
|
||||
#undef DECLARE_ASM
|
||||
#undef DECLARE_TF
|
||||
|
@ -313,10 +313,6 @@ void SetupIsolateDelegate::SetupBuiltinsInternal(Isolate* isolate) {
|
||||
code = BuildAdaptor(isolate, index, FUNCTION_ADDR(Builtin_##Name), \
|
||||
Builtins::BUILTIN_EXIT, #Name); \
|
||||
AddBuiltin(builtins, index++, code);
|
||||
#define BUILD_API(Name) \
|
||||
code = BuildAdaptor(isolate, index, FUNCTION_ADDR(Builtin_##Name), \
|
||||
Builtins::EXIT, #Name); \
|
||||
AddBuiltin(builtins, index++, code);
|
||||
#define BUILD_TFJ(Name, Argc, ...) \
|
||||
code = BuildWithCodeStubAssemblerJS( \
|
||||
isolate, index, &Builtins::Generate_##Name, Argc, #Name); \
|
||||
@ -350,11 +346,10 @@ void SetupIsolateDelegate::SetupBuiltinsInternal(Isolate* isolate) {
|
||||
#Name); \
|
||||
AddBuiltin(builtins, index++, code);
|
||||
|
||||
BUILTIN_LIST(BUILD_CPP, BUILD_API, BUILD_TFJ, BUILD_TFC, BUILD_TFS, BUILD_TFH,
|
||||
BUILD_BCH, BUILD_ASM);
|
||||
BUILTIN_LIST(BUILD_CPP, BUILD_TFJ, BUILD_TFC, BUILD_TFS, BUILD_TFH, BUILD_BCH,
|
||||
BUILD_ASM);
|
||||
|
||||
#undef BUILD_CPP
|
||||
#undef BUILD_API
|
||||
#undef BUILD_TFJ
|
||||
#undef BUILD_TFC
|
||||
#undef BUILD_TFS
|
||||
|
@ -1446,16 +1446,15 @@ void ReduceBuiltin(JSGraph* jsgraph, Node* node, int builtin_index, int arity,
|
||||
|
||||
const bool is_construct = (node->opcode() == IrOpcode::kJSConstruct);
|
||||
|
||||
DCHECK(Builtins::HasCppImplementation(builtin_index));
|
||||
|
||||
Node* target = NodeProperties::GetValueInput(node, 0);
|
||||
Node* new_target = is_construct
|
||||
? NodeProperties::GetValueInput(node, arity + 1)
|
||||
: jsgraph->UndefinedConstant();
|
||||
|
||||
// API and CPP builtins are implemented in C++, and we can inline both.
|
||||
// CPP builtins create a builtin exit frame, API builtins don't.
|
||||
const bool has_builtin_exit_frame = Builtins::IsCpp(builtin_index);
|
||||
// CPP builtins are implemented in C++, and we can inline it.
|
||||
// CPP builtins create a builtin exit frame.
|
||||
DCHECK(Builtins::IsCpp(builtin_index));
|
||||
const bool has_builtin_exit_frame = true;
|
||||
|
||||
Node* stub = jsgraph->CEntryStubConstant(1, kDontSaveFPRegs, kArgvOnStack,
|
||||
has_builtin_exit_frame);
|
||||
@ -1720,8 +1719,7 @@ Reduction JSTypedLowering::ReduceJSCall(Node* node) {
|
||||
common()->Call(Linkage::GetStubCallDescriptor(
|
||||
graph()->zone(), callable.descriptor(), 1 + arity, flags)));
|
||||
}
|
||||
} else if (shared.HasBuiltinId() &&
|
||||
Builtins::HasCppImplementation(shared.builtin_id())) {
|
||||
} else if (shared.HasBuiltinId() && Builtins::IsCpp(shared.builtin_id())) {
|
||||
// Patch {node} to a direct CEntry call.
|
||||
ReduceBuiltin(jsgraph(), node, shared.builtin_id(), arity, flags);
|
||||
} else if (shared.HasBuiltinId() &&
|
||||
|
@ -101,7 +101,6 @@ bool BuiltinAliasesOffHeapTrampolineRegister(Isolate* isolate, Code code) {
|
||||
// Bytecode handlers will only ever be used by the interpreter and so there
|
||||
// will never be a need to use trampolines with them.
|
||||
case Builtins::BCH:
|
||||
case Builtins::API:
|
||||
case Builtins::ASM:
|
||||
// TODO(jgruber): Extend checks to remaining kinds.
|
||||
return false;
|
||||
|
@ -2737,7 +2737,7 @@ void ImplementationVisitor::GenerateBuiltinDefinitions(
|
||||
IncludeGuardScope include_guard(new_contents_stream, file_name);
|
||||
new_contents_stream
|
||||
<< "\n"
|
||||
"#define BUILTIN_LIST_FROM_TORQUE(CPP, API, TFJ, TFC, TFS, TFH, "
|
||||
"#define BUILTIN_LIST_FROM_TORQUE(CPP, TFJ, TFC, TFS, TFH, "
|
||||
"ASM) "
|
||||
"\\\n";
|
||||
for (auto& declarable : GlobalContext::AllDeclarables()) {
|
||||
|
Loading…
Reference in New Issue
Block a user