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

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

Issue 1970543003: [formatting] Remove all double blank lines in WASM code. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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 | « test/cctest/wasm/test-run-wasm-js.cc ('k') | test/unittests/wasm/ast-decoder-unittest.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 <stdlib.h> 5 #include <stdlib.h>
6 #include <string.h> 6 #include <string.h>
7 7
8 #include "src/wasm/encoder.h" 8 #include "src/wasm/encoder.h"
9 #include "src/wasm/wasm-js.h" 9 #include "src/wasm/wasm-js.h"
10 #include "src/wasm/wasm-macro-gen.h" 10 #include "src/wasm/wasm-macro-gen.h"
(...skipping 26 matching lines...) Expand all
37 uint16_t f_index = builder->AddFunction(); 37 uint16_t f_index = builder->AddFunction();
38 WasmFunctionBuilder* f = builder->FunctionAt(f_index); 38 WasmFunctionBuilder* f = builder->FunctionAt(f_index);
39 f->ReturnType(kAstI32); 39 f->ReturnType(kAstI32);
40 f->Exported(1); 40 f->Exported(1);
41 byte code[] = {WASM_I8(kReturnValue)}; 41 byte code[] = {WASM_I8(kReturnValue)};
42 f->EmitCode(code, sizeof(code)); 42 f->EmitCode(code, sizeof(code));
43 WasmModuleWriter* writer = builder->Build(&zone); 43 WasmModuleWriter* writer = builder->Build(&zone);
44 TestModule(writer->WriteTo(&zone), kReturnValue); 44 TestModule(writer->WriteTo(&zone), kReturnValue);
45 } 45 }
46 46
47
48 TEST(Run_WasmModule_CallAdd) { 47 TEST(Run_WasmModule_CallAdd) {
49 v8::base::AccountingAllocator allocator; 48 v8::base::AccountingAllocator allocator;
50 Zone zone(&allocator); 49 Zone zone(&allocator);
51 WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); 50 WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone);
52 uint16_t f1_index = builder->AddFunction(); 51 uint16_t f1_index = builder->AddFunction();
53 WasmFunctionBuilder* f = builder->FunctionAt(f1_index); 52 WasmFunctionBuilder* f = builder->FunctionAt(f1_index);
54 f->ReturnType(kAstI32); 53 f->ReturnType(kAstI32);
55 uint16_t param1 = f->AddParam(kAstI32); 54 uint16_t param1 = f->AddParam(kAstI32);
56 uint16_t param2 = f->AddParam(kAstI32); 55 uint16_t param2 = f->AddParam(kAstI32);
57 byte code1[] = {WASM_I32_ADD(WASM_GET_LOCAL(param1), WASM_GET_LOCAL(param2))}; 56 byte code1[] = {WASM_I32_ADD(WASM_GET_LOCAL(param1), WASM_GET_LOCAL(param2))};
58 f->EmitCode(code1, sizeof(code1)); 57 f->EmitCode(code1, sizeof(code1));
59 uint16_t f2_index = builder->AddFunction(); 58 uint16_t f2_index = builder->AddFunction();
60 f = builder->FunctionAt(f2_index); 59 f = builder->FunctionAt(f2_index);
61 f->ReturnType(kAstI32); 60 f->ReturnType(kAstI32);
62 f->Exported(1); 61 f->Exported(1);
63 byte code2[] = {WASM_CALL_FUNCTION2(f1_index, WASM_I8(77), WASM_I8(22))}; 62 byte code2[] = {WASM_CALL_FUNCTION2(f1_index, WASM_I8(77), WASM_I8(22))};
64 f->EmitCode(code2, sizeof(code2)); 63 f->EmitCode(code2, sizeof(code2));
65 WasmModuleWriter* writer = builder->Build(&zone); 64 WasmModuleWriter* writer = builder->Build(&zone);
66 TestModule(writer->WriteTo(&zone), 99); 65 TestModule(writer->WriteTo(&zone), 99);
67 } 66 }
68 67
69
70 TEST(Run_WasmModule_ReadLoadedDataSegment) { 68 TEST(Run_WasmModule_ReadLoadedDataSegment) {
71 static const byte kDataSegmentDest0 = 12; 69 static const byte kDataSegmentDest0 = 12;
72 v8::base::AccountingAllocator allocator; 70 v8::base::AccountingAllocator allocator;
73 Zone zone(&allocator); 71 Zone zone(&allocator);
74 WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); 72 WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone);
75 uint16_t f_index = builder->AddFunction(); 73 uint16_t f_index = builder->AddFunction();
76 WasmFunctionBuilder* f = builder->FunctionAt(f_index); 74 WasmFunctionBuilder* f = builder->FunctionAt(f_index);
77 f->ReturnType(kAstI32); 75 f->ReturnType(kAstI32);
78 f->Exported(1); 76 f->Exported(1);
79 byte code[] = { 77 byte code[] = {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 f = builder->FunctionAt(f2_index); 145 f = builder->FunctionAt(f2_index);
148 f->ReturnType(kAstI32); 146 f->ReturnType(kAstI32);
149 f->Exported(1); 147 f->Exported(1);
150 byte code2[] = {WASM_STORE_GLOBAL(global1, WASM_I32V_1(56)), 148 byte code2[] = {WASM_STORE_GLOBAL(global1, WASM_I32V_1(56)),
151 WASM_STORE_GLOBAL(global2, WASM_I32V_1(41)), 149 WASM_STORE_GLOBAL(global2, WASM_I32V_1(41)),
152 WASM_RETURN1(WASM_CALL_FUNCTION0(f1_index))}; 150 WASM_RETURN1(WASM_CALL_FUNCTION0(f1_index))};
153 f->EmitCode(code2, sizeof(code2)); 151 f->EmitCode(code2, sizeof(code2));
154 WasmModuleWriter* writer = builder->Build(&zone); 152 WasmModuleWriter* writer = builder->Build(&zone);
155 TestModule(writer->WriteTo(&zone), 97); 153 TestModule(writer->WriteTo(&zone), 97);
156 } 154 }
OLDNEW
« no previous file with comments | « test/cctest/wasm/test-run-wasm-js.cc ('k') | test/unittests/wasm/ast-decoder-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698