Index: src/runtime/runtime-regexp.cc |
diff --git a/src/runtime/runtime-regexp.cc b/src/runtime/runtime-regexp.cc |
index 2f80fe9a35ff1e28086408d4cc5fd59018cb9cbc..efa91b84859d5eee37fc3f5ad2f15fc8ad2675d5 100644 |
--- a/src/runtime/runtime-regexp.cc |
+++ b/src/runtime/runtime-regexp.cc |
@@ -638,7 +638,11 @@ MUST_USE_RESULT static Object* StringReplaceGlobalRegExpWithEmptyString( |
// fresly allocated page or on an already swept page. Hence, the sweeper |
// thread can not get confused with the filler creation. No synchronization |
// needed. |
- heap->CreateFillerObjectAt(end_of_string, delta); |
+ // TODO(hpayer): We should shrink the large object page if the size |
+ // of the object changed significantly. |
+ if (!heap->lo_space()->Contains(*answer)) { |
+ heap->CreateFillerObjectAt(end_of_string, delta); |
+ } |
heap->AdjustLiveBytes(answer->address(), -delta, Heap::CONCURRENT_TO_SWEEPER); |
return *answer; |
} |