Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Unified Diff: src/builtins/builtins.cc

Issue 2854273004: Reduce binary size of Builtins::CallableFor (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/interface-descriptors.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins/builtins.cc
diff --git a/src/builtins/builtins.cc b/src/builtins/builtins.cc
index 47eda0be3c05f984684079c60c0fffe22e9adc5d..cc4a71a3eadb110eea8c79e6491819b329a6494b 100644
--- a/src/builtins/builtins.cc
+++ b/src/builtins/builtins.cc
@@ -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
« no previous file with comments | « no previous file | src/interface-descriptors.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698