Commit b9806c6a authored by Mike Stanton's avatar Mike Stanton Committed by Commit Bot

[Turbofan] Don't zap old TransitionArrays to simplify concurrent compile

Formerly, we zapped a transition array when we replaced it with a
larger one, but this is no longer necessary. Leaving those arrays in
peace makes life easier for concurrent (racy) access from a background
compilation thread.

Design doc with more info about racy access to transition arrays
between the main JavaScript thread and a background compilation thread
here:
https://docs.google.com/document/d/1ax2qyENdr50Qu9yur1qNu6_zRK0m6K2l7BLM_QDBFJM/edit?usp=sharing

Change-Id: I4c2757945266d43d82ec157e0ff2b9208a8e4c63
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2253840Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Michael Stanton <mvstanton@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68437}
parent 9f734db6
...@@ -406,26 +406,14 @@ Map TransitionsAccessor::GetMigrationTarget() { ...@@ -406,26 +406,14 @@ Map TransitionsAccessor::GetMigrationTarget() {
return Map(); return Map();
} }
void TransitionArray::Zap(Isolate* isolate) {
MemsetTagged(ObjectSlot(RawFieldOfElementAt(kPrototypeTransitionsIndex)),
ReadOnlyRoots(isolate).the_hole_value(),
length() - kPrototypeTransitionsIndex);
SetNumberOfTransitions(0);
}
void TransitionsAccessor::ReplaceTransitions(MaybeObject new_transitions) { void TransitionsAccessor::ReplaceTransitions(MaybeObject new_transitions) {
if (encoding() == kFullTransitionArray) { if (encoding() == kFullTransitionArray) {
TransitionArray old_transitions = transitions();
#if DEBUG #if DEBUG
TransitionArray old_transitions = transitions();
CheckNewTransitionsAreConsistent( CheckNewTransitionsAreConsistent(
old_transitions, new_transitions->GetHeapObjectAssumeStrong()); old_transitions, new_transitions->GetHeapObjectAssumeStrong());
DCHECK(old_transitions != new_transitions->GetHeapObjectAssumeStrong()); DCHECK(old_transitions != new_transitions->GetHeapObjectAssumeStrong());
#endif #endif
// Transition arrays are not shared. When one is replaced, it should not
// keep referenced objects alive, so we zap it.
// When there is another reference to the array somewhere (e.g. a handle),
// not zapping turns from a waste of memory into a source of crashes.
old_transitions.Zap(isolate_);
} }
map_.set_raw_transitions(new_transitions); map_.set_raw_transitions(new_transitions);
MarkNeedsReload(); MarkNeedsReload();
......
...@@ -338,8 +338,6 @@ class TransitionArray : public WeakFixedArray { ...@@ -338,8 +338,6 @@ class TransitionArray : public WeakFixedArray {
inline void Set(int transition_number, Name key, MaybeObject target); inline void Set(int transition_number, Name key, MaybeObject target);
void Zap(Isolate* isolate);
OBJECT_CONSTRUCTORS(TransitionArray, WeakFixedArray); OBJECT_CONSTRUCTORS(TransitionArray, WeakFixedArray);
}; };
......
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