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

Unified Diff: src/api.cc

Issue 2812603002: [api] consistently expose all well-known symbols. (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 | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index a0990efd76340ac7bdca7d9ef79fce23a6ba3df0..c10a5b0c66287e77ab4b63f1478668a1c51ed481 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -7928,34 +7928,28 @@ Local<Symbol> v8::Symbol::ForApi(Isolate* isolate, Local<String> name) {
i_isolate->SymbolFor(i::Heap::kApiSymbolTableRootIndex, i_name, false));
}
-
-Local<Symbol> v8::Symbol::GetIterator(Isolate* isolate) {
- i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
- return Utils::ToLocal(i_isolate->factory()->iterator_symbol());
-}
-
-
-Local<Symbol> v8::Symbol::GetUnscopables(Isolate* isolate) {
- i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
- return Utils::ToLocal(i_isolate->factory()->unscopables_symbol());
-}
-
-Local<Symbol> v8::Symbol::GetToPrimitive(Isolate* isolate) {
- i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
- return Utils::ToLocal(i_isolate->factory()->to_primitive_symbol());
-}
-
-Local<Symbol> v8::Symbol::GetToStringTag(Isolate* isolate) {
- i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
- return Utils::ToLocal(i_isolate->factory()->to_string_tag_symbol());
-}
-
-
-Local<Symbol> v8::Symbol::GetIsConcatSpreadable(Isolate* isolate) {
- i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
- return Utils::ToLocal(i_isolate->factory()->is_concat_spreadable_symbol());
-}
-
+#define WELL_KNOWN_SYMBOLS(V) \
+ V(HasInstance, has_instance) \
+ V(IsConcatSpreadable, is_concat_spreadable) \
+ V(Iterator, iterator) \
+ V(Match, match) \
+ V(Replace, replace) \
+ V(Search, search) \
+ V(Split, split) \
+ V(ToPrimitive, to_primitive) \
+ V(ToStringTag, to_string_tag) \
+ V(Unscopables, unscopables)
+
+#define SYMBOL_GETTER(Name, name) \
+ Local<Symbol> v8::Symbol::Get##Name(Isolate* isolate) { \
+ i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); \
+ return Utils::ToLocal(i_isolate->factory()->name##_symbol()); \
+ }
+
+WELL_KNOWN_SYMBOLS(SYMBOL_GETTER)
+
+#undef SYMBOL_GETTER
+#undef WELL_KNOWN_SYMBOLS
Local<Private> v8::Private::New(Isolate* isolate, Local<String> name) {
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698