[zone-compr] Fix WasmCapiTest, pt.2

The shutdown process should destroy AccountingAllocator instance before
the V8 platform.

Bug: v8:9923
Change-Id: Iff76b64d16c42c711ce4ee0c3533acd5ba5aaaa5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2330020
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69158}
This commit is contained in:
Igor Sheludko 2020-07-30 19:01:22 +02:00 committed by Commit Bot
parent 84be14c245
commit 151501a270

View File

@ -41,9 +41,10 @@ class WasmCapiTest : public ::testing::Test {
WasmCapiTest()
: Test(),
engine_(Engine::make()),
zone_(&allocator_, ZONE_NAME),
wire_bytes_(&zone_),
builder_(&zone_),
allocator_(std::make_unique<AccountingAllocator>()),
zone_(std::make_unique<Zone>(allocator_.get(), ZONE_NAME)),
wire_bytes_(zone_.get()),
builder_(zone_->New<WasmModuleBuilder>(zone_.get())),
exports_(ownvec<Extern>::make()),
wasm_i_i_sig_(1, 1, wasm_i_i_sig_types_) {
store_ = Store::make(engine_.get());
@ -53,7 +54,7 @@ class WasmCapiTest : public ::testing::Test {
}
void Compile() {
builder_.WriteTo(&wire_bytes_);
builder_->WriteTo(&wire_bytes_);
size_t size = wire_bytes_.end() - wire_bytes_.begin();
vec<byte_t> binary = vec<byte_t>::make(
size,
@ -119,10 +120,13 @@ class WasmCapiTest : public ::testing::Test {
instance_.reset();
module_.reset();
store_.reset();
builder_ = nullptr;
zone_.reset();
allocator_.reset();
engine_.reset();
}
WasmModuleBuilder* builder() { return &builder_; }
WasmModuleBuilder* builder() { return builder_; }
Engine* engine() { return engine_.get(); }
Store* store() { return store_.get(); }
Module* module() { return module_.get(); }
@ -135,10 +139,10 @@ class WasmCapiTest : public ::testing::Test {
private:
own<Engine> engine_;
AccountingAllocator allocator_;
Zone zone_;
own<AccountingAllocator> allocator_;
own<Zone> zone_;
ZoneBuffer wire_bytes_;
WasmModuleBuilder builder_;
WasmModuleBuilder* builder_;
own<Store> store_;
own<Module> module_;
own<Instance> instance_;