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