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

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

Issue 2628883006: Revert of [wasm] Enforce that function bodies end with the \"end\" opcode. (Closed)
Patch Set: Created 3 years, 11 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/wasm-text.cc ('k') | test/cctest/wasm/test-run-wasm-interpreter.cc » ('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/base/platform/elapsed-timer.h" 9 #include "src/base/platform/elapsed-timer.h"
10 #include "src/utils.h" 10 #include "src/utils.h"
(...skipping 1833 matching lines...) Expand 10 before | Expand all | Expand 10 after
1844 HandleScope scope(isolate); 1844 HandleScope scope(isolate);
1845 // Enable all optional operators. 1845 // Enable all optional operators.
1846 CommonOperatorBuilder common(&zone); 1846 CommonOperatorBuilder common(&zone);
1847 MachineOperatorBuilder machine(&zone, MachineType::PointerRepresentation(), 1847 MachineOperatorBuilder machine(&zone, MachineType::PointerRepresentation(),
1848 MachineOperatorBuilder::kAllOptionalOps); 1848 MachineOperatorBuilder::kAllOptionalOps);
1849 Graph graph(&zone); 1849 Graph graph(&zone);
1850 JSGraph jsgraph(isolate, &graph, &common, nullptr, nullptr, &machine); 1850 JSGraph jsgraph(isolate, &graph, &common, nullptr, nullptr, &machine);
1851 FunctionSig* sig = WasmOpcodes::Signature(opcode); 1851 FunctionSig* sig = WasmOpcodes::Signature(opcode);
1852 1852
1853 if (sig->parameter_count() == 1) { 1853 if (sig->parameter_count() == 1) {
1854 byte code[] = {WASM_NO_LOCALS, kExprGetLocal, 0, static_cast<byte>(opcode), 1854 byte code[] = {WASM_NO_LOCALS, kExprGetLocal, 0, static_cast<byte>(opcode)};
1855 WASM_END};
1856 TestBuildingGraph(&zone, &jsgraph, nullptr, sig, nullptr, code, 1855 TestBuildingGraph(&zone, &jsgraph, nullptr, sig, nullptr, code,
1857 code + arraysize(code)); 1856 code + arraysize(code));
1858 } else { 1857 } else {
1859 CHECK_EQ(2, sig->parameter_count()); 1858 CHECK_EQ(2, sig->parameter_count());
1860 byte code[] = {WASM_NO_LOCALS, 1859 byte code[] = {WASM_NO_LOCALS, kExprGetLocal, 0, kExprGetLocal, 1,
1861 kExprGetLocal, 1860 static_cast<byte>(opcode)};
1862 0,
1863 kExprGetLocal,
1864 1,
1865 static_cast<byte>(opcode),
1866 WASM_END};
1867 TestBuildingGraph(&zone, &jsgraph, nullptr, sig, nullptr, code, 1861 TestBuildingGraph(&zone, &jsgraph, nullptr, sig, nullptr, code,
1868 code + arraysize(code)); 1862 code + arraysize(code));
1869 } 1863 }
1870 } 1864 }
1871 1865
1872 TEST(Build_Wasm_SimpleExprs) { 1866 TEST(Build_Wasm_SimpleExprs) {
1873 // Test that the decoder can build a graph for all supported simple expressions. 1867 // Test that the decoder can build a graph for all supported simple expressions.
1874 #define GRAPH_BUILD_TEST(name, opcode, sig) \ 1868 #define GRAPH_BUILD_TEST(name, opcode, sig) \
1875 TestBuildGraphForSimpleExpression(kExpr##name); 1869 TestBuildGraphForSimpleExpression(kExpr##name);
1876 1870
(...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after
2865 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_DROP, 2859 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_DROP,
2866 WASM_ZERO); 2860 WASM_ZERO);
2867 const int32_t kMin = std::numeric_limits<int32_t>::min(); 2861 const int32_t kMin = std::numeric_limits<int32_t>::min();
2868 CHECK_EQ(0, r.Call(133, 100)); 2862 CHECK_EQ(0, r.Call(133, 100));
2869 CHECK_EQ(0, r.Call(kMin, -1)); 2863 CHECK_EQ(0, r.Call(kMin, -1));
2870 CHECK_EQ(0, r.Call(0, 1)); 2864 CHECK_EQ(0, r.Call(0, 1));
2871 CHECK_TRAP(r.Call(100, 0)); 2865 CHECK_TRAP(r.Call(100, 0));
2872 CHECK_TRAP(r.Call(-1001, 0)); 2866 CHECK_TRAP(r.Call(-1001, 0));
2873 CHECK_TRAP(r.Call(kMin, 0)); 2867 CHECK_TRAP(r.Call(kMin, 0));
2874 } 2868 }
OLDNEW
« no previous file with comments | « src/wasm/wasm-text.cc ('k') | test/cctest/wasm/test-run-wasm-interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698