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

Side by Side Diff: src/frames.cc

Issue 8357004: Add flag to tracing element kind transitions (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix nits Created 9 years, 2 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 int offset = static_cast<int>(pc() - code_pointer->address()); 704 int offset = static_cast<int>(pc() - code_pointer->address());
705 FrameSummary summary(receiver(), 705 FrameSummary summary(receiver(),
706 JSFunction::cast(function()), 706 JSFunction::cast(function()),
707 code_pointer, 707 code_pointer,
708 offset, 708 offset,
709 IsConstructor()); 709 IsConstructor());
710 functions->Add(summary); 710 functions->Add(summary);
711 } 711 }
712 712
713 713
714 void JavaScriptFrame::PrintTop(bool print_args, bool print_line_number) {
715 // constructor calls
716 HandleScope scope;
717 AssertNoAllocation no_allocation;
718 JavaScriptFrameIterator it;
719 while (!it.done()) {
720 if (it.frame()->is_java_script()) {
721 JavaScriptFrame* frame = it.frame();
722 if (frame->IsConstructor()) PrintF("new ");
723 // function name
724 Object* fun = frame->function();
725 if (fun->IsJSFunction()) {
726 JSFunction::cast(fun)->shared()->name()->MiniPrint();
727 } else {
728 fun->MiniPrint();
729 }
730 if (print_line_number) {
731 PrintF(" ");
Jakob Kummerow 2011/10/19 16:02:28 Insert this printed space into the PrintF() below.
732 Address pc = frame->pc();
733 Code* code = Code::cast(
734 v8::internal::Isolate::Current()->heap()->FindCodeObject(pc));
735 int source_pos = code->SourcePosition(pc);
736 SharedFunctionInfo* shared = JSFunction::cast(fun)->shared();
737 Handle<Script> script(Script::cast(shared->script()));
738 int line = GetScriptLineNumberSafe(script, source_pos) + 1;
739 String* script_name = String::cast(script->name());
740 SmartArrayPointer<char> c_script_name =
741 script_name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
742 PrintF("%s:%d", *c_script_name, line);
743 }
744 if (print_args) {
745 // function arguments
746 // (we are intentionally only printing the actually
747 // supplied parameters, not all parameters required)
748 PrintF("(this=");
749 frame->receiver()->MiniPrint();
750 const int length = frame->ComputeParametersCount();
751 for (int i = 0; i < length; i++) {
752 PrintF(", ");
753 frame->GetParameter(i)->MiniPrint();
754 }
755 PrintF(")");
756 }
757 break;
758 }
759 it.Advance();
760 }
761 }
762
763
714 void FrameSummary::Print() { 764 void FrameSummary::Print() {
715 PrintF("receiver: "); 765 PrintF("receiver: ");
716 receiver_->ShortPrint(); 766 receiver_->ShortPrint();
717 PrintF("\nfunction: "); 767 PrintF("\nfunction: ");
718 function_->shared()->DebugName()->ShortPrint(); 768 function_->shared()->DebugName()->ShortPrint();
719 PrintF("\ncode: "); 769 PrintF("\ncode: ");
720 code_->ShortPrint(); 770 code_->ShortPrint();
721 if (code_->kind() == Code::FUNCTION) PrintF(" NON-OPT"); 771 if (code_->kind() == Code::FUNCTION) PrintF(" NON-OPT");
722 if (code_->kind() == Code::OPTIMIZED_FUNCTION) PrintF(" OPT"); 772 if (code_->kind() == Code::OPTIMIZED_FUNCTION) PrintF(" OPT");
723 PrintF("\npc: %d\n", offset_); 773 PrintF("\npc: %d\n", offset_);
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
1319 ZoneList<StackFrame*> list(10); 1369 ZoneList<StackFrame*> list(10);
1320 for (StackFrameIterator it; !it.done(); it.Advance()) { 1370 for (StackFrameIterator it; !it.done(); it.Advance()) {
1321 StackFrame* frame = AllocateFrameCopy(it.frame()); 1371 StackFrame* frame = AllocateFrameCopy(it.frame());
1322 list.Add(frame); 1372 list.Add(frame);
1323 } 1373 }
1324 return list.ToVector(); 1374 return list.ToVector();
1325 } 1375 }
1326 1376
1327 1377
1328 } } // namespace v8::internal 1378 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698