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

Side by Side Diff: src/compiler.cc

Issue 131102: Eliminate double offsetting of line numbers in profiler. (Closed)
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
« no previous file with comments | « no previous file | src/log.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 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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 } 373 }
374 374
375 #if defined ENABLE_LOGGING_AND_PROFILING || defined ENABLE_OPROFILE_AGENT 375 #if defined ENABLE_LOGGING_AND_PROFILING || defined ENABLE_OPROFILE_AGENT
376 // Log the code generation. If source information is available include script 376 // Log the code generation. If source information is available include script
377 // name and line number. Check explicit whether logging is enabled as finding 377 // name and line number. Check explicit whether logging is enabled as finding
378 // the line number is not for free. 378 // the line number is not for free.
379 if (Logger::IsEnabled() || OProfileAgent::is_enabled()) { 379 if (Logger::IsEnabled() || OProfileAgent::is_enabled()) {
380 Handle<String> func_name(name->length() > 0 ? 380 Handle<String> func_name(name->length() > 0 ?
381 *name : shared->inferred_name()); 381 *name : shared->inferred_name());
382 if (script->name()->IsString()) { 382 if (script->name()->IsString()) {
383 int line_num = GetScriptLineNumber(script, start_position); 383 int line_num = GetScriptLineNumber(script, start_position) + 1;
384 if (line_num > 0) {
385 line_num += script->line_offset()->value() + 1;
386 }
387 LOG(CodeCreateEvent(Logger::LAZY_COMPILE_TAG, *code, *func_name, 384 LOG(CodeCreateEvent(Logger::LAZY_COMPILE_TAG, *code, *func_name,
388 String::cast(script->name()), line_num)); 385 String::cast(script->name()), line_num));
389 OProfileAgent::CreateNativeCodeRegion(*func_name, 386 OProfileAgent::CreateNativeCodeRegion(*func_name,
390 String::cast(script->name()), 387 String::cast(script->name()),
391 line_num, 388 line_num,
392 code->instruction_start(), 389 code->instruction_start(),
393 code->instruction_size()); 390 code->instruction_size());
394 } else { 391 } else {
395 LOG(CodeCreateEvent(Logger::LAZY_COMPILE_TAG, *code, *func_name)); 392 LOG(CodeCreateEvent(Logger::LAZY_COMPILE_TAG, *code, *func_name));
396 OProfileAgent::CreateNativeCodeRegion(*func_name, 393 OProfileAgent::CreateNativeCodeRegion(*func_name,
397 code->instruction_start(), 394 code->instruction_start(),
398 code->instruction_size()); 395 code->instruction_size());
399 } 396 }
400 } 397 }
401 #endif 398 #endif
402 399
403 // Update the shared function info with the compiled code. 400 // Update the shared function info with the compiled code.
404 shared->set_code(*code); 401 shared->set_code(*code);
405 402
406 // Set the expected number of properties for instances. 403 // Set the expected number of properties for instances.
407 SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count()); 404 SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count());
408 405
409 // Check the function has compiled code. 406 // Check the function has compiled code.
410 ASSERT(shared->is_compiled()); 407 ASSERT(shared->is_compiled());
411 return true; 408 return true;
412 } 409 }
413 410
414 411
415 } } // namespace v8::internal 412 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698