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 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 // Get the name of the function. | 668 // Get the name of the function. |
669 const int argc = 2; | 669 const int argc = 2; |
670 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) }; |
671 v8::Handle<v8::Value> result = frame_function_name->Call(exec_state, | 671 v8::Handle<v8::Value> result = frame_function_name->Call(exec_state, |
672 argc, argv); | 672 argc, argv); |
673 if (result->IsUndefined()) { | 673 if (result->IsUndefined()) { |
674 last_function_hit[0] = '\0'; | 674 last_function_hit[0] = '\0'; |
675 } else { | 675 } else { |
676 CHECK(result->IsString()); | 676 CHECK(result->IsString()); |
677 v8::Handle<v8::String> function_name(result->ToString()); | 677 v8::Handle<v8::String> function_name(result->ToString()); |
678 function_name->WriteAscii(last_function_hit); | 678 function_name->WriteUtf8(last_function_hit); |
679 } | 679 } |
680 } | 680 } |
681 | 681 |
682 if (!frame_source_line.IsEmpty()) { | 682 if (!frame_source_line.IsEmpty()) { |
683 // Get the source line. | 683 // Get the source line. |
684 const int argc = 1; | 684 const int argc = 1; |
685 v8::Handle<v8::Value> argv[argc] = { exec_state }; | 685 v8::Handle<v8::Value> argv[argc] = { exec_state }; |
686 v8::Handle<v8::Value> result = frame_source_line->Call(exec_state, | 686 v8::Handle<v8::Value> result = frame_source_line->Call(exec_state, |
687 argc, argv); | 687 argc, argv); |
688 CHECK(result->IsNumber()); | 688 CHECK(result->IsNumber()); |
(...skipping 14 matching lines...) Expand all Loading... |
703 // Get the script name of the function script. | 703 // Get the script name of the function script. |
704 const int argc = 1; | 704 const int argc = 1; |
705 v8::Handle<v8::Value> argv[argc] = { exec_state }; | 705 v8::Handle<v8::Value> argv[argc] = { exec_state }; |
706 v8::Handle<v8::Value> result = frame_script_name->Call(exec_state, | 706 v8::Handle<v8::Value> result = frame_script_name->Call(exec_state, |
707 argc, argv); | 707 argc, argv); |
708 if (result->IsUndefined()) { | 708 if (result->IsUndefined()) { |
709 last_script_name_hit[0] = '\0'; | 709 last_script_name_hit[0] = '\0'; |
710 } else { | 710 } else { |
711 CHECK(result->IsString()); | 711 CHECK(result->IsString()); |
712 v8::Handle<v8::String> script_name(result->ToString()); | 712 v8::Handle<v8::String> script_name(result->ToString()); |
713 script_name->WriteAscii(last_script_name_hit); | 713 script_name->WriteUtf8(last_script_name_hit); |
714 } | 714 } |
715 } | 715 } |
716 | 716 |
717 if (!frame_script_data.IsEmpty()) { | 717 if (!frame_script_data.IsEmpty()) { |
718 // Get the script data of the function script. | 718 // Get the script data of the function script. |
719 const int argc = 1; | 719 const int argc = 1; |
720 v8::Handle<v8::Value> argv[argc] = { exec_state }; | 720 v8::Handle<v8::Value> argv[argc] = { exec_state }; |
721 v8::Handle<v8::Value> result = frame_script_data->Call(exec_state, | 721 v8::Handle<v8::Value> result = frame_script_data->Call(exec_state, |
722 argc, argv); | 722 argc, argv); |
723 if (result->IsUndefined()) { | 723 if (result->IsUndefined()) { |
724 last_script_data_hit[0] = '\0'; | 724 last_script_data_hit[0] = '\0'; |
725 } else { | 725 } else { |
726 result = result->ToString(); | 726 result = result->ToString(); |
727 CHECK(result->IsString()); | 727 CHECK(result->IsString()); |
728 v8::Handle<v8::String> script_data(result->ToString()); | 728 v8::Handle<v8::String> script_data(result->ToString()); |
729 script_data->WriteAscii(last_script_data_hit); | 729 script_data->WriteUtf8(last_script_data_hit); |
730 } | 730 } |
731 } | 731 } |
732 | 732 |
733 // Perform a full deoptimization when the specified number of | 733 // Perform a full deoptimization when the specified number of |
734 // breaks have been hit. | 734 // breaks have been hit. |
735 if (break_point_hit_count == break_point_hit_count_deoptimize) { | 735 if (break_point_hit_count == break_point_hit_count_deoptimize) { |
736 i::Deoptimizer::DeoptimizeAll(isolate); | 736 i::Deoptimizer::DeoptimizeAll(isolate); |
737 } | 737 } |
738 } else if (event == v8::AfterCompile && !compiled_script_data.IsEmpty()) { | 738 } else if (event == v8::AfterCompile && !compiled_script_data.IsEmpty()) { |
739 const int argc = 1; | 739 const int argc = 1; |
740 v8::Handle<v8::Value> argv[argc] = { event_data }; | 740 v8::Handle<v8::Value> argv[argc] = { event_data }; |
741 v8::Handle<v8::Value> result = compiled_script_data->Call(exec_state, | 741 v8::Handle<v8::Value> result = compiled_script_data->Call(exec_state, |
742 argc, argv); | 742 argc, argv); |
743 if (result->IsUndefined()) { | 743 if (result->IsUndefined()) { |
744 last_script_data_hit[0] = '\0'; | 744 last_script_data_hit[0] = '\0'; |
745 } else { | 745 } else { |
746 result = result->ToString(); | 746 result = result->ToString(); |
747 CHECK(result->IsString()); | 747 CHECK(result->IsString()); |
748 v8::Handle<v8::String> script_data(result->ToString()); | 748 v8::Handle<v8::String> script_data(result->ToString()); |
749 script_data->WriteAscii(last_script_data_hit); | 749 script_data->WriteUtf8(last_script_data_hit); |
750 } | 750 } |
751 } | 751 } |
752 } | 752 } |
753 | 753 |
754 | 754 |
755 // Debug event handler which counts a number of events and collects the stack | 755 // Debug event handler which counts a number of events and collects the stack |
756 // height if there is a function compiled for that. | 756 // height if there is a function compiled for that. |
757 int exception_hit_count = 0; | 757 int exception_hit_count = 0; |
758 int uncaught_exception_hit_count = 0; | 758 int uncaught_exception_hit_count = 0; |
759 int last_js_stack_height = -1; | 759 int last_js_stack_height = -1; |
(...skipping 5609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6369 // Get the name of the function. | 6369 // Get the name of the function. |
6370 const int argc = 2; | 6370 const int argc = 2; |
6371 v8::Handle<v8::Value> argv[argc] = { exec_state, v8::Integer::New(0) }; | 6371 v8::Handle<v8::Value> argv[argc] = { exec_state, v8::Integer::New(0) }; |
6372 v8::Handle<v8::Value> result = frame_function_name->Call(exec_state, | 6372 v8::Handle<v8::Value> result = frame_function_name->Call(exec_state, |
6373 argc, argv); | 6373 argc, argv); |
6374 if (result->IsUndefined()) { | 6374 if (result->IsUndefined()) { |
6375 last_function_hit[0] = '\0'; | 6375 last_function_hit[0] = '\0'; |
6376 } else { | 6376 } else { |
6377 CHECK(result->IsString()); | 6377 CHECK(result->IsString()); |
6378 v8::Handle<v8::String> function_name(result->ToString()); | 6378 v8::Handle<v8::String> function_name(result->ToString()); |
6379 function_name->WriteAscii(last_function_hit); | 6379 function_name->WriteUtf8(last_function_hit); |
6380 } | 6380 } |
6381 } | 6381 } |
6382 | 6382 |
6383 // Keep forcing breaks. | 6383 // Keep forcing breaks. |
6384 if (break_point_hit_count < 20) { | 6384 if (break_point_hit_count < 20) { |
6385 v8::Debug::DebugBreak(); | 6385 v8::Debug::DebugBreak(); |
6386 } | 6386 } |
6387 } | 6387 } |
6388 } | 6388 } |
6389 | 6389 |
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7169 if (!frame_function_name.IsEmpty()) { | 7169 if (!frame_function_name.IsEmpty()) { |
7170 // Get the name of the function. | 7170 // Get the name of the function. |
7171 const int argc = 2; | 7171 const int argc = 2; |
7172 v8::Handle<v8::Value> argv[argc] = { exec_state, v8::Integer::New(0) }; | 7172 v8::Handle<v8::Value> argv[argc] = { exec_state, v8::Integer::New(0) }; |
7173 v8::Handle<v8::Value> result = | 7173 v8::Handle<v8::Value> result = |
7174 frame_function_name->Call(exec_state, argc, argv); | 7174 frame_function_name->Call(exec_state, argc, argv); |
7175 if (!result->IsUndefined()) { | 7175 if (!result->IsUndefined()) { |
7176 char fn[80]; | 7176 char fn[80]; |
7177 CHECK(result->IsString()); | 7177 CHECK(result->IsString()); |
7178 v8::Handle<v8::String> function_name(result->ToString()); | 7178 v8::Handle<v8::String> function_name(result->ToString()); |
7179 function_name->WriteAscii(fn); | 7179 function_name->WriteUtf8(fn); |
7180 if (strcmp(fn, "bar") == 0) { | 7180 if (strcmp(fn, "bar") == 0) { |
7181 i::Deoptimizer::DeoptimizeAll(v8::internal::Isolate::Current()); | 7181 i::Deoptimizer::DeoptimizeAll(v8::internal::Isolate::Current()); |
7182 debug_event_break_deoptimize_done = true; | 7182 debug_event_break_deoptimize_done = true; |
7183 } | 7183 } |
7184 } | 7184 } |
7185 } | 7185 } |
7186 | 7186 |
7187 v8::Debug::DebugBreak(); | 7187 v8::Debug::DebugBreak(); |
7188 } | 7188 } |
7189 } | 7189 } |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7540 TEST(LiveEditDisabled) { | 7540 TEST(LiveEditDisabled) { |
7541 v8::internal::FLAG_allow_natives_syntax = true; | 7541 v8::internal::FLAG_allow_natives_syntax = true; |
7542 LocalContext env; | 7542 LocalContext env; |
7543 v8::HandleScope scope(env->GetIsolate()); | 7543 v8::HandleScope scope(env->GetIsolate()); |
7544 v8::Debug::SetLiveEditEnabled(false); | 7544 v8::Debug::SetLiveEditEnabled(false); |
7545 CompileRun("%LiveEditCompareStrings('', '')"); | 7545 CompileRun("%LiveEditCompareStrings('', '')"); |
7546 } | 7546 } |
7547 | 7547 |
7548 | 7548 |
7549 #endif // ENABLE_DEBUGGER_SUPPORT | 7549 #endif // ENABLE_DEBUGGER_SUPPORT |
OLD | NEW |