[Linux] Clear WasmMemory with madvice instead of memset
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Aug 2017 13:11:00 +0000 (13:11 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Aug 2017 13:11:00 +0000 (13:11 +0000)
commita29eeb9a14be2cb4f1fe0953db819c88c09cb5b6
tree34a9d076ebcb87ee4de77fd63d224b16e40df810
parentc4defd7e2c10c61af564e1b39ffddfdf46a3d137
[Linux] Clear WasmMemory with madvice instead of memset
https://bugs.webkit.org/show_bug.cgi?id=175150

Reviewed by Filip Pizlo.

In Linux, zeroing pages with memset populates backing store.
Instead, we should use madvise with MADV_DONTNEED. It discards
pages. And if you access these pages, on-demand-zero-pages will
be shown.

We also commit grown pages in all OSes.

* wasm/WasmMemory.cpp:
(JSC::Wasm::commitZeroPages):
(JSC::Wasm::Memory::create):
(JSC::Wasm::Memory::grow):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220401 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/wasm/WasmMemory.cpp