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

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

Issue 2627543003: [wasm] Prerequisites for WebAssembly Table.Grow (Closed)
Patch Set: Rename update function Created 3 years, 11 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/compiler/test-run-wasm-machops.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 <setjmp.h> 8 #include <setjmp.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <stdlib.h> 10 #include <stdlib.h>
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 SignatureMap()}); 240 SignatureMap()});
241 WasmIndirectFunctionTable& table = module_.function_tables.back(); 241 WasmIndirectFunctionTable& table = module_.function_tables.back();
242 table.min_size = table_size; 242 table.min_size = table_size;
243 table.max_size = table_size; 243 table.max_size = table_size;
244 for (uint32_t i = 0; i < table_size; ++i) { 244 for (uint32_t i = 0; i < table_size; ++i) {
245 table.values.push_back(function_indexes[i]); 245 table.values.push_back(function_indexes[i]);
246 table.map.FindOrInsert(module_.functions[function_indexes[i]].sig); 246 table.map.FindOrInsert(module_.functions[function_indexes[i]].sig);
247 } 247 }
248 248
249 instance->function_tables.push_back( 249 instance->function_tables.push_back(
250 isolate_->factory()->NewFixedArray(table_size * 2)); 250 isolate_->factory()->NewFixedArray(table_size));
251 instance->signature_tables.push_back(
252 isolate_->factory()->NewFixedArray(table_size));
251 } 253 }
252 254
253 void PopulateIndirectFunctionTable() { 255 void PopulateIndirectFunctionTable() {
254 if (execution_mode_ == kExecuteInterpreted) return; 256 if (execution_mode_ == kExecuteInterpreted) return;
255 // Initialize the fixed arrays in instance->function_tables. 257 // Initialize the fixed arrays in instance->function_tables.
256 for (uint32_t i = 0; i < instance->function_tables.size(); i++) { 258 for (uint32_t i = 0; i < instance->function_tables.size(); i++) {
257 WasmIndirectFunctionTable& table = module_.function_tables[i]; 259 WasmIndirectFunctionTable& table = module_.function_tables[i];
258 Handle<FixedArray> array = instance->function_tables[i]; 260 Handle<FixedArray> function_table = instance->function_tables[i];
261 Handle<FixedArray> signature_table = instance->signature_tables[i];
259 int table_size = static_cast<int>(table.values.size()); 262 int table_size = static_cast<int>(table.values.size());
260 for (int j = 0; j < table_size; j++) { 263 for (int j = 0; j < table_size; j++) {
261 WasmFunction& function = module_.functions[table.values[j]]; 264 WasmFunction& function = module_.functions[table.values[j]];
262 array->set(j, Smi::FromInt(table.map.Find(function.sig))); 265 signature_table->set(j, Smi::FromInt(table.map.Find(function.sig)));
263 array->set(j + table_size, 266 function_table->set(j, *instance->function_code[function.func_index]);
264 *instance->function_code[function.func_index]);
265 } 267 }
266 } 268 }
267 } 269 }
268 270
269 uint32_t AddBytes(Vector<const byte> bytes) { 271 uint32_t AddBytes(Vector<const byte> bytes) {
270 Handle<SeqOneByteString> old_bytes( 272 Handle<SeqOneByteString> old_bytes(
271 instance_object_->compiled_module()->module_bytes(), isolate_); 273 instance_object_->compiled_module()->module_bytes(), isolate_);
272 uint32_t old_size = static_cast<uint32_t>(old_bytes->length()); 274 uint32_t old_size = static_cast<uint32_t>(old_bytes->length());
273 ScopedVector<byte> new_bytes(old_size + bytes.length()); 275 ScopedVector<byte> new_bytes(old_size + bytes.length());
274 memcpy(new_bytes.start(), old_bytes->GetChars(), old_size); 276 memcpy(new_bytes.start(), old_bytes->GetChars(), old_size);
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 void RunWasm_##name(WasmExecutionMode execution_mode) 798 void RunWasm_##name(WasmExecutionMode execution_mode)
797 799
798 #define WASM_EXEC_COMPILED_TEST(name) \ 800 #define WASM_EXEC_COMPILED_TEST(name) \
799 void RunWasm_##name(WasmExecutionMode execution_mode); \ 801 void RunWasm_##name(WasmExecutionMode execution_mode); \
800 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ 802 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \
801 void RunWasm_##name(WasmExecutionMode execution_mode) 803 void RunWasm_##name(WasmExecutionMode execution_mode)
802 804
803 } // namespace 805 } // namespace
804 806
805 #endif 807 #endif
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-run-wasm-machops.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698