| OLD | NEW |
| 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 5025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5036 " if ( x == 1 ) {\n" | 5036 " if ( x == 1 ) {\n" |
| 5037 " ThreadedAtBarrier1();\n" | 5037 " ThreadedAtBarrier1();\n" |
| 5038 " }\n" | 5038 " }\n" |
| 5039 " x = x + 1;\n" | 5039 " x = x + 1;\n" |
| 5040 " }\n" | 5040 " }\n" |
| 5041 "}\n" | 5041 "}\n" |
| 5042 "\n" | 5042 "\n" |
| 5043 "foo();\n"; | 5043 "foo();\n"; |
| 5044 | 5044 |
| 5045 v8::V8::Initialize(); | 5045 v8::V8::Initialize(); |
| 5046 v8::HandleScope scope; | 5046 { |
| 5047 DebugLocalContext env; | 5047 v8::HandleScope scope; |
| 5048 v8::Debug::SetMessageHandler2(&ThreadedMessageHandler); | 5048 DebugLocalContext env; |
| 5049 v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New(); | 5049 v8::Debug::SetMessageHandler2(&ThreadedMessageHandler); |
| 5050 global_template->Set(v8::String::New("ThreadedAtBarrier1"), | 5050 v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New(); |
| 5051 v8::FunctionTemplate::New(ThreadedAtBarrier1)); | 5051 global_template->Set(v8::String::New("ThreadedAtBarrier1"), |
| 5052 v8::Handle<v8::Context> context = v8::Context::New(NULL, global_template); | 5052 v8::FunctionTemplate::New(ThreadedAtBarrier1)); |
| 5053 v8::Context::Scope context_scope(context); | 5053 v8::Handle<v8::Context> context = v8::Context::New(NULL, global_template); |
| 5054 v8::Context::Scope context_scope(context); |
| 5054 | 5055 |
| 5055 CompileRun(source); | 5056 CompileRun(source); |
| 5057 } |
| 5058 |
| 5059 v8::V8::Dispose(); |
| 5056 } | 5060 } |
| 5057 | 5061 |
| 5058 void DebuggerThread::Run() { | 5062 void DebuggerThread::Run() { |
| 5059 const int kBufSize = 1000; | 5063 const int kBufSize = 1000; |
| 5060 uint16_t buffer[kBufSize]; | 5064 uint16_t buffer[kBufSize]; |
| 5061 | 5065 |
| 5062 const char* command_1 = "{\"seq\":102," | 5066 const char* command_1 = "{\"seq\":102," |
| 5063 "\"type\":\"request\"," | 5067 "\"type\":\"request\"," |
| 5064 "\"command\":\"evaluate\"," | 5068 "\"command\":\"evaluate\"," |
| 5065 "\"arguments\":{\"expression\":\"bar(false)\"}}"; | 5069 "\"arguments\":{\"expression\":\"bar(false)\"}}"; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5149 " x = y_global;" | 5153 " x = y_global;" |
| 5150 " var z = 3;" | 5154 " var z = 3;" |
| 5151 " x += 100;\n" | 5155 " x += 100;\n" |
| 5152 " return x;\n" | 5156 " return x;\n" |
| 5153 "}\n" | 5157 "}\n" |
| 5154 "\n"; | 5158 "\n"; |
| 5155 const char* source_2 = "cat(17);\n" | 5159 const char* source_2 = "cat(17);\n" |
| 5156 "cat(19);\n"; | 5160 "cat(19);\n"; |
| 5157 | 5161 |
| 5158 v8::V8::Initialize(); | 5162 v8::V8::Initialize(); |
| 5159 v8::HandleScope scope; | 5163 { |
| 5160 DebugLocalContext env; | 5164 v8::HandleScope scope; |
| 5161 v8::Debug::SetMessageHandler2(&BreakpointsMessageHandler); | 5165 DebugLocalContext env; |
| 5166 v8::Debug::SetMessageHandler2(&BreakpointsMessageHandler); |
| 5162 | 5167 |
| 5163 CompileRun(source_1); | 5168 CompileRun(source_1); |
| 5164 breakpoints_barriers->barrier_1.Wait(); | 5169 breakpoints_barriers->barrier_1.Wait(); |
| 5165 breakpoints_barriers->barrier_2.Wait(); | 5170 breakpoints_barriers->barrier_2.Wait(); |
| 5166 CompileRun(source_2); | 5171 CompileRun(source_2); |
| 5172 } |
| 5173 |
| 5174 v8::V8::Dispose(); |
| 5167 } | 5175 } |
| 5168 | 5176 |
| 5169 | 5177 |
| 5170 void BreakpointsDebuggerThread::Run() { | 5178 void BreakpointsDebuggerThread::Run() { |
| 5171 const int kBufSize = 1000; | 5179 const int kBufSize = 1000; |
| 5172 uint16_t buffer[kBufSize]; | 5180 uint16_t buffer[kBufSize]; |
| 5173 | 5181 |
| 5174 const char* command_1 = "{\"seq\":101," | 5182 const char* command_1 = "{\"seq\":101," |
| 5175 "\"type\":\"request\"," | 5183 "\"type\":\"request\"," |
| 5176 "\"command\":\"setbreakpoint\"," | 5184 "\"command\":\"setbreakpoint\"," |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5694 " var x = new_value;\n" | 5702 " var x = new_value;\n" |
| 5695 " y_global = 4;\n" | 5703 " y_global = 4;\n" |
| 5696 " x = 3 * x + 1;\n" | 5704 " x = 3 * x + 1;\n" |
| 5697 " y_global = 5;\n" | 5705 " y_global = 5;\n" |
| 5698 " return x;\n" | 5706 " return x;\n" |
| 5699 "}\n" | 5707 "}\n" |
| 5700 "\n"; | 5708 "\n"; |
| 5701 const char* source_2 = "cat(17);\n"; | 5709 const char* source_2 = "cat(17);\n"; |
| 5702 | 5710 |
| 5703 v8::V8::Initialize(); | 5711 v8::V8::Initialize(); |
| 5704 v8::HandleScope scope; | 5712 { |
| 5705 DebugLocalContext env; | 5713 v8::HandleScope scope; |
| 5714 DebugLocalContext env; |
| 5706 | 5715 |
| 5707 // Set up message and host dispatch handlers. | 5716 // Set up message and host dispatch handlers. |
| 5708 v8::Debug::SetMessageHandler2(HostDispatchMessageHandler); | 5717 v8::Debug::SetMessageHandler2(HostDispatchMessageHandler); |
| 5709 v8::Debug::SetHostDispatchHandler(HostDispatchDispatchHandler, 10 /* ms */); | 5718 v8::Debug::SetHostDispatchHandler(HostDispatchDispatchHandler, 10 /* ms */); |
| 5710 | 5719 |
| 5711 CompileRun(source_1); | 5720 CompileRun(source_1); |
| 5712 host_dispatch_barriers->barrier_1.Wait(); | 5721 host_dispatch_barriers->barrier_1.Wait(); |
| 5713 host_dispatch_barriers->barrier_2.Wait(); | 5722 host_dispatch_barriers->barrier_2.Wait(); |
| 5714 CompileRun(source_2); | 5723 CompileRun(source_2); |
| 5724 } |
| 5725 |
| 5726 v8::V8::Dispose(); |
| 5715 } | 5727 } |
| 5716 | 5728 |
| 5717 | 5729 |
| 5718 void HostDispatchDebuggerThread::Run() { | 5730 void HostDispatchDebuggerThread::Run() { |
| 5719 const int kBufSize = 1000; | 5731 const int kBufSize = 1000; |
| 5720 uint16_t buffer[kBufSize]; | 5732 uint16_t buffer[kBufSize]; |
| 5721 | 5733 |
| 5722 const char* command_1 = "{\"seq\":101," | 5734 const char* command_1 = "{\"seq\":101," |
| 5723 "\"type\":\"request\"," | 5735 "\"type\":\"request\"," |
| 5724 "\"command\":\"setbreakpoint\"," | 5736 "\"command\":\"setbreakpoint\"," |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5782 Barriers* debug_message_dispatch_barriers; | 5794 Barriers* debug_message_dispatch_barriers; |
| 5783 | 5795 |
| 5784 | 5796 |
| 5785 static void DebugMessageHandler() { | 5797 static void DebugMessageHandler() { |
| 5786 debug_message_dispatch_barriers->semaphore_1->Signal(); | 5798 debug_message_dispatch_barriers->semaphore_1->Signal(); |
| 5787 } | 5799 } |
| 5788 | 5800 |
| 5789 | 5801 |
| 5790 void DebugMessageDispatchV8Thread::Run() { | 5802 void DebugMessageDispatchV8Thread::Run() { |
| 5791 v8::V8::Initialize(); | 5803 v8::V8::Initialize(); |
| 5792 v8::HandleScope scope; | 5804 { |
| 5793 DebugLocalContext env; | 5805 v8::HandleScope scope; |
| 5806 DebugLocalContext env; |
| 5794 | 5807 |
| 5795 // Set up debug message dispatch handler. | 5808 // Set up debug message dispatch handler. |
| 5796 v8::Debug::SetDebugMessageDispatchHandler(DebugMessageHandler); | 5809 v8::Debug::SetDebugMessageDispatchHandler(DebugMessageHandler); |
| 5797 | 5810 |
| 5798 CompileRun("var y = 1 + 2;\n"); | 5811 CompileRun("var y = 1 + 2;\n"); |
| 5799 debug_message_dispatch_barriers->barrier_1.Wait(); | 5812 debug_message_dispatch_barriers->barrier_1.Wait(); |
| 5800 debug_message_dispatch_barriers->semaphore_1->Wait(); | 5813 debug_message_dispatch_barriers->semaphore_1->Wait(); |
| 5801 debug_message_dispatch_barriers->barrier_2.Wait(); | 5814 debug_message_dispatch_barriers->barrier_2.Wait(); |
| 5815 } |
| 5816 |
| 5817 v8::V8::Dispose(); |
| 5802 } | 5818 } |
| 5803 | 5819 |
| 5804 | 5820 |
| 5805 void DebugMessageDispatchDebuggerThread::Run() { | 5821 void DebugMessageDispatchDebuggerThread::Run() { |
| 5806 debug_message_dispatch_barriers->barrier_1.Wait(); | 5822 debug_message_dispatch_barriers->barrier_1.Wait(); |
| 5807 SendContinueCommand(); | 5823 SendContinueCommand(); |
| 5808 debug_message_dispatch_barriers->barrier_2.Wait(); | 5824 debug_message_dispatch_barriers->barrier_2.Wait(); |
| 5809 } | 5825 } |
| 5810 | 5826 |
| 5811 | 5827 |
| (...skipping 1532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7344 "g(false); \n" | 7360 "g(false); \n" |
| 7345 "%OptimizeFunctionOnNextCall(g); \n" | 7361 "%OptimizeFunctionOnNextCall(g); \n" |
| 7346 "g(true);"; | 7362 "g(true);"; |
| 7347 v8::Debug::SetDebugEventListener(DebugBreakInlineListener); | 7363 v8::Debug::SetDebugEventListener(DebugBreakInlineListener); |
| 7348 inline_script = v8::Script::Compile(v8::String::New(source)); | 7364 inline_script = v8::Script::Compile(v8::String::New(source)); |
| 7349 inline_script->Run(); | 7365 inline_script->Run(); |
| 7350 } | 7366 } |
| 7351 | 7367 |
| 7352 | 7368 |
| 7353 #endif // ENABLE_DEBUGGER_SUPPORT | 7369 #endif // ENABLE_DEBUGGER_SUPPORT |
| OLD | NEW |