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

Unified Diff: src/bootstrapper.cc

Issue 918303005: Avoid repeating code when creating builtins. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index 31d6e3e00c2cc355bc8b2caaface11a6989d55bd..c60e3023df1854d8c4d9a7645b2f6edb37bd6695 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -2267,15 +2267,24 @@ static void InstallBuiltinFunctionId(Handle<JSObject> holder,
void Genesis::InstallBuiltinFunctionIds() {
HandleScope scope(isolate());
+ struct BuiltinFunctionIds {
+ const char* holder_expr;
+ const char* fun_name;
+ BuiltinFunctionId id;
+ };
+
#define INSTALL_BUILTIN_ID(holder_expr, fun_name, name) \
- { \
- Handle<JSObject> holder = ResolveBuiltinIdHolder( \
- native_context(), #holder_expr); \
- BuiltinFunctionId id = k##name; \
- InstallBuiltinFunctionId(holder, #fun_name, id); \
- }
- FUNCTIONS_WITH_ID_LIST(INSTALL_BUILTIN_ID)
+ { #holder_expr, #fun_name, k##name } \
+ ,
+ const BuiltinFunctionIds builtins[] = {
+ FUNCTIONS_WITH_ID_LIST(INSTALL_BUILTIN_ID)};
#undef INSTALL_BUILTIN_ID
+
+ for (const BuiltinFunctionIds& builtin : builtins) {
+ Handle<JSObject> holder =
+ ResolveBuiltinIdHolder(native_context(), builtin.holder_expr);
+ InstallBuiltinFunctionId(holder, builtin.fun_name, builtin.id);
+ }
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698