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

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

Issue 1768973002: [debugger] break at each initialization in a multiple var declaration. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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 | « src/parsing/pattern-rewriter.cc ('k') | test/mjsunit/debug-multiple-var-decl.js » ('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 2729 matching lines...) Expand 10 before | Expand all | Expand 10 after
2740 v8::Local<v8::Value> args[kArgc] = {a}; 2740 v8::Local<v8::Value> args[kArgc] = {a};
2741 foo->Call(context, env->Global(), kArgc, args).ToLocalChecked(); 2741 foo->Call(context, env->Global(), kArgc, args).ToLocalChecked();
2742 2742
2743 // Set up break point and step through the function. 2743 // Set up break point and step through the function.
2744 SetBreakPoint(foo, 3); 2744 SetBreakPoint(foo, 3);
2745 step_action = StepNext; 2745 step_action = StepNext;
2746 break_point_hit_count = 0; 2746 break_point_hit_count = 0;
2747 foo->Call(context, env->Global(), kArgc, args).ToLocalChecked(); 2747 foo->Call(context, env->Global(), kArgc, args).ToLocalChecked();
2748 2748
2749 // With stepping all break locations are hit. 2749 // With stepping all break locations are hit.
2750 CHECK_EQ(44, break_point_hit_count); 2750 CHECK_EQ(45, break_point_hit_count);
2751 2751
2752 v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); 2752 v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr);
2753 CheckDebuggerUnloaded(env->GetIsolate()); 2753 CheckDebuggerUnloaded(env->GetIsolate());
2754 } 2754 }
2755 2755
2756 2756
2757 // Test of the stepping mechanism for keyed store in a loop. 2757 // Test of the stepping mechanism for keyed store in a loop.
2758 TEST(DebugStepKeyedStoreLoop) { 2758 TEST(DebugStepKeyedStoreLoop) {
2759 DebugLocalContext env; 2759 DebugLocalContext env;
2760 v8::HandleScope scope(env->GetIsolate()); 2760 v8::HandleScope scope(env->GetIsolate());
(...skipping 29 matching lines...) Expand all
2790 v8::Local<v8::Value> args[kArgc] = {a}; 2790 v8::Local<v8::Value> args[kArgc] = {a};
2791 foo->Call(context, env->Global(), kArgc, args).ToLocalChecked(); 2791 foo->Call(context, env->Global(), kArgc, args).ToLocalChecked();
2792 2792
2793 // Set up break point and step through the function. 2793 // Set up break point and step through the function.
2794 SetBreakPoint(foo, 3); 2794 SetBreakPoint(foo, 3);
2795 step_action = StepNext; 2795 step_action = StepNext;
2796 break_point_hit_count = 0; 2796 break_point_hit_count = 0;
2797 foo->Call(context, env->Global(), kArgc, args).ToLocalChecked(); 2797 foo->Call(context, env->Global(), kArgc, args).ToLocalChecked();
2798 2798
2799 // With stepping all break locations are hit. 2799 // With stepping all break locations are hit.
2800 CHECK_EQ(44, break_point_hit_count); 2800 CHECK_EQ(45, break_point_hit_count);
2801 2801
2802 v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); 2802 v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr);
2803 CheckDebuggerUnloaded(env->GetIsolate()); 2803 CheckDebuggerUnloaded(env->GetIsolate());
2804 } 2804 }
2805 2805
2806 2806
2807 // Test of the stepping mechanism for named load in a loop. 2807 // Test of the stepping mechanism for named load in a loop.
2808 TEST(DebugStepNamedLoadLoop) { 2808 TEST(DebugStepNamedLoadLoop) {
2809 DebugLocalContext env; 2809 DebugLocalContext env;
2810 v8::HandleScope scope(env->GetIsolate()); 2810 v8::HandleScope scope(env->GetIsolate());
(...skipping 24 matching lines...) Expand all
2835 // Call function without any break points to ensure inlining is in place. 2835 // Call function without any break points to ensure inlining is in place.
2836 foo->Call(context, env->Global(), 0, NULL).ToLocalChecked(); 2836 foo->Call(context, env->Global(), 0, NULL).ToLocalChecked();
2837 2837
2838 // Set up break point and step through the function. 2838 // Set up break point and step through the function.
2839 SetBreakPoint(foo, 4); 2839 SetBreakPoint(foo, 4);
2840 step_action = StepNext; 2840 step_action = StepNext;
2841 break_point_hit_count = 0; 2841 break_point_hit_count = 0;
2842 foo->Call(context, env->Global(), 0, NULL).ToLocalChecked(); 2842 foo->Call(context, env->Global(), 0, NULL).ToLocalChecked();
2843 2843
2844 // With stepping all break locations are hit. 2844 // With stepping all break locations are hit.
2845 CHECK_EQ(65, break_point_hit_count); 2845 CHECK_EQ(66, break_point_hit_count);
2846 2846
2847 v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); 2847 v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr);
2848 CheckDebuggerUnloaded(env->GetIsolate()); 2848 CheckDebuggerUnloaded(env->GetIsolate());
2849 } 2849 }
2850 2850
2851 2851
2852 static void DoDebugStepNamedStoreLoop(int expected) { 2852 static void DoDebugStepNamedStoreLoop(int expected) {
2853 DebugLocalContext env; 2853 DebugLocalContext env;
2854 v8::HandleScope scope(env->GetIsolate()); 2854 v8::HandleScope scope(env->GetIsolate());
2855 2855
(...skipping 23 matching lines...) Expand all
2879 2879
2880 // With stepping all expected break locations are hit. 2880 // With stepping all expected break locations are hit.
2881 CHECK_EQ(expected, break_point_hit_count); 2881 CHECK_EQ(expected, break_point_hit_count);
2882 2882
2883 v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); 2883 v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr);
2884 CheckDebuggerUnloaded(env->GetIsolate()); 2884 CheckDebuggerUnloaded(env->GetIsolate());
2885 } 2885 }
2886 2886
2887 2887
2888 // Test of the stepping mechanism for named load in a loop. 2888 // Test of the stepping mechanism for named load in a loop.
2889 TEST(DebugStepNamedStoreLoop) { DoDebugStepNamedStoreLoop(34); } 2889 TEST(DebugStepNamedStoreLoop) { DoDebugStepNamedStoreLoop(35); }
2890
2891 2890
2892 // Test the stepping mechanism with different ICs. 2891 // Test the stepping mechanism with different ICs.
2893 TEST(DebugStepLinearMixedICs) { 2892 TEST(DebugStepLinearMixedICs) {
2894 DebugLocalContext env; 2893 DebugLocalContext env;
2895 v8::HandleScope scope(env->GetIsolate()); 2894 v8::HandleScope scope(env->GetIsolate());
2896 2895
2897 // Register a debug event listener which steps and counts. 2896 // Register a debug event listener which steps and counts.
2898 v8::Debug::SetDebugEventListener(env->GetIsolate(), DebugEventStep); 2897 v8::Debug::SetDebugEventListener(env->GetIsolate(), DebugEventStep);
2899 2898
2900 v8::Local<v8::Context> context = env.context(); 2899 v8::Local<v8::Context> context = env.context();
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
3287 SetBreakPoint(foo, 8); // "var a = 0;" 3286 SetBreakPoint(foo, 8); // "var a = 0;"
3288 3287
3289 // Each loop generates 4 or 5 steps depending on whether a is equal. 3288 // Each loop generates 4 or 5 steps depending on whether a is equal.
3290 3289
3291 // Looping 10 times. 3290 // Looping 10 times.
3292 step_action = StepIn; 3291 step_action = StepIn;
3293 break_point_hit_count = 0; 3292 break_point_hit_count = 0;
3294 v8::Local<v8::Value> argv_10[argc] = {v8::Number::New(isolate, 10)}; 3293 v8::Local<v8::Value> argv_10[argc] = {v8::Number::New(isolate, 10)};
3295 result = foo->Call(context, env->Global(), argc, argv_10).ToLocalChecked(); 3294 result = foo->Call(context, env->Global(), argc, argv_10).ToLocalChecked();
3296 CHECK_EQ(5, result->Int32Value(context).FromJust()); 3295 CHECK_EQ(5, result->Int32Value(context).FromJust());
3297 CHECK_EQ(62, break_point_hit_count); 3296 CHECK_EQ(63, break_point_hit_count);
3298 3297
3299 // Looping 100 times. 3298 // Looping 100 times.
3300 step_action = StepIn; 3299 step_action = StepIn;
3301 break_point_hit_count = 0; 3300 break_point_hit_count = 0;
3302 v8::Local<v8::Value> argv_100[argc] = {v8::Number::New(isolate, 100)}; 3301 v8::Local<v8::Value> argv_100[argc] = {v8::Number::New(isolate, 100)};
3303 result = foo->Call(context, env->Global(), argc, argv_100).ToLocalChecked(); 3302 result = foo->Call(context, env->Global(), argc, argv_100).ToLocalChecked();
3304 CHECK_EQ(50, result->Int32Value(context).FromJust()); 3303 CHECK_EQ(50, result->Int32Value(context).FromJust());
3305 CHECK_EQ(557, break_point_hit_count); 3304 CHECK_EQ(558, break_point_hit_count);
3306 3305
3307 // Get rid of the debug event listener. 3306 // Get rid of the debug event listener.
3308 v8::Debug::SetDebugEventListener(isolate, nullptr); 3307 v8::Debug::SetDebugEventListener(isolate, nullptr);
3309 CheckDebuggerUnloaded(isolate); 3308 CheckDebuggerUnloaded(isolate);
3310 } 3309 }
3311 3310
3312 3311
3313 TEST(DebugStepForBreak) { 3312 TEST(DebugStepForBreak) {
3314 DebugLocalContext env; 3313 DebugLocalContext env;
3315 v8::Isolate* isolate = env->GetIsolate(); 3314 v8::Isolate* isolate = env->GetIsolate();
(...skipping 25 matching lines...) Expand all
3341 3340
3342 // Each loop generates 5 steps except for the last (when break is executed) 3341 // Each loop generates 5 steps except for the last (when break is executed)
3343 // which only generates 4. 3342 // which only generates 4.
3344 3343
3345 // Looping 10 times. 3344 // Looping 10 times.
3346 step_action = StepIn; 3345 step_action = StepIn;
3347 break_point_hit_count = 0; 3346 break_point_hit_count = 0;
3348 v8::Local<v8::Value> argv_10[argc] = {v8::Number::New(isolate, 10)}; 3347 v8::Local<v8::Value> argv_10[argc] = {v8::Number::New(isolate, 10)};
3349 result = foo->Call(context, env->Global(), argc, argv_10).ToLocalChecked(); 3348 result = foo->Call(context, env->Global(), argc, argv_10).ToLocalChecked();
3350 CHECK_EQ(9, result->Int32Value(context).FromJust()); 3349 CHECK_EQ(9, result->Int32Value(context).FromJust());
3351 CHECK_EQ(64, break_point_hit_count); 3350 CHECK_EQ(65, break_point_hit_count);
3352 3351
3353 // Looping 100 times. 3352 // Looping 100 times.
3354 step_action = StepIn; 3353 step_action = StepIn;
3355 break_point_hit_count = 0; 3354 break_point_hit_count = 0;
3356 v8::Local<v8::Value> argv_100[argc] = {v8::Number::New(isolate, 100)}; 3355 v8::Local<v8::Value> argv_100[argc] = {v8::Number::New(isolate, 100)};
3357 result = foo->Call(context, env->Global(), argc, argv_100).ToLocalChecked(); 3356 result = foo->Call(context, env->Global(), argc, argv_100).ToLocalChecked();
3358 CHECK_EQ(99, result->Int32Value(context).FromJust()); 3357 CHECK_EQ(99, result->Int32Value(context).FromJust());
3359 CHECK_EQ(604, break_point_hit_count); 3358 CHECK_EQ(605, break_point_hit_count);
3360 3359
3361 // Get rid of the debug event listener. 3360 // Get rid of the debug event listener.
3362 v8::Debug::SetDebugEventListener(isolate, nullptr); 3361 v8::Debug::SetDebugEventListener(isolate, nullptr);
3363 CheckDebuggerUnloaded(isolate); 3362 CheckDebuggerUnloaded(isolate);
3364 } 3363 }
3365 3364
3366 3365
3367 TEST(DebugStepForIn) { 3366 TEST(DebugStepForIn) {
3368 DebugLocalContext env; 3367 DebugLocalContext env;
3369 v8::HandleScope scope(env->GetIsolate()); 3368 v8::HandleScope scope(env->GetIsolate());
(...skipping 4695 matching lines...) Expand 10 before | Expand all | Expand 10 after
8065 CHECK_EQ(22, iterator->GetBreakLocation().position()); 8064 CHECK_EQ(22, iterator->GetBreakLocation().position());
8066 iterator->Next(); 8065 iterator->Next();
8067 CHECK(iterator->GetBreakLocation().IsReturn()); 8066 CHECK(iterator->GetBreakLocation().IsReturn());
8068 CHECK_EQ(50, iterator->GetBreakLocation().position()); 8067 CHECK_EQ(50, iterator->GetBreakLocation().position());
8069 iterator->Next(); 8068 iterator->Next();
8070 CHECK(iterator->Done()); 8069 CHECK(iterator->Done());
8071 delete iterator; 8070 delete iterator;
8072 8071
8073 DisableDebugger(isolate); 8072 DisableDebugger(isolate);
8074 } 8073 }
OLDNEW
« no previous file with comments | « src/parsing/pattern-rewriter.cc ('k') | test/mjsunit/debug-multiple-var-decl.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698