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

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

Issue 2972803002: [wasm] Use WeakFixedArray for list of instances sharing a WasmMemoryObject. (Closed)
Patch Set: [wasm] Use WeakFixedArray for list of instances sharing a WasmMemoryObject. Created 3 years, 5 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 | « no previous file | src/wasm/wasm-module.cc » ('j') | src/wasm/wasm-module.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 the V8 project authors. All rights reserved. 1 // Copyright 2017 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/wasm/module-compiler.h> 5 #include <src/wasm/module-compiler.h>
6 6
7 #include <atomic> 7 #include <atomic>
8 8
9 #include "src/asmjs/asm-js.h" 9 #include "src/asmjs/asm-js.h"
10 #include "src/assembler-inl.h" 10 #include "src/assembler-inl.h"
(...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after
1015 1015
1016 //-------------------------------------------------------------------------- 1016 //--------------------------------------------------------------------------
1017 // Set up the exports object for the new instance. 1017 // Set up the exports object for the new instance.
1018 //-------------------------------------------------------------------------- 1018 //--------------------------------------------------------------------------
1019 ProcessExports(code_table, instance, compiled_module_); 1019 ProcessExports(code_table, instance, compiled_module_);
1020 if (thrower_->error()) return {}; 1020 if (thrower_->error()) return {};
1021 1021
1022 //-------------------------------------------------------------------------- 1022 //--------------------------------------------------------------------------
1023 // Add instance to Memory object 1023 // Add instance to Memory object
1024 //-------------------------------------------------------------------------- 1024 //--------------------------------------------------------------------------
1025 DCHECK(instance->IsWasmInstanceObject());
1026 if (instance->has_memory_object()) { 1025 if (instance->has_memory_object()) {
1027 instance->memory_object()->AddInstance(isolate_, instance); 1026 Handle<WasmMemoryObject> memory(instance->memory_object(), isolate_);
1027 WasmMemoryObject::AddInstance(isolate_, memory, instance);
1028 } 1028 }
1029 1029
1030 //-------------------------------------------------------------------------- 1030 //--------------------------------------------------------------------------
1031 // Initialize the indirect function tables. 1031 // Initialize the indirect function tables.
1032 //-------------------------------------------------------------------------- 1032 //--------------------------------------------------------------------------
1033 if (function_table_count > 0) LoadTableSegments(code_table, instance); 1033 if (function_table_count > 0) LoadTableSegments(code_table, instance);
1034 1034
1035 // Patch all code with the relocations registered in code_specialization. 1035 // Patch all code with the relocations registered in code_specialization.
1036 code_specialization.RelocateDirectCalls(instance); 1036 code_specialization.RelocateDirectCalls(instance);
1037 code_specialization.ApplyToWholeInstance(*instance, SKIP_ICACHE_FLUSH); 1037 code_specialization.ApplyToWholeInstance(*instance, SKIP_ICACHE_FLUSH);
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
1661 memory_object = WasmMemoryObject::New( 1661 memory_object = WasmMemoryObject::New(
1662 isolate_, 1662 isolate_,
1663 (instance->has_memory_buffer()) 1663 (instance->has_memory_buffer())
1664 ? handle(instance->memory_buffer()) 1664 ? handle(instance->memory_buffer())
1665 : Handle<JSArrayBuffer>::null(), 1665 : Handle<JSArrayBuffer>::null(),
1666 (module_->max_mem_pages != 0) ? module_->max_mem_pages : -1); 1666 (module_->max_mem_pages != 0) ? module_->max_mem_pages : -1);
1667 instance->set_memory_object(*memory_object); 1667 instance->set_memory_object(*memory_object);
1668 } else { 1668 } else {
1669 memory_object = 1669 memory_object =
1670 Handle<WasmMemoryObject>(instance->memory_object(), isolate_); 1670 Handle<WasmMemoryObject>(instance->memory_object(), isolate_);
1671 memory_object->ResetInstancesLink(isolate_);
1672 } 1671 }
1673 1672
1674 desc.set_value(memory_object); 1673 desc.set_value(memory_object);
1675 break; 1674 break;
1676 } 1675 }
1677 case kExternalGlobal: { 1676 case kExternalGlobal: {
1678 // Export the value of the global variable as a number. 1677 // Export the value of the global variable as a number.
1679 WasmGlobal& global = module_->globals[exp.index]; 1678 WasmGlobal& global = module_->globals[exp.index];
1680 double num = 0; 1679 double num = 0;
1681 switch (global.type) { 1680 switch (global.type) {
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
2355 HandleScope scope(job_->isolate_); 2354 HandleScope scope(job_->isolate_);
2356 Handle<WasmModuleObject> result = 2355 Handle<WasmModuleObject> result =
2357 WasmModuleObject::New(job_->isolate_, job_->compiled_module_); 2356 WasmModuleObject::New(job_->isolate_, job_->compiled_module_);
2358 // {job_} is deleted in AsyncCompileSucceeded, therefore the {return}. 2357 // {job_} is deleted in AsyncCompileSucceeded, therefore the {return}.
2359 return job_->AsyncCompileSucceeded(result); 2358 return job_->AsyncCompileSucceeded(result);
2360 } 2359 }
2361 }; 2360 };
2362 } // namespace wasm 2361 } // namespace wasm
2363 } // namespace internal 2362 } // namespace internal
2364 } // namespace v8 2363 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/wasm/wasm-module.cc » ('j') | src/wasm/wasm-module.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698