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

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

Issue 2710603006: [wasm] Move compilation-related methods to CompilationHelper in wasm-module.cc. (Closed)
Patch Set: Created 3 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 | src/wasm/wasm-module.cc » ('j') | src/wasm/wasm-module.cc » ('J')
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 <memory> 7 #include <memory>
8 8
9 #include "src/isolate-inl.h" 9 #include "src/isolate-inl.h"
10 10
(...skipping 4083 matching lines...) Expand 10 before | Expand all | Expand 10 after
4094 ok_ = job_->ExecuteJob() == CompilationJob::SUCCEEDED; 4094 ok_ = job_->ExecuteJob() == CompilationJob::SUCCEEDED;
4095 // TODO(bradnelson): Improve histogram handling of size_t. 4095 // TODO(bradnelson): Improve histogram handling of size_t.
4096 // TODO(ahaas): The counters are not thread-safe at the moment. 4096 // TODO(ahaas): The counters are not thread-safe at the moment.
4097 // isolate_->counters()->wasm_compile_function_peak_memory_bytes() 4097 // isolate_->counters()->wasm_compile_function_peak_memory_bytes()
4098 // ->AddSample( 4098 // ->AddSample(
4099 // static_cast<int>(jsgraph->graph()->zone()->allocation_size())); 4099 // static_cast<int>(jsgraph->graph()->zone()->allocation_size()));
4100 4100
4101 if (FLAG_trace_wasm_decode_time) { 4101 if (FLAG_trace_wasm_decode_time) {
4102 double pipeline_ms = pipeline_timer.Elapsed().InMillisecondsF(); 4102 double pipeline_ms = pipeline_timer.Elapsed().InMillisecondsF();
4103 PrintF( 4103 PrintF(
4104 "wasm-compilation phase 1 ok: %d bytes, %0.3f ms decode, %zu nodes, " 4104 "wasm-compilation phase 1 ok: %u bytes, %0.3f ms decode, %zu nodes, "
4105 "%0.3f ms pipeline\n", 4105 "%0.3f ms pipeline\n",
4106 static_cast<int>(function_->code_end_offset - 4106 function_->code_end_offset - function_->code_start_offset, decode_ms,
4107 function_->code_start_offset), 4107 node_count, pipeline_ms);
4108 decode_ms, node_count, pipeline_ms);
4109 } 4108 }
4110 } 4109 }
4111 4110
4112 Handle<Code> WasmCompilationUnit::FinishCompilation() { 4111 Handle<Code> WasmCompilationUnit::FinishCompilation() {
4113 if (!ok_) { 4112 if (!ok_) {
4114 if (graph_construction_result_.failed()) { 4113 if (graph_construction_result_.failed()) {
4115 // Add the function as another context for the exception 4114 // Add the function as another context for the exception
4116 ScopedVector<char> buffer(128); 4115 ScopedVector<char> buffer(128);
4117 wasm::WasmName name = module_env_->wire_bytes.GetName(function_); 4116 wasm::WasmName name = module_env_->wire_bytes.GetName(function_);
4118 SNPrintF(buffer, "Compiling WASM function #%d:%.*s failed:", 4117 SNPrintF(buffer, "Compiling WASM function #%d:%.*s failed:",
4119 function_->func_index, name.length(), name.start()); 4118 function_->func_index, name.length(), name.start());
4120 thrower_->CompileFailed(buffer.start(), graph_construction_result_); 4119 thrower_->CompileFailed(buffer.start(), graph_construction_result_);
4121 } 4120 }
4122 4121
4123 return Handle<Code>::null(); 4122 return Handle<Code>::null();
4124 } 4123 }
4124 base::ElapsedTimer codegen_timer;
4125 if (FLAG_trace_wasm_decode_time) {
4126 codegen_timer.Start();
4127 }
4125 if (job_->FinalizeJob() != CompilationJob::SUCCEEDED) { 4128 if (job_->FinalizeJob() != CompilationJob::SUCCEEDED) {
4126 return Handle<Code>::null(); 4129 return Handle<Code>::null();
4127 } 4130 }
4128 base::ElapsedTimer compile_timer;
4129 if (FLAG_trace_wasm_decode_time) {
4130 compile_timer.Start();
4131 }
4132 Handle<Code> code = info_.code(); 4131 Handle<Code> code = info_.code();
4133 DCHECK(!code.is_null()); 4132 DCHECK(!code.is_null());
4134 4133
4135 if (isolate_->logger()->is_logging_code_events() || 4134 if (isolate_->logger()->is_logging_code_events() ||
4136 isolate_->is_profiling()) { 4135 isolate_->is_profiling()) {
4137 RecordFunctionCompilation(CodeEventListener::FUNCTION_TAG, isolate_, code, 4136 RecordFunctionCompilation(CodeEventListener::FUNCTION_TAG, isolate_, code,
4138 "WASM_function", function_->func_index, 4137 "WASM_function", function_->func_index,
4139 wasm::WasmName("module"), 4138 wasm::WasmName("module"),
4140 module_env_->wire_bytes.GetName(function_)); 4139 module_env_->wire_bytes.GetName(function_));
4141 } 4140 }
4142 4141
4143 if (FLAG_trace_wasm_decode_time) { 4142 if (FLAG_trace_wasm_decode_time) {
4144 double compile_ms = compile_timer.Elapsed().InMillisecondsF(); 4143 double codegen_ms = codegen_timer.Elapsed().InMillisecondsF();
4145 PrintF("wasm-code-generation ok: %d bytes, %0.3f ms code generation\n", 4144 PrintF("wasm-code-generation ok: %u bytes, %0.3f ms code generation\n",
4146 static_cast<int>(function_->code_end_offset - 4145 function_->code_end_offset - function_->code_start_offset,
4147 function_->code_start_offset), 4146 codegen_ms);
4148 compile_ms);
4149 } 4147 }
4150 4148
4151 return code; 4149 return code;
4152 } 4150 }
4153 4151
4154 } // namespace compiler 4152 } // namespace compiler
4155 } // namespace internal 4153 } // namespace internal
4156 } // namespace v8 4154 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/wasm/wasm-module.cc » ('j') | src/wasm/wasm-module.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698