| 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 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 int last_source_line = -1; | 649 int last_source_line = -1; |
| 650 int last_source_column = -1; | 650 int last_source_column = -1; |
| 651 | 651 |
| 652 // Debug event handler which counts the break points which have been hit. | 652 // Debug event handler which counts the break points which have been hit. |
| 653 int break_point_hit_count = 0; | 653 int break_point_hit_count = 0; |
| 654 int break_point_hit_count_deoptimize = 0; | 654 int break_point_hit_count_deoptimize = 0; |
| 655 static void DebugEventBreakPointHitCount(v8::DebugEvent event, | 655 static void DebugEventBreakPointHitCount(v8::DebugEvent event, |
| 656 v8::Handle<v8::Object> exec_state, | 656 v8::Handle<v8::Object> exec_state, |
| 657 v8::Handle<v8::Object> event_data, | 657 v8::Handle<v8::Object> event_data, |
| 658 v8::Handle<v8::Value> data) { | 658 v8::Handle<v8::Value> data) { |
| 659 Debug* debug = v8::internal::Isolate::Current()->debug(); | 659 v8::internal::Isolate* isolate = v8::internal::Isolate::Current(); |
| 660 Debug* debug = isolate->debug(); |
| 660 // When hitting a debug event listener there must be a break set. | 661 // When hitting a debug event listener there must be a break set. |
| 661 CHECK_NE(debug->break_id(), 0); | 662 CHECK_NE(debug->break_id(), 0); |
| 662 | 663 |
| 663 // Count the number of breaks. | 664 // Count the number of breaks. |
| 664 if (event == v8::Break) { | 665 if (event == v8::Break) { |
| 665 break_point_hit_count++; | 666 break_point_hit_count++; |
| 666 if (!frame_function_name.IsEmpty()) { | 667 if (!frame_function_name.IsEmpty()) { |
| 667 // Get the name of the function. | 668 // Get the name of the function. |
| 668 const int argc = 2; | 669 const int argc = 2; |
| 669 v8::Handle<v8::Value> argv[argc] = { exec_state, v8::Integer::New(0) }; | 670 v8::Handle<v8::Value> argv[argc] = { exec_state, v8::Integer::New(0) }; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 result = result->ToString(); | 726 result = result->ToString(); |
| 726 CHECK(result->IsString()); | 727 CHECK(result->IsString()); |
| 727 v8::Handle<v8::String> script_data(result->ToString()); | 728 v8::Handle<v8::String> script_data(result->ToString()); |
| 728 script_data->WriteAscii(last_script_data_hit); | 729 script_data->WriteAscii(last_script_data_hit); |
| 729 } | 730 } |
| 730 } | 731 } |
| 731 | 732 |
| 732 // Perform a full deoptimization when the specified number of | 733 // Perform a full deoptimization when the specified number of |
| 733 // breaks have been hit. | 734 // breaks have been hit. |
| 734 if (break_point_hit_count == break_point_hit_count_deoptimize) { | 735 if (break_point_hit_count == break_point_hit_count_deoptimize) { |
| 735 i::Deoptimizer::DeoptimizeAll(); | 736 i::Deoptimizer::DeoptimizeAll(isolate); |
| 736 } | 737 } |
| 737 } else if (event == v8::AfterCompile && !compiled_script_data.IsEmpty()) { | 738 } else if (event == v8::AfterCompile && !compiled_script_data.IsEmpty()) { |
| 738 const int argc = 1; | 739 const int argc = 1; |
| 739 v8::Handle<v8::Value> argv[argc] = { event_data }; | 740 v8::Handle<v8::Value> argv[argc] = { event_data }; |
| 740 v8::Handle<v8::Value> result = compiled_script_data->Call(exec_state, | 741 v8::Handle<v8::Value> result = compiled_script_data->Call(exec_state, |
| 741 argc, argv); | 742 argc, argv); |
| 742 if (result->IsUndefined()) { | 743 if (result->IsUndefined()) { |
| 743 last_script_data_hit[0] = '\0'; | 744 last_script_data_hit[0] = '\0'; |
| 744 } else { | 745 } else { |
| 745 result = result->ToString(); | 746 result = result->ToString(); |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 976 | 977 |
| 977 | 978 |
| 978 // Debug event handler which re-issues a debug break until a limit has been | 979 // Debug event handler which re-issues a debug break until a limit has been |
| 979 // reached. | 980 // reached. |
| 980 int max_break_point_hit_count = 0; | 981 int max_break_point_hit_count = 0; |
| 981 bool terminate_after_max_break_point_hit = false; | 982 bool terminate_after_max_break_point_hit = false; |
| 982 static void DebugEventBreakMax(v8::DebugEvent event, | 983 static void DebugEventBreakMax(v8::DebugEvent event, |
| 983 v8::Handle<v8::Object> exec_state, | 984 v8::Handle<v8::Object> exec_state, |
| 984 v8::Handle<v8::Object> event_data, | 985 v8::Handle<v8::Object> event_data, |
| 985 v8::Handle<v8::Value> data) { | 986 v8::Handle<v8::Value> data) { |
| 986 v8::internal::Debug* debug = v8::internal::Isolate::Current()->debug(); | 987 v8::internal::Isolate* isolate = v8::internal::Isolate::Current(); |
| 988 v8::internal::Debug* debug = isolate->debug(); |
| 987 // When hitting a debug event listener there must be a break set. | 989 // When hitting a debug event listener there must be a break set. |
| 988 CHECK_NE(debug->break_id(), 0); | 990 CHECK_NE(debug->break_id(), 0); |
| 989 | 991 |
| 990 if (event == v8::Break) { | 992 if (event == v8::Break) { |
| 991 if (break_point_hit_count < max_break_point_hit_count) { | 993 if (break_point_hit_count < max_break_point_hit_count) { |
| 992 // Count the number of breaks. | 994 // Count the number of breaks. |
| 993 break_point_hit_count++; | 995 break_point_hit_count++; |
| 994 | 996 |
| 995 // Collect the JavsScript stack height if the function frame_count is | 997 // Collect the JavsScript stack height if the function frame_count is |
| 996 // compiled. | 998 // compiled. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1007 v8::Debug::DebugBreak(); | 1009 v8::Debug::DebugBreak(); |
| 1008 | 1010 |
| 1009 } else if (terminate_after_max_break_point_hit) { | 1011 } else if (terminate_after_max_break_point_hit) { |
| 1010 // Terminate execution after the last break if requested. | 1012 // Terminate execution after the last break if requested. |
| 1011 v8::V8::TerminateExecution(); | 1013 v8::V8::TerminateExecution(); |
| 1012 } | 1014 } |
| 1013 | 1015 |
| 1014 // Perform a full deoptimization when the specified number of | 1016 // Perform a full deoptimization when the specified number of |
| 1015 // breaks have been hit. | 1017 // breaks have been hit. |
| 1016 if (break_point_hit_count == break_point_hit_count_deoptimize) { | 1018 if (break_point_hit_count == break_point_hit_count_deoptimize) { |
| 1017 i::Deoptimizer::DeoptimizeAll(); | 1019 i::Deoptimizer::DeoptimizeAll(isolate); |
| 1018 } | 1020 } |
| 1019 } | 1021 } |
| 1020 } | 1022 } |
| 1021 | 1023 |
| 1022 | 1024 |
| 1023 // --- M e s s a g e C a l l b a c k | 1025 // --- M e s s a g e C a l l b a c k |
| 1024 | 1026 |
| 1025 | 1027 |
| 1026 // Message callback which counts the number of messages. | 1028 // Message callback which counts the number of messages. |
| 1027 int message_callback_count = 0; | 1029 int message_callback_count = 0; |
| (...skipping 6132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7160 const int argc = 2; | 7162 const int argc = 2; |
| 7161 v8::Handle<v8::Value> argv[argc] = { exec_state, v8::Integer::New(0) }; | 7163 v8::Handle<v8::Value> argv[argc] = { exec_state, v8::Integer::New(0) }; |
| 7162 v8::Handle<v8::Value> result = | 7164 v8::Handle<v8::Value> result = |
| 7163 frame_function_name->Call(exec_state, argc, argv); | 7165 frame_function_name->Call(exec_state, argc, argv); |
| 7164 if (!result->IsUndefined()) { | 7166 if (!result->IsUndefined()) { |
| 7165 char fn[80]; | 7167 char fn[80]; |
| 7166 CHECK(result->IsString()); | 7168 CHECK(result->IsString()); |
| 7167 v8::Handle<v8::String> function_name(result->ToString()); | 7169 v8::Handle<v8::String> function_name(result->ToString()); |
| 7168 function_name->WriteAscii(fn); | 7170 function_name->WriteAscii(fn); |
| 7169 if (strcmp(fn, "bar") == 0) { | 7171 if (strcmp(fn, "bar") == 0) { |
| 7170 i::Deoptimizer::DeoptimizeAll(); | 7172 i::Deoptimizer::DeoptimizeAll(v8::internal::Isolate::Current()); |
| 7171 debug_event_break_deoptimize_done = true; | 7173 debug_event_break_deoptimize_done = true; |
| 7172 } | 7174 } |
| 7173 } | 7175 } |
| 7174 } | 7176 } |
| 7175 | 7177 |
| 7176 v8::Debug::DebugBreak(); | 7178 v8::Debug::DebugBreak(); |
| 7177 } | 7179 } |
| 7178 } | 7180 } |
| 7179 | 7181 |
| 7180 | 7182 |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7529 TEST(LiveEditDisabled) { | 7531 TEST(LiveEditDisabled) { |
| 7530 v8::internal::FLAG_allow_natives_syntax = true; | 7532 v8::internal::FLAG_allow_natives_syntax = true; |
| 7531 LocalContext env; | 7533 LocalContext env; |
| 7532 v8::HandleScope scope(env->GetIsolate()); | 7534 v8::HandleScope scope(env->GetIsolate()); |
| 7533 v8::Debug::SetLiveEditEnabled(false); | 7535 v8::Debug::SetLiveEditEnabled(false); |
| 7534 CompileRun("%LiveEditCompareStrings('', '')"); | 7536 CompileRun("%LiveEditCompareStrings('', '')"); |
| 7535 } | 7537 } |
| 7536 | 7538 |
| 7537 | 7539 |
| 7538 #endif // ENABLE_DEBUGGER_SUPPORT | 7540 #endif // ENABLE_DEBUGGER_SUPPORT |
| OLD | NEW |