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

Unified Diff: src/heap/heap.cc

Issue 2900703002: [es2015] Precompute the descriptive string for symbols. (Closed)
Patch Set: Address feedback. Created 3 years, 7 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 | « src/heap-symbols.h ('k') | src/isolate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index ad3bfef559452199064da7813739e217e8b2f568..847269e829865fb54c6dfe7a0753663708cc8509 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -2736,12 +2736,12 @@ void Heap::CreateInitialObjects() {
{
HandleScope scope(isolate());
-#define SYMBOL_INIT(name) \
- { \
- Handle<String> name##d = factory->NewStringFromStaticChars(#name); \
- Handle<Symbol> symbol(isolate()->factory()->NewPrivateSymbol()); \
- symbol->set_name(*name##d); \
- roots_[k##name##RootIndex] = *symbol; \
+#define SYMBOL_INIT(name) \
+ { \
+ Handle<String> name##d = factory->NewStringFromStaticChars(#name); \
+ Handle<Symbol> name = \
+ isolate()->factory()->NewPrivateSymbol(name##d).ToHandleChecked(); \
+ roots_[k##name##RootIndex] = *name; \
}
PRIVATE_SYMBOL_LIST(SYMBOL_INIT)
#undef SYMBOL_INIT
@@ -2750,18 +2750,16 @@ void Heap::CreateInitialObjects() {
{
HandleScope scope(isolate());
#define SYMBOL_INIT(name, description) \
- Handle<Symbol> name = factory->NewSymbol(); \
Handle<String> name##d = factory->NewStringFromStaticChars(#description); \
- name->set_name(*name##d); \
+ Handle<Symbol> name = factory->NewSymbol(name##d).ToHandleChecked(); \
roots_[k##name##RootIndex] = *name;
PUBLIC_SYMBOL_LIST(SYMBOL_INIT)
#undef SYMBOL_INIT
#define SYMBOL_INIT(name, description) \
- Handle<Symbol> name = factory->NewSymbol(); \
Handle<String> name##d = factory->NewStringFromStaticChars(#description); \
+ Handle<Symbol> name = factory->NewSymbol(name##d).ToHandleChecked(); \
name->set_is_well_known_symbol(true); \
- name->set_name(*name##d); \
roots_[k##name##RootIndex] = *name;
WELL_KNOWN_SYMBOL_LIST(SYMBOL_INIT)
#undef SYMBOL_INIT
@@ -4076,6 +4074,7 @@ AllocationResult Heap::AllocateSymbol() {
Symbol::cast(result)
->set_hash_field(Name::kIsNotArrayIndexMask | (hash << Name::kHashShift));
Symbol::cast(result)->set_name(undefined_value());
+ Symbol::cast(result)->set_descriptive_string(Symbol_parens_string());
Symbol::cast(result)->set_flags(0);
DCHECK(!Symbol::cast(result)->is_private());
« no previous file with comments | « src/heap-symbols.h ('k') | src/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698