diff --git a/BUILD.gn b/BUILD.gn index 4d91cbfce27..f74aea74f36 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -867,9 +867,6 @@ source_set("v8_base") { "src/compiler/value-numbering-reducer.h", "src/compiler/verifier.cc", "src/compiler/verifier.h", - "src/compiler/wasm-compiler.cc", - "src/compiler/wasm-compiler.h", - "src/compiler/wasm-linkage.cc", "src/compiler/zone-pool.cc", "src/compiler/zone-pool.h", "src/compiler.cc", @@ -1285,24 +1282,6 @@ source_set("v8_base") { "src/version.h", "src/vm-state-inl.h", "src/vm-state.h", - "src/wasm/asm-wasm-builder.cc", - "src/wasm/asm-wasm-builder.h", - "src/wasm/ast-decoder.cc", - "src/wasm/ast-decoder.h", - "src/wasm/decoder.h", - "src/wasm/encoder.cc", - "src/wasm/encoder.h", - "src/wasm/module-decoder.cc", - "src/wasm/module-decoder.h", - "src/wasm/wasm-js.cc", - "src/wasm/wasm-js.h", - "src/wasm/wasm-macro-gen.h", - "src/wasm/wasm-module.cc", - "src/wasm/wasm-module.h", - "src/wasm/wasm-opcodes.cc", - "src/wasm/wasm-opcodes.h", - "src/wasm/wasm-result.cc", - "src/wasm/wasm-result.h", "src/zone.cc", "src/zone.h", "src/zone-allocator.h", diff --git a/Makefile b/Makefile index c2caf40f4dc..28c1af2e07f 100644 --- a/Makefile +++ b/Makefile @@ -220,6 +220,12 @@ ifeq ($(arm_test_noprobe), on) GYPFLAGS += -Darm_test_noprobe=on endif +# Optionally enable wasm prototype. +# Assume you've placed a link to v8-native-prototype in third_party/wasm. +ifeq ($(wasm), on) + GYPFLAGS += -Dv8_wasm=1 +endif + # ----------------- available targets: -------------------- # - "grokdump": rebuilds heap constants lists used by grokdump # - any arch listed in ARCHES (see below) diff --git a/build/features.gypi b/build/features.gypi index f82a59f0f82..1ee3e569a76 100644 --- a/build/features.gypi +++ b/build/features.gypi @@ -67,6 +67,9 @@ # Set to 1 to enable DCHECKs in release builds. 'dcheck_always_on%': 0, + # Set to 1 to enable building with wasm prototype. + 'v8_wasm%': 0, + # Enable/disable JavaScript API accessors. 'v8_js_accessors%': 0, }, @@ -108,6 +111,9 @@ ['dcheck_always_on!=0', { 'defines': ['DEBUG',], }], + ['v8_wasm!=0', { + 'defines': ['V8_WASM',], + }], ], # conditions 'configurations': { 'DebugBaseCommon': { diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc index 72d7f994b11..4409d935229 100644 --- a/src/bootstrapper.cc +++ b/src/bootstrapper.cc @@ -16,7 +16,11 @@ #include "src/isolate-inl.h" #include "src/snapshot/natives.h" #include "src/snapshot/snapshot.h" +#include "third_party/fdlibm/fdlibm.h" + +#if defined(V8_WASM) #include "src/wasm/wasm-js.h" +#endif namespace v8 { namespace internal { @@ -2851,9 +2855,11 @@ bool Genesis::InstallSpecialObjects(Handle native_context) { JSObject::AddProperty(global, debug_string, global_proxy, DONT_ENUM); } +#if defined(V8_WASM) if (FLAG_expose_wasm) { WasmJs::Install(isolate, global); } +#endif return true; } diff --git a/src/d8.gyp b/src/d8.gyp index f249a78856a..2e4a6e0cc5c 100644 --- a/src/d8.gyp +++ b/src/d8.gyp @@ -101,6 +101,9 @@ '<(icu_gyp_path):icudata', ], }], + ['v8_wasm!=0', { + 'include_dirs': ['../third_party/wasm'], + }], ], }, { diff --git a/test/cctest/cctest.gyp b/test/cctest/cctest.gyp index 5d0bbfe004e..4e4674e6cfc 100644 --- a/test/cctest/cctest.gyp +++ b/test/cctest/cctest.gyp @@ -183,9 +183,6 @@ 'test-weakmaps.cc', 'test-weaksets.cc', 'trace-extension.cc', - 'wasm/test-run-wasm.cc', - 'wasm/test-run-wasm-module.cc', - 'wasm/test-signatures.h', ], 'conditions': [ ['v8_target_arch=="ia32"', { @@ -302,6 +299,13 @@ }, { 'dependencies': ['../../tools/gyp/v8.gyp:v8'], }], + ['v8_wasm!=0', { + 'sources': [ + 'wasm/test-run-wasm.cc', + 'wasm/test-run-wasm-module.cc', + 'wasm/test-signatures.h', + ], + }], ], }, { diff --git a/test/mjsunit/mjsunit.status b/test/mjsunit/mjsunit.status index 598726da6b7..f32b242cb83 100644 --- a/test/mjsunit/mjsunit.status +++ b/test/mjsunit/mjsunit.status @@ -166,6 +166,9 @@ # issue 4078: 'allocation-site-info': [PASS, NO_VARIANTS], + # Native WASM is not yet enabled by default. + 'wasm/*': [SKIP], + ############################################################################## # Too slow in debug mode with --stress-opt mode. 'compiler/regress-stacktrace-methods': [PASS, ['mode == debug', SKIP]], @@ -736,28 +739,6 @@ 'regress/regress-1132': [SKIP], }], # 'arch == ppc and simulator_run == True' - -# TODO(bradnelson): Figure out why this fails for arm. -['arch == arm', { - 'wasm/asm-wasm': [SKIP], -}], - -# TODO(bradnelson): Figure out why this crashes under asan. -['asan == True', { - 'wasm/asm-wasm': [SKIP], -}], - -# TODO(titzer): Figure out why parameter passing on 32-bit is broken. -['arch != x64', { - 'wasm/params': [SKIP], -}], - -# TODO(titzer): Figure out why arm64 is broken for wasm. -['arch == arm64', { - 'wasm/*': [SKIP], -}], - - ['ignition == True', { 'asm/*': [SKIP], 'compiler/*': [SKIP], @@ -769,7 +750,6 @@ 'harmony/*': [SKIP], 'regress/debug*': [SKIP], 'regress/regress-debug*': [SKIP], - 'wasm/*': [SKIP], 'allocation-folding': [SKIP], 'api-call-after-bypassed-exception': [SKIP], diff --git a/test/unittests/unittests.gyp b/test/unittests/unittests.gyp index 2c768a042b7..a905b7dace7 100644 --- a/test/unittests/unittests.gyp +++ b/test/unittests/unittests.gyp @@ -110,10 +110,6 @@ 'runtime/runtime-interpreter-unittest.cc', 'test-utils.h', 'test-utils.cc', - 'wasm/ast-decoder-unittest.cc', - 'wasm/encoder-unittest.cc', - 'wasm/module-decoder-unittest.cc', - 'wasm/wasm-macro-gen-unittest.cc', ], 'conditions': [ ['v8_target_arch=="arm"', { @@ -173,6 +169,14 @@ ], }, }], + ['v8_wasm!=0', { + 'sources': [ + 'wasm/ast-decoder-unittest.cc', + 'wasm/encoder-unittest.cc', + 'wasm/module-decoder-unittest.cc', + 'wasm/wasm-macro-gen-unittest.cc', + ], + }], ], }, ], diff --git a/tools/gyp/v8.gyp b/tools/gyp/v8.gyp index b040ba41214..d23c9bda1cc 100644 --- a/tools/gyp/v8.gyp +++ b/tools/gyp/v8.gyp @@ -646,9 +646,6 @@ '../../src/compiler/value-numbering-reducer.h', '../../src/compiler/verifier.cc', '../../src/compiler/verifier.h', - '../../src/compiler/wasm-compiler.cc', - '../../src/compiler/wasm-compiler.h', - '../../src/compiler/wasm-linkage.cc', '../../src/compiler/zone-pool.cc', '../../src/compiler/zone-pool.h', '../../src/compiler.cc', @@ -1069,24 +1066,6 @@ '../../src/version.h', '../../src/vm-state-inl.h', '../../src/vm-state.h', - '../../src/wasm/asm-wasm-builder.cc', - '../../src/wasm/asm-wasm-builder.h', - '../../src/wasm/ast-decoder.cc', - '../../src/wasm/ast-decoder.h', - '../../src/wasm/decoder.h', - '../../src/wasm/encoder.cc', - '../../src/wasm/encoder.h', - '../../src/wasm/module-decoder.cc', - '../../src/wasm/module-decoder.h', - '../../src/wasm/wasm-js.cc', - '../../src/wasm/wasm-js.h', - '../../src/wasm/wasm-macro-gen.h', - '../../src/wasm/wasm-module.cc', - '../../src/wasm/wasm-module.h', - '../../src/wasm/wasm-opcodes.cc', - '../../src/wasm/wasm-opcodes.h', - '../../src/wasm/wasm-result.cc', - '../../src/wasm/wasm-result.h', '../../src/zone.cc', '../../src/zone.h', '../../src/zone-allocator.h', @@ -1500,6 +1479,31 @@ }], ], }], + ['v8_wasm!=0', { + 'sources': [ + '../../src/compiler/wasm-compiler.cc', + '../../src/compiler/wasm-compiler.h', + '../../src/compiler/wasm-linkage.cc', + '../../src/wasm/asm-wasm-builder.cc', + '../../src/wasm/asm-wasm-builder.h', + '../../src/wasm/ast-decoder.cc', + '../../src/wasm/ast-decoder.h', + '../../src/wasm/decoder.h', + '../../src/wasm/encoder.cc', + '../../src/wasm/encoder.h', + '../../src/wasm/module-decoder.cc', + '../../src/wasm/module-decoder.h', + '../../src/wasm/wasm-js.cc', + '../../src/wasm/wasm-js.h', + '../../src/wasm/wasm-macro-gen.h', + '../../src/wasm/wasm-module.cc', + '../../src/wasm/wasm-module.h', + '../../src/wasm/wasm-opcodes.cc', + '../../src/wasm/wasm-opcodes.h', + '../../src/wasm/wasm-result.cc', + '../../src/wasm/wasm-result.h', + ], + }], ], }, {