OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 | 661 |
662 | 662 |
663 Object* Top::PromoteScheduledException() { | 663 Object* Top::PromoteScheduledException() { |
664 Object* thrown = scheduled_exception(); | 664 Object* thrown = scheduled_exception(); |
665 clear_scheduled_exception(); | 665 clear_scheduled_exception(); |
666 // Re-throw the exception to avoid getting repeated error reporting. | 666 // Re-throw the exception to avoid getting repeated error reporting. |
667 return ReThrow(thrown); | 667 return ReThrow(thrown); |
668 } | 668 } |
669 | 669 |
670 | 670 |
671 // NOTE: The stack trace frame iterator is an iterator that only | |
672 // traverse proper JavaScript frames; that is JavaScript frames that | |
673 // have proper JavaScript functions. This excludes the problematic | |
674 // functions in runtime.js. | |
675 class StackTraceFrameIterator: public JavaScriptFrameIterator { | |
676 public: | |
677 StackTraceFrameIterator() { | |
678 if (!done() && !frame()->function()->IsJSFunction()) Advance(); | |
679 } | |
680 | |
681 void Advance() { | |
682 while (true) { | |
683 JavaScriptFrameIterator::Advance(); | |
684 if (done()) return; | |
685 if (frame()->function()->IsJSFunction()) return; | |
686 } | |
687 } | |
688 }; | |
689 | |
690 | |
691 void Top::PrintCurrentStackTrace(FILE* out) { | 671 void Top::PrintCurrentStackTrace(FILE* out) { |
692 StackTraceFrameIterator it; | 672 StackTraceFrameIterator it; |
693 while (!it.done()) { | 673 while (!it.done()) { |
694 HandleScope scope; | 674 HandleScope scope; |
695 // Find code position if recorded in relocation info. | 675 // Find code position if recorded in relocation info. |
696 JavaScriptFrame* frame = it.frame(); | 676 JavaScriptFrame* frame = it.frame(); |
697 int pos = frame->code()->SourcePosition(frame->pc()); | 677 int pos = frame->code()->SourcePosition(frame->pc()); |
698 Handle<Object> pos_obj(Smi::FromInt(pos)); | 678 Handle<Object> pos_obj(Smi::FromInt(pos)); |
699 // Fetch function and receiver. | 679 // Fetch function and receiver. |
700 Handle<JSFunction> fun(JSFunction::cast(frame->function())); | 680 Handle<JSFunction> fun(JSFunction::cast(frame->function())); |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
957 Top::break_access_->Lock(); | 937 Top::break_access_->Lock(); |
958 } | 938 } |
959 | 939 |
960 | 940 |
961 ExecutionAccess::~ExecutionAccess() { | 941 ExecutionAccess::~ExecutionAccess() { |
962 Top::break_access_->Unlock(); | 942 Top::break_access_->Unlock(); |
963 } | 943 } |
964 | 944 |
965 | 945 |
966 } } // namespace v8::internal | 946 } } // namespace v8::internal |
OLD | NEW |