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

Side by Side Diff: src/frames.cc

Issue 8404030: Version 3.7.1 (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 9 years, 1 month 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/frames.h ('k') | src/full-codegen.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 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(FILE* file,
715 bool print_args,
716 bool print_line_number) {
717 // constructor calls
718 HandleScope scope;
719 AssertNoAllocation no_allocation;
720 JavaScriptFrameIterator it;
721 while (!it.done()) {
722 if (it.frame()->is_java_script()) {
723 JavaScriptFrame* frame = it.frame();
724 if (frame->IsConstructor()) PrintF(file, "new ");
725 // function name
726 Object* fun = frame->function();
727 if (fun->IsJSFunction()) {
728 SharedFunctionInfo* shared = JSFunction::cast(fun)->shared();
729 shared->DebugName()->ShortPrint(file);
730 if (print_line_number) {
731 Address pc = frame->pc();
732 Code* code = Code::cast(
733 v8::internal::Isolate::Current()->heap()->FindCodeObject(pc));
734 int source_pos = code->SourcePosition(pc);
735 Object* maybe_script = shared->script();
736 if (maybe_script->IsScript()) {
737 Handle<Script> script(Script::cast(maybe_script));
738 int line = GetScriptLineNumberSafe(script, source_pos) + 1;
739 Object* script_name_raw = script->name();
740 if (script_name_raw->IsString()) {
741 String* script_name = String::cast(script->name());
742 SmartArrayPointer<char> c_script_name =
743 script_name->ToCString(DISALLOW_NULLS,
744 ROBUST_STRING_TRAVERSAL);
745 PrintF(file, " at %s:%d", *c_script_name, line);
746 } else {
747 PrintF(file, "at <unknown>:%d", line);
748 }
749 } else {
750 PrintF(file, " at <unknown>:<unknown>");
751 }
752 }
753 } else {
754 fun->ShortPrint(file);
755 }
756
757 if (print_args) {
758 // function arguments
759 // (we are intentionally only printing the actually
760 // supplied parameters, not all parameters required)
761 PrintF(file, "(this=");
762 frame->receiver()->ShortPrint(file);
763 const int length = frame->ComputeParametersCount();
764 for (int i = 0; i < length; i++) {
765 PrintF(file, ", ");
766 frame->GetParameter(i)->ShortPrint(file);
767 }
768 PrintF(file, ")");
769 }
770 break;
771 }
772 it.Advance();
773 }
774 }
775
776
714 void FrameSummary::Print() { 777 void FrameSummary::Print() {
715 PrintF("receiver: "); 778 PrintF("receiver: ");
716 receiver_->ShortPrint(); 779 receiver_->ShortPrint();
717 PrintF("\nfunction: "); 780 PrintF("\nfunction: ");
718 function_->shared()->DebugName()->ShortPrint(); 781 function_->shared()->DebugName()->ShortPrint();
719 PrintF("\ncode: "); 782 PrintF("\ncode: ");
720 code_->ShortPrint(); 783 code_->ShortPrint();
721 if (code_->kind() == Code::FUNCTION) PrintF(" NON-OPT"); 784 if (code_->kind() == Code::FUNCTION) PrintF(" NON-OPT");
722 if (code_->kind() == Code::OPTIMIZED_FUNCTION) PrintF(" OPT"); 785 if (code_->kind() == Code::OPTIMIZED_FUNCTION) PrintF(" OPT");
723 PrintF("\npc: %d\n", offset_); 786 PrintF("\npc: %d\n", offset_);
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
1319 ZoneList<StackFrame*> list(10); 1382 ZoneList<StackFrame*> list(10);
1320 for (StackFrameIterator it; !it.done(); it.Advance()) { 1383 for (StackFrameIterator it; !it.done(); it.Advance()) {
1321 StackFrame* frame = AllocateFrameCopy(it.frame()); 1384 StackFrame* frame = AllocateFrameCopy(it.frame());
1322 list.Add(frame); 1385 list.Add(frame);
1323 } 1386 }
1324 return list.ToVector(); 1387 return list.ToVector();
1325 } 1388 }
1326 1389
1327 1390
1328 } } // namespace v8::internal 1391 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/frames.h ('k') | src/full-codegen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698