summaryrefslogtreecommitdiff
path: root/deps/v8/test/cctest/wasm/test-run-wasm-memory64.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/test/cctest/wasm/test-run-wasm-memory64.cc')
-rw-r--r--deps/v8/test/cctest/wasm/test-run-wasm-memory64.cc44
1 files changed, 44 insertions, 0 deletions
diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-memory64.cc b/deps/v8/test/cctest/wasm/test-run-wasm-memory64.cc
index 1dcccca67f..71bb77f6ad 100644
--- a/deps/v8/test/cctest/wasm/test-run-wasm-memory64.cc
+++ b/deps/v8/test/cctest/wasm/test-run-wasm-memory64.cc
@@ -7,6 +7,7 @@
#include "test/cctest/wasm/wasm-run-utils.h"
#include "test/common/wasm/test-signatures.h"
#include "test/common/wasm/wasm-macro-gen.h"
+#include "test/common/wasm/wasm-module-runner.h"
namespace v8 {
namespace internal {
@@ -54,6 +55,49 @@ WASM_EXEC_TEST(Load) {
// TODO(clemensb): Test atomic instructions.
+WASM_EXEC_TEST(InitExpression) {
+ EXPERIMENTAL_FLAG_SCOPE(memory64);
+ Isolate* isolate = CcTest::InitIsolateOnce();
+ HandleScope scope(isolate);
+
+ ErrorThrower thrower(isolate, "TestMemory64InitExpression");
+
+ const byte data[] = {
+ WASM_MODULE_HEADER, //
+ SECTION(Memory, //
+ ENTRY_COUNT(1), //
+ kMemory64WithMaximum, // type
+ 1, // initial size
+ 2), // maximum size
+ SECTION(Data, //
+ ENTRY_COUNT(1), //
+ 0, // linear memory index
+ WASM_I64V_3(0xFFFF), kExprEnd, // destination offset
+ U32V_1(1), // source size
+ 'c') // data bytes
+ };
+
+ testing::CompileAndInstantiateForTesting(
+ isolate, &thrower, ModuleWireBytes(data, data + arraysize(data)));
+ if (thrower.error()) {
+ thrower.Reify()->Print();
+ FATAL("compile or instantiate error");
+ }
+}
+
+WASM_EXEC_TEST(MemorySize) {
+ // TODO(clemensb): Implement memory64 in the interpreter.
+ if (execution_tier == TestExecutionTier::kInterpreter) return;
+
+ Memory64Runner<uint64_t> r(execution_tier);
+ constexpr int kNumPages = 13;
+ r.builder().AddMemoryElems<uint8_t>(kNumPages * kWasmPageSize);
+
+ BUILD(r, WASM_MEMORY_SIZE);
+
+ CHECK_EQ(kNumPages, r.Call());
+}
+
} // namespace wasm
} // namespace internal
} // namespace v8