[wasm] Fix GrowingVsFixedModule test

This test was not adapted for the jump table yet.

R=mstarzinger@chromium.org

Bug: v8:7867
Change-Id: Ifd03899b0757972525dcc54f04949635d03fa493
Reviewed-on: https://chromium-review.googlesource.com/1107624
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53878}
This commit is contained in:
Clemens Hammacher 2018-06-20 13:19:45 +02:00 committed by Commit Bot
parent d07d165fc1
commit a77b4e6867

View File

@ -141,6 +141,17 @@ TEST_F(DisjointAllocationPoolTest, MergingSkipLargerSrcWithGap) {
enum ModuleStyle : int { Fixed = 0, Growable = 1 };
std::string PrintWasmCodeManageTestParam(
::testing::TestParamInfo<ModuleStyle> info) {
switch (info.param) {
case Fixed:
return "Fixed";
case Growable:
return "Growable";
}
UNREACHABLE();
}
class WasmCodeManagerTest : public TestWithContext,
public ::testing::WithParamInterface<ModuleStyle> {
public:
@ -174,7 +185,8 @@ class WasmCodeManagerTest : public TestWithContext,
};
INSTANTIATE_TEST_CASE_P(Parameterized, WasmCodeManagerTest,
::testing::Values(Fixed, Growable));
::testing::Values(Fixed, Growable),
PrintWasmCodeManageTestParam);
TEST_P(WasmCodeManagerTest, EmptyCase) {
WasmCodeManager manager(0 * page());
@ -238,11 +250,18 @@ TEST_P(WasmCodeManagerTest, DifferentHeapsApplyLimitsIndependently) {
TEST_P(WasmCodeManagerTest, GrowingVsFixedModule) {
WasmCodeManager manager(3 * page());
NativeModulePtr nm = AllocModule(&manager, 1 * page(), GetParam());
size_t module_size = GetParam() == Fixed ? kMaxWasmCodeMemory : 1 * page();
size_t remaining_space_in_module = module_size - kJumpTableSize;
if (GetParam() == Fixed) {
ASSERT_DEATH_IF_SUPPORTED(AddCode(nm.get(), 0, kMaxWasmCodeMemory + 1),
"OOM in NativeModule::AddOwnedCode");
// Requesting more than the remaining space fails because the module cannot
// grow.
ASSERT_DEATH_IF_SUPPORTED(
AddCode(nm.get(), 0, remaining_space_in_module + kCodeAlignment),
"OOM in NativeModule::AddOwnedCode");
} else {
CHECK_NOT_NULL(AddCode(nm.get(), 0, 1 * page() + kCodeAlignment));
// The module grows by one page. One page remains uncommitted.
CHECK_NOT_NULL(
AddCode(nm.get(), 0, remaining_space_in_module + kCodeAlignment));
CHECK_EQ(manager.remaining_uncommitted_code_space(), 1 * page());
}
}