OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stdint.h> | 5 #include <stdint.h> |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "src/base/platform/elapsed-timer.h" | 9 #include "src/base/platform/elapsed-timer.h" |
10 #include "src/utils.h" | 10 #include "src/utils.h" |
(...skipping 1835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1846 WASM_EXEC_TEST(Infinite_Loop_not_taken2_brif) { | 1846 WASM_EXEC_TEST(Infinite_Loop_not_taken2_brif) { |
1847 WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); | 1847 WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); |
1848 BUILD(r, WASM_BLOCK_I(WASM_BRV_IF(0, WASM_I8(45), WASM_GET_LOCAL(0)), | 1848 BUILD(r, WASM_BLOCK_I(WASM_BRV_IF(0, WASM_I8(45), WASM_GET_LOCAL(0)), |
1849 WASM_INFINITE_LOOP)); | 1849 WASM_INFINITE_LOOP)); |
1850 // Run the code, but don't go into the infinite loop. | 1850 // Run the code, but don't go into the infinite loop. |
1851 CHECK_EQ(45, r.Call(1)); | 1851 CHECK_EQ(45, r.Call(1)); |
1852 } | 1852 } |
1853 | 1853 |
1854 static void TestBuildGraphForSimpleExpression(WasmOpcode opcode) { | 1854 static void TestBuildGraphForSimpleExpression(WasmOpcode opcode) { |
1855 Isolate* isolate = CcTest::InitIsolateOnce(); | 1855 Isolate* isolate = CcTest::InitIsolateOnce(); |
1856 Zone zone(isolate->allocator()); | 1856 Zone zone(isolate->allocator(), ZONE_NAME); |
1857 HandleScope scope(isolate); | 1857 HandleScope scope(isolate); |
1858 // Enable all optional operators. | 1858 // Enable all optional operators. |
1859 CommonOperatorBuilder common(&zone); | 1859 CommonOperatorBuilder common(&zone); |
1860 MachineOperatorBuilder machine(&zone, MachineType::PointerRepresentation(), | 1860 MachineOperatorBuilder machine(&zone, MachineType::PointerRepresentation(), |
1861 MachineOperatorBuilder::kAllOptionalOps); | 1861 MachineOperatorBuilder::kAllOptionalOps); |
1862 Graph graph(&zone); | 1862 Graph graph(&zone); |
1863 JSGraph jsgraph(isolate, &graph, &common, nullptr, nullptr, &machine); | 1863 JSGraph jsgraph(isolate, &graph, &common, nullptr, nullptr, &machine); |
1864 FunctionSig* sig = WasmOpcodes::Signature(opcode); | 1864 FunctionSig* sig = WasmOpcodes::Signature(opcode); |
1865 | 1865 |
1866 if (sig->parameter_count() == 1) { | 1866 if (sig->parameter_count() == 1) { |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2233 // 64-bit cases handled in test-run-wasm-64.cc. | 2233 // 64-bit cases handled in test-run-wasm-64.cc. |
2234 static MachineType mixed[] = { | 2234 static MachineType mixed[] = { |
2235 MachineType::Int32(), MachineType::Float32(), MachineType::Float64(), | 2235 MachineType::Int32(), MachineType::Float32(), MachineType::Float64(), |
2236 MachineType::Float32(), MachineType::Int32(), MachineType::Float64(), | 2236 MachineType::Float32(), MachineType::Int32(), MachineType::Float64(), |
2237 MachineType::Float32(), MachineType::Float64(), MachineType::Int32(), | 2237 MachineType::Float32(), MachineType::Float64(), MachineType::Int32(), |
2238 MachineType::Int32(), MachineType::Int32()}; | 2238 MachineType::Int32(), MachineType::Int32()}; |
2239 | 2239 |
2240 int num_params = static_cast<int>(arraysize(mixed)) - start; | 2240 int num_params = static_cast<int>(arraysize(mixed)) - start; |
2241 for (int which = 0; which < num_params; ++which) { | 2241 for (int which = 0; which < num_params; ++which) { |
2242 v8::internal::AccountingAllocator allocator; | 2242 v8::internal::AccountingAllocator allocator; |
2243 Zone zone(&allocator); | 2243 Zone zone(&allocator, ZONE_NAME); |
2244 TestingModule module(execution_mode); | 2244 TestingModule module(execution_mode); |
2245 module.AddMemory(1024); | 2245 module.AddMemory(1024); |
2246 MachineType* memtypes = &mixed[start]; | 2246 MachineType* memtypes = &mixed[start]; |
2247 MachineType result = memtypes[which]; | 2247 MachineType result = memtypes[which]; |
2248 | 2248 |
2249 // ========================================================================= | 2249 // ========================================================================= |
2250 // Build the selector function. | 2250 // Build the selector function. |
2251 // ========================================================================= | 2251 // ========================================================================= |
2252 uint32_t index; | 2252 uint32_t index; |
2253 FunctionSig::Builder b(&zone, 1, num_params); | 2253 FunctionSig::Builder b(&zone, 1, num_params); |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2866 FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(copysignf(*i, *j), r.Call(*i, *j)); } | 2866 FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(copysignf(*i, *j), r.Call(*i, *j)); } |
2867 } | 2867 } |
2868 } | 2868 } |
2869 | 2869 |
2870 static void CompileCallIndirectMany(LocalType param) { | 2870 static void CompileCallIndirectMany(LocalType param) { |
2871 // Make sure we don't run out of registers when compiling indirect calls | 2871 // Make sure we don't run out of registers when compiling indirect calls |
2872 // with many many parameters. | 2872 // with many many parameters. |
2873 TestSignatures sigs; | 2873 TestSignatures sigs; |
2874 for (byte num_params = 0; num_params < 40; ++num_params) { | 2874 for (byte num_params = 0; num_params < 40; ++num_params) { |
2875 v8::internal::AccountingAllocator allocator; | 2875 v8::internal::AccountingAllocator allocator; |
2876 Zone zone(&allocator); | 2876 Zone zone(&allocator, ZONE_NAME); |
2877 HandleScope scope(CcTest::InitIsolateOnce()); | 2877 HandleScope scope(CcTest::InitIsolateOnce()); |
2878 TestingModule module(kExecuteCompiled); | 2878 TestingModule module(kExecuteCompiled); |
2879 FunctionSig* sig = sigs.many(&zone, kAstStmt, param, num_params); | 2879 FunctionSig* sig = sigs.many(&zone, kAstStmt, param, num_params); |
2880 | 2880 |
2881 module.AddSignature(sig); | 2881 module.AddSignature(sig); |
2882 module.AddSignature(sig); | 2882 module.AddSignature(sig); |
2883 module.AddIndirectFunctionTable(nullptr, 0); | 2883 module.AddIndirectFunctionTable(nullptr, 0); |
2884 | 2884 |
2885 WasmFunctionCompiler t(sig, &module); | 2885 WasmFunctionCompiler t(sig, &module); |
2886 | 2886 |
(...skipping 21 matching lines...) Expand all Loading... |
2908 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_DROP, | 2908 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_DROP, |
2909 WASM_ZERO); | 2909 WASM_ZERO); |
2910 const int32_t kMin = std::numeric_limits<int32_t>::min(); | 2910 const int32_t kMin = std::numeric_limits<int32_t>::min(); |
2911 CHECK_EQ(0, r.Call(133, 100)); | 2911 CHECK_EQ(0, r.Call(133, 100)); |
2912 CHECK_EQ(0, r.Call(kMin, -1)); | 2912 CHECK_EQ(0, r.Call(kMin, -1)); |
2913 CHECK_EQ(0, r.Call(0, 1)); | 2913 CHECK_EQ(0, r.Call(0, 1)); |
2914 CHECK_TRAP(r.Call(100, 0)); | 2914 CHECK_TRAP(r.Call(100, 0)); |
2915 CHECK_TRAP(r.Call(-1001, 0)); | 2915 CHECK_TRAP(r.Call(-1001, 0)); |
2916 CHECK_TRAP(r.Call(kMin, 0)); | 2916 CHECK_TRAP(r.Call(kMin, 0)); |
2917 } | 2917 } |
OLD | NEW |