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

Side by Side Diff: src/wasm/wasm-module.cc

Issue 2005933003: [wasm] globals size is not a per-instance property. (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 | « src/wasm/wasm-module.h ('k') | test/cctest/wasm/wasm-run-utils.h » ('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 "src/base/atomic-utils.h" 5 #include "src/base/atomic-utils.h"
6 #include "src/macro-assembler.h" 6 #include "src/macro-assembler.h"
7 #include "src/objects.h" 7 #include "src/objects.h"
8 #include "src/property-descriptor.h" 8 #include "src/property-descriptor.h"
9 #include "src/v8.h" 9 #include "src/v8.h"
10 10
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 } 135 }
136 return function_code_[index]; 136 return function_code_[index];
137 } 137 }
138 138
139 void Finish(uint32_t index, Handle<Code> code) { 139 void Finish(uint32_t index, Handle<Code> code) {
140 DCHECK(index < function_code_.size()); 140 DCHECK(index < function_code_.size());
141 function_code_[index] = code; 141 function_code_[index] = code;
142 } 142 }
143 143
144 void Link(Handle<FixedArray> function_table, 144 void Link(Handle<FixedArray> function_table,
145 std::vector<uint16_t>& functions) { 145 const std::vector<uint16_t>& functions) {
146 for (size_t i = 0; i < function_code_.size(); i++) { 146 for (size_t i = 0; i < function_code_.size(); i++) {
147 LinkFunction(function_code_[i]); 147 LinkFunction(function_code_[i]);
148 } 148 }
149 if (!function_table.is_null()) { 149 if (!function_table.is_null()) {
150 int table_size = static_cast<int>(functions.size()); 150 int table_size = static_cast<int>(functions.size());
151 DCHECK_EQ(function_table->length(), table_size * 2); 151 DCHECK_EQ(function_table->length(), table_size * 2);
152 for (int i = 0; i < table_size; i++) { 152 for (int i = 0; i < table_size; i++) {
153 function_table->set(i + table_size, *function_code_[functions[i]]); 153 function_table->set(i + table_size, *function_code_[functions[i]]);
154 } 154 }
155 } 155 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 196
197 namespace { 197 namespace {
198 // Internal constants for the layout of the module object. 198 // Internal constants for the layout of the module object.
199 const int kWasmModuleInternalFieldCount = 5; 199 const int kWasmModuleInternalFieldCount = 5;
200 const int kWasmModuleFunctionTable = 0; 200 const int kWasmModuleFunctionTable = 0;
201 const int kWasmModuleCodeTable = 1; 201 const int kWasmModuleCodeTable = 1;
202 const int kWasmMemArrayBuffer = 2; 202 const int kWasmMemArrayBuffer = 2;
203 const int kWasmGlobalsArrayBuffer = 3; 203 const int kWasmGlobalsArrayBuffer = 3;
204 const int kWasmFunctionNamesArray = 4; 204 const int kWasmFunctionNamesArray = 4;
205 205
206 size_t AllocateGlobalsOffsets(std::vector<WasmGlobal>& globals) { 206 void LoadDataSegments(const WasmModule* module, byte* mem_addr,
207 uint32_t offset = 0; 207 size_t mem_size) {
208 if (globals.size() == 0) return 0;
209 for (WasmGlobal& global : globals) {
210 byte size = WasmOpcodes::MemSize(global.type);
211 offset = (offset + size - 1) & ~(size - 1); // align
212 global.offset = offset;
213 offset += size;
214 }
215 return offset;
216 }
217
218 void LoadDataSegments(WasmModule* module, byte* mem_addr, size_t mem_size) {
219 for (const WasmDataSegment& segment : module->data_segments) { 208 for (const WasmDataSegment& segment : module->data_segments) {
220 if (!segment.init) continue; 209 if (!segment.init) continue;
221 if (!segment.source_size) continue; 210 if (!segment.source_size) continue;
222 CHECK_LT(segment.dest_addr, mem_size); 211 CHECK_LT(segment.dest_addr, mem_size);
223 CHECK_LE(segment.source_size, mem_size); 212 CHECK_LE(segment.source_size, mem_size);
224 CHECK_LE(segment.dest_addr + segment.source_size, mem_size); 213 CHECK_LE(segment.dest_addr + segment.source_size, mem_size);
225 byte* addr = mem_addr + segment.dest_addr; 214 byte* addr = mem_addr + segment.dest_addr;
226 memcpy(addr, module->module_start + segment.source_offset, 215 memcpy(addr, module->module_start + segment.source_offset,
227 segment.source_size); 216 segment.source_size);
228 } 217 }
229 } 218 }
230 219
231 Handle<FixedArray> BuildFunctionTable(Isolate* isolate, WasmModule* module) { 220 Handle<FixedArray> BuildFunctionTable(Isolate* isolate,
221 const WasmModule* module) {
232 if (module->function_table.size() == 0) { 222 if (module->function_table.size() == 0) {
233 return Handle<FixedArray>::null(); 223 return Handle<FixedArray>::null();
234 } 224 }
235 int table_size = static_cast<int>(module->function_table.size()); 225 int table_size = static_cast<int>(module->function_table.size());
236 Handle<FixedArray> fixed = isolate->factory()->NewFixedArray(2 * table_size); 226 Handle<FixedArray> fixed = isolate->factory()->NewFixedArray(2 * table_size);
237 for (int i = 0; i < table_size; i++) { 227 for (int i = 0; i < table_size; i++) {
238 WasmFunction* function = &module->functions[module->function_table[i]]; 228 const WasmFunction* function =
229 &module->functions[module->function_table[i]];
239 fixed->set(i, Smi::FromInt(function->sig_index)); 230 fixed->set(i, Smi::FromInt(function->sig_index));
240 } 231 }
241 return fixed; 232 return fixed;
242 } 233 }
243 234
244 Handle<JSArrayBuffer> NewArrayBuffer(Isolate* isolate, size_t size, 235 Handle<JSArrayBuffer> NewArrayBuffer(Isolate* isolate, size_t size,
245 byte** backing_store) { 236 byte** backing_store) {
246 if (size > (WasmModule::kMaxMemPages * WasmModule::kPageSize)) { 237 if (size > (WasmModule::kMaxMemPages * WasmModule::kPageSize)) {
247 // TODO(titzer): lift restriction on maximum memory allocated here. 238 // TODO(titzer): lift restriction on maximum memory allocated here.
248 *backing_store = nullptr; 239 *backing_store = nullptr;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 if (!instance->mem_start) { 286 if (!instance->mem_start) {
296 thrower->Error("Out of memory: wasm memory"); 287 thrower->Error("Out of memory: wasm memory");
297 instance->mem_size = 0; 288 instance->mem_size = 0;
298 return false; 289 return false;
299 } 290 }
300 return true; 291 return true;
301 } 292 }
302 293
303 bool AllocateGlobals(ErrorThrower* thrower, Isolate* isolate, 294 bool AllocateGlobals(ErrorThrower* thrower, Isolate* isolate,
304 WasmModuleInstance* instance) { 295 WasmModuleInstance* instance) {
305 instance->globals_size = AllocateGlobalsOffsets(instance->module->globals); 296 uint32_t globals_size = instance->module->globals_size;
306 297 if (globals_size > 0) {
307 if (instance->globals_size > 0) { 298 instance->globals_buffer =
308 instance->globals_buffer = NewArrayBuffer(isolate, instance->globals_size, 299 NewArrayBuffer(isolate, globals_size, &instance->globals_start);
309 &instance->globals_start);
310 if (!instance->globals_start) { 300 if (!instance->globals_start) {
311 // Not enough space for backing store of globals. 301 // Not enough space for backing store of globals.
312 thrower->Error("Out of memory: wasm globals"); 302 thrower->Error("Out of memory: wasm globals");
313 return false; 303 return false;
314 } 304 }
315 } 305 }
316 return true; 306 return true;
317 } 307 }
318 } // namespace 308 } // namespace
319 309
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 } 456 }
467 457
468 inline void Report() { 458 inline void Report() {
469 if (FLAG_print_wasm_code_size) { 459 if (FLAG_print_wasm_code_size) {
470 PrintF("Total generated wasm code: %zu bytes\n", code_size); 460 PrintF("Total generated wasm code: %zu bytes\n", code_size);
471 PrintF("Total generated wasm reloc: %zu bytes\n", reloc_size); 461 PrintF("Total generated wasm reloc: %zu bytes\n", reloc_size);
472 } 462 }
473 } 463 }
474 }; 464 };
475 465
476 bool CompileWrappersToImportedFunctions(Isolate* isolate, WasmModule* module, 466 bool CompileWrappersToImportedFunctions(
477 const Handle<JSReceiver> ffi, 467 Isolate* isolate, const WasmModule* module, const Handle<JSReceiver> ffi,
478 WasmModuleInstance* instance, 468 WasmModuleInstance* instance, ErrorThrower* thrower, Factory* factory,
479 ErrorThrower* thrower, Factory* factory, 469 ModuleEnv* module_env, CodeStats& code_stats) {
480 ModuleEnv* module_env,
481 CodeStats& code_stats) {
482 uint32_t index = 0; 470 uint32_t index = 0;
483 if (module->import_table.size() > 0) { 471 if (module->import_table.size() > 0) {
484 instance->import_code.reserve(module->import_table.size()); 472 instance->import_code.reserve(module->import_table.size());
485 for (const WasmImport& import : module->import_table) { 473 for (const WasmImport& import : module->import_table) {
486 WasmName module_name = module->GetNameOrNull(import.module_name_offset, 474 WasmName module_name = module->GetNameOrNull(import.module_name_offset,
487 import.module_name_length); 475 import.module_name_length);
488 WasmName function_name = module->GetNameOrNull( 476 WasmName function_name = module->GetNameOrNull(
489 import.function_name_offset, import.function_name_length); 477 import.function_name_offset, import.function_name_length);
490 MaybeHandle<JSFunction> function = LookupFunction( 478 MaybeHandle<JSFunction> function = LookupFunction(
491 *thrower, factory, ffi, index, module_name, function_name); 479 *thrower, factory, ffi, index, module_name, function_name);
492 if (function.is_null()) return false; 480 if (function.is_null()) return false;
493 481
494 Handle<Code> code = compiler::CompileWasmToJSWrapper( 482 Handle<Code> code = compiler::CompileWasmToJSWrapper(
495 isolate, module_env, function.ToHandleChecked(), import.sig, 483 isolate, module_env, function.ToHandleChecked(), import.sig,
496 module_name, function_name); 484 module_name, function_name);
497 instance->import_code.push_back(code); 485 instance->import_code.push_back(code);
498 code_stats.Record(*code); 486 code_stats.Record(*code);
499 index++; 487 index++;
500 } 488 }
501 } 489 }
502 return true; 490 return true;
503 } 491 }
504 492
505 void InitializeParallelCompilation( 493 void InitializeParallelCompilation(
506 Isolate* isolate, std::vector<WasmFunction>& functions, 494 Isolate* isolate, const std::vector<WasmFunction>& functions,
507 std::vector<compiler::WasmCompilationUnit*>& compilation_units, 495 std::vector<compiler::WasmCompilationUnit*>& compilation_units,
508 ModuleEnv& module_env, ErrorThrower& thrower) { 496 ModuleEnv& module_env, ErrorThrower& thrower) {
509 // Create a placeholder code object for all functions. 497 // Create a placeholder code object for all functions.
510 // TODO(ahaas): Maybe we could skip this for external functions. 498 // TODO(ahaas): Maybe we could skip this for external functions.
511 for (uint32_t i = 0; i < functions.size(); i++) { 499 for (uint32_t i = 0; i < functions.size(); i++) {
512 module_env.linker->GetFunctionCode(i); 500 module_env.linker->GetFunctionCode(i);
513 } 501 }
514 502
515 for (uint32_t i = FLAG_skip_compiling_wasm_funcs; i < functions.size(); i++) { 503 for (uint32_t i = FLAG_skip_compiling_wasm_funcs; i < functions.size(); i++) {
516 compilation_units[i] = new compiler::WasmCompilationUnit( 504 compilation_units[i] = new compiler::WasmCompilationUnit(
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 for (size_t i = 0; i < num_tasks; i++) { 536 for (size_t i = 0; i < num_tasks; i++) {
549 // If the task has not started yet, then we abort it. Otherwise we wait for 537 // If the task has not started yet, then we abort it. Otherwise we wait for
550 // it to finish. 538 // it to finish.
551 if (!isolate->cancelable_task_manager()->TryAbort(task_ids[i])) { 539 if (!isolate->cancelable_task_manager()->TryAbort(task_ids[i])) {
552 pending_tasks->Wait(); 540 pending_tasks->Wait();
553 } 541 }
554 } 542 }
555 } 543 }
556 544
557 void FinishCompilationUnits( 545 void FinishCompilationUnits(
558 WasmModule* module,
559 std::queue<compiler::WasmCompilationUnit*>& executed_units, 546 std::queue<compiler::WasmCompilationUnit*>& executed_units,
560 std::vector<Handle<Code>>& results, base::Mutex& result_mutex) { 547 std::vector<Handle<Code>>& results, base::Mutex& result_mutex) {
561 while (true) { 548 while (true) {
562 compiler::WasmCompilationUnit* unit = nullptr; 549 compiler::WasmCompilationUnit* unit = nullptr;
563 { 550 {
564 base::LockGuard<base::Mutex> guard(&result_mutex); 551 base::LockGuard<base::Mutex> guard(&result_mutex);
565 if (executed_units.empty()) { 552 if (executed_units.empty()) {
566 break; 553 break;
567 } 554 }
568 unit = executed_units.front(); 555 unit = executed_units.front();
569 executed_units.pop(); 556 executed_units.pop();
570 } 557 }
571 int j = unit->index(); 558 int j = unit->index();
572 results[j] = unit->FinishCompilation(); 559 results[j] = unit->FinishCompilation();
573 delete unit; 560 delete unit;
574 } 561 }
575 } 562 }
576 563
577 bool FinishCompilation(Isolate* isolate, WasmModule* module, 564 bool FinishCompilation(Isolate* isolate, const WasmModule* module,
578 const Handle<JSReceiver> ffi, 565 const Handle<JSReceiver> ffi,
579 const std::vector<Handle<Code>>& results, 566 const std::vector<Handle<Code>>& results,
580 const WasmModuleInstance& instance, 567 const WasmModuleInstance& instance,
581 const Handle<FixedArray>& code_table, 568 const Handle<FixedArray>& code_table,
582 ErrorThrower& thrower, Factory* factory, 569 ErrorThrower& thrower, Factory* factory,
583 ModuleEnv& module_env, CodeStats& code_stats, 570 ModuleEnv& module_env, CodeStats& code_stats,
584 PropertyDescriptor& desc) { 571 PropertyDescriptor& desc) {
585 for (uint32_t i = FLAG_skip_compiling_wasm_funcs; 572 for (uint32_t i = FLAG_skip_compiling_wasm_funcs;
586 i < module->functions.size(); i++) { 573 i < module->functions.size(); i++) {
587 const WasmFunction& func = module->functions[i]; 574 const WasmFunction& func = module->functions[i];
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 } 616 }
630 return true; 617 return true;
631 } 618 }
632 } // namespace 619 } // namespace
633 620
634 // Instantiates a wasm module as a JSObject. 621 // Instantiates a wasm module as a JSObject.
635 // * allocates a backing store of {mem_size} bytes. 622 // * allocates a backing store of {mem_size} bytes.
636 // * installs a named property "memory" for that buffer if exported 623 // * installs a named property "memory" for that buffer if exported
637 // * installs named properties on the object for exported functions 624 // * installs named properties on the object for exported functions
638 // * compiles wasm code to machine code 625 // * compiles wasm code to machine code
639 MaybeHandle<JSObject> WasmModule::Instantiate(Isolate* isolate, 626 MaybeHandle<JSObject> WasmModule::Instantiate(
640 Handle<JSReceiver> ffi, 627 Isolate* isolate, Handle<JSReceiver> ffi,
641 Handle<JSArrayBuffer> memory) { 628 Handle<JSArrayBuffer> memory) const {
642 HistogramTimerScope wasm_instantiate_module_time_scope( 629 HistogramTimerScope wasm_instantiate_module_time_scope(
643 isolate->counters()->wasm_instantiate_module_time()); 630 isolate->counters()->wasm_instantiate_module_time());
644 ErrorThrower thrower(isolate, "WasmModule::Instantiate()"); 631 ErrorThrower thrower(isolate, "WasmModule::Instantiate()");
645 Factory* factory = isolate->factory(); 632 Factory* factory = isolate->factory();
646 633
647 PropertyDescriptor desc; 634 PropertyDescriptor desc;
648 desc.set_writable(false); 635 desc.set_writable(false);
649 636
650 // If FLAG_print_wasm_code_size is set, this aggregates the sum of all code 637 // If FLAG_print_wasm_code_size is set, this aggregates the sum of all code
651 // objects created for this module. 638 // objects created for this module.
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 // unit at a time and execute the parallel phase of the compilation 755 // unit at a time and execute the parallel phase of the compilation
769 // unit. After finishing the execution of the parallel phase, the 756 // unit. After finishing the execution of the parallel phase, the
770 // result is enqueued in {executed_units}. 757 // result is enqueued in {executed_units}.
771 while (FetchAndExecuteCompilationUnit(isolate, &compilation_units, 758 while (FetchAndExecuteCompilationUnit(isolate, &compilation_units,
772 &executed_units, &result_mutex, 759 &executed_units, &result_mutex,
773 &next_unit)) { 760 &next_unit)) {
774 // 3.b) If {executed_units} contains a compilation unit, the main thread 761 // 3.b) If {executed_units} contains a compilation unit, the main thread
775 // dequeues it and finishes the compilation unit. Compilation units 762 // dequeues it and finishes the compilation unit. Compilation units
776 // are finished concurrently to the background threads to save 763 // are finished concurrently to the background threads to save
777 // memory. 764 // memory.
778 FinishCompilationUnits(this, executed_units, results, result_mutex); 765 FinishCompilationUnits(executed_units, results, result_mutex);
779 } 766 }
780 // 4) After the parallel phase of all compilation units has started, the 767 // 4) After the parallel phase of all compilation units has started, the
781 // main thread waits for all {WasmCompilationTask} instances to finish. 768 // main thread waits for all {WasmCompilationTask} instances to finish.
782 WaitForCompilationTasks(isolate, task_ids.get(), pending_tasks); 769 WaitForCompilationTasks(isolate, task_ids.get(), pending_tasks);
783 // Finish the compilation of the remaining compilation units. 770 // Finish the compilation of the remaining compilation units.
784 FinishCompilationUnits(this, executed_units, results, result_mutex); 771 FinishCompilationUnits(executed_units, results, result_mutex);
785 } 772 }
786 // 5) The main thread finishes the compilation. 773 // 5) The main thread finishes the compilation.
787 if (!FinishCompilation(isolate, this, ffi, results, instance, code_table, 774 if (!FinishCompilation(isolate, this, ffi, results, instance, code_table,
788 thrower, factory, module_env, code_stats, desc)) { 775 thrower, factory, module_env, code_stats, desc)) {
789 instance.js_object = Handle<JSObject>::null(); 776 instance.js_object = Handle<JSObject>::null();
790 } 777 }
791 778
792 // Patch all direct call sites. 779 // Patch all direct call sites.
793 linker.Link(instance.function_table, this->function_table); 780 linker.Link(instance.function_table, this->function_table);
794 instance.js_object->SetInternalField(kWasmModuleFunctionTable, 781 instance.js_object->SetInternalField(kWasmModuleFunctionTable,
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 Handle<Code> ModuleEnv::GetImportCode(uint32_t index) { 861 Handle<Code> ModuleEnv::GetImportCode(uint32_t index) {
875 DCHECK(IsValidImport(index)); 862 DCHECK(IsValidImport(index));
876 return instance ? instance->import_code[index] : Handle<Code>::null(); 863 return instance ? instance->import_code[index] : Handle<Code>::null();
877 } 864 }
878 865
879 compiler::CallDescriptor* ModuleEnv::GetCallDescriptor(Zone* zone, 866 compiler::CallDescriptor* ModuleEnv::GetCallDescriptor(Zone* zone,
880 uint32_t index) { 867 uint32_t index) {
881 DCHECK(IsValidFunction(index)); 868 DCHECK(IsValidFunction(index));
882 // Always make a direct call to whatever is in the table at that location. 869 // Always make a direct call to whatever is in the table at that location.
883 // A wrapper will be generated for FFI calls. 870 // A wrapper will be generated for FFI calls.
884 WasmFunction* function = &module->functions[index]; 871 const WasmFunction* function = &module->functions[index];
885 return GetWasmCallDescriptor(zone, function->sig); 872 return GetWasmCallDescriptor(zone, function->sig);
886 } 873 }
887 874
888 int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start, 875 int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start,
889 const byte* module_end, bool asm_js) { 876 const byte* module_end, bool asm_js) {
890 HandleScope scope(isolate); 877 HandleScope scope(isolate);
891 Zone zone(isolate->allocator()); 878 Zone zone(isolate->allocator());
892 // Decode the module, but don't verify function bodies, since we'll 879 // Decode the module, but don't verify function bodies, since we'll
893 // be compiling them anyway. 880 // be compiling them anyway.
894 ModuleResult result = DecodeWasmModule(isolate, &zone, module_start, 881 ModuleResult result = DecodeWasmModule(isolate, &zone, module_start,
895 module_end, false, kWasmOrigin); 882 module_end, false, kWasmOrigin);
896 if (result.failed()) { 883 if (result.failed()) {
897 if (result.val) { 884 if (result.val) {
898 delete result.val; 885 delete result.val;
899 } 886 }
900 // Module verification failed. throw. 887 // Module verification failed. throw.
901 std::ostringstream str; 888 std::ostringstream str;
902 str << "WASM.compileRun() failed: " << result; 889 str << "WASM.compileRun() failed: " << result;
903 isolate->Throw( 890 isolate->Throw(
904 *isolate->factory()->NewStringFromAsciiChecked(str.str().c_str())); 891 *isolate->factory()->NewStringFromAsciiChecked(str.str().c_str()));
905 return -1; 892 return -1;
906 } 893 }
907 894
908 int32_t retval = CompileAndRunWasmModule(isolate, result.val); 895 int32_t retval = CompileAndRunWasmModule(isolate, result.val);
909 delete result.val; 896 delete result.val;
910 return retval; 897 return retval;
911 } 898 }
912 899
913 int32_t CompileAndRunWasmModule(Isolate* isolate, WasmModule* module) { 900 int32_t CompileAndRunWasmModule(Isolate* isolate, const WasmModule* module) {
914 ErrorThrower thrower(isolate, "CompileAndRunWasmModule"); 901 ErrorThrower thrower(isolate, "CompileAndRunWasmModule");
915 WasmModuleInstance instance(module); 902 WasmModuleInstance instance(module);
916 903
917 // Allocate and initialize the linear memory. 904 // Allocate and initialize the linear memory.
918 if (!AllocateMemory(&thrower, isolate, &instance)) { 905 if (!AllocateMemory(&thrower, isolate, &instance)) {
919 return -1; 906 return -1;
920 } 907 }
921 LoadDataSegments(module, instance.mem_start, instance.mem_size); 908 LoadDataSegments(module, instance.mem_start, instance.mem_size);
922 909
923 // Allocate the globals area if necessary. 910 // Allocate the globals area if necessary.
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
994 uint32_t func_index) { 981 uint32_t func_index) {
995 Object* func_names_arr_obj = wasm->GetInternalField(kWasmFunctionNamesArray); 982 Object* func_names_arr_obj = wasm->GetInternalField(kWasmFunctionNamesArray);
996 if (func_names_arr_obj->IsUndefined()) return Handle<String>::null(); 983 if (func_names_arr_obj->IsUndefined()) return Handle<String>::null();
997 return GetWasmFunctionNameFromTable( 984 return GetWasmFunctionNameFromTable(
998 handle(ByteArray::cast(func_names_arr_obj)), func_index); 985 handle(ByteArray::cast(func_names_arr_obj)), func_index);
999 } 986 }
1000 987
1001 } // namespace wasm 988 } // namespace wasm
1002 } // namespace internal 989 } // namespace internal
1003 } // namespace v8 990 } // namespace v8
OLDNEW
« no previous file with comments | « src/wasm/wasm-module.h ('k') | test/cctest/wasm/wasm-run-utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698