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/assembler-inl.h" | 7 #include "src/assembler-inl.h" |
8 #include "src/base/adapters.h" | 8 #include "src/base/adapters.h" |
9 #include "src/base/atomic-utils.h" | 9 #include "src/base/atomic-utils.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 1640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1651 } | 1651 } |
1652 int sig_index = table.map.FindOrInsert(function->sig); | 1652 int sig_index = table.map.FindOrInsert(function->sig); |
1653 table_instance.signature_table->set(i, Smi::FromInt(sig_index)); | 1653 table_instance.signature_table->set(i, Smi::FromInt(sig_index)); |
1654 table_instance.function_table->set(i, *UnwrapImportWrapper(val)); | 1654 table_instance.function_table->set(i, *UnwrapImportWrapper(val)); |
1655 } | 1655 } |
1656 | 1656 |
1657 num_imported_tables++; | 1657 num_imported_tables++; |
1658 break; | 1658 break; |
1659 } | 1659 } |
1660 case kExternalMemory: { | 1660 case kExternalMemory: { |
| 1661 // Validation should have failed if more than one memory object was |
| 1662 // provided. |
| 1663 DCHECK(!instance->has_memory_object()); |
1661 if (!WasmJs::IsWasmMemoryObject(isolate_, value)) { | 1664 if (!WasmJs::IsWasmMemoryObject(isolate_, value)) { |
1662 ReportLinkError("memory import must be a WebAssembly.Memory object", | 1665 ReportLinkError("memory import must be a WebAssembly.Memory object", |
1663 index, module_name, import_name); | 1666 index, module_name, import_name); |
1664 return -1; | 1667 return -1; |
1665 } | 1668 } |
1666 auto memory = Handle<WasmMemoryObject>::cast(value); | 1669 auto memory = Handle<WasmMemoryObject>::cast(value); |
1667 DCHECK(WasmJs::IsWasmMemoryObject(isolate_, memory)); | 1670 DCHECK(WasmJs::IsWasmMemoryObject(isolate_, memory)); |
1668 instance->set_memory_object(*memory); | 1671 instance->set_memory_object(*memory); |
1669 memory_ = Handle<JSArrayBuffer>(memory->buffer(), isolate_); | 1672 memory_ = Handle<JSArrayBuffer>(memory->buffer(), isolate_); |
1670 break; | 1673 break; |
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2320 CHECK(!compiled_module->has_weak_owning_instance()); | 2323 CHECK(!compiled_module->has_weak_owning_instance()); |
2321 } | 2324 } |
2322 | 2325 |
2323 void testing::ValidateOrphanedInstance(Isolate* isolate, | 2326 void testing::ValidateOrphanedInstance(Isolate* isolate, |
2324 Handle<WasmInstanceObject> instance) { | 2327 Handle<WasmInstanceObject> instance) { |
2325 DisallowHeapAllocation no_gc; | 2328 DisallowHeapAllocation no_gc; |
2326 WasmCompiledModule* compiled_module = instance->compiled_module(); | 2329 WasmCompiledModule* compiled_module = instance->compiled_module(); |
2327 CHECK(compiled_module->has_weak_wasm_module()); | 2330 CHECK(compiled_module->has_weak_wasm_module()); |
2328 CHECK(compiled_module->ptr_to_weak_wasm_module()->cleared()); | 2331 CHECK(compiled_module->ptr_to_weak_wasm_module()->cleared()); |
2329 } | 2332 } |
OLD | NEW |