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 | 10 |
(...skipping 1732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1743 TEST(Run_Wasm_Infinite_Loop_not_taken2_brif) { | 1743 TEST(Run_Wasm_Infinite_Loop_not_taken2_brif) { |
1744 WasmRunner<int32_t> r(MachineType::Int32()); | 1744 WasmRunner<int32_t> r(MachineType::Int32()); |
1745 BUILD(r, | 1745 BUILD(r, |
1746 B2(WASM_BRV_IF(0, WASM_I8(45), WASM_GET_LOCAL(0)), WASM_INFINITE_LOOP)); | 1746 B2(WASM_BRV_IF(0, WASM_I8(45), WASM_GET_LOCAL(0)), WASM_INFINITE_LOOP)); |
1747 // Run the code, but don't go into the infinite loop. | 1747 // Run the code, but don't go into the infinite loop. |
1748 CHECK_EQ(45, r.Call(1)); | 1748 CHECK_EQ(45, r.Call(1)); |
1749 } | 1749 } |
1750 | 1750 |
1751 | 1751 |
1752 static void TestBuildGraphForSimpleExpression(WasmOpcode opcode) { | 1752 static void TestBuildGraphForSimpleExpression(WasmOpcode opcode) { |
1753 if (!WasmOpcodes::IsSupported(opcode)) return; | |
1754 | |
1755 Isolate* isolate = CcTest::InitIsolateOnce(); | 1753 Isolate* isolate = CcTest::InitIsolateOnce(); |
1756 Zone zone(isolate->allocator()); | 1754 Zone zone(isolate->allocator()); |
1757 HandleScope scope(isolate); | 1755 HandleScope scope(isolate); |
1758 // Enable all optional operators. | 1756 // Enable all optional operators. |
1759 CommonOperatorBuilder common(&zone); | 1757 CommonOperatorBuilder common(&zone); |
1760 MachineOperatorBuilder machine(&zone, MachineType::PointerRepresentation(), | 1758 MachineOperatorBuilder machine(&zone, MachineType::PointerRepresentation(), |
1761 MachineOperatorBuilder::kAllOptionalOps); | 1759 MachineOperatorBuilder::kAllOptionalOps); |
1762 Graph graph(&zone); | 1760 Graph graph(&zone); |
1763 JSGraph jsgraph(isolate, &graph, &common, nullptr, nullptr, &machine); | 1761 JSGraph jsgraph(isolate, &graph, &common, nullptr, nullptr, &machine); |
1764 FunctionSig* sig = WasmOpcodes::Signature(opcode); | 1762 FunctionSig* sig = WasmOpcodes::Signature(opcode); |
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2863 WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); | 2861 WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); |
2864 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_ZERO); | 2862 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_ZERO); |
2865 const int32_t kMin = std::numeric_limits<int32_t>::min(); | 2863 const int32_t kMin = std::numeric_limits<int32_t>::min(); |
2866 CHECK_EQ(0, r.Call(133, 100)); | 2864 CHECK_EQ(0, r.Call(133, 100)); |
2867 CHECK_EQ(0, r.Call(kMin, -1)); | 2865 CHECK_EQ(0, r.Call(kMin, -1)); |
2868 CHECK_EQ(0, r.Call(0, 1)); | 2866 CHECK_EQ(0, r.Call(0, 1)); |
2869 CHECK_TRAP(r.Call(100, 0)); | 2867 CHECK_TRAP(r.Call(100, 0)); |
2870 CHECK_TRAP(r.Call(-1001, 0)); | 2868 CHECK_TRAP(r.Call(-1001, 0)); |
2871 CHECK_TRAP(r.Call(kMin, 0)); | 2869 CHECK_TRAP(r.Call(kMin, 0)); |
2872 } | 2870 } |
OLD | NEW |