Commit f3ad6cdb authored by Yang Guo's avatar Yang Guo Committed by Commit Bot

Revert "Add external backing store JS test"

This reverts commit 5107ec2a.

Reason for revert: Test is very flaky: https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Linux64

Original change's description:
> Add external backing store JS test
> 
> Allow mocking the limits for ArrayBuffer allocation to simulate operating
> system OOM.
> 
> Bug: chromium:845409
> Change-Id: I38bf56a3677e1db547c774223c81e913f56cb631
> Reviewed-on: https://chromium-review.googlesource.com/1203895
> Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#55616}

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

Change-Id: I633988dba1b0a87b652e72e0e667e90122e00f6d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:845409
Reviewed-on: https://chromium-review.googlesource.com/1206290Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Commit-Queue: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55630}
parent 69fabd05
...@@ -135,7 +135,6 @@ class ShellArrayBufferAllocator : public ArrayBufferAllocatorBase { ...@@ -135,7 +135,6 @@ class ShellArrayBufferAllocator : public ArrayBufferAllocatorBase {
// ArrayBuffer allocator that never allocates over 10MB. // ArrayBuffer allocator that never allocates over 10MB.
class MockArrayBufferAllocator : public ArrayBufferAllocatorBase { class MockArrayBufferAllocator : public ArrayBufferAllocatorBase {
protected:
void* Allocate(size_t length) override { void* Allocate(size_t length) override {
return ArrayBufferAllocatorBase::Allocate(Adjust(length)); return ArrayBufferAllocatorBase::Allocate(Adjust(length));
} }
...@@ -155,39 +154,6 @@ class MockArrayBufferAllocator : public ArrayBufferAllocatorBase { ...@@ -155,39 +154,6 @@ class MockArrayBufferAllocator : public ArrayBufferAllocatorBase {
} }
}; };
// ArrayBuffer allocator that can be equipped with a limit to simulate system
// OOM.
class MockArrayBufferAllocatiorWithLimit : public MockArrayBufferAllocator {
public:
explicit MockArrayBufferAllocatiorWithLimit(size_t allocation_limit)
: space_left_(allocation_limit) {}
protected:
void* Allocate(size_t length) override {
if (length > space_left_) {
return nullptr;
}
space_left_ -= length;
return MockArrayBufferAllocator::Allocate(length);
}
void* AllocateUninitialized(size_t length) override {
if (length > space_left_) {
return nullptr;
}
space_left_ -= length;
return MockArrayBufferAllocator::AllocateUninitialized(length);
}
void Free(void* data, size_t length) override {
space_left_ += length;
return MockArrayBufferAllocator::Free(data, length);
}
private:
std::atomic<size_t> space_left_;
};
// Predictable v8::Platform implementation. Worker threads are disabled, idle // Predictable v8::Platform implementation. Worker threads are disabled, idle
// tasks are disallowed, and the time reported by {MonotonicallyIncreasingTime} // tasks are disallowed, and the time reported by {MonotonicallyIncreasingTime}
// is deterministic. // is deterministic.
...@@ -2938,8 +2904,6 @@ bool Shell::SetOptions(int argc, char* argv[]) { ...@@ -2938,8 +2904,6 @@ bool Shell::SetOptions(int argc, char* argv[]) {
v8::V8::SetFlagsFromCommandLine(&argc, argv, true); v8::V8::SetFlagsFromCommandLine(&argc, argv, true);
options.mock_arraybuffer_allocator = i::FLAG_mock_arraybuffer_allocator; options.mock_arraybuffer_allocator = i::FLAG_mock_arraybuffer_allocator;
options.mock_arraybuffer_allocator_limit =
i::FLAG_mock_arraybuffer_allocator_limit;
// Set up isolated source groups. // Set up isolated source groups.
options.isolate_sources = new SourceGroup[options.num_isolates]; options.isolate_sources = new SourceGroup[options.num_isolates];
...@@ -3398,18 +3362,8 @@ int Shell::Main(int argc, char* argv[]) { ...@@ -3398,18 +3362,8 @@ int Shell::Main(int argc, char* argv[]) {
Isolate::CreateParams create_params; Isolate::CreateParams create_params;
ShellArrayBufferAllocator shell_array_buffer_allocator; ShellArrayBufferAllocator shell_array_buffer_allocator;
MockArrayBufferAllocator mock_arraybuffer_allocator; MockArrayBufferAllocator mock_arraybuffer_allocator;
const size_t memory_limit =
options.mock_arraybuffer_allocator_limit * options.num_isolates;
MockArrayBufferAllocatiorWithLimit mock_arraybuffer_allocator_with_limit(
memory_limit >= options.mock_arraybuffer_allocator_limit
? memory_limit
: std::numeric_limits<size_t>::max());
if (options.mock_arraybuffer_allocator) { if (options.mock_arraybuffer_allocator) {
if (memory_limit) {
Shell::array_buffer_allocator = &mock_arraybuffer_allocator_with_limit;
} else {
Shell::array_buffer_allocator = &mock_arraybuffer_allocator; Shell::array_buffer_allocator = &mock_arraybuffer_allocator;
}
} else { } else {
Shell::array_buffer_allocator = &shell_array_buffer_allocator; Shell::array_buffer_allocator = &shell_array_buffer_allocator;
} }
......
...@@ -369,7 +369,6 @@ class ShellOptions { ...@@ -369,7 +369,6 @@ class ShellOptions {
bool test_shell; bool test_shell;
bool expected_to_throw; bool expected_to_throw;
bool mock_arraybuffer_allocator; bool mock_arraybuffer_allocator;
size_t mock_arraybuffer_allocator_limit = 0;
bool enable_inspector; bool enable_inspector;
int num_isolates; int num_isolates;
v8::ScriptCompiler::CompileOptions compile_options; v8::ScriptCompiler::CompileOptions compile_options;
......
...@@ -1152,9 +1152,6 @@ DEFINE_ARGS(js_arguments, ...@@ -1152,9 +1152,6 @@ DEFINE_ARGS(js_arguments,
"Pass all remaining arguments to the script. Alias for \"--\".") "Pass all remaining arguments to the script. Alias for \"--\".")
DEFINE_BOOL(mock_arraybuffer_allocator, false, DEFINE_BOOL(mock_arraybuffer_allocator, false,
"Use a mock ArrayBuffer allocator for testing.") "Use a mock ArrayBuffer allocator for testing.")
DEFINE_SIZE_T(mock_arraybuffer_allocator_limit, 0,
"Memory limit for mock ArrayBuffer allocator used to simulate "
"OOM for testing.")
// //
// GDB JIT integration flags. // GDB JIT integration flags.
......
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --mock-arraybuffer-allocator --mock-arraybuffer-allocator-limit=800000000
for (var i = 0; i < 1024; i++) {
let garbage = new ArrayBuffer(1024*1024);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment