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

Side by Side Diff: test/cctest/wasm/wasm-run-utils.h

Issue 1698133002: [wasm] Clean up handling of function names. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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
« src/wasm/wasm-module.h ('K') | « src/wasm/wasm-module.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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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 #ifndef WASM_RUN_UTILS_H 5 #ifndef WASM_RUN_UTILS_H
6 #define WASM_RUN_UTILS_H 6 #define WASM_RUN_UTILS_H
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 #include <string.h> 10 #include <string.h>
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 rng.SetSeed(seed); 157 rng.SetSeed(seed);
158 rng.NextBytes(raw, end - raw); 158 rng.NextBytes(raw, end - raw);
159 } 159 }
160 160
161 WasmFunction* AddFunction(FunctionSig* sig, Handle<Code> code) { 161 WasmFunction* AddFunction(FunctionSig* sig, Handle<Code> code) {
162 AllocModule(); 162 AllocModule();
163 if (module->functions == nullptr) { 163 if (module->functions == nullptr) {
164 module->functions = new std::vector<WasmFunction>(); 164 module->functions = new std::vector<WasmFunction>();
165 instance->function_code = new std::vector<Handle<Code>>(); 165 instance->function_code = new std::vector<Handle<Code>>();
166 } 166 }
167 module->functions->push_back({sig, 0, 0, 0, 0, 0, 0, 0, false, false}); 167 uint32_t index = static_cast<uint32_t>(module->functions->size());
168 module->functions->push_back(
169 {sig, index, 0, 0, 0, 0, 0, 0, 0, false, false});
168 instance->function_code->push_back(code); 170 instance->function_code->push_back(code);
169 return &module->functions->back(); 171 return &module->functions->back();
170 } 172 }
171 173
172 void AddIndirectFunctionTable(int* functions, int table_size) { 174 void AddIndirectFunctionTable(int* functions, int table_size) {
173 AllocModule(); 175 AllocModule();
174 Isolate* isolate = module->shared_isolate; 176 Isolate* isolate = module->shared_isolate;
175 Handle<FixedArray> fixed = 177 Handle<FixedArray> fixed =
176 isolate->factory()->NewFixedArray(2 * table_size); 178 isolate->factory()->NewFixedArray(2 * table_size);
177 instance->function_table = fixed; 179 instance->function_table = fixed;
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 if (p1 == MachineType::None()) return 1; 411 if (p1 == MachineType::None()) return 1;
410 if (p2 == MachineType::None()) return 2; 412 if (p2 == MachineType::None()) return 2;
411 if (p3 == MachineType::None()) return 3; 413 if (p3 == MachineType::None()) return 3;
412 return 4; 414 return 4;
413 } 415 }
414 }; 416 };
415 417
416 } // namespace 418 } // namespace
417 419
418 #endif 420 #endif
OLDNEW
« src/wasm/wasm-module.h ('K') | « src/wasm/wasm-module.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698