| 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 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |