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

Side by Side Diff: src/compiler/wasm-compiler.cc

Issue 1709893002: [wasm] names for wasm stubs (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "src/compiler/wasm-compiler.h" 5 #include "src/compiler/wasm-compiler.h"
6 6
7 #include "src/isolate-inl.h" 7 #include "src/isolate-inl.h"
8 8
9 #include "src/base/platform/platform.h" 9 #include "src/base/platform/platform.h"
10 10
(...skipping 1989 matching lines...) Expand 10 before | Expand all | Expand 10 after
2000 os << AsRPO(graph); 2000 os << AsRPO(graph);
2001 } 2001 }
2002 2002
2003 // Schedule and compile to machine code. 2003 // Schedule and compile to machine code.
2004 int params = static_cast<int>( 2004 int params = static_cast<int>(
2005 module->GetFunctionSignature(index)->parameter_count()); 2005 module->GetFunctionSignature(index)->parameter_count());
2006 CallDescriptor* incoming = Linkage::GetJSCallDescriptor( 2006 CallDescriptor* incoming = Linkage::GetJSCallDescriptor(
2007 &zone, false, params + 1, CallDescriptor::kNoFlags); 2007 &zone, false, params + 1, CallDescriptor::kNoFlags);
2008 // TODO(titzer): this is technically a WASM wrapper, not a wasm function. 2008 // TODO(titzer): this is technically a WASM wrapper, not a wasm function.
2009 Code::Flags flags = Code::ComputeFlags(Code::WASM_FUNCTION); 2009 Code::Flags flags = Code::ComputeFlags(Code::WASM_FUNCTION);
2010 CompilationInfo info("js-to-wasm", isolate, &zone, flags); 2010 bool debugging =
2011 #if DEBUG
2012 true;
2013 #else
2014 FLAG_print_opt_code || FLAG_trace_turbo || FLAG_trace_turbo_graph;
2015 #endif
2016 const char* func_name = "js-to-wasm";
2017
2018 static unsigned id = 0;
2019 Vector<char> buffer;
2020 if (debugging) {
2021 buffer = Vector<char>::New(128);
2022 SNPrintF(buffer, "js-to-wasm#%d", id);
2023 func_name = buffer.start();
2024 }
2025
2026 CompilationInfo info(func_name, isolate, &zone, flags);
2011 Handle<Code> code = 2027 Handle<Code> code =
2012 Pipeline::GenerateCodeForTesting(&info, incoming, &graph, nullptr); 2028 Pipeline::GenerateCodeForTesting(&info, incoming, &graph, nullptr);
2029 if (debugging) {
2030 buffer.Dispose();
2031 }
2032
2013 RecordFunctionCompilation(Logger::FUNCTION_TAG, &info, "js-to-wasm", index, 2033 RecordFunctionCompilation(Logger::FUNCTION_TAG, &info, "js-to-wasm", index,
2014 module->module->GetName(func->name_offset)); 2034 module->module->GetName(func->name_offset));
2015 // Set the JSFunction's machine code. 2035 // Set the JSFunction's machine code.
2016 function->set_code(*code); 2036 function->set_code(*code);
2017 } 2037 }
2018 return function; 2038 return function;
2019 } 2039 }
2020 2040
2021 2041
2022 Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, wasm::ModuleEnv* module, 2042 Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, wasm::ModuleEnv* module,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
2062 if (FLAG_trace_turbo_graph) { // Simple textual RPO. 2082 if (FLAG_trace_turbo_graph) { // Simple textual RPO.
2063 OFStream os(stdout); 2083 OFStream os(stdout);
2064 os << "-- Graph after change lowering -- " << std::endl; 2084 os << "-- Graph after change lowering -- " << std::endl;
2065 os << AsRPO(graph); 2085 os << AsRPO(graph);
2066 } 2086 }
2067 2087
2068 // Schedule and compile to machine code. 2088 // Schedule and compile to machine code.
2069 CallDescriptor* incoming = module->GetWasmCallDescriptor(&zone, func->sig); 2089 CallDescriptor* incoming = module->GetWasmCallDescriptor(&zone, func->sig);
2070 // TODO(titzer): this is technically a WASM wrapper, not a wasm function. 2090 // TODO(titzer): this is technically a WASM wrapper, not a wasm function.
2071 Code::Flags flags = Code::ComputeFlags(Code::WASM_FUNCTION); 2091 Code::Flags flags = Code::ComputeFlags(Code::WASM_FUNCTION);
2072 CompilationInfo info("wasm-to-js", isolate, &zone, flags); 2092 bool debugging =
2093 #if DEBUG
2094 true;
2095 #else
2096 FLAG_print_opt_code || FLAG_trace_turbo || FLAG_trace_turbo_graph;
2097 #endif
2098 const char* func_name = "wasm-to-js";
2099 static unsigned id = 0;
2100 Vector<char> buffer;
2101 if (debugging) {
2102 buffer = Vector<char>::New(128);
2103 SNPrintF(buffer, "wasm-to-js#%d", id);
2104 func_name = buffer.start();
2105 }
2106
2107 CompilationInfo info(func_name, isolate, &zone, flags);
2073 code = Pipeline::GenerateCodeForTesting(&info, incoming, &graph, nullptr); 2108 code = Pipeline::GenerateCodeForTesting(&info, incoming, &graph, nullptr);
2109 if (debugging) {
2110 buffer.Dispose();
2111 }
2074 2112
2075 RecordFunctionCompilation(Logger::FUNCTION_TAG, &info, "wasm-to-js", index, 2113 RecordFunctionCompilation(Logger::FUNCTION_TAG, &info, "wasm-to-js", index,
2076 module->module->GetName(func->name_offset)); 2114 module->module->GetName(func->name_offset));
2077 } 2115 }
2078 return code; 2116 return code;
2079 } 2117 }
2080 2118
2081 2119
2082 // Helper function to compile a single function. 2120 // Helper function to compile a single function.
2083 Handle<Code> CompileWasmFunction(wasm::ErrorThrower& thrower, Isolate* isolate, 2121 Handle<Code> CompileWasmFunction(wasm::ErrorThrower& thrower, Isolate* isolate,
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
2163 module_env->module->GetName(function.name_offset)); 2201 module_env->module->GetName(function.name_offset));
2164 } 2202 }
2165 2203
2166 return code; 2204 return code;
2167 } 2205 }
2168 2206
2169 2207
2170 } // namespace compiler 2208 } // namespace compiler
2171 } // namespace internal 2209 } // namespace internal
2172 } // namespace v8 2210 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698