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

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

Issue 2240463002: [Interpreter] Introduce InterpreterCompilationJob (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@offheap_peekhole
Patch Set: DISALLOW_COPY_AND_ASSIGN Created 4 years, 4 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
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 3147 matching lines...) Expand 10 before | Expand all | Expand 10 after
3158 3158
3159 // Run the compiler pipeline to generate machine code. 3159 // Run the compiler pipeline to generate machine code.
3160 CallDescriptor* descriptor = wasm::ModuleEnv::GetWasmCallDescriptor( 3160 CallDescriptor* descriptor = wasm::ModuleEnv::GetWasmCallDescriptor(
3161 &compilation_zone_, function_->sig); 3161 &compilation_zone_, function_->sig);
3162 if (jsgraph_->machine()->Is32()) { 3162 if (jsgraph_->machine()->Is32()) {
3163 descriptor = 3163 descriptor =
3164 module_env_->GetI32WasmCallDescriptor(&compilation_zone_, descriptor); 3164 module_env_->GetI32WasmCallDescriptor(&compilation_zone_, descriptor);
3165 } 3165 }
3166 job_.reset(Pipeline::NewWasmCompilationJob(&info_, jsgraph_->graph(), 3166 job_.reset(Pipeline::NewWasmCompilationJob(&info_, jsgraph_->graph(),
3167 descriptor, source_positions)); 3167 descriptor, source_positions));
3168 3168 ok_ = job_->ExecuteJob() == CompilationJob::SUCCEEDED;
3169 // The function name {OptimizeGraph()} is misleading but necessary because we
3170 // want to use the CompilationJob interface. A better name would be
3171 // ScheduleGraphAndSelectInstructions.
3172 ok_ = job_->OptimizeGraph() == CompilationJob::SUCCEEDED;
3173 // TODO(bradnelson): Improve histogram handling of size_t. 3169 // TODO(bradnelson): Improve histogram handling of size_t.
3174 // TODO(ahaas): The counters are not thread-safe at the moment. 3170 // TODO(ahaas): The counters are not thread-safe at the moment.
3175 // isolate_->counters()->wasm_compile_function_peak_memory_bytes() 3171 // isolate_->counters()->wasm_compile_function_peak_memory_bytes()
3176 // ->AddSample( 3172 // ->AddSample(
3177 // static_cast<int>(jsgraph->graph()->zone()->allocation_size())); 3173 // static_cast<int>(jsgraph->graph()->zone()->allocation_size()));
3178 3174
3179 if (FLAG_trace_wasm_decode_time) { 3175 if (FLAG_trace_wasm_decode_time) {
3180 double pipeline_ms = pipeline_timer.Elapsed().InMillisecondsF(); 3176 double pipeline_ms = pipeline_timer.Elapsed().InMillisecondsF();
3181 PrintF( 3177 PrintF(
3182 "wasm-compilation phase 1 ok: %d bytes, %0.3f ms decode, %zu nodes, " 3178 "wasm-compilation phase 1 ok: %d bytes, %0.3f ms decode, %zu nodes, "
(...skipping 11 matching lines...) Expand all
3194 ScopedVector<char> buffer(128); 3190 ScopedVector<char> buffer(128);
3195 wasm::WasmName name = module_env_->module->GetName( 3191 wasm::WasmName name = module_env_->module->GetName(
3196 function_->name_offset, function_->name_length); 3192 function_->name_offset, function_->name_length);
3197 SNPrintF(buffer, "Compiling WASM function #%d:%.*s failed:", 3193 SNPrintF(buffer, "Compiling WASM function #%d:%.*s failed:",
3198 function_->func_index, name.length(), name.start()); 3194 function_->func_index, name.length(), name.start());
3199 thrower_->Failed(buffer.start(), graph_construction_result_); 3195 thrower_->Failed(buffer.start(), graph_construction_result_);
3200 } 3196 }
3201 3197
3202 return Handle<Code>::null(); 3198 return Handle<Code>::null();
3203 } 3199 }
3204 if (job_->GenerateCode() != CompilationJob::SUCCEEDED) { 3200 if (job_->FinalizeJob() != CompilationJob::SUCCEEDED) {
3205 return Handle<Code>::null(); 3201 return Handle<Code>::null();
3206 } 3202 }
3207 base::ElapsedTimer compile_timer; 3203 base::ElapsedTimer compile_timer;
3208 if (FLAG_trace_wasm_decode_time) { 3204 if (FLAG_trace_wasm_decode_time) {
3209 compile_timer.Start(); 3205 compile_timer.Start();
3210 } 3206 }
3211 Handle<Code> code = info_.code(); 3207 Handle<Code> code = info_.code();
3212 DCHECK(!code.is_null()); 3208 DCHECK(!code.is_null());
3213 3209
3214 if (isolate_->logger()->is_logging_code_events() || 3210 if (isolate_->logger()->is_logging_code_events() ||
(...skipping 12 matching lines...) Expand all
3227 function_->code_start_offset), 3223 function_->code_start_offset),
3228 compile_ms); 3224 compile_ms);
3229 } 3225 }
3230 3226
3231 return code; 3227 return code;
3232 } 3228 }
3233 3229
3234 } // namespace compiler 3230 } // namespace compiler
3235 } // namespace internal 3231 } // namespace internal
3236 } // namespace v8 3232 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698