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

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

Issue 1911313002: Pass debug name as Vector instead of const char* (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@wasm-offset-table-1
Patch Set: Created 4 years, 8 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
Index: src/compiler/wasm-compiler.cc
diff --git a/src/compiler/wasm-compiler.cc b/src/compiler/wasm-compiler.cc
index e60d47ed902ecc19ec47d2db9d0722d051fab2ce..69699eacf48c8b25a78e37b0fe00b153f6286dc2 100644
--- a/src/compiler/wasm-compiler.cc
+++ b/src/compiler/wasm-compiler.cc
@@ -2760,14 +2760,14 @@ Handle<JSFunction> CompileJSToWasmWrapper(
#else
FLAG_print_opt_code || FLAG_trace_turbo || FLAG_trace_turbo_graph;
#endif
- const char* func_name = "js-to-wasm";
+ Vector<const char> func_name = ArrayVector("js-to-wasm");
static unsigned id = 0;
Vector<char> buffer;
if (debugging) {
buffer = Vector<char>::New(128);
- SNPrintF(buffer, "js-to-wasm#%d", id);
- func_name = buffer.start();
+ int chars = SNPrintF(buffer, "js-to-wasm#%d", id);
+ func_name = Vector<const char>::cast(buffer.SubVector(0, chars));
}
CompilationInfo info(func_name, isolate, &zone, flags);
@@ -2836,13 +2836,13 @@ Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, wasm::ModuleEnv* module,
#else
FLAG_print_opt_code || FLAG_trace_turbo || FLAG_trace_turbo_graph;
#endif
- const char* func_name = "wasm-to-js";
+ Vector<const char> func_name = ArrayVector("wasm-to-js");
static unsigned id = 0;
Vector<char> buffer;
if (debugging) {
buffer = Vector<char>::New(128);
- SNPrintF(buffer, "wasm-to-js#%d", id);
- func_name = buffer.start();
+ int chars = SNPrintF(buffer, "wasm-to-js#%d", id);
+ func_name = Vector<const char>::cast(buffer.SubVector(0, chars));
}
CompilationInfo info(func_name, isolate, &zone, flags);
@@ -2950,23 +2950,27 @@ Handle<Code> CompileWasmFunction(wasm::ErrorThrower& thrower, Isolate* isolate,
#else
FLAG_print_opt_code || FLAG_trace_turbo || FLAG_trace_turbo_graph;
#endif
- const char* func_name = "wasm";
+ Vector<const char> func_name =
+ module_env->module
+ ->GetNameOrNull(function.name_offset, function.name_length)
titzer 2016/04/22 11:46:30 You should probably just make this method return V
Clemens Hammacher 2016/04/22 13:47:54 Done in https://codereview.chromium.org/1910213004
+ .toVec();
Vector<char> buffer;
- if (debugging) {
- buffer = Vector<char>::New(128);
- wasm::WasmName name =
- module_env->module->GetName(function.name_offset, function.name_length);
- SNPrintF(buffer, "WASM_function_#%d:%.*s", function.func_index, name.length,
- name.name);
- func_name = buffer.start();
+ if (func_name.is_empty()) {
+ if (debugging) {
+ buffer = Vector<char>::New(128);
+ int chars = SNPrintF(buffer, "WASM_function_#%d", function.func_index);
+ func_name = Vector<const char>::cast(buffer.SubVector(0, chars));
+ } else {
+ func_name = ArrayVector("wasm");
+ }
}
CompilationInfo info(func_name, isolate, &zone, flags);
Handle<Code> code = Pipeline::GenerateWASMCode(&info, descriptor, &graph,
&source_position_table);
- if (debugging) {
- buffer.Dispose();
- }
+
+ buffer.Dispose();
+
if (!code.is_null()) {
RecordFunctionCompilation(Logger::FUNCTION_TAG, &info, "WASM_function",
function.func_index,

Powered by Google App Engine
This is Rietveld 408576698