OLD | NEW |
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 <memory> | 5 #include <memory> |
6 | 6 |
7 #include "src/base/atomic-utils.h" | 7 #include "src/base/atomic-utils.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 | 9 |
10 #include "src/macro-assembler.h" | 10 #include "src/macro-assembler.h" |
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
766 it.rinfo()->update_wasm_global_reference(globals_start, nullptr); | 766 it.rinfo()->update_wasm_global_reference(globals_start, nullptr); |
767 changed = true; | 767 changed = true; |
768 } | 768 } |
769 } | 769 } |
770 if (changed) { | 770 if (changed) { |
771 Assembler::FlushICache(isolate, code->instruction_start(), | 771 Assembler::FlushICache(isolate, code->instruction_start(), |
772 code->instruction_size()); | 772 code->instruction_size()); |
773 } | 773 } |
774 } | 774 } |
775 } | 775 } |
776 compiled_module->reset_weak_owning_instance(); | |
777 compiled_module->reset_heap(); | 776 compiled_module->reset_heap(); |
778 } | 777 } |
779 | 778 |
780 static void InstanceFinalizer(const v8::WeakCallbackInfo<void>& data) { | 779 static void InstanceFinalizer(const v8::WeakCallbackInfo<void>& data) { |
781 JSObject** p = reinterpret_cast<JSObject**>(data.GetParameter()); | 780 JSObject** p = reinterpret_cast<JSObject**>(data.GetParameter()); |
782 JSObject* owner = *p; | 781 JSObject* owner = *p; |
783 WasmCompiledModule* compiled_module = | 782 WasmCompiledModule* compiled_module = |
784 WasmCompiledModule::cast(owner->GetInternalField(kWasmCompiledModule)); | 783 WasmCompiledModule::cast(owner->GetInternalField(kWasmCompiledModule)); |
785 Isolate* isolate = reinterpret_cast<Isolate*>(data.GetIsolate()); | 784 Isolate* isolate = reinterpret_cast<Isolate*>(data.GetIsolate()); |
786 DCHECK(compiled_module->has_weak_module_object()); | 785 DCHECK(compiled_module->has_weak_module_object()); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
824 DCHECK(!next->cleared()); | 823 DCHECK(!next->cleared()); |
825 if (prev == nullptr) { | 824 if (prev == nullptr) { |
826 WasmCompiledModule::cast(next->value())->reset_weak_prev_instance(); | 825 WasmCompiledModule::cast(next->value())->reset_weak_prev_instance(); |
827 } else { | 826 } else { |
828 WasmCompiledModule::cast(next->value()) | 827 WasmCompiledModule::cast(next->value()) |
829 ->set_ptr_to_weak_prev_instance(prev); | 828 ->set_ptr_to_weak_prev_instance(prev); |
830 } | 829 } |
831 } | 830 } |
832 } | 831 } |
833 } | 832 } |
| 833 compiled_module->reset_weak_owning_instance(); |
834 GlobalHandles::Destroy(reinterpret_cast<Object**>(p)); | 834 GlobalHandles::Destroy(reinterpret_cast<Object**>(p)); |
835 } | 835 } |
836 | 836 |
837 Handle<FixedArray> SetupIndirectFunctionTable( | 837 Handle<FixedArray> SetupIndirectFunctionTable( |
838 Isolate* isolate, Handle<FixedArray> wasm_functions, | 838 Isolate* isolate, Handle<FixedArray> wasm_functions, |
839 Handle<FixedArray> indirect_table_template, | 839 Handle<FixedArray> indirect_table_template, |
840 Handle<FixedArray> tables_to_replace) { | 840 Handle<FixedArray> tables_to_replace) { |
841 Factory* factory = isolate->factory(); | 841 Factory* factory = isolate->factory(); |
842 Handle<FixedArray> cloned_indirect_tables = | 842 Handle<FixedArray> cloned_indirect_tables = |
843 factory->CopyFixedArray(indirect_table_template); | 843 factory->CopyFixedArray(indirect_table_template); |
(...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1803 WasmCompiledModule* compiled_module = | 1803 WasmCompiledModule* compiled_module = |
1804 WasmCompiledModule::cast(instance->GetInternalField(kWasmCompiledModule)); | 1804 WasmCompiledModule::cast(instance->GetInternalField(kWasmCompiledModule)); |
1805 CHECK(compiled_module->has_weak_module_object()); | 1805 CHECK(compiled_module->has_weak_module_object()); |
1806 CHECK(compiled_module->ptr_to_weak_module_object()->cleared()); | 1806 CHECK(compiled_module->ptr_to_weak_module_object()->cleared()); |
1807 } | 1807 } |
1808 | 1808 |
1809 } // namespace testing | 1809 } // namespace testing |
1810 } // namespace wasm | 1810 } // namespace wasm |
1811 } // namespace internal | 1811 } // namespace internal |
1812 } // namespace v8 | 1812 } // namespace v8 |
OLD | NEW |