summaryrefslogtreecommitdiff
path: root/deps/v8/test/common
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2017-03-21 10:16:54 +0100
committerMichaël Zasso <targos@protonmail.com>2017-03-25 09:44:10 +0100
commitc459d8ea5d402c702948c860d9497b2230ff7e8a (patch)
tree56c282fc4d40e5cb613b47cf7be3ea0526ed5b6f /deps/v8/test/common
parente0bc5a7361b1d29c3ed034155fd779ce6f44fb13 (diff)
downloadandroid-node-v8-c459d8ea5d402c702948c860d9497b2230ff7e8a.tar.gz
android-node-v8-c459d8ea5d402c702948c860d9497b2230ff7e8a.tar.bz2
android-node-v8-c459d8ea5d402c702948c860d9497b2230ff7e8a.zip
deps: update V8 to 5.7.492.69
PR-URL: https://github.com/nodejs/node/pull/11752 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Diffstat (limited to 'deps/v8/test/common')
-rw-r--r--deps/v8/test/common/wasm/test-signatures.h48
-rw-r--r--deps/v8/test/common/wasm/wasm-module-runner.cc51
-rw-r--r--deps/v8/test/common/wasm/wasm-module-runner.h15
3 files changed, 59 insertions, 55 deletions
diff --git a/deps/v8/test/common/wasm/test-signatures.h b/deps/v8/test/common/wasm/test-signatures.h
index 3bf53f6867..c0bc7a933f 100644
--- a/deps/v8/test/common/wasm/test-signatures.h
+++ b/deps/v8/test/common/wasm/test-signatures.h
@@ -12,7 +12,7 @@ namespace v8 {
namespace internal {
namespace wasm {
-typedef Signature<LocalType> FunctionSig;
+typedef Signature<ValueType> FunctionSig;
// A helper class with many useful signatures in order to simplify tests.
class TestSignatures {
@@ -40,18 +40,18 @@ class TestSignatures {
sig_v_iii(0, 3, kIntTypes4),
sig_s_i(1, 1, kSimd128IntTypes4) {
// I used C++ and you won't believe what happened next....
- for (int i = 0; i < 4; i++) kIntTypes4[i] = kAstI32;
- for (int i = 0; i < 4; i++) kLongTypes4[i] = kAstI64;
- for (int i = 0; i < 4; i++) kFloatTypes4[i] = kAstF32;
- for (int i = 0; i < 4; i++) kDoubleTypes4[i] = kAstF64;
- for (int i = 0; i < 4; i++) kIntLongTypes4[i] = kAstI64;
- for (int i = 0; i < 4; i++) kIntFloatTypes4[i] = kAstF32;
- for (int i = 0; i < 4; i++) kIntDoubleTypes4[i] = kAstF64;
- for (int i = 0; i < 4; i++) kSimd128IntTypes4[i] = kAstS128;
- kIntLongTypes4[0] = kAstI32;
- kIntFloatTypes4[0] = kAstI32;
- kIntDoubleTypes4[0] = kAstI32;
- kSimd128IntTypes4[1] = kAstI32;
+ for (int i = 0; i < 4; i++) kIntTypes4[i] = kWasmI32;
+ for (int i = 0; i < 4; i++) kLongTypes4[i] = kWasmI64;
+ for (int i = 0; i < 4; i++) kFloatTypes4[i] = kWasmF32;
+ for (int i = 0; i < 4; i++) kDoubleTypes4[i] = kWasmF64;
+ for (int i = 0; i < 4; i++) kIntLongTypes4[i] = kWasmI64;
+ for (int i = 0; i < 4; i++) kIntFloatTypes4[i] = kWasmF32;
+ for (int i = 0; i < 4; i++) kIntDoubleTypes4[i] = kWasmF64;
+ for (int i = 0; i < 4; i++) kSimd128IntTypes4[i] = kWasmS128;
+ kIntLongTypes4[0] = kWasmI32;
+ kIntFloatTypes4[0] = kWasmI32;
+ kIntDoubleTypes4[0] = kWasmI32;
+ kSimd128IntTypes4[1] = kWasmI32;
}
FunctionSig* i_v() { return &sig_i_v; }
@@ -80,9 +80,9 @@ class TestSignatures {
FunctionSig* v_iii() { return &sig_v_iii; }
FunctionSig* s_i() { return &sig_s_i; }
- FunctionSig* many(Zone* zone, LocalType ret, LocalType param, int count) {
- FunctionSig::Builder builder(zone, ret == kAstStmt ? 0 : 1, count);
- if (ret != kAstStmt) builder.AddReturn(ret);
+ FunctionSig* many(Zone* zone, ValueType ret, ValueType param, int count) {
+ FunctionSig::Builder builder(zone, ret == kWasmStmt ? 0 : 1, count);
+ if (ret != kWasmStmt) builder.AddReturn(ret);
for (int i = 0; i < count; i++) {
builder.AddParam(param);
}
@@ -90,14 +90,14 @@ class TestSignatures {
}
private:
- LocalType kIntTypes4[4];
- LocalType kLongTypes4[4];
- LocalType kFloatTypes4[4];
- LocalType kDoubleTypes4[4];
- LocalType kIntLongTypes4[4];
- LocalType kIntFloatTypes4[4];
- LocalType kIntDoubleTypes4[4];
- LocalType kSimd128IntTypes4[4];
+ ValueType kIntTypes4[4];
+ ValueType kLongTypes4[4];
+ ValueType kFloatTypes4[4];
+ ValueType kDoubleTypes4[4];
+ ValueType kIntLongTypes4[4];
+ ValueType kIntFloatTypes4[4];
+ ValueType kIntDoubleTypes4[4];
+ ValueType kSimd128IntTypes4[4];
FunctionSig sig_i_v;
FunctionSig sig_i_i;
diff --git a/deps/v8/test/common/wasm/wasm-module-runner.cc b/deps/v8/test/common/wasm/wasm-module-runner.cc
index 0b885175fc..7d0e00ee70 100644
--- a/deps/v8/test/common/wasm/wasm-module-runner.cc
+++ b/deps/v8/test/common/wasm/wasm-module-runner.cc
@@ -45,38 +45,38 @@ const WasmModule* DecodeWasmModuleForTesting(
return decoding_result.val;
}
-const Handle<JSObject> InstantiateModuleForTesting(Isolate* isolate,
- ErrorThrower* thrower,
- const WasmModule* module) {
- CHECK(module != nullptr);
-
+const Handle<WasmInstanceObject> InstantiateModuleForTesting(
+ Isolate* isolate, ErrorThrower* thrower, const WasmModule* module,
+ const ModuleWireBytes& wire_bytes) {
+ DCHECK_NOT_NULL(module);
if (module->import_table.size() > 0) {
thrower->CompileError("Not supported: module has imports.");
}
- if (thrower->error()) return Handle<JSObject>::null();
+ if (thrower->error()) return Handle<WasmInstanceObject>::null();
// Although we decoded the module for some pre-validation, run the bytes
// again through the normal pipeline.
// TODO(wasm): Use {module} instead of decoding the module bytes again.
MaybeHandle<WasmModuleObject> module_object = CreateModuleObjectFromBytes(
- isolate, module->module_start, module->module_end, thrower,
- ModuleOrigin::kWasmOrigin, Handle<Script>::null(), nullptr, nullptr);
+ isolate, wire_bytes.module_bytes.start(), wire_bytes.module_bytes.end(),
+ thrower, ModuleOrigin::kWasmOrigin, Handle<Script>::null(),
+ Vector<const byte>::empty());
if (module_object.is_null()) {
thrower->CompileError("Module pre-validation failed.");
- return Handle<JSObject>::null();
+ return Handle<WasmInstanceObject>::null();
}
- MaybeHandle<JSObject> maybe_instance = WasmModule::Instantiate(
- isolate, thrower, module_object.ToHandleChecked(),
- Handle<JSReceiver>::null(), Handle<JSArrayBuffer>::null());
- Handle<JSObject> instance;
+ MaybeHandle<WasmInstanceObject> maybe_instance =
+ WasmModule::Instantiate(isolate, thrower, module_object.ToHandleChecked(),
+ Handle<JSReceiver>::null());
+ Handle<WasmInstanceObject> instance;
if (!maybe_instance.ToHandle(&instance)) {
- return Handle<JSObject>::null();
+ return Handle<WasmInstanceObject>::null();
}
return instance;
}
-const Handle<JSObject> CompileInstantiateWasmModuleForTesting(
+const Handle<WasmInstanceObject> CompileInstantiateWasmModuleForTesting(
Isolate* isolate, ErrorThrower* thrower, const byte* module_start,
const byte* module_end, ModuleOrigin origin) {
std::unique_ptr<const WasmModule> module(DecodeWasmModuleForTesting(
@@ -84,9 +84,10 @@ const Handle<JSObject> CompileInstantiateWasmModuleForTesting(
if (module == nullptr) {
thrower->CompileError("Wasm module decoding failed");
- return Handle<JSObject>::null();
+ return Handle<WasmInstanceObject>::null();
}
- return InstantiateModuleForTesting(isolate, thrower, module.get());
+ return InstantiateModuleForTesting(isolate, thrower, module.get(),
+ ModuleWireBytes(module_start, module_end));
}
int32_t RunWasmModuleForTesting(Isolate* isolate, Handle<JSObject> instance,
@@ -111,10 +112,11 @@ int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start,
}
int32_t InterpretWasmModule(Isolate* isolate, ErrorThrower* thrower,
- const WasmModule* module, int function_index,
- WasmVal* args, bool* possible_nondeterminism) {
- CHECK(module != nullptr);
-
+ const WasmModule* module,
+ const ModuleWireBytes& wire_bytes,
+ int function_index, WasmVal* args,
+ bool* possible_nondeterminism) {
+ DCHECK_NOT_NULL(module);
Zone zone(isolate->allocator(), ZONE_NAME);
v8::internal::HandleScope scope(isolate);
@@ -137,7 +139,8 @@ int32_t InterpretWasmModule(Isolate* isolate, ErrorThrower* thrower,
static_cast<byte*>(calloc(GetMinModuleMemSize(module), 1));
instance.globals_start = nullptr;
- WasmInterpreter interpreter(&instance, isolate->allocator());
+ ModuleBytesEnv env(module, &instance, wire_bytes);
+ WasmInterpreter interpreter(env, isolate->allocator());
WasmInterpreter::Thread* thread = interpreter.GetThread(0);
thread->Reset();
@@ -202,9 +205,7 @@ int32_t CallWasmFunctionForTesting(Isolate* isolate, Handle<JSObject> instance,
}
void SetupIsolateForWasmModule(Isolate* isolate) {
- WasmJs::InstallWasmMapsIfNeeded(isolate, isolate->native_context());
- WasmJs::InstallWasmModuleSymbolIfNeeded(isolate, isolate->global_object(),
- isolate->native_context());
+ WasmJs::Install(isolate);
}
} // namespace testing
} // namespace wasm
diff --git a/deps/v8/test/common/wasm/wasm-module-runner.h b/deps/v8/test/common/wasm/wasm-module-runner.h
index d6702e1e37..ed6ad88031 100644
--- a/deps/v8/test/common/wasm/wasm-module-runner.h
+++ b/deps/v8/test/common/wasm/wasm-module-runner.h
@@ -10,6 +10,7 @@
#include "src/objects.h"
#include "src/wasm/wasm-interpreter.h"
#include "src/wasm/wasm-module.h"
+#include "src/wasm/wasm-objects.h"
#include "src/wasm/wasm-result.h"
#include "src/zone/zone.h"
@@ -24,9 +25,9 @@ const WasmModule* DecodeWasmModuleForTesting(
const byte* module_end, ModuleOrigin origin, bool verify_functions = false);
// Instantiates a module without any imports and exports.
-const Handle<JSObject> InstantiateModuleForTesting(Isolate* isolate,
- ErrorThrower* thrower,
- const WasmModule* module);
+const Handle<WasmInstanceObject> InstantiateModuleForTesting(
+ Isolate* isolate, ErrorThrower* thrower, const WasmModule* module,
+ const ModuleWireBytes& wire_bytes);
int32_t CallWasmFunctionForTesting(Isolate* isolate, Handle<JSObject> instance,
ErrorThrower* thrower, const char* name,
@@ -42,11 +43,13 @@ int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start,
// {function_index}. The return type of the function has to be int32. The module
// should not have any imports or exports
int32_t InterpretWasmModule(Isolate* isolate, ErrorThrower* thrower,
- const WasmModule* module, int function_index,
- WasmVal* args, bool* may_produced_nan);
+ const WasmModule* module,
+ const ModuleWireBytes& wire_bytes,
+ int function_index, WasmVal* args,
+ bool* may_produced_nan);
// Compiles WasmModule bytes and return an instance of the compiled module.
-const Handle<JSObject> CompileInstantiateWasmModuleForTesting(
+const Handle<WasmInstanceObject> CompileInstantiateWasmModuleForTesting(
Isolate* isolate, ErrorThrower* thrower, const byte* module_start,
const byte* module_end, ModuleOrigin origin);