| OLD | NEW |
| 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 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 716 bool print_line_number) { | 716 bool print_line_number) { |
| 717 // constructor calls | 717 // constructor calls |
| 718 HandleScope scope; | 718 HandleScope scope; |
| 719 AssertNoAllocation no_allocation; | 719 AssertNoAllocation no_allocation; |
| 720 JavaScriptFrameIterator it; | 720 JavaScriptFrameIterator it; |
| 721 while (!it.done()) { | 721 while (!it.done()) { |
| 722 if (it.frame()->is_java_script()) { | 722 if (it.frame()->is_java_script()) { |
| 723 JavaScriptFrame* frame = it.frame(); | 723 JavaScriptFrame* frame = it.frame(); |
| 724 if (frame->IsConstructor()) PrintF(file, "new "); | 724 if (frame->IsConstructor()) PrintF(file, "new "); |
| 725 // function name | 725 // function name |
| 726 Object* fun = frame->function(); | 726 Object* maybe_fun = frame->function(); |
| 727 if (fun->IsJSFunction()) { | 727 if (maybe_fun->IsJSFunction()) { |
| 728 SharedFunctionInfo* shared = JSFunction::cast(fun)->shared(); | 728 JSFunction* fun = JSFunction::cast(maybe_fun); |
| 729 shared->DebugName()->ShortPrint(file); | 729 fun->PrintName(); |
| 730 Code* js_code = frame->unchecked_code(); |
| 731 Address pc = frame->pc(); |
| 732 int code_offset = |
| 733 static_cast<int>(pc - js_code->instruction_start()); |
| 734 PrintF("+%d", code_offset); |
| 735 SharedFunctionInfo* shared = fun->shared(); |
| 730 if (print_line_number) { | 736 if (print_line_number) { |
| 731 Address pc = frame->pc(); | |
| 732 Code* code = Code::cast( | 737 Code* code = Code::cast( |
| 733 v8::internal::Isolate::Current()->heap()->FindCodeObject(pc)); | 738 v8::internal::Isolate::Current()->heap()->FindCodeObject(pc)); |
| 734 int source_pos = code->SourcePosition(pc); | 739 int source_pos = code->SourcePosition(pc); |
| 735 Object* maybe_script = shared->script(); | 740 Object* maybe_script = shared->script(); |
| 736 if (maybe_script->IsScript()) { | 741 if (maybe_script->IsScript()) { |
| 737 Handle<Script> script(Script::cast(maybe_script)); | 742 Handle<Script> script(Script::cast(maybe_script)); |
| 738 int line = GetScriptLineNumberSafe(script, source_pos) + 1; | 743 int line = GetScriptLineNumberSafe(script, source_pos) + 1; |
| 739 Object* script_name_raw = script->name(); | 744 Object* script_name_raw = script->name(); |
| 740 if (script_name_raw->IsString()) { | 745 if (script_name_raw->IsString()) { |
| 741 String* script_name = String::cast(script->name()); | 746 String* script_name = String::cast(script->name()); |
| 742 SmartArrayPointer<char> c_script_name = | 747 SmartArrayPointer<char> c_script_name = |
| 743 script_name->ToCString(DISALLOW_NULLS, | 748 script_name->ToCString(DISALLOW_NULLS, |
| 744 ROBUST_STRING_TRAVERSAL); | 749 ROBUST_STRING_TRAVERSAL); |
| 745 PrintF(file, " at %s:%d", *c_script_name, line); | 750 PrintF(file, " at %s:%d", *c_script_name, line); |
| 746 } else { | 751 } else { |
| 747 PrintF(file, "at <unknown>:%d", line); | 752 PrintF(file, "at <unknown>:%d", line); |
| 748 } | 753 } |
| 749 } else { | 754 } else { |
| 750 PrintF(file, " at <unknown>:<unknown>"); | 755 PrintF(file, " at <unknown>:<unknown>"); |
| 751 } | 756 } |
| 752 } | 757 } |
| 753 } else { | 758 } else { |
| 754 fun->ShortPrint(file); | 759 PrintF("<unknown>"); |
| 755 } | 760 } |
| 756 | 761 |
| 757 if (print_args) { | 762 if (print_args) { |
| 758 // function arguments | 763 // function arguments |
| 759 // (we are intentionally only printing the actually | 764 // (we are intentionally only printing the actually |
| 760 // supplied parameters, not all parameters required) | 765 // supplied parameters, not all parameters required) |
| 761 PrintF(file, "(this="); | 766 PrintF(file, "(this="); |
| 762 frame->receiver()->ShortPrint(file); | 767 frame->receiver()->ShortPrint(file); |
| 763 const int length = frame->ComputeParametersCount(); | 768 const int length = frame->ComputeParametersCount(); |
| 764 for (int i = 0; i < length; i++) { | 769 for (int i = 0; i < length; i++) { |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1381 ZoneList<StackFrame*> list(10); | 1386 ZoneList<StackFrame*> list(10); |
| 1382 for (StackFrameIterator it; !it.done(); it.Advance()) { | 1387 for (StackFrameIterator it; !it.done(); it.Advance()) { |
| 1383 StackFrame* frame = AllocateFrameCopy(it.frame()); | 1388 StackFrame* frame = AllocateFrameCopy(it.frame()); |
| 1384 list.Add(frame); | 1389 list.Add(frame); |
| 1385 } | 1390 } |
| 1386 return list.ToVector(); | 1391 return list.ToVector(); |
| 1387 } | 1392 } |
| 1388 | 1393 |
| 1389 | 1394 |
| 1390 } } // namespace v8::internal | 1395 } } // namespace v8::internal |
| OLD | NEW |