Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Side by Side Diff: test/cctest/wasm/test-run-wasm.cc

Issue 1890803002: [wasm] Generate source position information (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@wasm-throw-error
Patch Set: avoid using std::tie Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/wasm/ast-decoder.cc ('k') | test/cctest/wasm/wasm-run-utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/wasm/wasm-macro-gen.h" 9 #include "src/wasm/wasm-macro-gen.h"
10 10
(...skipping 1709 matching lines...) Expand 10 before | Expand all | Expand 10 after
1720 // Enable all optional operators. 1720 // Enable all optional operators.
1721 CommonOperatorBuilder common(&zone); 1721 CommonOperatorBuilder common(&zone);
1722 MachineOperatorBuilder machine(&zone, MachineType::PointerRepresentation(), 1722 MachineOperatorBuilder machine(&zone, MachineType::PointerRepresentation(),
1723 MachineOperatorBuilder::kAllOptionalOps); 1723 MachineOperatorBuilder::kAllOptionalOps);
1724 Graph graph(&zone); 1724 Graph graph(&zone);
1725 JSGraph jsgraph(isolate, &graph, &common, nullptr, nullptr, &machine); 1725 JSGraph jsgraph(isolate, &graph, &common, nullptr, nullptr, &machine);
1726 FunctionSig* sig = WasmOpcodes::Signature(opcode); 1726 FunctionSig* sig = WasmOpcodes::Signature(opcode);
1727 1727
1728 if (sig->parameter_count() == 1) { 1728 if (sig->parameter_count() == 1) {
1729 byte code[] = {WASM_NO_LOCALS, static_cast<byte>(opcode), kExprGetLocal, 0}; 1729 byte code[] = {WASM_NO_LOCALS, static_cast<byte>(opcode), kExprGetLocal, 0};
1730 TestBuildingGraph(&zone, &jsgraph, nullptr, sig, code, 1730 TestBuildingGraph(&zone, &jsgraph, nullptr, sig, nullptr, code,
1731 code + arraysize(code)); 1731 code + arraysize(code));
1732 } else { 1732 } else {
1733 CHECK_EQ(2, sig->parameter_count()); 1733 CHECK_EQ(2, sig->parameter_count());
1734 byte code[] = {WASM_NO_LOCALS, static_cast<byte>(opcode), 1734 byte code[] = {WASM_NO_LOCALS, static_cast<byte>(opcode),
1735 kExprGetLocal, 0, 1735 kExprGetLocal, 0,
1736 kExprGetLocal, 1}; 1736 kExprGetLocal, 1};
1737 TestBuildingGraph(&zone, &jsgraph, nullptr, sig, code, 1737 TestBuildingGraph(&zone, &jsgraph, nullptr, sig, nullptr, code,
1738 code + arraysize(code)); 1738 code + arraysize(code));
1739 } 1739 }
1740 } 1740 }
1741 1741
1742 1742
1743 TEST(Build_Wasm_SimpleExprs) { 1743 TEST(Build_Wasm_SimpleExprs) {
1744 // Test that the decoder can build a graph for all supported simple expressions. 1744 // Test that the decoder can build a graph for all supported simple expressions.
1745 #define GRAPH_BUILD_TEST(name, opcode, sig) \ 1745 #define GRAPH_BUILD_TEST(name, opcode, sig) \
1746 TestBuildGraphForSimpleExpression(kExpr##name); 1746 TestBuildGraphForSimpleExpression(kExpr##name);
1747 1747
(...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after
2822 WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); 2822 WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32());
2823 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_ZERO); 2823 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_ZERO);
2824 const int32_t kMin = std::numeric_limits<int32_t>::min(); 2824 const int32_t kMin = std::numeric_limits<int32_t>::min();
2825 CHECK_EQ(0, r.Call(133, 100)); 2825 CHECK_EQ(0, r.Call(133, 100));
2826 CHECK_EQ(0, r.Call(kMin, -1)); 2826 CHECK_EQ(0, r.Call(kMin, -1));
2827 CHECK_EQ(0, r.Call(0, 1)); 2827 CHECK_EQ(0, r.Call(0, 1));
2828 CHECK_TRAP(r.Call(100, 0)); 2828 CHECK_TRAP(r.Call(100, 0));
2829 CHECK_TRAP(r.Call(-1001, 0)); 2829 CHECK_TRAP(r.Call(-1001, 0));
2830 CHECK_TRAP(r.Call(kMin, 0)); 2830 CHECK_TRAP(r.Call(kMin, 0));
2831 } 2831 }
OLDNEW
« no previous file with comments | « src/wasm/ast-decoder.cc ('k') | test/cctest/wasm/wasm-run-utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698