| 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 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 // tests. | 642 // tests. |
| 643 char last_script_name_hit[80]; | 643 char last_script_name_hit[80]; |
| 644 char last_script_data_hit[80]; | 644 char last_script_data_hit[80]; |
| 645 | 645 |
| 646 // Global variables to store the last source position - used by some tests. | 646 // Global variables to store the last source position - used by some tests. |
| 647 int last_source_line = -1; | 647 int last_source_line = -1; |
| 648 int last_source_column = -1; | 648 int last_source_column = -1; |
| 649 | 649 |
| 650 // Debug event handler which counts the break points which have been hit. | 650 // Debug event handler which counts the break points which have been hit. |
| 651 int break_point_hit_count = 0; | 651 int break_point_hit_count = 0; |
| 652 int break_point_hit_count_deoptimize = 0; |
| 652 static void DebugEventBreakPointHitCount(v8::DebugEvent event, | 653 static void DebugEventBreakPointHitCount(v8::DebugEvent event, |
| 653 v8::Handle<v8::Object> exec_state, | 654 v8::Handle<v8::Object> exec_state, |
| 654 v8::Handle<v8::Object> event_data, | 655 v8::Handle<v8::Object> event_data, |
| 655 v8::Handle<v8::Value> data) { | 656 v8::Handle<v8::Value> data) { |
| 656 Debug* debug = v8::internal::Isolate::Current()->debug(); | 657 Debug* debug = v8::internal::Isolate::Current()->debug(); |
| 657 // When hitting a debug event listener there must be a break set. | 658 // When hitting a debug event listener there must be a break set. |
| 658 CHECK_NE(debug->break_id(), 0); | 659 CHECK_NE(debug->break_id(), 0); |
| 659 | 660 |
| 660 // Count the number of breaks. | 661 // Count the number of breaks. |
| 661 if (event == v8::Break) { | 662 if (event == v8::Break) { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 argc, argv); | 719 argc, argv); |
| 719 if (result->IsUndefined()) { | 720 if (result->IsUndefined()) { |
| 720 last_script_data_hit[0] = '\0'; | 721 last_script_data_hit[0] = '\0'; |
| 721 } else { | 722 } else { |
| 722 result = result->ToString(); | 723 result = result->ToString(); |
| 723 CHECK(result->IsString()); | 724 CHECK(result->IsString()); |
| 724 v8::Handle<v8::String> script_data(result->ToString()); | 725 v8::Handle<v8::String> script_data(result->ToString()); |
| 725 script_data->WriteAscii(last_script_data_hit); | 726 script_data->WriteAscii(last_script_data_hit); |
| 726 } | 727 } |
| 727 } | 728 } |
| 729 |
| 730 // Perform a full deoptimization when the specified number of |
| 731 // breaks have been hit. |
| 732 if (break_point_hit_count == break_point_hit_count_deoptimize) { |
| 733 i::Deoptimizer::DeoptimizeAll(); |
| 734 } |
| 728 } else if (event == v8::AfterCompile && !compiled_script_data.IsEmpty()) { | 735 } else if (event == v8::AfterCompile && !compiled_script_data.IsEmpty()) { |
| 729 const int argc = 1; | 736 const int argc = 1; |
| 730 v8::Handle<v8::Value> argv[argc] = { event_data }; | 737 v8::Handle<v8::Value> argv[argc] = { event_data }; |
| 731 v8::Handle<v8::Value> result = compiled_script_data->Call(exec_state, | 738 v8::Handle<v8::Value> result = compiled_script_data->Call(exec_state, |
| 732 argc, argv); | 739 argc, argv); |
| 733 if (result->IsUndefined()) { | 740 if (result->IsUndefined()) { |
| 734 last_script_data_hit[0] = '\0'; | 741 last_script_data_hit[0] = '\0'; |
| 735 } else { | 742 } else { |
| 736 result = result->ToString(); | 743 result = result->ToString(); |
| 737 CHECK(result->IsString()); | 744 CHECK(result->IsString()); |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 976 v8::Handle<v8::Value> data) { | 983 v8::Handle<v8::Value> data) { |
| 977 v8::internal::Debug* debug = v8::internal::Isolate::Current()->debug(); | 984 v8::internal::Debug* debug = v8::internal::Isolate::Current()->debug(); |
| 978 // When hitting a debug event listener there must be a break set. | 985 // When hitting a debug event listener there must be a break set. |
| 979 CHECK_NE(debug->break_id(), 0); | 986 CHECK_NE(debug->break_id(), 0); |
| 980 | 987 |
| 981 if (event == v8::Break) { | 988 if (event == v8::Break) { |
| 982 if (break_point_hit_count < max_break_point_hit_count) { | 989 if (break_point_hit_count < max_break_point_hit_count) { |
| 983 // Count the number of breaks. | 990 // Count the number of breaks. |
| 984 break_point_hit_count++; | 991 break_point_hit_count++; |
| 985 | 992 |
| 993 // Collect the JavsScript stack height if the function frame_count is |
| 994 // compiled. |
| 995 if (!frame_count.IsEmpty()) { |
| 996 static const int kArgc = 1; |
| 997 v8::Handle<v8::Value> argv[kArgc] = { exec_state }; |
| 998 // Using exec_state as receiver is just to have a receiver. |
| 999 v8::Handle<v8::Value> result = |
| 1000 frame_count->Call(exec_state, kArgc, argv); |
| 1001 last_js_stack_height = result->Int32Value(); |
| 1002 } |
| 1003 |
| 986 // Set the break flag again to come back here as soon as possible. | 1004 // Set the break flag again to come back here as soon as possible. |
| 987 v8::Debug::DebugBreak(); | 1005 v8::Debug::DebugBreak(); |
| 1006 |
| 988 } else if (terminate_after_max_break_point_hit) { | 1007 } else if (terminate_after_max_break_point_hit) { |
| 989 // Terminate execution after the last break if requested. | 1008 // Terminate execution after the last break if requested. |
| 990 v8::V8::TerminateExecution(); | 1009 v8::V8::TerminateExecution(); |
| 991 } | 1010 } |
| 1011 |
| 1012 // Perform a full deoptimization when the specified number of |
| 1013 // breaks have been hit. |
| 1014 if (break_point_hit_count == break_point_hit_count_deoptimize) { |
| 1015 i::Deoptimizer::DeoptimizeAll(); |
| 1016 } |
| 992 } | 1017 } |
| 993 } | 1018 } |
| 994 | 1019 |
| 995 | 1020 |
| 996 // --- M e s s a g e C a l l b a c k | 1021 // --- M e s s a g e C a l l b a c k |
| 997 | 1022 |
| 998 | 1023 |
| 999 // Message callback which counts the number of messages. | 1024 // Message callback which counts the number of messages. |
| 1000 int message_callback_count = 0; | 1025 int message_callback_count = 0; |
| 1001 | 1026 |
| (...skipping 3719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4721 /* Tests the message queues that hold debugger commands and | 4746 /* Tests the message queues that hold debugger commands and |
| 4722 * response messages to the debugger. Fills queues and makes | 4747 * response messages to the debugger. Fills queues and makes |
| 4723 * them grow. | 4748 * them grow. |
| 4724 */ | 4749 */ |
| 4725 Barriers message_queue_barriers; | 4750 Barriers message_queue_barriers; |
| 4726 | 4751 |
| 4727 // This is the debugger thread, that executes no v8 calls except | 4752 // This is the debugger thread, that executes no v8 calls except |
| 4728 // placing JSON debugger commands in the queue. | 4753 // placing JSON debugger commands in the queue. |
| 4729 class MessageQueueDebuggerThread : public v8::internal::Thread { | 4754 class MessageQueueDebuggerThread : public v8::internal::Thread { |
| 4730 public: | 4755 public: |
| 4731 explicit MessageQueueDebuggerThread(v8::internal::Isolate* isolate) | 4756 MessageQueueDebuggerThread() |
| 4732 : Thread(isolate, "MessageQueueDebuggerThread") { } | 4757 : Thread("MessageQueueDebuggerThread") { } |
| 4733 void Run(); | 4758 void Run(); |
| 4734 }; | 4759 }; |
| 4735 | 4760 |
| 4736 static void MessageHandler(const uint16_t* message, int length, | 4761 static void MessageHandler(const uint16_t* message, int length, |
| 4737 v8::Debug::ClientData* client_data) { | 4762 v8::Debug::ClientData* client_data) { |
| 4738 static char print_buffer[1000]; | 4763 static char print_buffer[1000]; |
| 4739 Utf16ToAscii(message, length, print_buffer); | 4764 Utf16ToAscii(message, length, print_buffer); |
| 4740 if (IsBreakEventMessage(print_buffer)) { | 4765 if (IsBreakEventMessage(print_buffer)) { |
| 4741 // Lets test script wait until break occurs to send commands. | 4766 // Lets test script wait until break occurs to send commands. |
| 4742 // Signals when a break is reported. | 4767 // Signals when a break is reported. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4825 // Run after 2 responses. | 4850 // Run after 2 responses. |
| 4826 for (int i = 0; i < 2 ; ++i) { | 4851 for (int i = 0; i < 2 ; ++i) { |
| 4827 message_queue_barriers.semaphore_1->Signal(); | 4852 message_queue_barriers.semaphore_1->Signal(); |
| 4828 } | 4853 } |
| 4829 // Main thread continues running source_3 to end, waits for this thread. | 4854 // Main thread continues running source_3 to end, waits for this thread. |
| 4830 } | 4855 } |
| 4831 | 4856 |
| 4832 | 4857 |
| 4833 // This thread runs the v8 engine. | 4858 // This thread runs the v8 engine. |
| 4834 TEST(MessageQueues) { | 4859 TEST(MessageQueues) { |
| 4835 MessageQueueDebuggerThread message_queue_debugger_thread( | 4860 MessageQueueDebuggerThread message_queue_debugger_thread; |
| 4836 i::Isolate::Current()); | |
| 4837 | 4861 |
| 4838 // Create a V8 environment | 4862 // Create a V8 environment |
| 4839 v8::HandleScope scope; | 4863 v8::HandleScope scope; |
| 4840 DebugLocalContext env; | 4864 DebugLocalContext env; |
| 4841 message_queue_barriers.Initialize(); | 4865 message_queue_barriers.Initialize(); |
| 4842 v8::Debug::SetMessageHandler(MessageHandler); | 4866 v8::Debug::SetMessageHandler(MessageHandler); |
| 4843 message_queue_debugger_thread.Start(); | 4867 message_queue_debugger_thread.Start(); |
| 4844 | 4868 |
| 4845 const char* source_1 = "a = 3; b = 4; c = new Object(); c.d = 5;"; | 4869 const char* source_1 = "a = 3; b = 4; c = new Object(); c.d = 5;"; |
| 4846 const char* source_2 = "e = 17;"; | 4870 const char* source_2 = "e = 17;"; |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4973 /* This test interrupts a running infinite loop that is | 4997 /* This test interrupts a running infinite loop that is |
| 4974 * occupying the v8 thread by a break command from the | 4998 * occupying the v8 thread by a break command from the |
| 4975 * debugger thread. It then changes the value of a | 4999 * debugger thread. It then changes the value of a |
| 4976 * global object, to make the loop terminate. | 5000 * global object, to make the loop terminate. |
| 4977 */ | 5001 */ |
| 4978 | 5002 |
| 4979 Barriers threaded_debugging_barriers; | 5003 Barriers threaded_debugging_barriers; |
| 4980 | 5004 |
| 4981 class V8Thread : public v8::internal::Thread { | 5005 class V8Thread : public v8::internal::Thread { |
| 4982 public: | 5006 public: |
| 4983 explicit V8Thread(v8::internal::Isolate* isolate) | 5007 V8Thread() : Thread("V8Thread") { } |
| 4984 : Thread(isolate, "V8Thread") { } | |
| 4985 void Run(); | 5008 void Run(); |
| 4986 }; | 5009 }; |
| 4987 | 5010 |
| 4988 class DebuggerThread : public v8::internal::Thread { | 5011 class DebuggerThread : public v8::internal::Thread { |
| 4989 public: | 5012 public: |
| 4990 explicit DebuggerThread(v8::internal::Isolate* isolate) | 5013 DebuggerThread() : Thread("DebuggerThread") { } |
| 4991 : Thread(isolate, "DebuggerThread") { } | |
| 4992 void Run(); | 5014 void Run(); |
| 4993 }; | 5015 }; |
| 4994 | 5016 |
| 4995 | 5017 |
| 4996 static v8::Handle<v8::Value> ThreadedAtBarrier1(const v8::Arguments& args) { | 5018 static v8::Handle<v8::Value> ThreadedAtBarrier1(const v8::Arguments& args) { |
| 4997 threaded_debugging_barriers.barrier_1.Wait(); | 5019 threaded_debugging_barriers.barrier_1.Wait(); |
| 4998 return v8::Undefined(); | 5020 return v8::Undefined(); |
| 4999 } | 5021 } |
| 5000 | 5022 |
| 5001 | 5023 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 5025 " while ( flag == true ) {\n" | 5047 " while ( flag == true ) {\n" |
| 5026 " if ( x == 1 ) {\n" | 5048 " if ( x == 1 ) {\n" |
| 5027 " ThreadedAtBarrier1();\n" | 5049 " ThreadedAtBarrier1();\n" |
| 5028 " }\n" | 5050 " }\n" |
| 5029 " x = x + 1;\n" | 5051 " x = x + 1;\n" |
| 5030 " }\n" | 5052 " }\n" |
| 5031 "}\n" | 5053 "}\n" |
| 5032 "\n" | 5054 "\n" |
| 5033 "foo();\n"; | 5055 "foo();\n"; |
| 5034 | 5056 |
| 5057 v8::V8::Initialize(); |
| 5035 v8::HandleScope scope; | 5058 v8::HandleScope scope; |
| 5036 DebugLocalContext env; | 5059 DebugLocalContext env; |
| 5037 v8::Debug::SetMessageHandler2(&ThreadedMessageHandler); | 5060 v8::Debug::SetMessageHandler2(&ThreadedMessageHandler); |
| 5038 v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New(); | 5061 v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New(); |
| 5039 global_template->Set(v8::String::New("ThreadedAtBarrier1"), | 5062 global_template->Set(v8::String::New("ThreadedAtBarrier1"), |
| 5040 v8::FunctionTemplate::New(ThreadedAtBarrier1)); | 5063 v8::FunctionTemplate::New(ThreadedAtBarrier1)); |
| 5041 v8::Handle<v8::Context> context = v8::Context::New(NULL, global_template); | 5064 v8::Handle<v8::Context> context = v8::Context::New(NULL, global_template); |
| 5042 v8::Context::Scope context_scope(context); | 5065 v8::Context::Scope context_scope(context); |
| 5043 | 5066 |
| 5044 CompileRun(source); | 5067 CompileRun(source); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 5058 | 5081 |
| 5059 threaded_debugging_barriers.barrier_1.Wait(); | 5082 threaded_debugging_barriers.barrier_1.Wait(); |
| 5060 v8::Debug::DebugBreak(); | 5083 v8::Debug::DebugBreak(); |
| 5061 threaded_debugging_barriers.barrier_2.Wait(); | 5084 threaded_debugging_barriers.barrier_2.Wait(); |
| 5062 v8::Debug::SendCommand(buffer, AsciiToUtf16(command_1, buffer)); | 5085 v8::Debug::SendCommand(buffer, AsciiToUtf16(command_1, buffer)); |
| 5063 v8::Debug::SendCommand(buffer, AsciiToUtf16(command_2, buffer)); | 5086 v8::Debug::SendCommand(buffer, AsciiToUtf16(command_2, buffer)); |
| 5064 } | 5087 } |
| 5065 | 5088 |
| 5066 | 5089 |
| 5067 TEST(ThreadedDebugging) { | 5090 TEST(ThreadedDebugging) { |
| 5068 DebuggerThread debugger_thread(i::Isolate::Current()); | 5091 DebuggerThread debugger_thread; |
| 5069 V8Thread v8_thread(i::Isolate::Current()); | 5092 V8Thread v8_thread; |
| 5070 | 5093 |
| 5071 // Create a V8 environment | 5094 // Create a V8 environment |
| 5072 threaded_debugging_barriers.Initialize(); | 5095 threaded_debugging_barriers.Initialize(); |
| 5073 | 5096 |
| 5074 v8_thread.Start(); | 5097 v8_thread.Start(); |
| 5075 debugger_thread.Start(); | 5098 debugger_thread.Start(); |
| 5076 | 5099 |
| 5077 v8_thread.Join(); | 5100 v8_thread.Join(); |
| 5078 debugger_thread.Join(); | 5101 debugger_thread.Join(); |
| 5079 } | 5102 } |
| 5080 | 5103 |
| 5081 /* Test RecursiveBreakpoints */ | 5104 /* Test RecursiveBreakpoints */ |
| 5082 /* In this test, the debugger evaluates a function with a breakpoint, after | 5105 /* In this test, the debugger evaluates a function with a breakpoint, after |
| 5083 * hitting a breakpoint in another function. We do this with both values | 5106 * hitting a breakpoint in another function. We do this with both values |
| 5084 * of the flag enabling recursive breakpoints, and verify that the second | 5107 * of the flag enabling recursive breakpoints, and verify that the second |
| 5085 * breakpoint is hit when enabled, and missed when disabled. | 5108 * breakpoint is hit when enabled, and missed when disabled. |
| 5086 */ | 5109 */ |
| 5087 | 5110 |
| 5088 class BreakpointsV8Thread : public v8::internal::Thread { | 5111 class BreakpointsV8Thread : public v8::internal::Thread { |
| 5089 public: | 5112 public: |
| 5090 explicit BreakpointsV8Thread(v8::internal::Isolate* isolate) | 5113 BreakpointsV8Thread() : Thread("BreakpointsV8Thread") { } |
| 5091 : Thread(isolate, "BreakpointsV8Thread") { } | |
| 5092 void Run(); | 5114 void Run(); |
| 5093 }; | 5115 }; |
| 5094 | 5116 |
| 5095 class BreakpointsDebuggerThread : public v8::internal::Thread { | 5117 class BreakpointsDebuggerThread : public v8::internal::Thread { |
| 5096 public: | 5118 public: |
| 5097 explicit BreakpointsDebuggerThread(v8::internal::Isolate* isolate, | 5119 explicit BreakpointsDebuggerThread(bool global_evaluate) |
| 5098 bool global_evaluate) | 5120 : Thread("BreakpointsDebuggerThread"), |
| 5099 : Thread(isolate, "BreakpointsDebuggerThread"), | |
| 5100 global_evaluate_(global_evaluate) {} | 5121 global_evaluate_(global_evaluate) {} |
| 5101 void Run(); | 5122 void Run(); |
| 5102 | 5123 |
| 5103 private: | 5124 private: |
| 5104 bool global_evaluate_; | 5125 bool global_evaluate_; |
| 5105 }; | 5126 }; |
| 5106 | 5127 |
| 5107 | 5128 |
| 5108 Barriers* breakpoints_barriers; | 5129 Barriers* breakpoints_barriers; |
| 5109 int break_event_breakpoint_id; | 5130 int break_event_breakpoint_id; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 5139 " var x = 1;\n" | 5160 " var x = 1;\n" |
| 5140 " x = y_global;" | 5161 " x = y_global;" |
| 5141 " var z = 3;" | 5162 " var z = 3;" |
| 5142 " x += 100;\n" | 5163 " x += 100;\n" |
| 5143 " return x;\n" | 5164 " return x;\n" |
| 5144 "}\n" | 5165 "}\n" |
| 5145 "\n"; | 5166 "\n"; |
| 5146 const char* source_2 = "cat(17);\n" | 5167 const char* source_2 = "cat(17);\n" |
| 5147 "cat(19);\n"; | 5168 "cat(19);\n"; |
| 5148 | 5169 |
| 5170 v8::V8::Initialize(); |
| 5149 v8::HandleScope scope; | 5171 v8::HandleScope scope; |
| 5150 DebugLocalContext env; | 5172 DebugLocalContext env; |
| 5151 v8::Debug::SetMessageHandler2(&BreakpointsMessageHandler); | 5173 v8::Debug::SetMessageHandler2(&BreakpointsMessageHandler); |
| 5152 | 5174 |
| 5153 CompileRun(source_1); | 5175 CompileRun(source_1); |
| 5154 breakpoints_barriers->barrier_1.Wait(); | 5176 breakpoints_barriers->barrier_1.Wait(); |
| 5155 breakpoints_barriers->barrier_2.Wait(); | 5177 breakpoints_barriers->barrier_2.Wait(); |
| 5156 CompileRun(source_2); | 5178 CompileRun(source_2); |
| 5157 } | 5179 } |
| 5158 | 5180 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5266 breakpoints_barriers->semaphore_1->Wait(); | 5288 breakpoints_barriers->semaphore_1->Wait(); |
| 5267 // Must have result 116. | 5289 // Must have result 116. |
| 5268 CHECK_EQ(116, evaluate_int_result); | 5290 CHECK_EQ(116, evaluate_int_result); |
| 5269 // 9: Continue evaluation of source2, reach end. | 5291 // 9: Continue evaluation of source2, reach end. |
| 5270 v8::Debug::SendCommand(buffer, AsciiToUtf16(command_8, buffer)); | 5292 v8::Debug::SendCommand(buffer, AsciiToUtf16(command_8, buffer)); |
| 5271 } | 5293 } |
| 5272 | 5294 |
| 5273 void TestRecursiveBreakpointsGeneric(bool global_evaluate) { | 5295 void TestRecursiveBreakpointsGeneric(bool global_evaluate) { |
| 5274 i::FLAG_debugger_auto_break = true; | 5296 i::FLAG_debugger_auto_break = true; |
| 5275 | 5297 |
| 5276 BreakpointsDebuggerThread breakpoints_debugger_thread(i::Isolate::Current(), | 5298 BreakpointsDebuggerThread breakpoints_debugger_thread(global_evaluate); |
| 5277 global_evaluate); | 5299 BreakpointsV8Thread breakpoints_v8_thread; |
| 5278 BreakpointsV8Thread breakpoints_v8_thread(i::Isolate::Current()); | |
| 5279 | 5300 |
| 5280 // Create a V8 environment | 5301 // Create a V8 environment |
| 5281 Barriers stack_allocated_breakpoints_barriers; | 5302 Barriers stack_allocated_breakpoints_barriers; |
| 5282 stack_allocated_breakpoints_barriers.Initialize(); | 5303 stack_allocated_breakpoints_barriers.Initialize(); |
| 5283 breakpoints_barriers = &stack_allocated_breakpoints_barriers; | 5304 breakpoints_barriers = &stack_allocated_breakpoints_barriers; |
| 5284 | 5305 |
| 5285 breakpoints_v8_thread.Start(); | 5306 breakpoints_v8_thread.Start(); |
| 5286 breakpoints_debugger_thread.Start(); | 5307 breakpoints_debugger_thread.Start(); |
| 5287 | 5308 |
| 5288 breakpoints_v8_thread.Join(); | 5309 breakpoints_v8_thread.Join(); |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5650 } | 5671 } |
| 5651 | 5672 |
| 5652 | 5673 |
| 5653 /* Test DebuggerHostDispatch */ | 5674 /* Test DebuggerHostDispatch */ |
| 5654 /* In this test, the debugger waits for a command on a breakpoint | 5675 /* In this test, the debugger waits for a command on a breakpoint |
| 5655 * and is dispatching host commands while in the infinite loop. | 5676 * and is dispatching host commands while in the infinite loop. |
| 5656 */ | 5677 */ |
| 5657 | 5678 |
| 5658 class HostDispatchV8Thread : public v8::internal::Thread { | 5679 class HostDispatchV8Thread : public v8::internal::Thread { |
| 5659 public: | 5680 public: |
| 5660 explicit HostDispatchV8Thread(v8::internal::Isolate* isolate) | 5681 HostDispatchV8Thread() : Thread("HostDispatchV8Thread") { } |
| 5661 : Thread(isolate, "HostDispatchV8Thread") { } | |
| 5662 void Run(); | 5682 void Run(); |
| 5663 }; | 5683 }; |
| 5664 | 5684 |
| 5665 class HostDispatchDebuggerThread : public v8::internal::Thread { | 5685 class HostDispatchDebuggerThread : public v8::internal::Thread { |
| 5666 public: | 5686 public: |
| 5667 explicit HostDispatchDebuggerThread(v8::internal::Isolate* isolate) | 5687 HostDispatchDebuggerThread() : Thread("HostDispatchDebuggerThread") { } |
| 5668 : Thread(isolate, "HostDispatchDebuggerThread") { } | |
| 5669 void Run(); | 5688 void Run(); |
| 5670 }; | 5689 }; |
| 5671 | 5690 |
| 5672 Barriers* host_dispatch_barriers; | 5691 Barriers* host_dispatch_barriers; |
| 5673 | 5692 |
| 5674 static void HostDispatchMessageHandler(const v8::Debug::Message& message) { | 5693 static void HostDispatchMessageHandler(const v8::Debug::Message& message) { |
| 5675 static char print_buffer[1000]; | 5694 static char print_buffer[1000]; |
| 5676 v8::String::Value json(message.GetJSON()); | 5695 v8::String::Value json(message.GetJSON()); |
| 5677 Utf16ToAscii(*json, json.length(), print_buffer); | 5696 Utf16ToAscii(*json, json.length(), print_buffer); |
| 5678 } | 5697 } |
| 5679 | 5698 |
| 5680 | 5699 |
| 5681 static void HostDispatchDispatchHandler() { | 5700 static void HostDispatchDispatchHandler() { |
| 5682 host_dispatch_barriers->semaphore_1->Signal(); | 5701 host_dispatch_barriers->semaphore_1->Signal(); |
| 5683 } | 5702 } |
| 5684 | 5703 |
| 5685 | 5704 |
| 5686 void HostDispatchV8Thread::Run() { | 5705 void HostDispatchV8Thread::Run() { |
| 5687 const char* source_1 = "var y_global = 3;\n" | 5706 const char* source_1 = "var y_global = 3;\n" |
| 5688 "function cat( new_value ) {\n" | 5707 "function cat( new_value ) {\n" |
| 5689 " var x = new_value;\n" | 5708 " var x = new_value;\n" |
| 5690 " y_global = 4;\n" | 5709 " y_global = 4;\n" |
| 5691 " x = 3 * x + 1;\n" | 5710 " x = 3 * x + 1;\n" |
| 5692 " y_global = 5;\n" | 5711 " y_global = 5;\n" |
| 5693 " return x;\n" | 5712 " return x;\n" |
| 5694 "}\n" | 5713 "}\n" |
| 5695 "\n"; | 5714 "\n"; |
| 5696 const char* source_2 = "cat(17);\n"; | 5715 const char* source_2 = "cat(17);\n"; |
| 5697 | 5716 |
| 5717 v8::V8::Initialize(); |
| 5698 v8::HandleScope scope; | 5718 v8::HandleScope scope; |
| 5699 DebugLocalContext env; | 5719 DebugLocalContext env; |
| 5700 | 5720 |
| 5701 // Setup message and host dispatch handlers. | 5721 // Setup message and host dispatch handlers. |
| 5702 v8::Debug::SetMessageHandler2(HostDispatchMessageHandler); | 5722 v8::Debug::SetMessageHandler2(HostDispatchMessageHandler); |
| 5703 v8::Debug::SetHostDispatchHandler(HostDispatchDispatchHandler, 10 /* ms */); | 5723 v8::Debug::SetHostDispatchHandler(HostDispatchDispatchHandler, 10 /* ms */); |
| 5704 | 5724 |
| 5705 CompileRun(source_1); | 5725 CompileRun(source_1); |
| 5706 host_dispatch_barriers->barrier_1.Wait(); | 5726 host_dispatch_barriers->barrier_1.Wait(); |
| 5707 host_dispatch_barriers->barrier_2.Wait(); | 5727 host_dispatch_barriers->barrier_2.Wait(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 5730 // v8 thread starts compiling source_2. | 5750 // v8 thread starts compiling source_2. |
| 5731 // Break happens, to run queued commands and host dispatches. | 5751 // Break happens, to run queued commands and host dispatches. |
| 5732 // Wait for host dispatch to be processed. | 5752 // Wait for host dispatch to be processed. |
| 5733 host_dispatch_barriers->semaphore_1->Wait(); | 5753 host_dispatch_barriers->semaphore_1->Wait(); |
| 5734 // 2: Continue evaluation | 5754 // 2: Continue evaluation |
| 5735 v8::Debug::SendCommand(buffer, AsciiToUtf16(command_2, buffer)); | 5755 v8::Debug::SendCommand(buffer, AsciiToUtf16(command_2, buffer)); |
| 5736 } | 5756 } |
| 5737 | 5757 |
| 5738 | 5758 |
| 5739 TEST(DebuggerHostDispatch) { | 5759 TEST(DebuggerHostDispatch) { |
| 5740 HostDispatchDebuggerThread host_dispatch_debugger_thread( | 5760 HostDispatchDebuggerThread host_dispatch_debugger_thread; |
| 5741 i::Isolate::Current()); | 5761 HostDispatchV8Thread host_dispatch_v8_thread; |
| 5742 HostDispatchV8Thread host_dispatch_v8_thread(i::Isolate::Current()); | |
| 5743 i::FLAG_debugger_auto_break = true; | 5762 i::FLAG_debugger_auto_break = true; |
| 5744 | 5763 |
| 5745 // Create a V8 environment | 5764 // Create a V8 environment |
| 5746 Barriers stack_allocated_host_dispatch_barriers; | 5765 Barriers stack_allocated_host_dispatch_barriers; |
| 5747 stack_allocated_host_dispatch_barriers.Initialize(); | 5766 stack_allocated_host_dispatch_barriers.Initialize(); |
| 5748 host_dispatch_barriers = &stack_allocated_host_dispatch_barriers; | 5767 host_dispatch_barriers = &stack_allocated_host_dispatch_barriers; |
| 5749 | 5768 |
| 5750 host_dispatch_v8_thread.Start(); | 5769 host_dispatch_v8_thread.Start(); |
| 5751 host_dispatch_debugger_thread.Start(); | 5770 host_dispatch_debugger_thread.Start(); |
| 5752 | 5771 |
| 5753 host_dispatch_v8_thread.Join(); | 5772 host_dispatch_v8_thread.Join(); |
| 5754 host_dispatch_debugger_thread.Join(); | 5773 host_dispatch_debugger_thread.Join(); |
| 5755 } | 5774 } |
| 5756 | 5775 |
| 5757 | 5776 |
| 5758 /* Test DebugMessageDispatch */ | 5777 /* Test DebugMessageDispatch */ |
| 5759 /* In this test, the V8 thread waits for a message from the debug thread. | 5778 /* In this test, the V8 thread waits for a message from the debug thread. |
| 5760 * The DebugMessageDispatchHandler is executed from the debugger thread | 5779 * The DebugMessageDispatchHandler is executed from the debugger thread |
| 5761 * which signals the V8 thread to wake up. | 5780 * which signals the V8 thread to wake up. |
| 5762 */ | 5781 */ |
| 5763 | 5782 |
| 5764 class DebugMessageDispatchV8Thread : public v8::internal::Thread { | 5783 class DebugMessageDispatchV8Thread : public v8::internal::Thread { |
| 5765 public: | 5784 public: |
| 5766 explicit DebugMessageDispatchV8Thread(v8::internal::Isolate* isolate) | 5785 DebugMessageDispatchV8Thread() : Thread("DebugMessageDispatchV8Thread") { } |
| 5767 : Thread(isolate, "DebugMessageDispatchV8Thread") { } | |
| 5768 void Run(); | 5786 void Run(); |
| 5769 }; | 5787 }; |
| 5770 | 5788 |
| 5771 class DebugMessageDispatchDebuggerThread : public v8::internal::Thread { | 5789 class DebugMessageDispatchDebuggerThread : public v8::internal::Thread { |
| 5772 public: | 5790 public: |
| 5773 explicit DebugMessageDispatchDebuggerThread(v8::internal::Isolate* isolate) | 5791 DebugMessageDispatchDebuggerThread() |
| 5774 : Thread(isolate, "DebugMessageDispatchDebuggerThread") { } | 5792 : Thread("DebugMessageDispatchDebuggerThread") { } |
| 5775 void Run(); | 5793 void Run(); |
| 5776 }; | 5794 }; |
| 5777 | 5795 |
| 5778 Barriers* debug_message_dispatch_barriers; | 5796 Barriers* debug_message_dispatch_barriers; |
| 5779 | 5797 |
| 5780 | 5798 |
| 5781 static void DebugMessageHandler() { | 5799 static void DebugMessageHandler() { |
| 5782 debug_message_dispatch_barriers->semaphore_1->Signal(); | 5800 debug_message_dispatch_barriers->semaphore_1->Signal(); |
| 5783 } | 5801 } |
| 5784 | 5802 |
| 5785 | 5803 |
| 5786 void DebugMessageDispatchV8Thread::Run() { | 5804 void DebugMessageDispatchV8Thread::Run() { |
| 5805 v8::V8::Initialize(); |
| 5787 v8::HandleScope scope; | 5806 v8::HandleScope scope; |
| 5788 DebugLocalContext env; | 5807 DebugLocalContext env; |
| 5789 | 5808 |
| 5790 // Setup debug message dispatch handler. | 5809 // Setup debug message dispatch handler. |
| 5791 v8::Debug::SetDebugMessageDispatchHandler(DebugMessageHandler); | 5810 v8::Debug::SetDebugMessageDispatchHandler(DebugMessageHandler); |
| 5792 | 5811 |
| 5793 CompileRun("var y = 1 + 2;\n"); | 5812 CompileRun("var y = 1 + 2;\n"); |
| 5794 debug_message_dispatch_barriers->barrier_1.Wait(); | 5813 debug_message_dispatch_barriers->barrier_1.Wait(); |
| 5795 debug_message_dispatch_barriers->semaphore_1->Wait(); | 5814 debug_message_dispatch_barriers->semaphore_1->Wait(); |
| 5796 debug_message_dispatch_barriers->barrier_2.Wait(); | 5815 debug_message_dispatch_barriers->barrier_2.Wait(); |
| 5797 } | 5816 } |
| 5798 | 5817 |
| 5799 | 5818 |
| 5800 void DebugMessageDispatchDebuggerThread::Run() { | 5819 void DebugMessageDispatchDebuggerThread::Run() { |
| 5801 debug_message_dispatch_barriers->barrier_1.Wait(); | 5820 debug_message_dispatch_barriers->barrier_1.Wait(); |
| 5802 SendContinueCommand(); | 5821 SendContinueCommand(); |
| 5803 debug_message_dispatch_barriers->barrier_2.Wait(); | 5822 debug_message_dispatch_barriers->barrier_2.Wait(); |
| 5804 } | 5823 } |
| 5805 | 5824 |
| 5806 | 5825 |
| 5807 TEST(DebuggerDebugMessageDispatch) { | 5826 TEST(DebuggerDebugMessageDispatch) { |
| 5808 DebugMessageDispatchDebuggerThread debug_message_dispatch_debugger_thread( | 5827 DebugMessageDispatchDebuggerThread debug_message_dispatch_debugger_thread; |
| 5809 i::Isolate::Current()); | 5828 DebugMessageDispatchV8Thread debug_message_dispatch_v8_thread; |
| 5810 DebugMessageDispatchV8Thread debug_message_dispatch_v8_thread( | |
| 5811 i::Isolate::Current()); | |
| 5812 | 5829 |
| 5813 i::FLAG_debugger_auto_break = true; | 5830 i::FLAG_debugger_auto_break = true; |
| 5814 | 5831 |
| 5815 // Create a V8 environment | 5832 // Create a V8 environment |
| 5816 Barriers stack_allocated_debug_message_dispatch_barriers; | 5833 Barriers stack_allocated_debug_message_dispatch_barriers; |
| 5817 stack_allocated_debug_message_dispatch_barriers.Initialize(); | 5834 stack_allocated_debug_message_dispatch_barriers.Initialize(); |
| 5818 debug_message_dispatch_barriers = | 5835 debug_message_dispatch_barriers = |
| 5819 &stack_allocated_debug_message_dispatch_barriers; | 5836 &stack_allocated_debug_message_dispatch_barriers; |
| 5820 | 5837 |
| 5821 debug_message_dispatch_v8_thread.Start(); | 5838 debug_message_dispatch_v8_thread.Start(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 5840 OS::SNPrintF(i::Vector<char>(port2_str, kPortBufferLen), "%d", kPort2); | 5857 OS::SNPrintF(i::Vector<char>(port2_str, kPortBufferLen), "%d", kPort2); |
| 5841 | 5858 |
| 5842 bool ok; | 5859 bool ok; |
| 5843 | 5860 |
| 5844 // Initialize the socket library. | 5861 // Initialize the socket library. |
| 5845 i::Socket::Setup(); | 5862 i::Socket::Setup(); |
| 5846 | 5863 |
| 5847 // Test starting and stopping the agent without any client connection. | 5864 // Test starting and stopping the agent without any client connection. |
| 5848 debugger->StartAgent("test", kPort1); | 5865 debugger->StartAgent("test", kPort1); |
| 5849 debugger->StopAgent(); | 5866 debugger->StopAgent(); |
| 5850 | |
| 5851 // Test starting the agent, connecting a client and shutting down the agent | 5867 // Test starting the agent, connecting a client and shutting down the agent |
| 5852 // with the client connected. | 5868 // with the client connected. |
| 5853 ok = debugger->StartAgent("test", kPort2); | 5869 ok = debugger->StartAgent("test", kPort2); |
| 5854 CHECK(ok); | 5870 CHECK(ok); |
| 5855 debugger->WaitForAgent(); | 5871 debugger->WaitForAgent(); |
| 5856 i::Socket* client = i::OS::CreateSocket(); | 5872 i::Socket* client = i::OS::CreateSocket(); |
| 5857 ok = client->Connect("localhost", port2_str); | 5873 ok = client->Connect("localhost", port2_str); |
| 5858 CHECK(ok); | 5874 CHECK(ok); |
| 5875 // It is important to wait for a message from the agent. Otherwise, |
| 5876 // we can close the server socket during "accept" syscall, making it failing |
| 5877 // (at least on Linux), and the test will work incorrectly. |
| 5878 char buf; |
| 5879 ok = client->Receive(&buf, 1) == 1; |
| 5880 CHECK(ok); |
| 5859 debugger->StopAgent(); | 5881 debugger->StopAgent(); |
| 5860 delete client; | 5882 delete client; |
| 5861 | 5883 |
| 5862 // Test starting and stopping the agent with the required port already | 5884 // Test starting and stopping the agent with the required port already |
| 5863 // occoupied. | 5885 // occoupied. |
| 5864 i::Socket* server = i::OS::CreateSocket(); | 5886 i::Socket* server = i::OS::CreateSocket(); |
| 5865 server->Bind(kPort3); | 5887 server->Bind(kPort3); |
| 5866 | 5888 |
| 5867 debugger->StartAgent("test", kPort3); | 5889 debugger->StartAgent("test", kPort3); |
| 5868 debugger->StopAgent(); | 5890 debugger->StopAgent(); |
| 5869 | 5891 |
| 5870 delete server; | 5892 delete server; |
| 5871 } | 5893 } |
| 5872 | 5894 |
| 5873 | 5895 |
| 5874 class DebuggerAgentProtocolServerThread : public i::Thread { | 5896 class DebuggerAgentProtocolServerThread : public i::Thread { |
| 5875 public: | 5897 public: |
| 5876 explicit DebuggerAgentProtocolServerThread(i::Isolate* isolate, int port) | 5898 explicit DebuggerAgentProtocolServerThread(int port) |
| 5877 : Thread(isolate, "DebuggerAgentProtocolServerThread"), | 5899 : Thread("DebuggerAgentProtocolServerThread"), |
| 5878 port_(port), | 5900 port_(port), |
| 5879 server_(NULL), | 5901 server_(NULL), |
| 5880 client_(NULL), | 5902 client_(NULL), |
| 5881 listening_(OS::CreateSemaphore(0)) { | 5903 listening_(OS::CreateSemaphore(0)) { |
| 5882 } | 5904 } |
| 5883 ~DebuggerAgentProtocolServerThread() { | 5905 ~DebuggerAgentProtocolServerThread() { |
| 5884 // Close both sockets. | 5906 // Close both sockets. |
| 5885 delete client_; | 5907 delete client_; |
| 5886 delete server_; | 5908 delete server_; |
| 5887 delete listening_; | 5909 delete listening_; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5932 // Make a string with the port number. | 5954 // Make a string with the port number. |
| 5933 const int kPortBufferLen = 6; | 5955 const int kPortBufferLen = 6; |
| 5934 char port_str[kPortBufferLen]; | 5956 char port_str[kPortBufferLen]; |
| 5935 OS::SNPrintF(i::Vector<char>(port_str, kPortBufferLen), "%d", kPort); | 5957 OS::SNPrintF(i::Vector<char>(port_str, kPortBufferLen), "%d", kPort); |
| 5936 | 5958 |
| 5937 // Initialize the socket library. | 5959 // Initialize the socket library. |
| 5938 i::Socket::Setup(); | 5960 i::Socket::Setup(); |
| 5939 | 5961 |
| 5940 // Create a socket server to receive a debugger agent message. | 5962 // Create a socket server to receive a debugger agent message. |
| 5941 DebuggerAgentProtocolServerThread* server = | 5963 DebuggerAgentProtocolServerThread* server = |
| 5942 new DebuggerAgentProtocolServerThread(i::Isolate::Current(), kPort); | 5964 new DebuggerAgentProtocolServerThread(kPort); |
| 5943 server->Start(); | 5965 server->Start(); |
| 5944 server->WaitForListening(); | 5966 server->WaitForListening(); |
| 5945 | 5967 |
| 5946 // Connect. | 5968 // Connect. |
| 5947 i::Socket* client = i::OS::CreateSocket(); | 5969 i::Socket* client = i::OS::CreateSocket(); |
| 5948 CHECK(client != NULL); | 5970 CHECK(client != NULL); |
| 5949 bool ok = client->Connect(kLocalhost, port_str); | 5971 bool ok = client->Connect(kLocalhost, port_str); |
| 5950 CHECK(ok); | 5972 CHECK(ok); |
| 5951 | 5973 |
| 5952 // Send headers which overflow the receive buffer. | 5974 // Send headers which overflow the receive buffer. |
| (...skipping 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7191 "loop(0);"; | 7213 "loop(0);"; |
| 7192 v8::Script::Compile(v8::String::New(src))->Run(); | 7214 v8::Script::Compile(v8::String::New(src))->Run(); |
| 7193 } | 7215 } |
| 7194 | 7216 |
| 7195 | 7217 |
| 7196 // Test that setting the terminate execution flag during debug break processing. | 7218 // Test that setting the terminate execution flag during debug break processing. |
| 7197 static void TestDebugBreakInLoop(const char* loop_head, | 7219 static void TestDebugBreakInLoop(const char* loop_head, |
| 7198 const char** loop_bodies, | 7220 const char** loop_bodies, |
| 7199 const char* loop_tail) { | 7221 const char* loop_tail) { |
| 7200 // Receive 100 breaks for each test and then terminate JavaScript execution. | 7222 // Receive 100 breaks for each test and then terminate JavaScript execution. |
| 7201 static int count = 0; | 7223 static const int kBreaksPerTest = 100; |
| 7202 | 7224 |
| 7203 for (int i = 0; loop_bodies[i] != NULL; i++) { | 7225 for (int i = 0; i < 1 && loop_bodies[i] != NULL; i++) { |
| 7204 count++; | 7226 // Perform a lazy deoptimization after various numbers of breaks |
| 7205 max_break_point_hit_count = count * 100; | 7227 // have been hit. |
| 7206 terminate_after_max_break_point_hit = true; | 7228 for (int j = 0; j < 10; j++) { |
| 7229 break_point_hit_count_deoptimize = j; |
| 7230 if (j == 10) { |
| 7231 break_point_hit_count_deoptimize = kBreaksPerTest; |
| 7232 } |
| 7207 | 7233 |
| 7208 EmbeddedVector<char, 1024> buffer; | 7234 break_point_hit_count = 0; |
| 7209 OS::SNPrintF(buffer, | 7235 max_break_point_hit_count = kBreaksPerTest; |
| 7210 "function f() {%s%s%s}", | 7236 terminate_after_max_break_point_hit = true; |
| 7211 loop_head, loop_bodies[i], loop_tail); | |
| 7212 | 7237 |
| 7213 // Function with infinite loop. | 7238 EmbeddedVector<char, 1024> buffer; |
| 7214 CompileRun(buffer.start()); | 7239 OS::SNPrintF(buffer, |
| 7240 "function f() {%s%s%s}", |
| 7241 loop_head, loop_bodies[i], loop_tail); |
| 7215 | 7242 |
| 7216 // Set the debug break to enter the debugger as soon as possible. | 7243 // Function with infinite loop. |
| 7217 v8::Debug::DebugBreak(); | 7244 CompileRun(buffer.start()); |
| 7218 | 7245 |
| 7219 // Call function with infinite loop. | 7246 // Set the debug break to enter the debugger as soon as possible. |
| 7220 CompileRun("f();"); | 7247 v8::Debug::DebugBreak(); |
| 7221 CHECK_EQ(count * 100, break_point_hit_count); | |
| 7222 | 7248 |
| 7223 CHECK(!v8::V8::IsExecutionTerminating()); | 7249 // Call function with infinite loop. |
| 7250 CompileRun("f();"); |
| 7251 CHECK_EQ(kBreaksPerTest, break_point_hit_count); |
| 7252 |
| 7253 CHECK(!v8::V8::IsExecutionTerminating()); |
| 7254 } |
| 7224 } | 7255 } |
| 7225 } | 7256 } |
| 7226 | 7257 |
| 7227 | 7258 |
| 7228 TEST(DebugBreakLoop) { | 7259 TEST(DebugBreakLoop) { |
| 7229 v8::HandleScope scope; | 7260 v8::HandleScope scope; |
| 7230 DebugLocalContext env; | 7261 DebugLocalContext env; |
| 7231 | 7262 |
| 7232 // Register a debug event listener which sets the break flag and counts. | 7263 // Register a debug event listener which sets the break flag and counts. |
| 7233 v8::Debug::SetDebugEventListener(DebugEventBreakMax); | 7264 v8::Debug::SetDebugEventListener(DebugEventBreakMax); |
| 7234 | 7265 |
| 7266 // Create a function for getting the frame count when hitting the break. |
| 7267 frame_count = CompileFunction(&env, frame_count_source, "frame_count"); |
| 7268 |
| 7235 CompileRun("var a = 1;"); | 7269 CompileRun("var a = 1;"); |
| 7236 CompileRun("function g() { }"); | 7270 CompileRun("function g() { }"); |
| 7237 CompileRun("function h() { }"); | 7271 CompileRun("function h() { }"); |
| 7238 | 7272 |
| 7239 const char* loop_bodies[] = { | 7273 const char* loop_bodies[] = { |
| 7240 "", | 7274 "", |
| 7241 "g()", | 7275 "g()", |
| 7242 "if (a == 0) { g() }", | 7276 "if (a == 0) { g() }", |
| 7243 "if (a == 1) { g() }", | 7277 "if (a == 1) { g() }", |
| 7244 "if (a == 0) { g() } else { h() }", | 7278 "if (a == 0) { g() } else { h() }", |
| (...skipping 15 matching lines...) Expand all Loading... |
| 7260 TestDebugBreakInLoop("for (;;) {", loop_bodies, "}"); | 7294 TestDebugBreakInLoop("for (;;) {", loop_bodies, "}"); |
| 7261 TestDebugBreakInLoop("for (;a == 1;) {", loop_bodies, "}"); | 7295 TestDebugBreakInLoop("for (;a == 1;) {", loop_bodies, "}"); |
| 7262 | 7296 |
| 7263 // Get rid of the debug event listener. | 7297 // Get rid of the debug event listener. |
| 7264 v8::Debug::SetDebugEventListener(NULL); | 7298 v8::Debug::SetDebugEventListener(NULL); |
| 7265 CheckDebuggerUnloaded(); | 7299 CheckDebuggerUnloaded(); |
| 7266 } | 7300 } |
| 7267 | 7301 |
| 7268 | 7302 |
| 7269 #endif // ENABLE_DEBUGGER_SUPPORT | 7303 #endif // ENABLE_DEBUGGER_SUPPORT |
| OLD | NEW |