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 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
860 // When hitting a debug event listener there must be a break set. | 860 // When hitting a debug event listener there must be a break set. |
861 CHECK_NE(v8::internal::Debug::break_id(), 0); | 861 CHECK_NE(v8::internal::Debug::break_id(), 0); |
862 | 862 |
863 // Perform a garbage collection when break point is hit and continue. Based | 863 // Perform a garbage collection when break point is hit and continue. Based |
864 // on the number of break points hit either scavenge or mark compact | 864 // on the number of break points hit either scavenge or mark compact |
865 // collector is used. | 865 // collector is used. |
866 if (event == v8::Break) { | 866 if (event == v8::Break) { |
867 break_point_hit_count++; | 867 break_point_hit_count++; |
868 if (break_point_hit_count % 2 == 0) { | 868 if (break_point_hit_count % 2 == 0) { |
869 // Scavenge. | 869 // Scavenge. |
870 Heap::CollectGarbage(0, v8::internal::NEW_SPACE); | 870 Heap::CollectGarbage(v8::internal::NEW_SPACE); |
871 } else { | 871 } else { |
872 // Mark sweep compact. | 872 // Mark sweep compact. |
873 Heap::CollectAllGarbage(true); | 873 Heap::CollectAllGarbage(true); |
874 } | 874 } |
875 } | 875 } |
876 } | 876 } |
877 | 877 |
878 | 878 |
879 // Debug event handler which re-issues a debug break and calls the garbage | 879 // Debug event handler which re-issues a debug break and calls the garbage |
880 // collector to have the heap verified. | 880 // collector to have the heap verified. |
881 static void DebugEventBreak(v8::DebugEvent event, | 881 static void DebugEventBreak(v8::DebugEvent event, |
882 v8::Handle<v8::Object> exec_state, | 882 v8::Handle<v8::Object> exec_state, |
883 v8::Handle<v8::Object> event_data, | 883 v8::Handle<v8::Object> event_data, |
884 v8::Handle<v8::Value> data) { | 884 v8::Handle<v8::Value> data) { |
885 // When hitting a debug event listener there must be a break set. | 885 // When hitting a debug event listener there must be a break set. |
886 CHECK_NE(v8::internal::Debug::break_id(), 0); | 886 CHECK_NE(v8::internal::Debug::break_id(), 0); |
887 | 887 |
888 if (event == v8::Break) { | 888 if (event == v8::Break) { |
889 // Count the number of breaks. | 889 // Count the number of breaks. |
890 break_point_hit_count++; | 890 break_point_hit_count++; |
891 | 891 |
892 // Run the garbage collector to enforce heap verification if option | 892 // Run the garbage collector to enforce heap verification if option |
893 // --verify-heap is set. | 893 // --verify-heap is set. |
894 Heap::CollectGarbage(0, v8::internal::NEW_SPACE); | 894 Heap::CollectGarbage(v8::internal::NEW_SPACE); |
895 | 895 |
896 // Set the break flag again to come back here as soon as possible. | 896 // Set the break flag again to come back here as soon as possible. |
897 v8::Debug::DebugBreak(); | 897 v8::Debug::DebugBreak(); |
898 } | 898 } |
899 } | 899 } |
900 | 900 |
901 | 901 |
902 // Debug event handler which re-issues a debug break until a limit has been | 902 // Debug event handler which re-issues a debug break until a limit has been |
903 // reached. | 903 // reached. |
904 int max_break_point_hit_count = 0; | 904 int max_break_point_hit_count = 0; |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1315 v8::Local<v8::Function> f, | 1315 v8::Local<v8::Function> f, |
1316 bool force_compaction) { | 1316 bool force_compaction) { |
1317 break_point_hit_count = 0; | 1317 break_point_hit_count = 0; |
1318 | 1318 |
1319 for (int i = 0; i < 3; i++) { | 1319 for (int i = 0; i < 3; i++) { |
1320 // Call function. | 1320 // Call function. |
1321 f->Call(recv, 0, NULL); | 1321 f->Call(recv, 0, NULL); |
1322 CHECK_EQ(1 + i * 3, break_point_hit_count); | 1322 CHECK_EQ(1 + i * 3, break_point_hit_count); |
1323 | 1323 |
1324 // Scavenge and call function. | 1324 // Scavenge and call function. |
1325 Heap::CollectGarbage(0, v8::internal::NEW_SPACE); | 1325 Heap::CollectGarbage(v8::internal::NEW_SPACE); |
1326 f->Call(recv, 0, NULL); | 1326 f->Call(recv, 0, NULL); |
1327 CHECK_EQ(2 + i * 3, break_point_hit_count); | 1327 CHECK_EQ(2 + i * 3, break_point_hit_count); |
1328 | 1328 |
1329 // Mark sweep (and perhaps compact) and call function. | 1329 // Mark sweep (and perhaps compact) and call function. |
1330 Heap::CollectAllGarbage(force_compaction); | 1330 Heap::CollectAllGarbage(force_compaction); |
1331 f->Call(recv, 0, NULL); | 1331 f->Call(recv, 0, NULL); |
1332 CHECK_EQ(3 + i * 3, break_point_hit_count); | 1332 CHECK_EQ(3 + i * 3, break_point_hit_count); |
1333 } | 1333 } |
1334 } | 1334 } |
1335 | 1335 |
(...skipping 5550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6886 | 6886 |
6887 CHECK_EQ(2, TestClientData::constructor_call_counter); | 6887 CHECK_EQ(2, TestClientData::constructor_call_counter); |
6888 CHECK_EQ(TestClientData::constructor_call_counter, | 6888 CHECK_EQ(TestClientData::constructor_call_counter, |
6889 TestClientData::destructor_call_counter); | 6889 TestClientData::destructor_call_counter); |
6890 | 6890 |
6891 v8::Debug::SetDebugEventListener(NULL); | 6891 v8::Debug::SetDebugEventListener(NULL); |
6892 CheckDebuggerUnloaded(); | 6892 CheckDebuggerUnloaded(); |
6893 } | 6893 } |
6894 | 6894 |
6895 #endif // ENABLE_DEBUGGER_SUPPORT | 6895 #endif // ENABLE_DEBUGGER_SUPPORT |
OLD | NEW |