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

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

Issue 2061623002: Introduce JIT code events dispatcher for the isolate. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebaseline Created 4 years, 6 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 | « src/compiler.cc ('k') | src/deoptimizer.cc » ('j') | 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/elapsed-timer.h" 9 #include "src/base/platform/elapsed-timer.h"
10 #include "src/base/platform/platform.h" 10 #include "src/base/platform/platform.h"
(...skipping 12 matching lines...) Expand all
23 #include "src/compiler/machine-operator.h" 23 #include "src/compiler/machine-operator.h"
24 #include "src/compiler/node-matchers.h" 24 #include "src/compiler/node-matchers.h"
25 #include "src/compiler/pipeline.h" 25 #include "src/compiler/pipeline.h"
26 #include "src/compiler/source-position.h" 26 #include "src/compiler/source-position.h"
27 #include "src/compiler/zone-pool.h" 27 #include "src/compiler/zone-pool.h"
28 28
29 #include "src/code-factory.h" 29 #include "src/code-factory.h"
30 #include "src/code-stubs.h" 30 #include "src/code-stubs.h"
31 #include "src/factory.h" 31 #include "src/factory.h"
32 #include "src/log-inl.h" 32 #include "src/log-inl.h"
33 #include "src/profiler/cpu-profiler.h"
34 33
35 #include "src/wasm/ast-decoder.h" 34 #include "src/wasm/ast-decoder.h"
36 #include "src/wasm/wasm-module.h" 35 #include "src/wasm/wasm-module.h"
37 #include "src/wasm/wasm-opcodes.h" 36 #include "src/wasm/wasm-opcodes.h"
38 37
39 // TODO(titzer): pull WASM_64 up to a common header. 38 // TODO(titzer): pull WASM_64 up to a common header.
40 #if !V8_TARGET_ARCH_32_BIT || V8_TARGET_ARCH_X64 39 #if !V8_TARGET_ARCH_32_BIT || V8_TARGET_ARCH_X64
41 #define WASM_64 1 40 #define WASM_64 1
42 #else 41 #else
43 #define WASM_64 0 42 #define WASM_64 0
(...skipping 2883 matching lines...) Expand 10 before | Expand all | Expand 10 after
2927 } 2926 }
2928 2927
2929 void WasmGraphBuilder::SetSourcePosition(Node* node, 2928 void WasmGraphBuilder::SetSourcePosition(Node* node,
2930 wasm::WasmCodePosition position) { 2929 wasm::WasmCodePosition position) {
2931 DCHECK_NE(position, wasm::kNoCodePosition); 2930 DCHECK_NE(position, wasm::kNoCodePosition);
2932 compiler::SourcePosition pos(position); 2931 compiler::SourcePosition pos(position);
2933 if (source_position_table_) 2932 if (source_position_table_)
2934 source_position_table_->SetSourcePosition(node, pos); 2933 source_position_table_->SetSourcePosition(node, pos);
2935 } 2934 }
2936 2935
2937 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag, 2936 static void RecordFunctionCompilation(CodeEventListener::LogEventsAndTags tag,
2938 CompilationInfo* info, 2937 CompilationInfo* info,
2939 const char* message, uint32_t index, 2938 const char* message, uint32_t index,
2940 wasm::WasmName func_name) { 2939 wasm::WasmName func_name) {
2941 Isolate* isolate = info->isolate(); 2940 Isolate* isolate = info->isolate();
2942 if (isolate->logger()->is_logging_code_events() || isolate->is_profiling()) { 2941 if (isolate->logger()->is_logging_code_events() || isolate->is_profiling()) {
2943 ScopedVector<char> buffer(128); 2942 ScopedVector<char> buffer(128);
2944 SNPrintF(buffer, "%s#%d:%.*s", message, index, func_name.length(), 2943 SNPrintF(buffer, "%s#%d:%.*s", message, index, func_name.length(),
2945 func_name.start()); 2944 func_name.start());
2946 Handle<String> name_str = 2945 Handle<String> name_str =
2947 isolate->factory()->NewStringFromAsciiChecked(buffer.start()); 2946 isolate->factory()->NewStringFromAsciiChecked(buffer.start());
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
3030 if (FLAG_print_opt_code && !code.is_null()) { 3029 if (FLAG_print_opt_code && !code.is_null()) {
3031 OFStream os(stdout); 3030 OFStream os(stdout);
3032 code->Disassemble(buffer.start(), os); 3031 code->Disassemble(buffer.start(), os);
3033 } 3032 }
3034 #endif 3033 #endif
3035 if (debugging) { 3034 if (debugging) {
3036 buffer.Dispose(); 3035 buffer.Dispose();
3037 } 3036 }
3038 3037
3039 RecordFunctionCompilation( 3038 RecordFunctionCompilation(
3040 Logger::FUNCTION_TAG, &info, "js-to-wasm", index, 3039 CodeEventListener::FUNCTION_TAG, &info, "js-to-wasm", index,
3041 module->module->GetName(func->name_offset, func->name_length)); 3040 module->module->GetName(func->name_offset, func->name_length));
3042 // Set the JSFunction's machine code. 3041 // Set the JSFunction's machine code.
3043 function->set_code(*code); 3042 function->set_code(*code);
3044 } 3043 }
3045 return function; 3044 return function;
3046 } 3045 }
3047 3046
3048 Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, wasm::ModuleEnv* module, 3047 Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, wasm::ModuleEnv* module,
3049 Handle<JSFunction> function, 3048 Handle<JSFunction> function,
3050 wasm::FunctionSig* sig, 3049 wasm::FunctionSig* sig,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
3103 #ifdef ENABLE_DISASSEMBLER 3102 #ifdef ENABLE_DISASSEMBLER
3104 if (FLAG_print_opt_code && !code.is_null()) { 3103 if (FLAG_print_opt_code && !code.is_null()) {
3105 OFStream os(stdout); 3104 OFStream os(stdout);
3106 code->Disassemble(buffer.start(), os); 3105 code->Disassemble(buffer.start(), os);
3107 } 3106 }
3108 #endif 3107 #endif
3109 if (debugging) { 3108 if (debugging) {
3110 buffer.Dispose(); 3109 buffer.Dispose();
3111 } 3110 }
3112 3111
3113 RecordFunctionCompilation(Logger::FUNCTION_TAG, &info, "wasm-to-js", 0, 3112 RecordFunctionCompilation(CodeEventListener::FUNCTION_TAG, &info,
3114 module_name); 3113 "wasm-to-js", 0, module_name);
3115 } 3114 }
3116 return code; 3115 return code;
3117 } 3116 }
3118 3117
3119 SourcePositionTable* WasmCompilationUnit::BuildGraphForWasmFunction( 3118 SourcePositionTable* WasmCompilationUnit::BuildGraphForWasmFunction(
3120 double* decode_ms) { 3119 double* decode_ms) {
3121 base::ElapsedTimer decode_timer; 3120 base::ElapsedTimer decode_timer;
3122 if (FLAG_trace_wasm_decode_time) { 3121 if (FLAG_trace_wasm_decode_time) {
3123 decode_timer.Start(); 3122 decode_timer.Start();
3124 } 3123 }
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
3268 return Handle<Code>::null(); 3267 return Handle<Code>::null();
3269 } 3268 }
3270 base::ElapsedTimer compile_timer; 3269 base::ElapsedTimer compile_timer;
3271 if (FLAG_trace_wasm_decode_time) { 3270 if (FLAG_trace_wasm_decode_time) {
3272 compile_timer.Start(); 3271 compile_timer.Start();
3273 } 3272 }
3274 Handle<Code> code = info_.code(); 3273 Handle<Code> code = info_.code();
3275 DCHECK(!code.is_null()); 3274 DCHECK(!code.is_null());
3276 3275
3277 RecordFunctionCompilation( 3276 RecordFunctionCompilation(
3278 Logger::FUNCTION_TAG, &info_, "WASM_function", function_->func_index, 3277 CodeEventListener::FUNCTION_TAG, &info_, "WASM_function",
3278 function_->func_index,
3279 module_env_->module->GetName(function_->name_offset, 3279 module_env_->module->GetName(function_->name_offset,
3280 function_->name_length)); 3280 function_->name_length));
3281 3281
3282 if (FLAG_trace_wasm_decode_time) { 3282 if (FLAG_trace_wasm_decode_time) {
3283 double compile_ms = compile_timer.Elapsed().InMillisecondsF(); 3283 double compile_ms = compile_timer.Elapsed().InMillisecondsF();
3284 PrintF("wasm-code-generation ok: %d bytes, %0.3f ms code generation\n", 3284 PrintF("wasm-code-generation ok: %d bytes, %0.3f ms code generation\n",
3285 static_cast<int>(function_->code_end_offset - 3285 static_cast<int>(function_->code_end_offset -
3286 function_->code_start_offset), 3286 function_->code_start_offset),
3287 compile_ms); 3287 compile_ms);
3288 } 3288 }
3289 3289
3290 return code; 3290 return code;
3291 } 3291 }
3292 3292
3293 } // namespace compiler 3293 } // namespace compiler
3294 } // namespace internal 3294 } // namespace internal
3295 } // namespace v8 3295 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler.cc ('k') | src/deoptimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698