Commit b0bf3752 authored by Dan Elphick's avatar Dan Elphick Committed by Commit Bot

[heap] Move hash_seed into RO_SPACE

Creates the hash_seed byte array in RO_SPACE and moves the root from
STRONG_MUTABLE_IMMOVABLE_ROOT_LIST to STRONG_READ_ONLY_ROOT_LIST.

Bug: v8:8191
Change-Id: I3b044fbb3e51eb5d21ac2e68a54076623865b9d2
Reviewed-on: https://chromium-review.googlesource.com/c/1297959
Commit-Queue: Dan Elphick <delphick@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56960}
parent 6bc73a28
...@@ -555,7 +555,8 @@ Oddball* Heap::ToBoolean(bool condition) { ...@@ -555,7 +555,8 @@ Oddball* Heap::ToBoolean(bool condition) {
uint64_t Heap::HashSeed() { uint64_t Heap::HashSeed() {
uint64_t seed; uint64_t seed;
hash_seed()->copy_out(0, reinterpret_cast<byte*>(&seed), kInt64Size); ReadOnlyRoots(this).hash_seed()->copy_out(0, reinterpret_cast<byte*>(&seed),
kInt64Size);
DCHECK(FLAG_randomize_hashes || seed == 0); DCHECK(FLAG_randomize_hashes || seed == 0);
return seed; return seed;
} }
......
...@@ -4413,6 +4413,7 @@ void Heap::SetUp() { ...@@ -4413,6 +4413,7 @@ void Heap::SetUp() {
} }
void Heap::InitializeHashSeed() { void Heap::InitializeHashSeed() {
DCHECK(!deserialization_complete_);
uint64_t new_hash_seed; uint64_t new_hash_seed;
if (FLAG_hash_seed == 0) { if (FLAG_hash_seed == 0) {
int64_t rnd = isolate()->random_number_generator()->NextInt64(); int64_t rnd = isolate()->random_number_generator()->NextInt64();
...@@ -4420,7 +4421,8 @@ void Heap::InitializeHashSeed() { ...@@ -4420,7 +4421,8 @@ void Heap::InitializeHashSeed() {
} else { } else {
new_hash_seed = static_cast<uint64_t>(FLAG_hash_seed); new_hash_seed = static_cast<uint64_t>(FLAG_hash_seed);
} }
hash_seed()->copy_in(0, reinterpret_cast<byte*>(&new_hash_seed), kInt64Size); ReadOnlyRoots(this).hash_seed()->copy_in(
0, reinterpret_cast<byte*>(&new_hash_seed), kInt64Size);
} }
void Heap::SetStackLimits() { void Heap::SetStackLimits() {
......
...@@ -623,7 +623,7 @@ void Heap::CreateInitialObjects() { ...@@ -623,7 +623,7 @@ void Heap::CreateInitialObjects() {
set_minus_infinity_value( set_minus_infinity_value(
*factory->NewHeapNumber(-V8_INFINITY, TENURED_READ_ONLY)); *factory->NewHeapNumber(-V8_INFINITY, TENURED_READ_ONLY));
set_hash_seed(*factory->NewByteArray(kInt64Size, TENURED)); set_hash_seed(*factory->NewByteArray(kInt64Size, TENURED_READ_ONLY));
InitializeHashSeed(); InitializeHashSeed();
// There's no "current microtask" in the beginning. // There's no "current microtask" in the beginning.
......
...@@ -215,7 +215,9 @@ class RootVisitor; ...@@ -215,7 +215,9 @@ class RootVisitor;
V(HeapObject*, self_reference_marker, SelfReferenceMarker) \ V(HeapObject*, self_reference_marker, SelfReferenceMarker) \
/* Canonical trampoline RelocInfo */ \ /* Canonical trampoline RelocInfo */ \
V(ByteArray*, off_heap_trampoline_relocation_info, \ V(ByteArray*, off_heap_trampoline_relocation_info, \
OffHeapTrampolineRelocationInfo) OffHeapTrampolineRelocationInfo) \
/* Hash seed */ \
V(ByteArray*, hash_seed, HashSeed)
// Mutable roots that are known to be immortal immovable, for which we can // Mutable roots that are known to be immortal immovable, for which we can
// safely skip write barriers. // safely skip write barriers.
...@@ -253,8 +255,6 @@ class RootVisitor; ...@@ -253,8 +255,6 @@ class RootVisitor;
V(MicrotaskQueue*, default_microtask_queue, DefaultMicrotaskQueue) \ V(MicrotaskQueue*, default_microtask_queue, DefaultMicrotaskQueue) \
/* Indirection lists for isolate-independent builtins */ \ /* Indirection lists for isolate-independent builtins */ \
V(FixedArray*, builtins_constants_table, BuiltinsConstantsTable) \ V(FixedArray*, builtins_constants_table, BuiltinsConstantsTable) \
/* Hash seed */ \
V(ByteArray*, hash_seed, HashSeed) \
/* JS Entries */ \ /* JS Entries */ \
V(Code*, js_entry_code, JsEntryCode) \ V(Code*, js_entry_code, JsEntryCode) \
V(Code*, js_construct_entry_code, JsConstructEntryCode) \ V(Code*, js_construct_entry_code, JsConstructEntryCode) \
......
...@@ -296,41 +296,41 @@ KNOWN_MAPS = { ...@@ -296,41 +296,41 @@ KNOWN_MAPS = {
("RO_SPACE", 0x02699): (171, "Tuple2Map"), ("RO_SPACE", 0x02699): (171, "Tuple2Map"),
("RO_SPACE", 0x02739): (173, "ArrayBoilerplateDescriptionMap"), ("RO_SPACE", 0x02739): (173, "ArrayBoilerplateDescriptionMap"),
("RO_SPACE", 0x02a79): (161, "InterceptorInfoMap"), ("RO_SPACE", 0x02a79): (161, "InterceptorInfoMap"),
("RO_SPACE", 0x050c1): (153, "AccessCheckInfoMap"), ("RO_SPACE", 0x050d9): (153, "AccessCheckInfoMap"),
("RO_SPACE", 0x05111): (154, "AccessorInfoMap"), ("RO_SPACE", 0x05129): (154, "AccessorInfoMap"),
("RO_SPACE", 0x05161): (155, "AccessorPairMap"), ("RO_SPACE", 0x05179): (155, "AccessorPairMap"),
("RO_SPACE", 0x051b1): (156, "AliasedArgumentsEntryMap"), ("RO_SPACE", 0x051c9): (156, "AliasedArgumentsEntryMap"),
("RO_SPACE", 0x05201): (157, "AllocationMementoMap"), ("RO_SPACE", 0x05219): (157, "AllocationMementoMap"),
("RO_SPACE", 0x05251): (158, "AsyncGeneratorRequestMap"), ("RO_SPACE", 0x05269): (158, "AsyncGeneratorRequestMap"),
("RO_SPACE", 0x052a1): (159, "DebugInfoMap"), ("RO_SPACE", 0x052b9): (159, "DebugInfoMap"),
("RO_SPACE", 0x052f1): (160, "FunctionTemplateInfoMap"), ("RO_SPACE", 0x05309): (160, "FunctionTemplateInfoMap"),
("RO_SPACE", 0x05341): (162, "InterpreterDataMap"), ("RO_SPACE", 0x05359): (162, "InterpreterDataMap"),
("RO_SPACE", 0x05391): (163, "ModuleInfoEntryMap"), ("RO_SPACE", 0x053a9): (163, "ModuleInfoEntryMap"),
("RO_SPACE", 0x053e1): (164, "ModuleMap"), ("RO_SPACE", 0x053f9): (164, "ModuleMap"),
("RO_SPACE", 0x05431): (165, "ObjectTemplateInfoMap"), ("RO_SPACE", 0x05449): (165, "ObjectTemplateInfoMap"),
("RO_SPACE", 0x05481): (166, "PromiseCapabilityMap"), ("RO_SPACE", 0x05499): (166, "PromiseCapabilityMap"),
("RO_SPACE", 0x054d1): (167, "PromiseReactionMap"), ("RO_SPACE", 0x054e9): (167, "PromiseReactionMap"),
("RO_SPACE", 0x05521): (168, "PrototypeInfoMap"), ("RO_SPACE", 0x05539): (168, "PrototypeInfoMap"),
("RO_SPACE", 0x05571): (169, "ScriptMap"), ("RO_SPACE", 0x05589): (169, "ScriptMap"),
("RO_SPACE", 0x055c1): (170, "StackFrameInfoMap"), ("RO_SPACE", 0x055d9): (170, "StackFrameInfoMap"),
("RO_SPACE", 0x05611): (172, "Tuple3Map"), ("RO_SPACE", 0x05629): (172, "Tuple3Map"),
("RO_SPACE", 0x05661): (174, "WasmDebugInfoMap"), ("RO_SPACE", 0x05679): (174, "WasmDebugInfoMap"),
("RO_SPACE", 0x056b1): (175, "WasmExportedFunctionDataMap"), ("RO_SPACE", 0x056c9): (175, "WasmExportedFunctionDataMap"),
("RO_SPACE", 0x05701): (176, "CallableTaskMap"), ("RO_SPACE", 0x05719): (176, "CallableTaskMap"),
("RO_SPACE", 0x05751): (177, "CallbackTaskMap"), ("RO_SPACE", 0x05769): (177, "CallbackTaskMap"),
("RO_SPACE", 0x057a1): (178, "PromiseFulfillReactionJobTaskMap"), ("RO_SPACE", 0x057b9): (178, "PromiseFulfillReactionJobTaskMap"),
("RO_SPACE", 0x057f1): (179, "PromiseRejectReactionJobTaskMap"), ("RO_SPACE", 0x05809): (179, "PromiseRejectReactionJobTaskMap"),
("RO_SPACE", 0x05841): (180, "PromiseResolveThenableJobTaskMap"), ("RO_SPACE", 0x05859): (180, "PromiseResolveThenableJobTaskMap"),
("RO_SPACE", 0x05891): (181, "MicrotaskQueueMap"), ("RO_SPACE", 0x058a9): (181, "MicrotaskQueueMap"),
("RO_SPACE", 0x058e1): (182, "AllocationSiteWithWeakNextMap"), ("RO_SPACE", 0x058f9): (182, "AllocationSiteWithWeakNextMap"),
("RO_SPACE", 0x05931): (182, "AllocationSiteWithoutWeakNextMap"), ("RO_SPACE", 0x05949): (182, "AllocationSiteWithoutWeakNextMap"),
("RO_SPACE", 0x05981): (214, "LoadHandler1Map"), ("RO_SPACE", 0x05999): (214, "LoadHandler1Map"),
("RO_SPACE", 0x059d1): (214, "LoadHandler2Map"), ("RO_SPACE", 0x059e9): (214, "LoadHandler2Map"),
("RO_SPACE", 0x05a21): (214, "LoadHandler3Map"), ("RO_SPACE", 0x05a39): (214, "LoadHandler3Map"),
("RO_SPACE", 0x05a71): (221, "StoreHandler0Map"), ("RO_SPACE", 0x05a89): (221, "StoreHandler0Map"),
("RO_SPACE", 0x05ac1): (221, "StoreHandler1Map"), ("RO_SPACE", 0x05ad9): (221, "StoreHandler1Map"),
("RO_SPACE", 0x05b11): (221, "StoreHandler2Map"), ("RO_SPACE", 0x05b29): (221, "StoreHandler2Map"),
("RO_SPACE", 0x05b61): (221, "StoreHandler3Map"), ("RO_SPACE", 0x05b79): (221, "StoreHandler3Map"),
("MAP_SPACE", 0x00139): (1057, "ExternalMap"), ("MAP_SPACE", 0x00139): (1057, "ExternalMap"),
("MAP_SPACE", 0x00189): (1073, "JSMessageObjectMap"), ("MAP_SPACE", 0x00189): (1073, "JSMessageObjectMap"),
} }
...@@ -385,6 +385,7 @@ KNOWN_OBJECTS = { ...@@ -385,6 +385,7 @@ KNOWN_OBJECTS = {
("RO_SPACE", 0x02b01): "MinusInfinityValue", ("RO_SPACE", 0x02b01): "MinusInfinityValue",
("RO_SPACE", 0x02b11): "SelfReferenceMarker", ("RO_SPACE", 0x02b11): "SelfReferenceMarker",
("RO_SPACE", 0x02b69): "OffHeapTrampolineRelocationInfo", ("RO_SPACE", 0x02b69): "OffHeapTrampolineRelocationInfo",
("RO_SPACE", 0x02b81): "HashSeed",
("OLD_SPACE", 0x00139): "ArgumentsIteratorAccessor", ("OLD_SPACE", 0x00139): "ArgumentsIteratorAccessor",
("OLD_SPACE", 0x001a9): "ArrayLengthAccessor", ("OLD_SPACE", 0x001a9): "ArrayLengthAccessor",
("OLD_SPACE", 0x00219): "BoundFunctionLengthAccessor", ("OLD_SPACE", 0x00219): "BoundFunctionLengthAccessor",
...@@ -419,7 +420,6 @@ KNOWN_OBJECTS = { ...@@ -419,7 +420,6 @@ KNOWN_OBJECTS = {
("OLD_SPACE", 0x018c1): "RegExpMultipleCache", ("OLD_SPACE", 0x018c1): "RegExpMultipleCache",
("OLD_SPACE", 0x020d1): "DefaultMicrotaskQueue", ("OLD_SPACE", 0x020d1): "DefaultMicrotaskQueue",
("OLD_SPACE", 0x020e9): "BuiltinsConstantsTable", ("OLD_SPACE", 0x020e9): "BuiltinsConstantsTable",
("OLD_SPACE", 0x02a11): "HashSeed",
} }
# List of known V8 Frame Markers. # List of known V8 Frame Markers.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment