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

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

Issue 2676513008: [wasm] Managed<T> ensures T's lifetime does not leak past Isolate's (Closed)
Patch Set: renamed to ManagedObjectFinalizer, and using "finalizer"` Created 3 years, 10 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-objects.h ('k') | test/cctest/BUILD.gn » ('j') | 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 "src/wasm/wasm-objects.h" 5 #include "src/wasm/wasm-objects.h"
6 #include "src/utils.h" 6 #include "src/utils.h"
7 7
8 #include "src/base/iterator.h" 8 #include "src/base/iterator.h"
9 #include "src/debug/debug-interface.h" 9 #include "src/debug/debug-interface.h"
10 #include "src/objects-inl.h" 10 #include "src/objects-inl.h"
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 return false; 524 return false;
525 return true; 525 return true;
526 } 526 }
527 527
528 WasmSharedModuleData* WasmSharedModuleData::cast(Object* object) { 528 WasmSharedModuleData* WasmSharedModuleData::cast(Object* object) {
529 DCHECK(IsWasmSharedModuleData(object)); 529 DCHECK(IsWasmSharedModuleData(object));
530 return reinterpret_cast<WasmSharedModuleData*>(object); 530 return reinterpret_cast<WasmSharedModuleData*>(object);
531 } 531 }
532 532
533 wasm::WasmModule* WasmSharedModuleData::module() { 533 wasm::WasmModule* WasmSharedModuleData::module() {
534 return reinterpret_cast<WasmModuleWrapper*>(get(kModuleWrapper))->get(); 534 // We populate the kModuleWrapper field with a Foreign holding the
535 // address to the address of a WasmModule. This is because we can
536 // handle both cases when the WasmModule's lifetime is managed through
537 // a Managed<WasmModule> object, as well as cases when it's managed
538 // by the embedder. CcTests fall into the latter case.
539 return *(reinterpret_cast<wasm::WasmModule**>(
540 Foreign::cast(get(kModuleWrapper))->foreign_address()));
535 } 541 }
536 542
537 DEFINE_OPTIONAL_ARR_ACCESSORS(WasmSharedModuleData, module_bytes, kModuleBytes, 543 DEFINE_OPTIONAL_ARR_ACCESSORS(WasmSharedModuleData, module_bytes, kModuleBytes,
538 SeqOneByteString); 544 SeqOneByteString);
539 DEFINE_ARR_GETTER(WasmSharedModuleData, script, kScript, Script); 545 DEFINE_ARR_GETTER(WasmSharedModuleData, script, kScript, Script);
540 DEFINE_OPTIONAL_ARR_ACCESSORS(WasmSharedModuleData, asm_js_offset_table, 546 DEFINE_OPTIONAL_ARR_ACCESSORS(WasmSharedModuleData, asm_js_offset_table,
541 kAsmJsOffsetTable, ByteArray); 547 kAsmJsOffsetTable, ByteArray);
542 DEFINE_OPTIONAL_ARR_GETTER(WasmSharedModuleData, breakpoint_infos, 548 DEFINE_OPTIONAL_ARR_GETTER(WasmSharedModuleData, breakpoint_infos,
543 kBreakPointInfos, FixedArray); 549 kBreakPointInfos, FixedArray);
544 550
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
1174 if (!array->get(kWrapperInstanceObject)->IsWeakCell()) return false; 1180 if (!array->get(kWrapperInstanceObject)->IsWeakCell()) return false;
1175 Isolate* isolate = array->GetIsolate(); 1181 Isolate* isolate = array->GetIsolate();
1176 if (!array->get(kNextInstanceWrapper)->IsUndefined(isolate) && 1182 if (!array->get(kNextInstanceWrapper)->IsUndefined(isolate) &&
1177 !array->get(kNextInstanceWrapper)->IsFixedArray()) 1183 !array->get(kNextInstanceWrapper)->IsFixedArray())
1178 return false; 1184 return false;
1179 if (!array->get(kPreviousInstanceWrapper)->IsUndefined(isolate) && 1185 if (!array->get(kPreviousInstanceWrapper)->IsUndefined(isolate) &&
1180 !array->get(kPreviousInstanceWrapper)->IsFixedArray()) 1186 !array->get(kPreviousInstanceWrapper)->IsFixedArray())
1181 return false; 1187 return false;
1182 return true; 1188 return true;
1183 } 1189 }
OLDNEW
« no previous file with comments | « src/wasm/wasm-objects.h ('k') | test/cctest/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698