Revert "[Memory] Experiment to try using regular version of 'new T[]'."

This reverts commit bec2b4d267.

Reason for revert: NewArrayOOM fails.

Original change's description:
> [Memory] Experiment to try using regular version of 'new T[]'.
> 
> - Use normal new, vs. nothrow new.
> - Modify NewArray to have only 1 invocation of new.
> 
> Bug: chromium:752056
> Change-Id: I1a2fb3626264b1bf647af9227d55e9b54e44e8b6
> Reviewed-on: https://chromium-review.googlesource.com/600895
> Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
> Commit-Queue: Bill Budge <bbudge@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#47173}

TBR=bbudge@chromium.org,mlippautz@chromium.org

Change-Id: I881f3b75209714d11d93fae6268171ffa9cc47a1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:752056
Reviewed-on: https://chromium-review.googlesource.com/602847
Reviewed-by: Bill Budge <bbudge@chromium.org>
Commit-Queue: Bill Budge <bbudge@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47174}
This commit is contained in:
Bill Budge 2017-08-04 20:28:52 +00:00 committed by Commit Bot
parent bec2b4d267
commit 93d84f28d6

View File

@ -34,13 +34,13 @@ class V8_EXPORT_PRIVATE Malloced {
template <typename T> template <typename T>
T* NewArray(size_t size) { T* NewArray(size_t size) {
int retries = 0; T* result = new (std::nothrow) T[size];
while (true) { if (result == nullptr) {
T* result = new T[size];
if (result != nullptr) return result;
if (retries++ == 1) FatalProcessOutOfMemory("NewArray");
V8::GetCurrentPlatform()->OnCriticalMemoryPressure(); V8::GetCurrentPlatform()->OnCriticalMemoryPressure();
result = new (std::nothrow) T[size];
if (result == nullptr) FatalProcessOutOfMemory("NewArray");
} }
return result;
} }
template <typename T> template <typename T>