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

Unified Diff: src/wasm/wasm-module.cc

Issue 1970503004: [wasm] Differentiate unnamed and empty names (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@add-utf8-check
Patch Set: Yang's last comments Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/wasm/wasm-module.h ('k') | test/cctest/wasm/test-wasm-function-name-table.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/wasm-module.cc
diff --git a/src/wasm/wasm-module.cc b/src/wasm/wasm-module.cc
index c9a42797eb93b5781e5c5ed6c2151e680879efa9..f297d749fec39e5fa3e9c8b325272b3ef635e552 100644
--- a/src/wasm/wasm-module.cc
+++ b/src/wasm/wasm-module.cc
@@ -332,7 +332,7 @@ static MaybeHandle<JSFunction> ReportFFIError(ErrorThrower& thrower,
const char* error, uint32_t index,
wasm::WasmName module_name,
wasm::WasmName function_name) {
- if (function_name.start()) {
+ if (!function_name.is_empty()) {
thrower.Error("Import #%d module=\"%.*s\" function=\"%.*s\" error: %s",
index, module_name.length(), module_name.start(),
function_name.length(), function_name.start(), error);
@@ -368,7 +368,7 @@ static MaybeHandle<JSFunction> LookupFunction(
}
Handle<Object> function;
- if (function_name.start()) {
+ if (!function_name.is_empty()) {
// Look up the function in the module.
Handle<String> name = factory->InternalizeUtf8String(function_name);
MaybeHandle<Object> result = Object::GetProperty(module, name);
@@ -977,13 +977,12 @@ int32_t CompileAndRunWasmModule(Isolate* isolate, WasmModule* module) {
return -1;
}
-Handle<Object> GetWasmFunctionName(Handle<JSObject> wasm, uint32_t func_index) {
- Handle<Object> func_names_arr_obj = handle(
- wasm->GetInternalField(kWasmFunctionNamesArray), wasm->GetIsolate());
- if (func_names_arr_obj->IsUndefined())
- return func_names_arr_obj; // Return undefined.
+MaybeHandle<String> GetWasmFunctionName(Handle<JSObject> wasm,
+ uint32_t func_index) {
+ Object* func_names_arr_obj = wasm->GetInternalField(kWasmFunctionNamesArray);
+ if (func_names_arr_obj->IsUndefined()) return Handle<String>::null();
return GetWasmFunctionNameFromTable(
- Handle<ByteArray>::cast(func_names_arr_obj), func_index);
+ handle(ByteArray::cast(func_names_arr_obj)), func_index);
}
} // namespace wasm
« no previous file with comments | « src/wasm/wasm-module.h ('k') | test/cctest/wasm/test-wasm-function-name-table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698