| 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 "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/wasm/module-decoder.h" | 10 #include "src/wasm/module-decoder.h" |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 return false; | 523 return false; |
| 524 return true; | 524 return true; |
| 525 } | 525 } |
| 526 | 526 |
| 527 WasmSharedModuleData* WasmSharedModuleData::cast(Object* object) { | 527 WasmSharedModuleData* WasmSharedModuleData::cast(Object* object) { |
| 528 DCHECK(IsWasmSharedModuleData(object)); | 528 DCHECK(IsWasmSharedModuleData(object)); |
| 529 return reinterpret_cast<WasmSharedModuleData*>(object); | 529 return reinterpret_cast<WasmSharedModuleData*>(object); |
| 530 } | 530 } |
| 531 | 531 |
| 532 wasm::WasmModule* WasmSharedModuleData::module() { | 532 wasm::WasmModule* WasmSharedModuleData::module() { |
| 533 return reinterpret_cast<WasmModuleWrapper*>(get(kModuleWrapper))->get(); | 533 // We populate the kModuleWrapper field with a Foreign holding the |
| 534 // address to the address of a WasmModule. This is because we can |
| 535 // handle both cases when the WasmModule's lifetime is managed through |
| 536 // a Managed<WasmModule> object, as well as cases when it's managed |
| 537 // by the embedder. CcTests fall into the latter case. |
| 538 return *(reinterpret_cast<wasm::WasmModule**>( |
| 539 Foreign::cast(get(kModuleWrapper))->foreign_address())); |
| 534 } | 540 } |
| 535 | 541 |
| 536 DEFINE_OPTIONAL_ARR_ACCESSORS(WasmSharedModuleData, module_bytes, kModuleBytes, | 542 DEFINE_OPTIONAL_ARR_ACCESSORS(WasmSharedModuleData, module_bytes, kModuleBytes, |
| 537 SeqOneByteString); | 543 SeqOneByteString); |
| 538 DEFINE_ARR_GETTER(WasmSharedModuleData, script, kScript, Script); | 544 DEFINE_ARR_GETTER(WasmSharedModuleData, script, kScript, Script); |
| 539 DEFINE_OPTIONAL_ARR_ACCESSORS(WasmSharedModuleData, asm_js_offset_table, | 545 DEFINE_OPTIONAL_ARR_ACCESSORS(WasmSharedModuleData, asm_js_offset_table, |
| 540 kAsmJsOffsetTable, ByteArray); | 546 kAsmJsOffsetTable, ByteArray); |
| 541 DEFINE_OPTIONAL_ARR_GETTER(WasmSharedModuleData, breakpoint_infos, | 547 DEFINE_OPTIONAL_ARR_GETTER(WasmSharedModuleData, breakpoint_infos, |
| 542 kBreakPointInfos, FixedArray); | 548 kBreakPointInfos, FixedArray); |
| 543 | 549 |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1178 !array->get(kPreviousInstanceWrapper)->IsFixedArray()) | 1184 !array->get(kPreviousInstanceWrapper)->IsFixedArray()) |
| 1179 return false; | 1185 return false; |
| 1180 return true; | 1186 return true; |
| 1181 } | 1187 } |
| 1182 | 1188 |
| 1183 void WasmInstanceWrapper::set_instance_object(Handle<JSObject> instance, | 1189 void WasmInstanceWrapper::set_instance_object(Handle<JSObject> instance, |
| 1184 Isolate* isolate) { | 1190 Isolate* isolate) { |
| 1185 Handle<WeakCell> cell = isolate->factory()->NewWeakCell(instance); | 1191 Handle<WeakCell> cell = isolate->factory()->NewWeakCell(instance); |
| 1186 set(kWrapperInstanceObject, *cell); | 1192 set(kWrapperInstanceObject, *cell); |
| 1187 } | 1193 } |
| OLD | NEW |