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

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

Issue 1573053003: [wasm] Fix set_local appearing in unreachable code. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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/ast-decoder.cc ('k') | no next file » | 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/utils/random-number-generator.h" 9 #include "src/base/utils/random-number-generator.h"
10 10
(...skipping 1666 matching lines...) Expand 10 before | Expand all | Expand 10 after
1677 BUILD(r, WASM_BLOCK( 1677 BUILD(r, WASM_BLOCK(
1678 2, WASM_IF(WASM_GET_LOCAL(0), WASM_SET_LOCAL(0, WASM_I8(61))), 1678 2, WASM_IF(WASM_GET_LOCAL(0), WASM_SET_LOCAL(0, WASM_I8(61))),
1679 WASM_GET_LOCAL(0))); 1679 WASM_GET_LOCAL(0)));
1680 FOR_INT32_INPUTS(i) { 1680 FOR_INT32_INPUTS(i) {
1681 int32_t expected = *i ? 61 : *i; 1681 int32_t expected = *i ? 61 : *i;
1682 CHECK_EQ(expected, r.Call(*i)); 1682 CHECK_EQ(expected, r.Call(*i));
1683 } 1683 }
1684 } 1684 }
1685 1685
1686 1686
1687 TEST(Run_Wasm_DanglingAssign) {
1688 WasmRunner<int32_t> r(MachineType::Int32());
1689 // { return 0; p0 = 0; }
1690 BUILD(r, WASM_BLOCK(2, WASM_RETURN(WASM_ZERO), WASM_SET_LOCAL(0, WASM_ZERO)));
ahaas 2016/01/11 11:40:52 Nit: Maybe we could return a magic number instead
1691 CHECK_EQ(0, r.Call(1));
1692 }
1693
1694
1687 TEST(Run_Wasm_ExprIf_P) { 1695 TEST(Run_Wasm_ExprIf_P) {
1688 WasmRunner<int32_t> r(MachineType::Int32()); 1696 WasmRunner<int32_t> r(MachineType::Int32());
1689 // p0 ? 11 : 22; 1697 // p0 ? 11 : 22;
1690 BUILD(r, WASM_IF_ELSE(WASM_GET_LOCAL(0), // -- 1698 BUILD(r, WASM_IF_ELSE(WASM_GET_LOCAL(0), // --
1691 WASM_I8(11), // -- 1699 WASM_I8(11), // --
1692 WASM_I8(22))); // -- 1700 WASM_I8(22))); // --
1693 FOR_INT32_INPUTS(i) { 1701 FOR_INT32_INPUTS(i) {
1694 int32_t expected = *i ? 11 : 22; 1702 int32_t expected = *i ? 11 : 22;
1695 CHECK_EQ(expected, r.Call(*i)); 1703 CHECK_EQ(expected, r.Call(*i));
1696 } 1704 }
(...skipping 1912 matching lines...) Expand 10 before | Expand all | Expand 10 after
3609 TEST(Run_Wasm_F32CopySign) { 3617 TEST(Run_Wasm_F32CopySign) {
3610 WasmRunner<float> r(MachineType::Float32(), MachineType::Float32()); 3618 WasmRunner<float> r(MachineType::Float32(), MachineType::Float32());
3611 BUILD(r, WASM_F32_COPYSIGN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); 3619 BUILD(r, WASM_F32_COPYSIGN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
3612 3620
3613 FOR_FLOAT32_INPUTS(i) { 3621 FOR_FLOAT32_INPUTS(i) {
3614 FOR_FLOAT32_INPUTS(j) { CheckFloatEq(copysign(*i, *j), r.Call(*i, *j)); } 3622 FOR_FLOAT32_INPUTS(j) { CheckFloatEq(copysign(*i, *j), r.Call(*i, *j)); }
3615 } 3623 }
3616 } 3624 }
3617 3625
3618 #endif 3626 #endif
OLDNEW
« no previous file with comments | « src/wasm/ast-decoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698