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

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

Issue 2380463006: [wasm] Properly handlify WasmCompiledModule::Clone. (Closed)
Patch Set: Created 4 years, 2 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') | no next file » | 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 <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 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1213 // may still have placeholders for imports. 1213 // may still have placeholders for imports.
1214 old_code_table = original->code_table(); 1214 old_code_table = original->code_table();
1215 code_table = factory->CopyFixedArray(old_code_table); 1215 code_table = factory->CopyFixedArray(old_code_table);
1216 1216
1217 if (original->has_weak_owning_instance()) { 1217 if (original->has_weak_owning_instance()) {
1218 WeakCell* tmp = original->ptr_to_weak_owning_instance(); 1218 WeakCell* tmp = original->ptr_to_weak_owning_instance();
1219 DCHECK(!tmp->cleared()); 1219 DCHECK(!tmp->cleared());
1220 // There is already an owner, clone everything. 1220 // There is already an owner, clone everything.
1221 owner = Handle<JSObject>(JSObject::cast(tmp->value()), isolate); 1221 owner = Handle<JSObject>(JSObject::cast(tmp->value()), isolate);
1222 // Insert the latest clone in front. 1222 // Insert the latest clone in front.
1223 compiled_module = original->Clone(isolate); 1223 compiled_module = WasmCompiledModule::Clone(isolate, original);
1224 // Replace the strong reference to point to the new instance here. 1224 // Replace the strong reference to point to the new instance here.
1225 // This allows any of the other instances, including the original, 1225 // This allows any of the other instances, including the original,
1226 // to be collected. 1226 // to be collected.
1227 module_object->SetInternalField(0, *compiled_module); 1227 module_object->SetInternalField(0, *compiled_module);
1228 compiled_module->set_weak_module_object(original->weak_module_object()); 1228 compiled_module->set_weak_module_object(original->weak_module_object());
1229 link_to_original = factory->NewWeakCell(original); 1229 link_to_original = factory->NewWeakCell(original);
1230 // Don't link to original here. We remember the original 1230 // Don't link to original here. We remember the original
1231 // as a weak link. If that link isn't clear by the time we finish 1231 // as a weak link. If that link isn't clear by the time we finish
1232 // instantiating this instance, then we link it at that time. 1232 // instantiating this instance, then we link it at that time.
1233 compiled_module->reset_weak_next_instance(); 1233 compiled_module->reset_weak_next_instance();
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
1815 WasmCompiledModule* compiled_module = 1815 WasmCompiledModule* compiled_module =
1816 WasmCompiledModule::cast(instance->GetInternalField(kWasmCompiledModule)); 1816 WasmCompiledModule::cast(instance->GetInternalField(kWasmCompiledModule));
1817 CHECK(compiled_module->has_weak_module_object()); 1817 CHECK(compiled_module->has_weak_module_object());
1818 CHECK(compiled_module->ptr_to_weak_module_object()->cleared()); 1818 CHECK(compiled_module->ptr_to_weak_module_object()->cleared());
1819 } 1819 }
1820 1820
1821 } // namespace testing 1821 } // namespace testing
1822 } // namespace wasm 1822 } // namespace wasm
1823 } // namespace internal 1823 } // namespace internal
1824 } // namespace v8 1824 } // namespace v8
OLDNEW
« no previous file with comments | « src/wasm/wasm-module.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698