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

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

Issue 1775873002: [Wasm] Convert many of the fixed-size values to LEB128. (Closed) Base URL: http://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix windows Created 4 years, 9 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/mjsunit/wasm/wasm-module-builder.js » ('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 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 CHECK_EQ(87, r.Call(1)); 1082 CHECK_EQ(87, r.Call(1));
1083 CHECK_EQ(88, r.Call(2)); 1083 CHECK_EQ(88, r.Call(2));
1084 CHECK_EQ(85, r.Call(3)); 1084 CHECK_EQ(85, r.Call(3));
1085 CHECK_EQ(85, r.Call(4)); 1085 CHECK_EQ(85, r.Call(4));
1086 CHECK_EQ(85, r.Call(5)); 1086 CHECK_EQ(85, r.Call(5));
1087 } 1087 }
1088 1088
1089 TEST(Run_Wasm_BrTable4) { 1089 TEST(Run_Wasm_BrTable4) {
1090 for (int i = 0; i < 4; i++) { 1090 for (int i = 0; i < 4; i++) {
1091 for (int t = 0; t < 4; t++) { 1091 for (int t = 0; t < 4; t++) {
1092 uint16_t cases[] = {0, 1, 2, 3}; 1092 uint32_t cases[] = {0, 1, 2, 3};
1093 cases[i] = t; 1093 cases[i] = t;
1094 byte code[] = {B2(B2(B2(B2(B1(WASM_BR_TABLE( 1094 byte code[] = {B2(B2(B2(B2(B1(WASM_BR_TABLE(
1095 WASM_GET_LOCAL(0), 3, BR_TARGET(cases[0]), 1095 WASM_GET_LOCAL(0), 3, BR_TARGET(cases[0]),
1096 BR_TARGET(cases[1]), BR_TARGET(cases[2]), 1096 BR_TARGET(cases[1]), BR_TARGET(cases[2]),
1097 BR_TARGET(cases[3]))), 1097 BR_TARGET(cases[3]))),
1098 RET_I8(70)), 1098 RET_I8(70)),
1099 RET_I8(71)), 1099 RET_I8(71)),
1100 RET_I8(72)), 1100 RET_I8(72)),
1101 RET_I8(73)), 1101 RET_I8(73)),
1102 WASM_I8(75)}; 1102 WASM_I8(75)};
1103 1103
1104 WasmRunner<int32_t> r(MachineType::Int32()); 1104 WasmRunner<int32_t> r(MachineType::Int32());
1105 r.Build(code, code + arraysize(code)); 1105 r.Build(code, code + arraysize(code));
1106 1106
1107 for (int x = -3; x < 50; x++) { 1107 for (int x = -3; x < 50; x++) {
1108 int index = (x > 3 || x < 0) ? 3 : x; 1108 int index = (x > 3 || x < 0) ? 3 : x;
1109 int32_t expected = 70 + cases[index]; 1109 int32_t expected = 70 + cases[index];
1110 CHECK_EQ(expected, r.Call(x)); 1110 CHECK_EQ(expected, r.Call(x));
1111 } 1111 }
1112 } 1112 }
1113 } 1113 }
1114 } 1114 }
1115 1115
1116 TEST(Run_Wasm_BrTable4x4) { 1116 TEST(Run_Wasm_BrTable4x4) {
1117 for (byte a = 0; a < 4; a++) { 1117 for (byte a = 0; a < 4; a++) {
1118 for (byte b = 0; b < 4; b++) { 1118 for (byte b = 0; b < 4; b++) {
1119 for (byte c = 0; c < 4; c++) { 1119 for (byte c = 0; c < 4; c++) {
1120 for (byte d = 0; d < 4; d++) { 1120 for (byte d = 0; d < 4; d++) {
1121 for (int i = 0; i < 4; i++) { 1121 for (int i = 0; i < 4; i++) {
1122 uint16_t cases[] = {a, b, c, d}; 1122 uint32_t cases[] = {a, b, c, d};
1123 byte code[] = { 1123 byte code[] = {
1124 B2(B2(B2(B2(B1(WASM_BR_TABLE( 1124 B2(B2(B2(B2(B1(WASM_BR_TABLE(
1125 WASM_GET_LOCAL(0), 3, BR_TARGET(cases[0]), 1125 WASM_GET_LOCAL(0), 3, BR_TARGET(cases[0]),
1126 BR_TARGET(cases[1]), BR_TARGET(cases[2]), 1126 BR_TARGET(cases[1]), BR_TARGET(cases[2]),
1127 BR_TARGET(cases[3]))), 1127 BR_TARGET(cases[3]))),
1128 RET_I8(50)), 1128 RET_I8(50)),
1129 RET_I8(51)), 1129 RET_I8(51)),
1130 RET_I8(52)), 1130 RET_I8(52)),
1131 RET_I8(53)), 1131 RET_I8(53)),
1132 WASM_I8(55)}; 1132 WASM_I8(55)};
(...skipping 2207 matching lines...) Expand 10 before | Expand all | Expand 10 after
3340 3340
3341 #if WASM_64 3341 #if WASM_64
3342 TEST(Compile_Wasm_CallIndirect_Many_i64) { CompileCallIndirectMany(kAstI64); } 3342 TEST(Compile_Wasm_CallIndirect_Many_i64) { CompileCallIndirectMany(kAstI64); }
3343 #endif 3343 #endif
3344 3344
3345 3345
3346 TEST(Compile_Wasm_CallIndirect_Many_f32) { CompileCallIndirectMany(kAstF32); } 3346 TEST(Compile_Wasm_CallIndirect_Many_f32) { CompileCallIndirectMany(kAstF32); }
3347 3347
3348 3348
3349 TEST(Compile_Wasm_CallIndirect_Many_f64) { CompileCallIndirectMany(kAstF64); } 3349 TEST(Compile_Wasm_CallIndirect_Many_f64) { CompileCallIndirectMany(kAstF64); }
OLDNEW
« no previous file with comments | « src/wasm/wasm-module.h ('k') | test/mjsunit/wasm/wasm-module-builder.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698