Commit 151501a2 authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

[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/+/2330020Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69158}
parent 84be14c2
...@@ -41,9 +41,10 @@ class WasmCapiTest : public ::testing::Test { ...@@ -41,9 +41,10 @@ class WasmCapiTest : public ::testing::Test {
WasmCapiTest() WasmCapiTest()
: Test(), : Test(),
engine_(Engine::make()), engine_(Engine::make()),
zone_(&allocator_, ZONE_NAME), allocator_(std::make_unique<AccountingAllocator>()),
wire_bytes_(&zone_), zone_(std::make_unique<Zone>(allocator_.get(), ZONE_NAME)),
builder_(&zone_), wire_bytes_(zone_.get()),
builder_(zone_->New<WasmModuleBuilder>(zone_.get())),
exports_(ownvec<Extern>::make()), exports_(ownvec<Extern>::make()),
wasm_i_i_sig_(1, 1, wasm_i_i_sig_types_) { wasm_i_i_sig_(1, 1, wasm_i_i_sig_types_) {
store_ = Store::make(engine_.get()); store_ = Store::make(engine_.get());
...@@ -53,7 +54,7 @@ class WasmCapiTest : public ::testing::Test { ...@@ -53,7 +54,7 @@ class WasmCapiTest : public ::testing::Test {
} }
void Compile() { void Compile() {
builder_.WriteTo(&wire_bytes_); builder_->WriteTo(&wire_bytes_);
size_t size = wire_bytes_.end() - wire_bytes_.begin(); size_t size = wire_bytes_.end() - wire_bytes_.begin();
vec<byte_t> binary = vec<byte_t>::make( vec<byte_t> binary = vec<byte_t>::make(
size, size,
...@@ -119,10 +120,13 @@ class WasmCapiTest : public ::testing::Test { ...@@ -119,10 +120,13 @@ class WasmCapiTest : public ::testing::Test {
instance_.reset(); instance_.reset();
module_.reset(); module_.reset();
store_.reset(); store_.reset();
builder_ = nullptr;
zone_.reset();
allocator_.reset();
engine_.reset(); engine_.reset();
} }
WasmModuleBuilder* builder() { return &builder_; } WasmModuleBuilder* builder() { return builder_; }
Engine* engine() { return engine_.get(); } Engine* engine() { return engine_.get(); }
Store* store() { return store_.get(); } Store* store() { return store_.get(); }
Module* module() { return module_.get(); } Module* module() { return module_.get(); }
...@@ -135,10 +139,10 @@ class WasmCapiTest : public ::testing::Test { ...@@ -135,10 +139,10 @@ class WasmCapiTest : public ::testing::Test {
private: private:
own<Engine> engine_; own<Engine> engine_;
AccountingAllocator allocator_; own<AccountingAllocator> allocator_;
Zone zone_; own<Zone> zone_;
ZoneBuffer wire_bytes_; ZoneBuffer wire_bytes_;
WasmModuleBuilder builder_; WasmModuleBuilder* builder_;
own<Store> store_; own<Store> store_;
own<Module> module_; own<Module> module_;
own<Instance> instance_; own<Instance> instance_;
......
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