 Chromium Code Reviews
 Chromium Code Reviews Issue 21042003:
  Patch to enhance the source code line information for profiler.  (Closed) 
  Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
    
  
    Issue 21042003:
  Patch to enhance the source code line information for profiler.  (Closed) 
  Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/| OLD | NEW | 
|---|---|
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 253 if (FLAG_trace && info()->IsOptimizing()) { | 253 if (FLAG_trace && info()->IsOptimizing()) { | 
| 254 __ CallRuntime(Runtime::kTraceEnter, 0); | 254 __ CallRuntime(Runtime::kTraceEnter, 0); | 
| 255 } | 255 } | 
| 256 return !is_aborted(); | 256 return !is_aborted(); | 
| 257 } | 257 } | 
| 258 | 258 | 
| 259 | 259 | 
| 260 bool LCodeGen::GenerateBody() { | 260 bool LCodeGen::GenerateBody() { | 
| 261 ASSERT(is_generating()); | 261 ASSERT(is_generating()); | 
| 262 bool emit_instructions = true; | 262 bool emit_instructions = true; | 
| 263 | |
| 
danno
2013/08/05 16:59:17
Please remove extraneous whitespace change
 | |
| 263 for (current_instruction_ = 0; | 264 for (current_instruction_ = 0; | 
| 264 !is_aborted() && current_instruction_ < instructions_->length(); | 265 !is_aborted() && current_instruction_ < instructions_->length(); | 
| 265 current_instruction_++) { | 266 current_instruction_++) { | 
| 266 LInstruction* instr = instructions_->at(current_instruction_); | 267 LInstruction* instr = instructions_->at(current_instruction_); | 
| 267 | 268 | 
| 268 // Don't emit code for basic blocks with a replacement. | 269 // Don't emit code for basic blocks with a replacement. | 
| 269 if (instr->IsLabel()) { | 270 if (instr->IsLabel()) { | 
| 270 emit_instructions = !LLabel::cast(instr)->HasReplacement(); | 271 emit_instructions = !LLabel::cast(instr)->HasReplacement(); | 
| 271 } | 272 } | 
| 272 if (!emit_instructions) continue; | 273 if (!emit_instructions) continue; | 
| 273 | 274 | 
| 274 if (FLAG_code_comments && instr->HasInterestingComment(this)) { | 275 if (FLAG_code_comments && instr->HasInterestingComment(this)) { | 
| 275 Comment(";;; <@%d,#%d> %s", | 276 Comment(";;; <@%d,#%d> %s", | 
| 276 current_instruction_, | 277 current_instruction_, | 
| 277 instr->hydrogen_value()->id(), | 278 instr->hydrogen_value()->id(), | 
| 278 instr->Mnemonic()); | 279 instr->Mnemonic()); | 
| 279 } | 280 } | 
| 280 | 281 | 
| 282 RecordAndUpdatePosition(instr->position()); | |
| 283 | |
| 281 instr->CompileToNative(this); | 284 instr->CompileToNative(this); | 
| 282 } | 285 } | 
| 283 EnsureSpaceForLazyDeopt(Deoptimizer::patch_size()); | 286 EnsureSpaceForLazyDeopt(Deoptimizer::patch_size()); | 
| 284 return !is_aborted(); | 287 return !is_aborted(); | 
| 285 } | 288 } | 
| 286 | 289 | 
| 287 | 290 | 
| 288 bool LCodeGen::GenerateJumpTable() { | 291 bool LCodeGen::GenerateJumpTable() { | 
| 289 Label needs_frame; | 292 Label needs_frame; | 
| 290 if (jump_table_.length() > 0) { | 293 if (jump_table_.length() > 0) { | 
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 324 } | 327 } | 
| 325 return !is_aborted(); | 328 return !is_aborted(); | 
| 326 } | 329 } | 
| 327 | 330 | 
| 328 | 331 | 
| 329 bool LCodeGen::GenerateDeferredCode() { | 332 bool LCodeGen::GenerateDeferredCode() { | 
| 330 ASSERT(is_generating()); | 333 ASSERT(is_generating()); | 
| 331 if (deferred_.length() > 0) { | 334 if (deferred_.length() > 0) { | 
| 332 for (int i = 0; !is_aborted() && i < deferred_.length(); i++) { | 335 for (int i = 0; !is_aborted() && i < deferred_.length(); i++) { | 
| 333 LDeferredCode* code = deferred_[i]; | 336 LDeferredCode* code = deferred_[i]; | 
| 337 | |
| 338 int pos = instructions_->at(code->instruction_index())->position(); | |
| 339 RecordAndUpdatePosition(pos); | |
| 340 | |
| 334 Comment(";;; <@%d,#%d> " | 341 Comment(";;; <@%d,#%d> " | 
| 335 "-------------------- Deferred %s --------------------", | 342 "-------------------- Deferred %s --------------------", | 
| 336 code->instruction_index(), | 343 code->instruction_index(), | 
| 337 code->instr()->hydrogen_value()->id(), | 344 code->instr()->hydrogen_value()->id(), | 
| 338 code->instr()->Mnemonic()); | 345 code->instr()->Mnemonic()); | 
| 339 __ bind(code->entry()); | 346 __ bind(code->entry()); | 
| 340 if (NeedsDeferredFrame()) { | 347 if (NeedsDeferredFrame()) { | 
| 341 Comment(";;; Build frame"); | 348 Comment(";;; Build frame"); | 
| 342 ASSERT(!frame_is_built_); | 349 ASSERT(!frame_is_built_); | 
| 343 ASSERT(info()->IsStub()); | 350 ASSERT(info()->IsStub()); | 
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 852 RecordSafepoint(pointers, Safepoint::kWithRegisters, arguments, deopt_mode); | 859 RecordSafepoint(pointers, Safepoint::kWithRegisters, arguments, deopt_mode); | 
| 853 } | 860 } | 
| 854 | 861 | 
| 855 | 862 | 
| 856 void LCodeGen::RecordPosition(int position) { | 863 void LCodeGen::RecordPosition(int position) { | 
| 857 if (position == RelocInfo::kNoPosition) return; | 864 if (position == RelocInfo::kNoPosition) return; | 
| 858 masm()->positions_recorder()->RecordPosition(position); | 865 masm()->positions_recorder()->RecordPosition(position); | 
| 859 } | 866 } | 
| 860 | 867 | 
| 861 | 868 | 
| 869 void LCodeGen::RecordAndUpdatePosition(int position) { | |
| 870 if (position >= 0 && position != old_position_) { | |
| 871 masm()->positions_recorder()->RecordPosition(position); | |
| 872 old_position_ = position; | |
| 873 } | |
| 874 } | |
| 875 | |
| 876 | |
| 862 static const char* LabelType(LLabel* label) { | 877 static const char* LabelType(LLabel* label) { | 
| 863 if (label->is_loop_header()) return " (loop header)"; | 878 if (label->is_loop_header()) return " (loop header)"; | 
| 864 if (label->is_osr_entry()) return " (OSR entry)"; | 879 if (label->is_osr_entry()) return " (OSR entry)"; | 
| 865 return ""; | 880 return ""; | 
| 866 } | 881 } | 
| 867 | 882 | 
| 868 | 883 | 
| 869 void LCodeGen::DoLabel(LLabel* label) { | 884 void LCodeGen::DoLabel(LLabel* label) { | 
| 870 Comment(";;; <@%d,#%d> -------------------- B%d%s --------------------", | 885 Comment(";;; <@%d,#%d> -------------------- B%d%s --------------------", | 
| 871 current_instruction_, | 886 current_instruction_, | 
| (...skipping 4705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5577 FixedArray::kHeaderSize - kPointerSize)); | 5592 FixedArray::kHeaderSize - kPointerSize)); | 
| 5578 __ bind(&done); | 5593 __ bind(&done); | 
| 5579 } | 5594 } | 
| 5580 | 5595 | 
| 5581 | 5596 | 
| 5582 #undef __ | 5597 #undef __ | 
| 5583 | 5598 | 
| 5584 } } // namespace v8::internal | 5599 } } // namespace v8::internal | 
| 5585 | 5600 | 
| 5586 #endif // V8_TARGET_ARCH_X64 | 5601 #endif // V8_TARGET_ARCH_X64 | 
| OLD | NEW |