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

Unified Diff: src/isolate.cc

Issue 1149863005: Move hash code from hidden string to a private symbol (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix merge Created 5 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/isolate.h ('k') | src/math.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index 1b031f8a937559306d048d616e59f9955170ce2e..0b2478691bbf347aca4eb847998986ab854cedd4 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -2522,21 +2522,29 @@ ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET)
#endif
+Handle<JSObject> Isolate::SetUpSubregistry(Handle<JSObject> registry,
+ Handle<Map> map, const char* cname) {
+ Handle<String> name = factory()->InternalizeUtf8String(cname);
+ Handle<JSObject> obj = factory()->NewJSObjectFromMap(map);
+ JSObject::NormalizeProperties(obj, CLEAR_INOBJECT_PROPERTIES, 0,
+ "SetupSymbolRegistry");
+ JSObject::AddProperty(registry, name, obj, NONE);
+ return obj;
+}
+
+
Handle<JSObject> Isolate::GetSymbolRegistry() {
if (heap()->symbol_registry()->IsSmi()) {
Handle<Map> map = factory()->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
Handle<JSObject> registry = factory()->NewJSObjectFromMap(map);
heap()->set_symbol_registry(*registry);
- static const char* nested[] = {"for", "for_api", "keyFor", "private_api",
- "private_intern"};
- for (unsigned i = 0; i < arraysize(nested); ++i) {
- Handle<String> name = factory()->InternalizeUtf8String(nested[i]);
- Handle<JSObject> obj = factory()->NewJSObjectFromMap(map);
- JSObject::NormalizeProperties(obj, KEEP_INOBJECT_PROPERTIES, 8,
- "SetupSymbolRegistry");
- JSObject::SetProperty(registry, name, obj, STRICT).Assert();
- }
+ SetUpSubregistry(registry, map, "for");
+ SetUpSubregistry(registry, map, "for_api");
+ SetUpSubregistry(registry, map, "keyFor");
+ SetUpSubregistry(registry, map, "private_api");
+ heap()->AddPrivateGlobalSymbols(
+ SetUpSubregistry(registry, map, "private_intern"));
}
return Handle<JSObject>::cast(factory()->symbol_registry());
}
« no previous file with comments | « src/isolate.h ('k') | src/math.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698