Commit 133ef93a authored by jkummerow's avatar jkummerow Committed by Commit bot

Reduce binary size of Builtins::CallableFor

by pulling parameterizable things out of the case-blocks.
No change in functionality.

BUG=chromium:714894

Review-Url: https://codereview.chromium.org/2854273004
Cr-Commit-Position: refs/heads/master@{#45066}
parent 192984ea
......@@ -133,24 +133,29 @@ int Builtins::GetBuiltinParameterCount(Name name) {
// static
Callable Builtins::CallableFor(Isolate* isolate, Name name) {
Handle<Code> code(
reinterpret_cast<Code**>(isolate->builtins()->builtin_address(name)));
CallDescriptors::Key key;
switch (name) {
#define CASE(Name, ...) \
case k##Name: { \
Handle<Code> code = isolate->builtins()->Name(); \
auto descriptor = Builtin_##Name##_InterfaceDescriptor(isolate); \
return Callable(code, descriptor); \
// This macro is deliberately crafted so as to emit very little code,
// in order to keep binary size of this function under control.
#define CASE(Name, ...) \
case k##Name: { \
key = Builtin_##Name##_InterfaceDescriptor::key(); \
break; \
}
BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, CASE, CASE,
CASE, IGNORE_BUILTIN, IGNORE_BUILTIN)
#undef CASE
case kConsoleAssert: {
Handle<Code> code = isolate->builtins()->ConsoleAssert();
return Callable(code, BuiltinDescriptor(isolate));
}
default:
UNREACHABLE();
return Callable(Handle<Code>::null(), VoidDescriptor(isolate));
}
CallInterfaceDescriptor descriptor(isolate, key);
return Callable(code, descriptor);
}
// static
......
......@@ -885,6 +885,7 @@ class WasmRuntimeCallDescriptor final : public CallInterfaceDescriptor {
BUILTIN_LIST_TFS(DEFINE_TFS_BUILTIN_DESCRIPTOR)
#undef DEFINE_TFS_BUILTIN_DESCRIPTOR
#undef DECLARE_DEFAULT_DESCRIPTOR
#undef DECLARE_DESCRIPTOR_WITH_BASE
#undef DECLARE_DESCRIPTOR
#undef DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE
......
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