| 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/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 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1282 | 1282 |
| 1283 // Look up an import value in the {ffi_} object. | 1283 // Look up an import value in the {ffi_} object. |
| 1284 MaybeHandle<Object> LookupImport(uint32_t index, Handle<String> module_name, | 1284 MaybeHandle<Object> LookupImport(uint32_t index, Handle<String> module_name, |
| 1285 MaybeHandle<String> import_name) { | 1285 MaybeHandle<String> import_name) { |
| 1286 if (ffi_.is_null()) { | 1286 if (ffi_.is_null()) { |
| 1287 return ReportFFIError("FFI is not an object", index, module_name, | 1287 return ReportFFIError("FFI is not an object", index, module_name, |
| 1288 import_name); | 1288 import_name); |
| 1289 } | 1289 } |
| 1290 | 1290 |
| 1291 // Look up the module first. | 1291 // Look up the module first. |
| 1292 MaybeHandle<Object> result = Object::GetProperty(ffi_, module_name); | 1292 MaybeHandle<Object> result = |
| 1293 Object::GetPropertyOrElement(ffi_, module_name); |
| 1293 if (result.is_null()) { | 1294 if (result.is_null()) { |
| 1294 return ReportFFIError("module not found", index, module_name, | 1295 return ReportFFIError("module not found", index, module_name, |
| 1295 import_name); | 1296 import_name); |
| 1296 } | 1297 } |
| 1297 | 1298 |
| 1298 Handle<Object> module = result.ToHandleChecked(); | 1299 Handle<Object> module = result.ToHandleChecked(); |
| 1299 | 1300 |
| 1300 if (!import_name.is_null()) { | 1301 if (!import_name.is_null()) { |
| 1301 // Look up the value in the module. | 1302 // Look up the value in the module. |
| 1302 if (!module->IsJSReceiver()) { | 1303 if (!module->IsJSReceiver()) { |
| 1303 return ReportFFIError("module is not an object or function", index, | 1304 return ReportFFIError("module is not an object or function", index, |
| 1304 module_name, import_name); | 1305 module_name, import_name); |
| 1305 } | 1306 } |
| 1306 | 1307 |
| 1307 result = Object::GetProperty(module, import_name.ToHandleChecked()); | 1308 result = |
| 1309 Object::GetPropertyOrElement(module, import_name.ToHandleChecked()); |
| 1308 if (result.is_null()) { | 1310 if (result.is_null()) { |
| 1309 return ReportFFIError("import not found", index, module_name, | 1311 return ReportFFIError("import not found", index, module_name, |
| 1310 import_name); | 1312 import_name); |
| 1311 } | 1313 } |
| 1312 } else { | 1314 } else { |
| 1313 // No function specified. Use the "default export". | 1315 // No function specified. Use the "default export". |
| 1314 result = module; | 1316 result = module; |
| 1315 } | 1317 } |
| 1316 | 1318 |
| 1317 return result; | 1319 return result; |
| (...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2179 MaybeHandle<String> WasmCompiledModule::GetFunctionName( | 2181 MaybeHandle<String> WasmCompiledModule::GetFunctionName( |
| 2180 Handle<WasmCompiledModule> compiled_module, uint32_t func_index) { | 2182 Handle<WasmCompiledModule> compiled_module, uint32_t func_index) { |
| 2181 DCHECK_LT(func_index, compiled_module->module()->functions.size()); | 2183 DCHECK_LT(func_index, compiled_module->module()->functions.size()); |
| 2182 WasmFunction& function = compiled_module->module()->functions[func_index]; | 2184 WasmFunction& function = compiled_module->module()->functions[func_index]; |
| 2183 Isolate* isolate = compiled_module->GetIsolate(); | 2185 Isolate* isolate = compiled_module->GetIsolate(); |
| 2184 MaybeHandle<String> string = ExtractStringFromModuleBytes( | 2186 MaybeHandle<String> string = ExtractStringFromModuleBytes( |
| 2185 isolate, compiled_module, function.name_offset, function.name_length); | 2187 isolate, compiled_module, function.name_offset, function.name_length); |
| 2186 if (!string.is_null()) return string.ToHandleChecked(); | 2188 if (!string.is_null()) return string.ToHandleChecked(); |
| 2187 return {}; | 2189 return {}; |
| 2188 } | 2190 } |
| OLD | NEW |