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

Side by Side Diff: src/compiler.cc

Issue 125141: Attempt to reduce performance penalty for logging and profiling (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 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 | Annotate | Revision Log
« no previous file with comments | « src/codegen.cc ('k') | src/log.h » ('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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 168
169 // Check for stack-overflow exceptions. 169 // Check for stack-overflow exceptions.
170 if (code.is_null()) { 170 if (code.is_null()) {
171 Top::StackOverflow(); 171 Top::StackOverflow();
172 return Handle<JSFunction>::null(); 172 return Handle<JSFunction>::null();
173 } 173 }
174 174
175 #if defined ENABLE_LOGGING_AND_PROFILING || defined ENABLE_OPROFILE_AGENT 175 #if defined ENABLE_LOGGING_AND_PROFILING || defined ENABLE_OPROFILE_AGENT
176 // Log the code generation for the script. Check explicit whether logging is 176 // Log the code generation for the script. Check explicit whether logging is
177 // to avoid allocating when not required. 177 // to avoid allocating when not required.
178 if (Logger::IsEnabled() || OProfileAgent::is_enabled()) { 178 if (Logger::is_logging() || OProfileAgent::is_enabled()) {
179 if (script->name()->IsString()) { 179 if (script->name()->IsString()) {
180 SmartPointer<char> data = 180 SmartPointer<char> data =
181 String::cast(script->name())->ToCString(DISALLOW_NULLS); 181 String::cast(script->name())->ToCString(DISALLOW_NULLS);
182 LOG(CodeCreateEvent(is_eval ? Logger::EVAL_TAG : Logger::SCRIPT_TAG, 182 LOG(CodeCreateEvent(is_eval ? Logger::EVAL_TAG : Logger::SCRIPT_TAG,
183 *code, *data)); 183 *code, *data));
184 OProfileAgent::CreateNativeCodeRegion(*data, 184 OProfileAgent::CreateNativeCodeRegion(*data,
185 code->instruction_start(), 185 code->instruction_start(),
186 code->instruction_size()); 186 code->instruction_size());
187 } else { 187 } else {
188 LOG(CodeCreateEvent(is_eval ? Logger::EVAL_TAG : Logger::SCRIPT_TAG, 188 LOG(CodeCreateEvent(is_eval ? Logger::EVAL_TAG : Logger::SCRIPT_TAG,
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 // Check for stack-overflow exception. 366 // Check for stack-overflow exception.
367 if (code.is_null()) { 367 if (code.is_null()) {
368 Top::StackOverflow(); 368 Top::StackOverflow();
369 return false; 369 return false;
370 } 370 }
371 371
372 #if defined ENABLE_LOGGING_AND_PROFILING || defined ENABLE_OPROFILE_AGENT 372 #if defined ENABLE_LOGGING_AND_PROFILING || defined ENABLE_OPROFILE_AGENT
373 // Log the code generation. If source information is available include script 373 // Log the code generation. If source information is available include script
374 // name and line number. Check explicit whether logging is enabled as finding 374 // name and line number. Check explicit whether logging is enabled as finding
375 // the line number is not for free. 375 // the line number is not for free.
376 if (Logger::IsEnabled() || OProfileAgent::is_enabled()) { 376 if (Logger::is_logging() || OProfileAgent::is_enabled()) {
377 Handle<String> func_name(name->length() > 0 ? 377 Handle<String> func_name(name->length() > 0 ?
378 *name : shared->inferred_name()); 378 *name : shared->inferred_name());
379 if (script->name()->IsString()) { 379 if (script->name()->IsString()) {
380 int line_num = GetScriptLineNumber(script, start_position) + 1; 380 int line_num = GetScriptLineNumber(script, start_position) + 1;
381 LOG(CodeCreateEvent(Logger::LAZY_COMPILE_TAG, *code, *func_name, 381 LOG(CodeCreateEvent(Logger::LAZY_COMPILE_TAG, *code, *func_name,
382 String::cast(script->name()), line_num)); 382 String::cast(script->name()), line_num));
383 OProfileAgent::CreateNativeCodeRegion(*func_name, 383 OProfileAgent::CreateNativeCodeRegion(*func_name,
384 String::cast(script->name()), 384 String::cast(script->name()),
385 line_num, 385 line_num,
386 code->instruction_start(), 386 code->instruction_start(),
(...skipping 13 matching lines...) Expand all
400 // Set the expected number of properties for instances. 400 // Set the expected number of properties for instances.
401 SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count()); 401 SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count());
402 402
403 // Check the function has compiled code. 403 // Check the function has compiled code.
404 ASSERT(shared->is_compiled()); 404 ASSERT(shared->is_compiled());
405 return true; 405 return true;
406 } 406 }
407 407
408 408
409 } } // namespace v8::internal 409 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/codegen.cc ('k') | src/log.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698