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 2829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2840 v8::Handle<v8::Value> args[kArgc] = { a }; | 2840 v8::Handle<v8::Value> args[kArgc] = { a }; |
2841 foo->Call(env->Global(), kArgc, args); | 2841 foo->Call(env->Global(), kArgc, args); |
2842 | 2842 |
2843 // Set up break point and step through the function. | 2843 // Set up break point and step through the function. |
2844 SetBreakPoint(foo, 3); | 2844 SetBreakPoint(foo, 3); |
2845 step_action = StepNext; | 2845 step_action = StepNext; |
2846 break_point_hit_count = 0; | 2846 break_point_hit_count = 0; |
2847 foo->Call(env->Global(), kArgc, args); | 2847 foo->Call(env->Global(), kArgc, args); |
2848 | 2848 |
2849 // With stepping all break locations are hit. | 2849 // With stepping all break locations are hit. |
2850 CHECK_EQ(34, break_point_hit_count); | 2850 CHECK_EQ(35, break_point_hit_count); |
2851 | 2851 |
2852 v8::Debug::SetDebugEventListener2(NULL); | 2852 v8::Debug::SetDebugEventListener2(NULL); |
2853 CheckDebuggerUnloaded(); | 2853 CheckDebuggerUnloaded(); |
2854 } | 2854 } |
2855 | 2855 |
2856 | 2856 |
2857 // Test of the stepping mechanism for keyed store in a loop. | 2857 // Test of the stepping mechanism for keyed store in a loop. |
2858 TEST(DebugStepKeyedStoreLoop) { | 2858 TEST(DebugStepKeyedStoreLoop) { |
2859 DebugLocalContext env; | 2859 DebugLocalContext env; |
2860 v8::HandleScope scope(env->GetIsolate()); | 2860 v8::HandleScope scope(env->GetIsolate()); |
(...skipping 26 matching lines...) Expand all Loading... |
2887 v8::Handle<v8::Value> args[kArgc] = { a }; | 2887 v8::Handle<v8::Value> args[kArgc] = { a }; |
2888 foo->Call(env->Global(), kArgc, args); | 2888 foo->Call(env->Global(), kArgc, args); |
2889 | 2889 |
2890 // Set up break point and step through the function. | 2890 // Set up break point and step through the function. |
2891 SetBreakPoint(foo, 3); | 2891 SetBreakPoint(foo, 3); |
2892 step_action = StepNext; | 2892 step_action = StepNext; |
2893 break_point_hit_count = 0; | 2893 break_point_hit_count = 0; |
2894 foo->Call(env->Global(), kArgc, args); | 2894 foo->Call(env->Global(), kArgc, args); |
2895 | 2895 |
2896 // With stepping all break locations are hit. | 2896 // With stepping all break locations are hit. |
2897 CHECK_EQ(33, break_point_hit_count); | 2897 CHECK_EQ(34, break_point_hit_count); |
2898 | 2898 |
2899 v8::Debug::SetDebugEventListener2(NULL); | 2899 v8::Debug::SetDebugEventListener2(NULL); |
2900 CheckDebuggerUnloaded(); | 2900 CheckDebuggerUnloaded(); |
2901 } | 2901 } |
2902 | 2902 |
2903 | 2903 |
2904 // Test of the stepping mechanism for named load in a loop. | 2904 // Test of the stepping mechanism for named load in a loop. |
2905 TEST(DebugStepNamedLoadLoop) { | 2905 TEST(DebugStepNamedLoadLoop) { |
2906 DebugLocalContext env; | 2906 DebugLocalContext env; |
2907 v8::HandleScope scope(env->GetIsolate()); | 2907 v8::HandleScope scope(env->GetIsolate()); |
(...skipping 23 matching lines...) Expand all Loading... |
2931 // Call function without any break points to ensure inlining is in place. | 2931 // Call function without any break points to ensure inlining is in place. |
2932 foo->Call(env->Global(), 0, NULL); | 2932 foo->Call(env->Global(), 0, NULL); |
2933 | 2933 |
2934 // Set up break point and step through the function. | 2934 // Set up break point and step through the function. |
2935 SetBreakPoint(foo, 4); | 2935 SetBreakPoint(foo, 4); |
2936 step_action = StepNext; | 2936 step_action = StepNext; |
2937 break_point_hit_count = 0; | 2937 break_point_hit_count = 0; |
2938 foo->Call(env->Global(), 0, NULL); | 2938 foo->Call(env->Global(), 0, NULL); |
2939 | 2939 |
2940 // With stepping all break locations are hit. | 2940 // With stepping all break locations are hit. |
2941 CHECK_EQ(54, break_point_hit_count); | 2941 CHECK_EQ(55, break_point_hit_count); |
2942 | 2942 |
2943 v8::Debug::SetDebugEventListener2(NULL); | 2943 v8::Debug::SetDebugEventListener2(NULL); |
2944 CheckDebuggerUnloaded(); | 2944 CheckDebuggerUnloaded(); |
2945 } | 2945 } |
2946 | 2946 |
2947 | 2947 |
2948 static void DoDebugStepNamedStoreLoop(int expected) { | 2948 static void DoDebugStepNamedStoreLoop(int expected) { |
2949 DebugLocalContext env; | 2949 DebugLocalContext env; |
2950 v8::HandleScope scope(env->GetIsolate()); | 2950 v8::HandleScope scope(env->GetIsolate()); |
2951 | 2951 |
(...skipping 23 matching lines...) Expand all Loading... |
2975 // With stepping all expected break locations are hit. | 2975 // With stepping all expected break locations are hit. |
2976 CHECK_EQ(expected, break_point_hit_count); | 2976 CHECK_EQ(expected, break_point_hit_count); |
2977 | 2977 |
2978 v8::Debug::SetDebugEventListener2(NULL); | 2978 v8::Debug::SetDebugEventListener2(NULL); |
2979 CheckDebuggerUnloaded(); | 2979 CheckDebuggerUnloaded(); |
2980 } | 2980 } |
2981 | 2981 |
2982 | 2982 |
2983 // Test of the stepping mechanism for named load in a loop. | 2983 // Test of the stepping mechanism for named load in a loop. |
2984 TEST(DebugStepNamedStoreLoop) { | 2984 TEST(DebugStepNamedStoreLoop) { |
2985 DoDebugStepNamedStoreLoop(23); | 2985 DoDebugStepNamedStoreLoop(24); |
2986 } | 2986 } |
2987 | 2987 |
2988 | 2988 |
2989 // Test the stepping mechanism with different ICs. | 2989 // Test the stepping mechanism with different ICs. |
2990 TEST(DebugStepLinearMixedICs) { | 2990 TEST(DebugStepLinearMixedICs) { |
2991 DebugLocalContext env; | 2991 DebugLocalContext env; |
2992 v8::HandleScope scope(env->GetIsolate()); | 2992 v8::HandleScope scope(env->GetIsolate()); |
2993 | 2993 |
2994 // Register a debug event listener which steps and counts. | 2994 // Register a debug event listener which steps and counts. |
2995 v8::Debug::SetDebugEventListener2(DebugEventStep); | 2995 v8::Debug::SetDebugEventListener2(DebugEventStep); |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3347 SetBreakPoint(foo, 8); // "var a = 0;" | 3347 SetBreakPoint(foo, 8); // "var a = 0;" |
3348 | 3348 |
3349 // Each loop generates 4 or 5 steps depending on whether a is equal. | 3349 // Each loop generates 4 or 5 steps depending on whether a is equal. |
3350 | 3350 |
3351 // Looping 10 times. | 3351 // Looping 10 times. |
3352 step_action = StepIn; | 3352 step_action = StepIn; |
3353 break_point_hit_count = 0; | 3353 break_point_hit_count = 0; |
3354 v8::Handle<v8::Value> argv_10[argc] = { v8::Number::New(10) }; | 3354 v8::Handle<v8::Value> argv_10[argc] = { v8::Number::New(10) }; |
3355 result = foo->Call(env->Global(), argc, argv_10); | 3355 result = foo->Call(env->Global(), argc, argv_10); |
3356 CHECK_EQ(5, result->Int32Value()); | 3356 CHECK_EQ(5, result->Int32Value()); |
3357 CHECK_EQ(51, break_point_hit_count); | 3357 CHECK_EQ(52, break_point_hit_count); |
3358 | 3358 |
3359 // Looping 100 times. | 3359 // Looping 100 times. |
3360 step_action = StepIn; | 3360 step_action = StepIn; |
3361 break_point_hit_count = 0; | 3361 break_point_hit_count = 0; |
3362 v8::Handle<v8::Value> argv_100[argc] = { v8::Number::New(100) }; | 3362 v8::Handle<v8::Value> argv_100[argc] = { v8::Number::New(100) }; |
3363 result = foo->Call(env->Global(), argc, argv_100); | 3363 result = foo->Call(env->Global(), argc, argv_100); |
3364 CHECK_EQ(50, result->Int32Value()); | 3364 CHECK_EQ(50, result->Int32Value()); |
3365 CHECK_EQ(456, break_point_hit_count); | 3365 CHECK_EQ(457, break_point_hit_count); |
3366 | 3366 |
3367 // Get rid of the debug event listener. | 3367 // Get rid of the debug event listener. |
3368 v8::Debug::SetDebugEventListener2(NULL); | 3368 v8::Debug::SetDebugEventListener2(NULL); |
3369 CheckDebuggerUnloaded(); | 3369 CheckDebuggerUnloaded(); |
3370 } | 3370 } |
3371 | 3371 |
3372 | 3372 |
3373 TEST(DebugStepForBreak) { | 3373 TEST(DebugStepForBreak) { |
3374 DebugLocalContext env; | 3374 DebugLocalContext env; |
3375 v8::HandleScope scope(env->GetIsolate()); | 3375 v8::HandleScope scope(env->GetIsolate()); |
(...skipping 23 matching lines...) Expand all Loading... |
3399 | 3399 |
3400 // Each loop generates 5 steps except for the last (when break is executed) | 3400 // Each loop generates 5 steps except for the last (when break is executed) |
3401 // which only generates 4. | 3401 // which only generates 4. |
3402 | 3402 |
3403 // Looping 10 times. | 3403 // Looping 10 times. |
3404 step_action = StepIn; | 3404 step_action = StepIn; |
3405 break_point_hit_count = 0; | 3405 break_point_hit_count = 0; |
3406 v8::Handle<v8::Value> argv_10[argc] = { v8::Number::New(10) }; | 3406 v8::Handle<v8::Value> argv_10[argc] = { v8::Number::New(10) }; |
3407 result = foo->Call(env->Global(), argc, argv_10); | 3407 result = foo->Call(env->Global(), argc, argv_10); |
3408 CHECK_EQ(9, result->Int32Value()); | 3408 CHECK_EQ(9, result->Int32Value()); |
3409 CHECK_EQ(54, break_point_hit_count); | 3409 CHECK_EQ(55, break_point_hit_count); |
3410 | 3410 |
3411 // Looping 100 times. | 3411 // Looping 100 times. |
3412 step_action = StepIn; | 3412 step_action = StepIn; |
3413 break_point_hit_count = 0; | 3413 break_point_hit_count = 0; |
3414 v8::Handle<v8::Value> argv_100[argc] = { v8::Number::New(100) }; | 3414 v8::Handle<v8::Value> argv_100[argc] = { v8::Number::New(100) }; |
3415 result = foo->Call(env->Global(), argc, argv_100); | 3415 result = foo->Call(env->Global(), argc, argv_100); |
3416 CHECK_EQ(99, result->Int32Value()); | 3416 CHECK_EQ(99, result->Int32Value()); |
3417 CHECK_EQ(504, break_point_hit_count); | 3417 CHECK_EQ(505, break_point_hit_count); |
3418 | 3418 |
3419 // Get rid of the debug event listener. | 3419 // Get rid of the debug event listener. |
3420 v8::Debug::SetDebugEventListener2(NULL); | 3420 v8::Debug::SetDebugEventListener2(NULL); |
3421 CheckDebuggerUnloaded(); | 3421 CheckDebuggerUnloaded(); |
3422 } | 3422 } |
3423 | 3423 |
3424 | 3424 |
3425 TEST(DebugStepForIn) { | 3425 TEST(DebugStepForIn) { |
3426 DebugLocalContext env; | 3426 DebugLocalContext env; |
3427 v8::HandleScope scope(env->GetIsolate()); | 3427 v8::HandleScope scope(env->GetIsolate()); |
(...skipping 4106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7534 TEST(LiveEditDisabled) { | 7534 TEST(LiveEditDisabled) { |
7535 v8::internal::FLAG_allow_natives_syntax = true; | 7535 v8::internal::FLAG_allow_natives_syntax = true; |
7536 LocalContext env; | 7536 LocalContext env; |
7537 v8::HandleScope scope(env->GetIsolate()); | 7537 v8::HandleScope scope(env->GetIsolate()); |
7538 v8::Debug::SetLiveEditEnabled(false); | 7538 v8::Debug::SetLiveEditEnabled(false); |
7539 CompileRun("%LiveEditCompareStrings('', '')"); | 7539 CompileRun("%LiveEditCompareStrings('', '')"); |
7540 } | 7540 } |
7541 | 7541 |
7542 | 7542 |
7543 #endif // ENABLE_DEBUGGER_SUPPORT | 7543 #endif // ENABLE_DEBUGGER_SUPPORT |
OLD | NEW |