| OLD | NEW |
| 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 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1011 | 1011 |
| 1012 //-------------------------------------------------------------------------- | 1012 //-------------------------------------------------------------------------- |
| 1013 // Set up the exports object for the new instance. | 1013 // Set up the exports object for the new instance. |
| 1014 //-------------------------------------------------------------------------- | 1014 //-------------------------------------------------------------------------- |
| 1015 ProcessExports(code_table, instance, compiled_module_); | 1015 ProcessExports(code_table, instance, compiled_module_); |
| 1016 if (thrower_->error()) return {}; | 1016 if (thrower_->error()) return {}; |
| 1017 | 1017 |
| 1018 //-------------------------------------------------------------------------- | 1018 //-------------------------------------------------------------------------- |
| 1019 // Add instance to Memory object | 1019 // Add instance to Memory object |
| 1020 //-------------------------------------------------------------------------- | 1020 //-------------------------------------------------------------------------- |
| 1021 DCHECK(instance->IsWasmInstanceObject()); | |
| 1022 if (instance->has_memory_object()) { | 1021 if (instance->has_memory_object()) { |
| 1023 instance->memory_object()->AddInstance(isolate_, instance); | 1022 Handle<WasmMemoryObject> memory(instance->memory_object(), isolate_); |
| 1023 WasmMemoryObject::AddInstance(isolate_, memory, instance); |
| 1024 } | 1024 } |
| 1025 | 1025 |
| 1026 //-------------------------------------------------------------------------- | 1026 //-------------------------------------------------------------------------- |
| 1027 // Initialize the indirect function tables. | 1027 // Initialize the indirect function tables. |
| 1028 //-------------------------------------------------------------------------- | 1028 //-------------------------------------------------------------------------- |
| 1029 if (function_table_count > 0) LoadTableSegments(code_table, instance); | 1029 if (function_table_count > 0) LoadTableSegments(code_table, instance); |
| 1030 | 1030 |
| 1031 // Patch all code with the relocations registered in code_specialization. | 1031 // Patch all code with the relocations registered in code_specialization. |
| 1032 code_specialization.RelocateDirectCalls(instance); | 1032 code_specialization.RelocateDirectCalls(instance); |
| 1033 code_specialization.ApplyToWholeInstance(*instance, SKIP_ICACHE_FLUSH); | 1033 code_specialization.ApplyToWholeInstance(*instance, SKIP_ICACHE_FLUSH); |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1657 memory_object = WasmMemoryObject::New( | 1657 memory_object = WasmMemoryObject::New( |
| 1658 isolate_, | 1658 isolate_, |
| 1659 (instance->has_memory_buffer()) | 1659 (instance->has_memory_buffer()) |
| 1660 ? handle(instance->memory_buffer()) | 1660 ? handle(instance->memory_buffer()) |
| 1661 : Handle<JSArrayBuffer>::null(), | 1661 : Handle<JSArrayBuffer>::null(), |
| 1662 (module_->max_mem_pages != 0) ? module_->max_mem_pages : -1); | 1662 (module_->max_mem_pages != 0) ? module_->max_mem_pages : -1); |
| 1663 instance->set_memory_object(*memory_object); | 1663 instance->set_memory_object(*memory_object); |
| 1664 } else { | 1664 } else { |
| 1665 memory_object = | 1665 memory_object = |
| 1666 Handle<WasmMemoryObject>(instance->memory_object(), isolate_); | 1666 Handle<WasmMemoryObject>(instance->memory_object(), isolate_); |
| 1667 memory_object->ResetInstancesLink(isolate_); | |
| 1668 } | 1667 } |
| 1669 | 1668 |
| 1670 desc.set_value(memory_object); | 1669 desc.set_value(memory_object); |
| 1671 break; | 1670 break; |
| 1672 } | 1671 } |
| 1673 case kExternalGlobal: { | 1672 case kExternalGlobal: { |
| 1674 // Export the value of the global variable as a number. | 1673 // Export the value of the global variable as a number. |
| 1675 WasmGlobal& global = module_->globals[exp.index]; | 1674 WasmGlobal& global = module_->globals[exp.index]; |
| 1676 double num = 0; | 1675 double num = 0; |
| 1677 switch (global.type) { | 1676 switch (global.type) { |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2350 HandleScope scope(job_->isolate_); | 2349 HandleScope scope(job_->isolate_); |
| 2351 Handle<WasmModuleObject> result = | 2350 Handle<WasmModuleObject> result = |
| 2352 WasmModuleObject::New(job_->isolate_, job_->compiled_module_); | 2351 WasmModuleObject::New(job_->isolate_, job_->compiled_module_); |
| 2353 // {job_} is deleted in AsyncCompileSucceeded, therefore the {return}. | 2352 // {job_} is deleted in AsyncCompileSucceeded, therefore the {return}. |
| 2354 return job_->AsyncCompileSucceeded(result); | 2353 return job_->AsyncCompileSucceeded(result); |
| 2355 } | 2354 } |
| 2356 }; | 2355 }; |
| 2357 } // namespace wasm | 2356 } // namespace wasm |
| 2358 } // namespace internal | 2357 } // namespace internal |
| 2359 } // namespace v8 | 2358 } // namespace v8 |
| OLD | NEW |