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

Side by Side Diff: test/unittests/wasm/ast-decoder-unittest.cc

Issue 1860103002: [wasm] Local decl parsing tweak. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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 "test/unittests/test-utils.h" 5 #include "test/unittests/test-utils.h"
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #include "test/cctest/wasm/test-signatures.h" 9 #include "test/cctest/wasm/test-signatures.h"
10 10
(...skipping 2228 matching lines...) Expand 10 before | Expand all | Expand 10 after
2239 LocalType type = kLocalTypes[i]; 2239 LocalType type = kLocalTypes[i];
2240 const byte data[] = { 2240 const byte data[] = {
2241 1, 1, static_cast<byte>(WasmOpcodes::LocalTypeCodeFor(type))}; 2241 1, 1, static_cast<byte>(WasmOpcodes::LocalTypeCodeFor(type))};
2242 AstLocalDecls decls(zone()); 2242 AstLocalDecls decls(zone());
2243 bool result = DecodeLocalDecls(decls, data, data + sizeof(data)); 2243 bool result = DecodeLocalDecls(decls, data, data + sizeof(data));
2244 EXPECT_TRUE(result); 2244 EXPECT_TRUE(result);
2245 EXPECT_EQ(1, decls.total_local_count); 2245 EXPECT_EQ(1, decls.total_local_count);
2246 2246
2247 LocalTypeMap map = Expand(decls); 2247 LocalTypeMap map = Expand(decls);
2248 EXPECT_EQ(1, map.size()); 2248 EXPECT_EQ(1, map.size());
2249 EXPECT_EQ(type, map.at(0)); 2249 EXPECT_EQ(type, map[0]);
2250 } 2250 }
2251 } 2251 }
2252 2252
2253 TEST_F(LocalDeclDecoderTest, FiveLocals) { 2253 TEST_F(LocalDeclDecoderTest, FiveLocals) {
2254 for (size_t i = 0; i < arraysize(kLocalTypes); i++) { 2254 for (size_t i = 0; i < arraysize(kLocalTypes); i++) {
2255 LocalType type = kLocalTypes[i]; 2255 LocalType type = kLocalTypes[i];
2256 const byte data[] = { 2256 const byte data[] = {
2257 1, 5, static_cast<byte>(WasmOpcodes::LocalTypeCodeFor(type))}; 2257 1, 5, static_cast<byte>(WasmOpcodes::LocalTypeCodeFor(type))};
2258 AstLocalDecls decls(zone()); 2258 AstLocalDecls decls(zone());
2259 bool result = DecodeLocalDecls(decls, data, data + sizeof(data)); 2259 bool result = DecodeLocalDecls(decls, data, data + sizeof(data));
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
2313 size_t pos = 0; 2313 size_t pos = 0;
2314 pos = ExpectRun(map, pos, kAstF32, 5); 2314 pos = ExpectRun(map, pos, kAstF32, 5);
2315 pos = ExpectRun(map, pos, kAstI32, 1337); 2315 pos = ExpectRun(map, pos, kAstI32, 1337);
2316 pos = ExpectRun(map, pos, kAstI64, 212); 2316 pos = ExpectRun(map, pos, kAstI64, 212);
2317 delete[] data; 2317 delete[] data;
2318 } 2318 }
2319 2319
2320 } // namespace wasm 2320 } // namespace wasm
2321 } // namespace internal 2321 } // namespace internal
2322 } // namespace v8 2322 } // namespace v8
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