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 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 for (RelocIterator it(*export_wrapper_code, mask); !it.done(); it.next()) { | 1009 for (RelocIterator it(*export_wrapper_code, mask); !it.done(); it.next()) { |
1010 RelocInfo* rinfo = it.rinfo(); | 1010 RelocInfo* rinfo = it.rinfo(); |
1011 Address target_address = rinfo->target_address(); | 1011 Address target_address = rinfo->target_address(); |
1012 Code* target = Code::GetCodeFromTargetAddress(target_address); | 1012 Code* target = Code::GetCodeFromTargetAddress(target_address); |
1013 if (target->kind() == Code::WASM_FUNCTION || | 1013 if (target->kind() == Code::WASM_FUNCTION || |
1014 target->kind() == Code::WASM_TO_JS_FUNCTION) { | 1014 target->kind() == Code::WASM_TO_JS_FUNCTION) { |
1015 ++found; | 1015 ++found; |
1016 code = handle(target); | 1016 code = handle(target); |
1017 } | 1017 } |
1018 } | 1018 } |
1019 DCHECK(found == 1); | 1019 DCHECK_EQ(1, found); |
1020 return code; | 1020 return code; |
1021 } | 1021 } |
1022 | 1022 |
1023 static Handle<Code> CompileImportWrapper(Isolate* isolate, int index, | 1023 static Handle<Code> CompileImportWrapper(Isolate* isolate, int index, |
1024 FunctionSig* sig, | 1024 FunctionSig* sig, |
1025 Handle<JSReceiver> target, | 1025 Handle<JSReceiver> target, |
1026 Handle<String> module_name, | 1026 Handle<String> module_name, |
1027 MaybeHandle<String> import_name, | 1027 MaybeHandle<String> import_name, |
1028 ModuleOrigin origin) { | 1028 ModuleOrigin origin) { |
1029 Handle<Code> code; | |
1030 WasmFunction* other_func = GetWasmFunctionForImportWrapper(isolate, target); | 1029 WasmFunction* other_func = GetWasmFunctionForImportWrapper(isolate, target); |
1031 if (other_func) { | 1030 if (other_func) { |
1032 if (sig->Equals(other_func->sig)) { | 1031 if (sig->Equals(other_func->sig)) { |
1033 // Signature matched. Unwrap the JS->WASM wrapper and return the raw | 1032 // Signature matched. Unwrap the JS->WASM wrapper and return the raw |
1034 // WASM function code. | 1033 // WASM function code. |
1035 return UnwrapImportWrapper(target); | 1034 return UnwrapImportWrapper(target); |
1036 } else { | 1035 } else { |
1037 return Handle<Code>::null(); | 1036 return Handle<Code>::null(); |
1038 } | 1037 } |
1039 } else { | 1038 } else { |
(...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2323 CHECK(!compiled_module->has_weak_owning_instance()); | 2322 CHECK(!compiled_module->has_weak_owning_instance()); |
2324 } | 2323 } |
2325 | 2324 |
2326 void testing::ValidateOrphanedInstance(Isolate* isolate, | 2325 void testing::ValidateOrphanedInstance(Isolate* isolate, |
2327 Handle<WasmInstanceObject> instance) { | 2326 Handle<WasmInstanceObject> instance) { |
2328 DisallowHeapAllocation no_gc; | 2327 DisallowHeapAllocation no_gc; |
2329 WasmCompiledModule* compiled_module = instance->compiled_module(); | 2328 WasmCompiledModule* compiled_module = instance->compiled_module(); |
2330 CHECK(compiled_module->has_weak_wasm_module()); | 2329 CHECK(compiled_module->has_weak_wasm_module()); |
2331 CHECK(compiled_module->ptr_to_weak_wasm_module()->cleared()); | 2330 CHECK(compiled_module->ptr_to_weak_wasm_module()->cleared()); |
2332 } | 2331 } |
OLD | NEW |