[compiler] Fix ref construction failure in ContextRef::previous

The `previous` field is immutable after initialization and the
context itself is read through an atomic load.

Bug: v8:7790
Change-Id: I8525cac7264573a7e9fc479613aaf268b72ab836
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3067333
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Auto-Submit: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#76054}
This commit is contained in:
Jakob Gruber 2021-08-03 10:18:10 +02:00 committed by V8 LUCI CQ
parent 3d135785fd
commit c8dd61cb6a

View File

@ -1676,7 +1676,9 @@ ContextRef ContextRef::previous(size_t* depth) const {
current = Context::cast(current.unchecked_previous());
(*depth)--;
}
return MakeRef(broker(), current);
// The `previous` field is immutable after initialization and the
// context itself is read through an atomic load.
return MakeRefAssumeMemoryFence(broker(), current);
}
base::Optional<ObjectRef> ContextRef::get(int index) const {