cherry-pick-1228036.patch 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: Georg Neis <[email protected]>
  3. Date: Mon, 26 Jul 2021 16:40:39 +0200
  4. Subject: Finish concurrent sweeping before overwriting ByteArrays
  5. Bug: chromium:1228036
  6. Change-Id: I5abe7009920d2c8f81f024c9ae7bb6b13607da1a
  7. Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3054119
  8. Commit-Queue: Georg Neis <[email protected]>
  9. Reviewed-by: Hannes Payer <[email protected]>
  10. diff --git a/src/deoptimizer/translated-state.cc b/src/deoptimizer/translated-state.cc
  11. index 02c473d22b18a0a4c288e655afdb73340a0d0ffc..b5378a553a49e41c96713cf3f2ed901f7cfe4626 100644
  12. --- a/src/deoptimizer/translated-state.cc
  13. +++ b/src/deoptimizer/translated-state.cc
  14. @@ -514,6 +514,12 @@ Handle<Object> TranslatedValue::GetValue() {
  15. // pass the verifier.
  16. container_->EnsureObjectAllocatedAt(this);
  17. + // Finish any sweeping so that it becomes safe to overwrite the ByteArray
  18. + // headers.
  19. + // TODO(hpayer): Find a cleaner way to support a group of
  20. + // non-fully-initialized objects.
  21. + isolate()->heap()->mark_compact_collector()->EnsureSweepingCompleted();
  22. +
  23. // 2. Initialize the objects. If we have allocated only byte arrays
  24. // for some objects, we now overwrite the byte arrays with the
  25. // correct object fields. Note that this phase does not allocate
  26. @@ -1397,9 +1403,9 @@ TranslatedValue* TranslatedState::GetValueByObjectIndex(int object_index) {
  27. }
  28. Handle<HeapObject> TranslatedState::InitializeObjectAt(TranslatedValue* slot) {
  29. - slot = ResolveCapturedObject(slot);
  30. -
  31. DisallowGarbageCollection no_gc;
  32. +
  33. + slot = ResolveCapturedObject(slot);
  34. if (slot->materialization_state() != TranslatedValue::kFinished) {
  35. std::stack<int> worklist;
  36. worklist.push(slot->object_index());