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

Side by Side Diff: src/execution.cc

Issue 9965101: Don't crash on stack overflow entering the debugger. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: review feedback Created 8 years, 8 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
« no previous file with comments | « src/debug.cc ('k') | test/mjsunit/regress/regress-119429.js » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 808 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 // Just continue if breaks are disabled. 819 // Just continue if breaks are disabled.
820 if (isolate->debug()->disable_break()) { 820 if (isolate->debug()->disable_break()) {
821 return isolate->heap()->undefined_value(); 821 return isolate->heap()->undefined_value();
822 } 822 }
823 823
824 // Ignore debug break during bootstrapping. 824 // Ignore debug break during bootstrapping.
825 if (isolate->bootstrapper()->IsActive()) { 825 if (isolate->bootstrapper()->IsActive()) {
826 return isolate->heap()->undefined_value(); 826 return isolate->heap()->undefined_value();
827 } 827 }
828 828
829 StackLimitCheck check(isolate);
830 if (check.HasOverflowed()) {
831 return isolate->heap()->undefined_value();
832 }
833
829 { 834 {
830 JavaScriptFrameIterator it(isolate); 835 JavaScriptFrameIterator it(isolate);
831 ASSERT(!it.done()); 836 ASSERT(!it.done());
832 Object* fun = it.frame()->function(); 837 Object* fun = it.frame()->function();
833 if (fun && fun->IsJSFunction()) { 838 if (fun && fun->IsJSFunction()) {
834 // Don't stop in builtin functions. 839 // Don't stop in builtin functions.
835 if (JSFunction::cast(fun)->IsBuiltin()) { 840 if (JSFunction::cast(fun)->IsBuiltin()) {
836 return isolate->heap()->undefined_value(); 841 return isolate->heap()->undefined_value();
837 } 842 }
838 GlobalObject* global = JSFunction::cast(fun)->context()->global(); 843 GlobalObject* global = JSFunction::cast(fun)->context()->global();
(...skipping 16 matching lines...) Expand all
855 860
856 // Return to continue execution. 861 // Return to continue execution.
857 return isolate->heap()->undefined_value(); 862 return isolate->heap()->undefined_value();
858 } 863 }
859 864
860 void Execution::ProcessDebugMessages(bool debug_command_only) { 865 void Execution::ProcessDebugMessages(bool debug_command_only) {
861 Isolate* isolate = Isolate::Current(); 866 Isolate* isolate = Isolate::Current();
862 // Clear the debug command request flag. 867 // Clear the debug command request flag.
863 isolate->stack_guard()->Continue(DEBUGCOMMAND); 868 isolate->stack_guard()->Continue(DEBUGCOMMAND);
864 869
870 StackLimitCheck check(isolate);
871 if (check.HasOverflowed()) {
872 return;
873 }
874
865 HandleScope scope(isolate); 875 HandleScope scope(isolate);
866 // Enter the debugger. Just continue if we fail to enter the debugger. 876 // Enter the debugger. Just continue if we fail to enter the debugger.
867 EnterDebugger debugger; 877 EnterDebugger debugger;
868 if (debugger.FailedToEnter()) { 878 if (debugger.FailedToEnter()) {
869 return; 879 return;
870 } 880 }
871 881
872 // Notify the debug event listeners. Indicate auto continue if the break was 882 // Notify the debug event listeners. Indicate auto continue if the break was
873 // a debug command break. 883 // a debug command break.
874 isolate->debugger()->OnDebugBreak(isolate->factory()->undefined_value(), 884 isolate->debugger()->OnDebugBreak(isolate->factory()->undefined_value(),
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 } 920 }
911 if (stack_guard->IsInterrupted()) { 921 if (stack_guard->IsInterrupted()) {
912 stack_guard->Continue(INTERRUPT); 922 stack_guard->Continue(INTERRUPT);
913 return isolate->StackOverflow(); 923 return isolate->StackOverflow();
914 } 924 }
915 return isolate->heap()->undefined_value(); 925 return isolate->heap()->undefined_value();
916 } 926 }
917 927
918 928
919 } } // namespace v8::internal 929 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/debug.cc ('k') | test/mjsunit/regress/regress-119429.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698