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

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

Issue 2077623002: [wasm] memory size is an uint32_t, not a size_t. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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-module.h ('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/base/platform/elapsed-timer.h" 9 #include "src/base/platform/elapsed-timer.h"
10 10
(...skipping 1602 matching lines...) Expand 10 before | Expand all | Expand 10 after
1613 WASM_GET_LOCAL(kSum)), 1613 WASM_GET_LOCAL(kSum)),
1614 WASM_GET_LOCAL(0))); 1614 WASM_GET_LOCAL(0)));
1615 1615
1616 CHECK_EQ(0, r.Call(4 * (kSize - 1))); 1616 CHECK_EQ(0, r.Call(4 * (kSize - 1)));
1617 CHECK_NE(-99.25, buffer[0]); 1617 CHECK_NE(-99.25, buffer[0]);
1618 CHECK_EQ(71256.0f, buffer[0]); 1618 CHECK_EQ(71256.0f, buffer[0]);
1619 } 1619 }
1620 1620
1621 template <typename T> 1621 template <typename T>
1622 T GenerateAndRunFold(WasmExecutionMode execution_mode, WasmOpcode binop, 1622 T GenerateAndRunFold(WasmExecutionMode execution_mode, WasmOpcode binop,
1623 T* buffer, size_t size, LocalType astType, 1623 T* buffer, uint32_t size, LocalType astType,
1624 MachineType memType) { 1624 MachineType memType) {
1625 TestingModule module(execution_mode); 1625 TestingModule module(execution_mode);
1626 module.AddMemoryElems<T>(size); 1626 module.AddMemoryElems<T>(size);
1627 for (size_t i = 0; i < size; i++) { 1627 for (size_t i = 0; i < size; i++) {
bradnelson 2016/06/16 21:11:23 -> uint32_t ?
Mircea Trofin 2016/06/16 21:55:25 Done.
1628 module.raw_mem_start<T>()[i] = buffer[i]; 1628 module.raw_mem_start<T>()[i] = buffer[i];
1629 } 1629 }
1630 WasmRunner<int32_t> r(&module, MachineType::Int32()); 1630 WasmRunner<int32_t> r(&module, MachineType::Int32());
1631 const byte kAccum = r.AllocateLocal(astType); 1631 const byte kAccum = r.AllocateLocal(astType);
1632 1632
1633 BUILD( 1633 BUILD(
1634 r, 1634 r,
1635 WASM_BLOCK( 1635 WASM_BLOCK(
1636 4, WASM_SET_LOCAL(kAccum, WASM_LOAD_MEM(memType, WASM_ZERO)), 1636 4, WASM_SET_LOCAL(kAccum, WASM_LOAD_MEM(memType, WASM_ZERO)),
1637 WASM_WHILE( 1637 WASM_WHILE(
(...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after
2814 MachineType::Int32()); 2814 MachineType::Int32());
2815 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_ZERO); 2815 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_ZERO);
2816 const int32_t kMin = std::numeric_limits<int32_t>::min(); 2816 const int32_t kMin = std::numeric_limits<int32_t>::min();
2817 CHECK_EQ(0, r.Call(133, 100)); 2817 CHECK_EQ(0, r.Call(133, 100));
2818 CHECK_EQ(0, r.Call(kMin, -1)); 2818 CHECK_EQ(0, r.Call(kMin, -1));
2819 CHECK_EQ(0, r.Call(0, 1)); 2819 CHECK_EQ(0, r.Call(0, 1));
2820 CHECK_TRAP(r.Call(100, 0)); 2820 CHECK_TRAP(r.Call(100, 0));
2821 CHECK_TRAP(r.Call(-1001, 0)); 2821 CHECK_TRAP(r.Call(-1001, 0));
2822 CHECK_TRAP(r.Call(kMin, 0)); 2822 CHECK_TRAP(r.Call(kMin, 0));
2823 } 2823 }
OLDNEW
« no previous file with comments | « src/wasm/wasm-module.h ('k') | test/cctest/wasm/wasm-run-utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698