Chromium Code Reviews| Index: src/builtins/builtins.cc |
| diff --git a/src/builtins/builtins.cc b/src/builtins/builtins.cc |
| index 2188743fc5f5d5e40123d122ed0589bd52fb9f79..5e6e5c038dfdc85f3698b66a780ca1129e5814f8 100644 |
| --- a/src/builtins/builtins.cc |
| +++ b/src/builtins/builtins.cc |
| @@ -184,6 +184,7 @@ const char* Builtins::Lookup(byte* pc) { |
| return NULL; |
| } |
| +// static |
| const char* Builtins::name(int index) { |
| switch (index) { |
| #define CASE(Name, ...) \ |
| @@ -198,6 +199,68 @@ const char* Builtins::name(int index) { |
| return ""; |
| } |
| +// static |
| +Address Builtins::CppEntryOf(int index) { |
| + DCHECK(0 <= index && index < builtin_count); |
| + switch (index) { |
| +#define CASE(Name, ...) \ |
| + case k##Name: \ |
| + return FUNCTION_ADDR(Builtin_##Name); |
| + BUILTIN_LIST_C(CASE) |
| +#undef CASE |
| + default: |
| + return nullptr; |
|
Toon Verwaest
2016/08/19 13:37:05
Shouldn't this be unreachable already?
jgruber
2016/08/19 15:11:38
No, case statements are built only for CPP and API
|
| + } |
| + UNREACHABLE(); |
| +} |
| + |
| +// static |
| +bool Builtins::IsCpp(int index) { |
| + DCHECK(0 <= index && index < builtin_count); |
| + switch (index) { |
| +#define CASE(Name, ...) \ |
| + case k##Name: \ |
| + return true; |
| + BUILTIN_LIST(CASE, IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, |
| + IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN) |
|
Toon Verwaest
2016/08/19 13:37:05
Does it make sense to add a macro CPP_BUILTIN(V) B
jgruber
2016/08/19 15:11:38
Done.
|
| +#undef CASE |
| + default: |
| + return false; |
| + } |
| + UNREACHABLE(); |
| +} |
| + |
| +// static |
| +bool Builtins::IsApi(int index) { |
| + DCHECK(0 <= index && index < builtin_count); |
| + switch (index) { |
| +#define CASE(Name, ...) \ |
| + case k##Name: \ |
| + return true; |
| + BUILTIN_LIST(IGNORE_BUILTIN, CASE, IGNORE_BUILTIN, IGNORE_BUILTIN, |
| + IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN) |
| +#undef CASE |
| + default: |
| + return false; |
| + } |
| + UNREACHABLE(); |
| +} |
| + |
| +// static |
| +bool Builtins::HasCppImplementation(int index) { |
| + DCHECK(0 <= index && index < builtin_count); |
| + switch (index) { |
| +#define CASE(Name, ...) \ |
| + case k##Name: \ |
| + return true; |
| + BUILTIN_LIST_C(CASE) |
| +#undef CASE |
| + default: |
| + return false; |
| + } |
| + UNREACHABLE(); |
| +} |
| + |
| #define DEFINE_BUILTIN_ACCESSOR(Name, ...) \ |
| Handle<Code> Builtins::Name() { \ |
| Code** code_address = reinterpret_cast<Code**>(builtin_address(k##Name)); \ |