diff options
Diffstat (limited to 'chromium/v8/src/sandbox')
-rw-r--r-- | chromium/v8/src/sandbox/external-pointer-table-inl.h | 8 | ||||
-rw-r--r-- | chromium/v8/src/sandbox/external-pointer-table.cc | 12 |
2 files changed, 8 insertions, 12 deletions
diff --git a/chromium/v8/src/sandbox/external-pointer-table-inl.h b/chromium/v8/src/sandbox/external-pointer-table-inl.h index 1e4ff34e614..9295ddd3a3f 100644 --- a/chromium/v8/src/sandbox/external-pointer-table-inl.h +++ b/chromium/v8/src/sandbox/external-pointer-table-inl.h @@ -6,6 +6,7 @@ #define V8_SANDBOX_EXTERNAL_POINTER_TABLE_INL_H_ #include "src/base/atomicops.h" +#include "src/common/assert-scope.h" #include "src/sandbox/external-pointer-table.h" #include "src/sandbox/external-pointer.h" #include "src/utils/allocation.h" @@ -75,6 +76,13 @@ ExternalPointerHandle ExternalPointerTable::AllocateAndInitializeEntry( Isolate* isolate, Address initial_value, ExternalPointerTag tag) { DCHECK(is_initialized()); + // We currently don't want entry allocation to trigger garbage collection as + // this may cause seemingly harmless pointer field assignments to trigger + // garbage collection. This is especially true for lazily-initialized + // external pointer slots which will typically only allocate the external + // pointer table entry when the pointer is first set to a non-null value. + DisallowGarbageCollection no_gc; + Freelist freelist; bool success = false; while (!success) { diff --git a/chromium/v8/src/sandbox/external-pointer-table.cc b/chromium/v8/src/sandbox/external-pointer-table.cc index 95d8819dc5d..6a3d8aeb196 100644 --- a/chromium/v8/src/sandbox/external-pointer-table.cc +++ b/chromium/v8/src/sandbox/external-pointer-table.cc @@ -315,18 +315,6 @@ ExternalPointerTable::Freelist ExternalPointerTable::Grow(Isolate* isolate) { set_capacity(new_capacity); - // Schedule GC when the table's utilization crosses one of these thresholds. - constexpr double kGCThresholds[] = {0.5, 0.75, 0.9, 0.95, 0.99}; - constexpr double kMaxCapacity = static_cast<double>(kMaxExternalPointers); - double old_utilization = static_cast<double>(old_capacity) / kMaxCapacity; - double new_utilization = static_cast<double>(new_capacity) / kMaxCapacity; - for (double threshold : kGCThresholds) { - if (old_utilization < threshold && new_utilization >= threshold) { - isolate->heap()->ReportExternalMemoryPressure(); - break; - } - } - // Build freelist bottom to top, which might be more cache friendly. uint32_t start = std::max<uint32_t>(old_capacity, 1); // Skip entry zero uint32_t last = new_capacity - 1; |