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

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

Issue 1967023004: [wasm] Add UTF-8 validation (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase on parallel compilation 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-function-name-table.cc ('k') | test/mjsunit/wasm/unicode-validation.js » ('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 e2cb8742f9d9ebeb09970097aa3f537b02aa4f00..0f7df4d6064e0d542367da780486db8a6002f65e 100644
--- a/src/wasm/wasm-module.cc
+++ b/src/wasm/wasm-module.cc
@@ -586,9 +586,9 @@ bool FinishCompilation(Isolate* isolate, WasmModule* module,
DCHECK_EQ(i, func.func_index);
WasmName str = module->GetName(func.name_offset, func.name_length);
WasmName str_null = {nullptr, 0};
- Handle<String> name = factory->InternalizeUtf8String(str);
Handle<Code> code = Handle<Code>::null();
Handle<JSFunction> function = Handle<JSFunction>::null();
+ Handle<String> function_name = Handle<String>::null();
if (func.external) {
// Lookup external function in FFI object.
MaybeHandle<JSFunction> function =
@@ -613,8 +613,9 @@ bool FinishCompilation(Isolate* isolate, WasmModule* module,
return false;
}
if (func.exported) {
+ function_name = factory->InternalizeUtf8String(str);
function = compiler::CompileJSToWasmWrapper(
- isolate, &module_env, name, code, instance.js_object, i);
+ isolate, &module_env, function_name, code, instance.js_object, i);
record_code_size(total_code_size, function->code());
}
}
@@ -629,7 +630,8 @@ bool FinishCompilation(Isolate* isolate, WasmModule* module,
// module.
desc.set_value(function);
Maybe<bool> status = JSReceiver::DefineOwnProperty(
- isolate, instance.js_object, name, &desc, Object::THROW_ON_ERROR);
+ isolate, instance.js_object, function_name, &desc,
+ Object::THROW_ON_ERROR);
if (!status.IsJust())
thrower.Error("export of %.*s failed.", str.length(), str.start());
}
« no previous file with comments | « src/wasm/wasm-function-name-table.cc ('k') | test/mjsunit/wasm/unicode-validation.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698