| OLD | NEW |
| 1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-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 5886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5897 // sent. | 5897 // sent. |
| 5898 CHECK_EQ(1, after_compile_message_count); | 5898 CHECK_EQ(1, after_compile_message_count); |
| 5899 | 5899 |
| 5900 ClearBreakPointFromJS(sbp1); | 5900 ClearBreakPointFromJS(sbp1); |
| 5901 ClearBreakPointFromJS(sbp2); | 5901 ClearBreakPointFromJS(sbp2); |
| 5902 v8::Debug::SetMessageHandler2(NULL); | 5902 v8::Debug::SetMessageHandler2(NULL); |
| 5903 } | 5903 } |
| 5904 | 5904 |
| 5905 | 5905 |
| 5906 static void BreakMessageHandler(const v8::Debug::Message& message) { | 5906 static void BreakMessageHandler(const v8::Debug::Message& message) { |
| 5907 i::Isolate* isolate = i::Isolate::Current(); |
| 5907 if (message.IsEvent() && message.GetEvent() == v8::Break) { | 5908 if (message.IsEvent() && message.GetEvent() == v8::Break) { |
| 5908 // Count the number of breaks. | 5909 // Count the number of breaks. |
| 5909 break_point_hit_count++; | 5910 break_point_hit_count++; |
| 5910 | 5911 |
| 5911 v8::HandleScope scope; | 5912 v8::HandleScope scope; |
| 5912 v8::Handle<v8::String> json = message.GetJSON(); | 5913 v8::Handle<v8::String> json = message.GetJSON(); |
| 5913 | 5914 |
| 5914 SendContinueCommand(); | 5915 SendContinueCommand(); |
| 5915 } else if (message.IsEvent() && message.GetEvent() == v8::AfterCompile) { | 5916 } else if (message.IsEvent() && message.GetEvent() == v8::AfterCompile) { |
| 5916 v8::HandleScope scope; | 5917 v8::HandleScope scope; |
| 5917 | 5918 |
| 5918 bool is_debug_break = i::StackGuard::IsDebugBreak(); | 5919 bool is_debug_break = isolate->stack_guard()->IsDebugBreak(); |
| 5919 // Force DebugBreak flag while serializer is working. | 5920 // Force DebugBreak flag while serializer is working. |
| 5920 i::StackGuard::DebugBreak(); | 5921 isolate->stack_guard()->DebugBreak(); |
| 5921 | 5922 |
| 5922 // Force serialization to trigger some internal JS execution. | 5923 // Force serialization to trigger some internal JS execution. |
| 5923 v8::Handle<v8::String> json = message.GetJSON(); | 5924 v8::Handle<v8::String> json = message.GetJSON(); |
| 5924 | 5925 |
| 5925 // Restore previous state. | 5926 // Restore previous state. |
| 5926 if (is_debug_break) { | 5927 if (is_debug_break) { |
| 5927 i::StackGuard::DebugBreak(); | 5928 isolate->stack_guard()->DebugBreak(); |
| 5928 } else { | 5929 } else { |
| 5929 i::StackGuard::Continue(i::DEBUGBREAK); | 5930 isolate->stack_guard()->Continue(i::DEBUGBREAK); |
| 5930 } | 5931 } |
| 5931 } | 5932 } |
| 5932 } | 5933 } |
| 5933 | 5934 |
| 5934 | 5935 |
| 5935 // Test that if DebugBreak is forced it is ignored when code from | 5936 // Test that if DebugBreak is forced it is ignored when code from |
| 5936 // debug-delay.js is executed. | 5937 // debug-delay.js is executed. |
| 5937 TEST(NoDebugBreakInAfterCompileMessageHandler) { | 5938 TEST(NoDebugBreakInAfterCompileMessageHandler) { |
| 5938 v8::HandleScope scope; | 5939 v8::HandleScope scope; |
| 5939 DebugLocalContext env; | 5940 DebugLocalContext env; |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6216 expected_context = v8::Context::New(); | 6217 expected_context = v8::Context::New(); |
| 6217 v8::Context::Scope context_scope(expected_context); | 6218 v8::Context::Scope context_scope(expected_context); |
| 6218 v8::Script::Compile(v8::String::New("(function(){debugger;})();"))->Run(); | 6219 v8::Script::Compile(v8::String::New("(function(){debugger;})();"))->Run(); |
| 6219 expected_context.Dispose(); | 6220 expected_context.Dispose(); |
| 6220 expected_context.Clear(); | 6221 expected_context.Clear(); |
| 6221 v8::Debug::SetDebugEventListener(NULL); | 6222 v8::Debug::SetDebugEventListener(NULL); |
| 6222 expected_context_data = v8::Handle<v8::Value>(); | 6223 expected_context_data = v8::Handle<v8::Value>(); |
| 6223 CheckDebuggerUnloaded(); | 6224 CheckDebuggerUnloaded(); |
| 6224 } | 6225 } |
| 6225 | 6226 |
| OLD | NEW |