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

Side by Side Diff: src/compiler.cc

Issue 1582004: C++ profiles processor: wire up to VM. (Closed)
Patch Set: Created 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 CompilationInfo info(lit, script, is_eval); 210 CompilationInfo info(lit, script, is_eval);
211 Handle<Code> code = MakeCode(context, &info); 211 Handle<Code> code = MakeCode(context, &info);
212 212
213 // Check for stack-overflow exceptions. 213 // Check for stack-overflow exceptions.
214 if (code.is_null()) { 214 if (code.is_null()) {
215 Top::StackOverflow(); 215 Top::StackOverflow();
216 return Handle<SharedFunctionInfo>::null(); 216 return Handle<SharedFunctionInfo>::null();
217 } 217 }
218 218
219 if (script->name()->IsString()) { 219 if (script->name()->IsString()) {
220 LOG(CodeCreateEvent(is_eval ? Logger::EVAL_TAG : Logger::SCRIPT_TAG, 220 PROFILE(CodeCreateEvent(is_eval ? Logger::EVAL_TAG : Logger::SCRIPT_TAG,
221 *code, String::cast(script->name()))); 221 *code, String::cast(script->name())));
222 OPROFILE(CreateNativeCodeRegion(String::cast(script->name()), 222 OPROFILE(CreateNativeCodeRegion(String::cast(script->name()),
223 code->instruction_start(), 223 code->instruction_start(),
224 code->instruction_size())); 224 code->instruction_size()));
225 } else { 225 } else {
226 LOG(CodeCreateEvent(is_eval ? Logger::EVAL_TAG : Logger::SCRIPT_TAG, 226 PROFILE(CodeCreateEvent(is_eval ? Logger::EVAL_TAG : Logger::SCRIPT_TAG,
227 *code, "")); 227 *code, ""));
228 OPROFILE(CreateNativeCodeRegion(is_eval ? "Eval" : "Script", 228 OPROFILE(CreateNativeCodeRegion(is_eval ? "Eval" : "Script",
229 code->instruction_start(), 229 code->instruction_start(),
230 code->instruction_size())); 230 code->instruction_size()));
231 } 231 }
232 232
233 // Allocate function. 233 // Allocate function.
234 Handle<SharedFunctionInfo> result = 234 Handle<SharedFunctionInfo> result =
235 Factory::NewSharedFunctionInfo(lit->name(), 235 Factory::NewSharedFunctionInfo(lit->name(),
236 lit->materialized_literal_count(), 236 lit->materialized_literal_count(),
237 code); 237 code);
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 578
579 void Compiler::RecordFunctionCompilation(Logger::LogEventsAndTags tag, 579 void Compiler::RecordFunctionCompilation(Logger::LogEventsAndTags tag,
580 Handle<String> name, 580 Handle<String> name,
581 Handle<String> inferred_name, 581 Handle<String> inferred_name,
582 int start_position, 582 int start_position,
583 Handle<Script> script, 583 Handle<Script> script,
584 Handle<Code> code) { 584 Handle<Code> code) {
585 // Log the code generation. If source information is available 585 // Log the code generation. If source information is available
586 // include script name and line number. Check explicitly whether 586 // include script name and line number. Check explicitly whether
587 // logging is enabled as finding the line number is not free. 587 // logging is enabled as finding the line number is not free.
588 if (Logger::is_logging() || OProfileAgent::is_enabled()) { 588 if (Logger::is_logging()
589 || OProfileAgent::is_enabled()
590 || CpuProfiler::is_profiling()) {
589 Handle<String> func_name(name->length() > 0 ? *name : *inferred_name); 591 Handle<String> func_name(name->length() > 0 ? *name : *inferred_name);
590 if (script->name()->IsString()) { 592 if (script->name()->IsString()) {
591 int line_num = GetScriptLineNumber(script, start_position) + 1; 593 int line_num = GetScriptLineNumber(script, start_position) + 1;
592 USE(line_num); 594 USE(line_num);
593 LOG(CodeCreateEvent(tag, *code, *func_name, 595 PROFILE(CodeCreateEvent(tag, *code, *func_name,
594 String::cast(script->name()), line_num)); 596 String::cast(script->name()), line_num));
595 OPROFILE(CreateNativeCodeRegion(*func_name, 597 OPROFILE(CreateNativeCodeRegion(*func_name,
596 String::cast(script->name()), 598 String::cast(script->name()),
597 line_num, 599 line_num,
598 code->instruction_start(), 600 code->instruction_start(),
599 code->instruction_size())); 601 code->instruction_size()));
600 } else { 602 } else {
601 LOG(CodeCreateEvent(tag, *code, *func_name)); 603 PROFILE(CodeCreateEvent(tag, *code, *func_name));
602 OPROFILE(CreateNativeCodeRegion(*func_name, 604 OPROFILE(CreateNativeCodeRegion(*func_name,
603 code->instruction_start(), 605 code->instruction_start(),
604 code->instruction_size())); 606 code->instruction_size()));
605 } 607 }
606 } 608 }
607 } 609 }
608 610
609 } } // namespace v8::internal 611 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/codegen.cc ('k') | src/cpu-profiler.h » ('j') | src/platform-linux.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698