Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: test/cctest/test-debug.cc

Issue 1303393004: Revert of [heap] More flag cleanup. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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("CheckDebuggerUnloaded", 401 CcTest::heap()->CollectAllGarbage(Heap::kMakeHeapIterableMask);
402 Heap::kMakeHeapIterableMask);
403 402
404 // Iterate the head and check that there are no debugger related objects left. 403 // Iterate the head and check that there are no debugger related objects left.
405 HeapIterator iterator(CcTest::heap()); 404 HeapIterator iterator(CcTest::heap());
406 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { 405 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) {
407 CHECK(!obj->IsDebugInfo()); 406 CHECK(!obj->IsDebugInfo());
408 CHECK(!obj->IsBreakPointInfo()); 407 CHECK(!obj->IsBreakPointInfo());
409 408
410 // If deep check of functions is requested check that no debug break code 409 // If deep check of functions is requested check that no debug break code
411 // is left in all functions. 410 // is left in all functions.
412 if (check_functions) { 411 if (check_functions) {
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 // When hitting a debug event listener there must be a break set. 806 // When hitting a debug event listener there must be a break set.
808 CHECK_NE(debug->break_id(), 0); 807 CHECK_NE(debug->break_id(), 0);
809 808
810 // Perform a garbage collection when break point is hit and continue. Based 809 // Perform a garbage collection when break point is hit and continue. Based
811 // on the number of break points hit either scavenge or mark compact 810 // on the number of break points hit either scavenge or mark compact
812 // collector is used. 811 // collector is used.
813 if (event == v8::Break) { 812 if (event == v8::Break) {
814 break_point_hit_count++; 813 break_point_hit_count++;
815 if (break_point_hit_count % 2 == 0) { 814 if (break_point_hit_count % 2 == 0) {
816 // Scavenge. 815 // Scavenge.
817 CcTest::heap()->CollectGarbageNewSpace(); 816 CcTest::heap()->CollectGarbage(v8::internal::NEW_SPACE);
818 } else { 817 } else {
819 // Mark sweep compact. 818 // Mark sweep compact.
820 CcTest::heap()->CollectAllGarbage(); 819 CcTest::heap()->CollectAllGarbage();
821 } 820 }
822 } 821 }
823 } 822 }
824 823
825 824
826 // Debug event handler which re-issues a debug break and calls the garbage 825 // Debug event handler which re-issues a debug break and calls the garbage
827 // collector to have the heap verified. 826 // collector to have the heap verified.
828 static void DebugEventBreak( 827 static void DebugEventBreak(
829 const v8::Debug::EventDetails& event_details) { 828 const v8::Debug::EventDetails& event_details) {
830 v8::DebugEvent event = event_details.GetEvent(); 829 v8::DebugEvent event = event_details.GetEvent();
831 v8::internal::Debug* debug = CcTest::i_isolate()->debug(); 830 v8::internal::Debug* debug = CcTest::i_isolate()->debug();
832 // When hitting a debug event listener there must be a break set. 831 // When hitting a debug event listener there must be a break set.
833 CHECK_NE(debug->break_id(), 0); 832 CHECK_NE(debug->break_id(), 0);
834 833
835 if (event == v8::Break) { 834 if (event == v8::Break) {
836 // Count the number of breaks. 835 // Count the number of breaks.
837 break_point_hit_count++; 836 break_point_hit_count++;
838 837
839 // Run the garbage collector to enforce heap verification if option 838 // Run the garbage collector to enforce heap verification if option
840 // --verify-heap is set. 839 // --verify-heap is set.
841 CcTest::heap()->CollectGarbageNewSpace(); 840 CcTest::heap()->CollectGarbage(v8::internal::NEW_SPACE);
842 841
843 // Set the break flag again to come back here as soon as possible. 842 // Set the break flag again to come back here as soon as possible.
844 v8::Debug::DebugBreak(CcTest::isolate()); 843 v8::Debug::DebugBreak(CcTest::isolate());
845 } 844 }
846 } 845 }
847 846
848 847
849 // Debug event handler which re-issues a debug break until a limit has been 848 // Debug event handler which re-issues a debug break until a limit has been
850 // reached. 849 // reached.
851 int max_break_point_hit_count = 0; 850 int max_break_point_hit_count = 0;
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
1215 static void CallAndGC(v8::Local<v8::Object> recv, 1214 static void CallAndGC(v8::Local<v8::Object> recv,
1216 v8::Local<v8::Function> f) { 1215 v8::Local<v8::Function> f) {
1217 break_point_hit_count = 0; 1216 break_point_hit_count = 0;
1218 1217
1219 for (int i = 0; i < 3; i++) { 1218 for (int i = 0; i < 3; i++) {
1220 // Call function. 1219 // Call function.
1221 f->Call(recv, 0, NULL); 1220 f->Call(recv, 0, NULL);
1222 CHECK_EQ(1 + i * 3, break_point_hit_count); 1221 CHECK_EQ(1 + i * 3, break_point_hit_count);
1223 1222
1224 // Scavenge and call function. 1223 // Scavenge and call function.
1225 CcTest::heap()->CollectGarbageNewSpace(); 1224 CcTest::heap()->CollectGarbage(v8::internal::NEW_SPACE);
1226 f->Call(recv, 0, NULL); 1225 f->Call(recv, 0, NULL);
1227 CHECK_EQ(2 + i * 3, break_point_hit_count); 1226 CHECK_EQ(2 + i * 3, break_point_hit_count);
1228 1227
1229 // Mark sweep (and perhaps compact) and call function. 1228 // Mark sweep (and perhaps compact) and call function.
1230 CcTest::heap()->CollectAllGarbage(); 1229 CcTest::heap()->CollectAllGarbage();
1231 f->Call(recv, 0, NULL); 1230 f->Call(recv, 0, NULL);
1232 CHECK_EQ(3 + i * 3, break_point_hit_count); 1231 CHECK_EQ(3 + i * 3, break_point_hit_count);
1233 } 1232 }
1234 } 1233 }
1235 1234
(...skipping 6384 matching lines...) Expand 10 before | Expand all | Expand 10 after
7620 "let y = 2; \n" 7619 "let y = 2; \n"
7621 "debugger; \n" 7620 "debugger; \n"
7622 "x * y", 7621 "x * y",
7623 30); 7622 30);
7624 ExpectInt32( 7623 ExpectInt32(
7625 "x = 1; y = 2; \n" 7624 "x = 1; y = 2; \n"
7626 "debugger;" 7625 "debugger;"
7627 "x * y", 7626 "x * y",
7628 30); 7627 30);
7629 } 7628 }
OLDNEW
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698