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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 | 391 |
392 // Check that the debugger has been fully unloaded. | 392 // Check that the debugger has been fully unloaded. |
393 void CheckDebuggerUnloaded(bool check_functions) { | 393 void CheckDebuggerUnloaded(bool check_functions) { |
394 // Check that the debugger context is cleared and that there is no debug | 394 // Check that the debugger context is cleared and that there is no debug |
395 // information stored for the debugger. | 395 // information stored for the debugger. |
396 CHECK(CcTest::i_isolate()->debug()->debug_context().is_null()); | 396 CHECK(CcTest::i_isolate()->debug()->debug_context().is_null()); |
397 CHECK(!CcTest::i_isolate()->debug()->debug_info_list_); | 397 CHECK(!CcTest::i_isolate()->debug()->debug_info_list_); |
398 | 398 |
399 // Collect garbage to ensure weak handles are cleared. | 399 // Collect garbage to ensure weak handles are cleared. |
400 CcTest::heap()->CollectAllGarbage(); | 400 CcTest::heap()->CollectAllGarbage(); |
401 CcTest::heap()->CollectAllGarbage(Heap::kMakeHeapIterableMask); | 401 CcTest::heap()->CollectAllGarbage("CheckDebuggerUnloaded", |
| 402 Heap::kMakeHeapIterableMask); |
402 | 403 |
403 // Iterate the head and check that there are no debugger related objects left. | 404 // Iterate the head and check that there are no debugger related objects left. |
404 HeapIterator iterator(CcTest::heap()); | 405 HeapIterator iterator(CcTest::heap()); |
405 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { | 406 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { |
406 CHECK(!obj->IsDebugInfo()); | 407 CHECK(!obj->IsDebugInfo()); |
407 CHECK(!obj->IsBreakPointInfo()); | 408 CHECK(!obj->IsBreakPointInfo()); |
408 | 409 |
409 // If deep check of functions is requested check that no debug break code | 410 // If deep check of functions is requested check that no debug break code |
410 // is left in all functions. | 411 // is left in all functions. |
411 if (check_functions) { | 412 if (check_functions) { |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 // When hitting a debug event listener there must be a break set. | 807 // When hitting a debug event listener there must be a break set. |
807 CHECK_NE(debug->break_id(), 0); | 808 CHECK_NE(debug->break_id(), 0); |
808 | 809 |
809 // Perform a garbage collection when break point is hit and continue. Based | 810 // Perform a garbage collection when break point is hit and continue. Based |
810 // on the number of break points hit either scavenge or mark compact | 811 // on the number of break points hit either scavenge or mark compact |
811 // collector is used. | 812 // collector is used. |
812 if (event == v8::Break) { | 813 if (event == v8::Break) { |
813 break_point_hit_count++; | 814 break_point_hit_count++; |
814 if (break_point_hit_count % 2 == 0) { | 815 if (break_point_hit_count % 2 == 0) { |
815 // Scavenge. | 816 // Scavenge. |
816 CcTest::heap()->CollectGarbage(v8::internal::NEW_SPACE); | 817 CcTest::heap()->CollectGarbageNewSpace(); |
817 } else { | 818 } else { |
818 // Mark sweep compact. | 819 // Mark sweep compact. |
819 CcTest::heap()->CollectAllGarbage(); | 820 CcTest::heap()->CollectAllGarbage(); |
820 } | 821 } |
821 } | 822 } |
822 } | 823 } |
823 | 824 |
824 | 825 |
825 // Debug event handler which re-issues a debug break and calls the garbage | 826 // Debug event handler which re-issues a debug break and calls the garbage |
826 // collector to have the heap verified. | 827 // collector to have the heap verified. |
827 static void DebugEventBreak( | 828 static void DebugEventBreak( |
828 const v8::Debug::EventDetails& event_details) { | 829 const v8::Debug::EventDetails& event_details) { |
829 v8::DebugEvent event = event_details.GetEvent(); | 830 v8::DebugEvent event = event_details.GetEvent(); |
830 v8::internal::Debug* debug = CcTest::i_isolate()->debug(); | 831 v8::internal::Debug* debug = CcTest::i_isolate()->debug(); |
831 // When hitting a debug event listener there must be a break set. | 832 // When hitting a debug event listener there must be a break set. |
832 CHECK_NE(debug->break_id(), 0); | 833 CHECK_NE(debug->break_id(), 0); |
833 | 834 |
834 if (event == v8::Break) { | 835 if (event == v8::Break) { |
835 // Count the number of breaks. | 836 // Count the number of breaks. |
836 break_point_hit_count++; | 837 break_point_hit_count++; |
837 | 838 |
838 // Run the garbage collector to enforce heap verification if option | 839 // Run the garbage collector to enforce heap verification if option |
839 // --verify-heap is set. | 840 // --verify-heap is set. |
840 CcTest::heap()->CollectGarbage(v8::internal::NEW_SPACE); | 841 CcTest::heap()->CollectGarbageNewSpace(); |
841 | 842 |
842 // Set the break flag again to come back here as soon as possible. | 843 // Set the break flag again to come back here as soon as possible. |
843 v8::Debug::DebugBreak(CcTest::isolate()); | 844 v8::Debug::DebugBreak(CcTest::isolate()); |
844 } | 845 } |
845 } | 846 } |
846 | 847 |
847 | 848 |
848 // Debug event handler which re-issues a debug break until a limit has been | 849 // Debug event handler which re-issues a debug break until a limit has been |
849 // reached. | 850 // reached. |
850 int max_break_point_hit_count = 0; | 851 int max_break_point_hit_count = 0; |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1214 static void CallAndGC(v8::Local<v8::Object> recv, | 1215 static void CallAndGC(v8::Local<v8::Object> recv, |
1215 v8::Local<v8::Function> f) { | 1216 v8::Local<v8::Function> f) { |
1216 break_point_hit_count = 0; | 1217 break_point_hit_count = 0; |
1217 | 1218 |
1218 for (int i = 0; i < 3; i++) { | 1219 for (int i = 0; i < 3; i++) { |
1219 // Call function. | 1220 // Call function. |
1220 f->Call(recv, 0, NULL); | 1221 f->Call(recv, 0, NULL); |
1221 CHECK_EQ(1 + i * 3, break_point_hit_count); | 1222 CHECK_EQ(1 + i * 3, break_point_hit_count); |
1222 | 1223 |
1223 // Scavenge and call function. | 1224 // Scavenge and call function. |
1224 CcTest::heap()->CollectGarbage(v8::internal::NEW_SPACE); | 1225 CcTest::heap()->CollectGarbageNewSpace(); |
1225 f->Call(recv, 0, NULL); | 1226 f->Call(recv, 0, NULL); |
1226 CHECK_EQ(2 + i * 3, break_point_hit_count); | 1227 CHECK_EQ(2 + i * 3, break_point_hit_count); |
1227 | 1228 |
1228 // Mark sweep (and perhaps compact) and call function. | 1229 // Mark sweep (and perhaps compact) and call function. |
1229 CcTest::heap()->CollectAllGarbage(); | 1230 CcTest::heap()->CollectAllGarbage(); |
1230 f->Call(recv, 0, NULL); | 1231 f->Call(recv, 0, NULL); |
1231 CHECK_EQ(3 + i * 3, break_point_hit_count); | 1232 CHECK_EQ(3 + i * 3, break_point_hit_count); |
1232 } | 1233 } |
1233 } | 1234 } |
1234 | 1235 |
(...skipping 6382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7617 "let y = 2; \n" | 7618 "let y = 2; \n" |
7618 "debugger; \n" | 7619 "debugger; \n" |
7619 "x * y", | 7620 "x * y", |
7620 30); | 7621 30); |
7621 ExpectInt32( | 7622 ExpectInt32( |
7622 "x = 1; y = 2; \n" | 7623 "x = 1; y = 2; \n" |
7623 "debugger;" | 7624 "debugger;" |
7624 "x * y", | 7625 "x * y", |
7625 30); | 7626 30); |
7626 } | 7627 } |
OLD | NEW |