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

Unified Diff: src/heap/heap.cc

Issue 1705713002: [runtime] Replace hidden_string with a 0-hash-code private symbol (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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 | « src/heap/heap.h ('k') | src/ic/ic.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 287a93627e652722a2cf18410cabf7b34c8e2ec1..c2c3bb47cf548f98f054df19f4fdce5fec0edae1 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -2667,17 +2667,6 @@ void Heap::CreateInitialObjects() {
roots_[constant_string_table[i].index] = *str;
}
- // The {hidden_string} is special because it is an empty string, but does not
- // match any string (even the {empty_string}) when looked up in properties.
- // Allocate the hidden string which is used to identify the hidden properties
- // in JSObjects. The hash code has a special value so that it will not match
- // the empty string when searching for the property. It cannot be part of the
- // loop above because it needs to be allocated manually with the special
- // hash code in place. The hash code for the hidden_string is zero to ensure
- // that it will always be at the first entry in property descriptors.
- set_hidden_string(*factory->NewOneByteInternalizedString(
- OneByteVector("", 0), String::kEmptyStringHash));
-
// Create the code_stubs dictionary. The initial size is set to avoid
// expanding the dictionary during bootstrapping.
set_code_stubs(*UnseededNumberDictionary::New(isolate(), 128));
@@ -2706,6 +2695,14 @@ void Heap::CreateInitialObjects() {
#undef SYMBOL_INIT
}
+ // The {hidden_properties_symbol} is special because it is the only name with
+ // hash code zero. This ensures that it will always be the first entry as
+ // sorted by hash code in descriptor arrays. It is used to identify the hidden
+ // properties in JSObjects.
+ // kIsNotArrayIndexMask is a computed hash with value zero.
+ Symbol::cast(roots_[khidden_properties_symbolRootIndex])
+ ->set_hash_field(Name::kIsNotArrayIndexMask);
ulan 2016/02/17 10:45:22 Oh well
+
{
HandleScope scope(isolate());
#define SYMBOL_INIT(name, description) \
« no previous file with comments | « src/heap/heap.h ('k') | src/ic/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698