| OLD | NEW |
| 1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2008 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 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 } | 934 } |
| 935 | 935 |
| 936 | 936 |
| 937 // --- T h e A c t u a l T e s t s | 937 // --- T h e A c t u a l T e s t s |
| 938 | 938 |
| 939 | 939 |
| 940 // Test that the debug break function is the expected one for different kinds | 940 // Test that the debug break function is the expected one for different kinds |
| 941 // of break locations. | 941 // of break locations. |
| 942 TEST(DebugStub) { | 942 TEST(DebugStub) { |
| 943 using ::v8::internal::Builtins; | 943 using ::v8::internal::Builtins; |
| 944 using ::v8::internal::Isolate; |
| 944 v8::HandleScope scope; | 945 v8::HandleScope scope; |
| 945 DebugLocalContext env; | 946 DebugLocalContext env; |
| 946 | 947 |
| 947 CheckDebugBreakFunction(&env, | 948 CheckDebugBreakFunction(&env, |
| 948 "function f1(){}", "f1", | 949 "function f1(){}", "f1", |
| 949 0, | 950 0, |
| 950 v8::internal::RelocInfo::JS_RETURN, | 951 v8::internal::RelocInfo::JS_RETURN, |
| 951 NULL); | 952 NULL); |
| 952 CheckDebugBreakFunction(&env, | 953 CheckDebugBreakFunction(&env, |
| 953 "function f2(){x=1;}", "f2", | 954 "function f2(){x=1;}", "f2", |
| 954 0, | 955 0, |
| 955 v8::internal::RelocInfo::CODE_TARGET, | 956 v8::internal::RelocInfo::CODE_TARGET, |
| 956 Builtins::builtin(Builtins::StoreIC_DebugBreak)); | 957 Isolate::Current()->builtins()->builtin( |
| 958 Builtins::StoreIC_DebugBreak)); |
| 957 CheckDebugBreakFunction(&env, | 959 CheckDebugBreakFunction(&env, |
| 958 "function f3(){var a=x;}", "f3", | 960 "function f3(){var a=x;}", "f3", |
| 959 0, | 961 0, |
| 960 v8::internal::RelocInfo::CODE_TARGET_CONTEXT, | 962 v8::internal::RelocInfo::CODE_TARGET_CONTEXT, |
| 961 Builtins::builtin(Builtins::LoadIC_DebugBreak)); | 963 Isolate::Current()->builtins()->builtin( |
| 964 Builtins::LoadIC_DebugBreak)); |
| 962 | 965 |
| 963 // TODO(1240753): Make the test architecture independent or split | 966 // TODO(1240753): Make the test architecture independent or split |
| 964 // parts of the debugger into architecture dependent files. This | 967 // parts of the debugger into architecture dependent files. This |
| 965 // part currently disabled as it is not portable between IA32/ARM. | 968 // part currently disabled as it is not portable between IA32/ARM. |
| 966 // Currently on ICs for keyed store/load on ARM. | 969 // Currently on ICs for keyed store/load on ARM. |
| 967 #if !defined (__arm__) && !defined(__thumb__) | 970 #if !defined (__arm__) && !defined(__thumb__) |
| 968 CheckDebugBreakFunction( | 971 CheckDebugBreakFunction( |
| 969 &env, | 972 &env, |
| 970 "function f4(){var index='propertyName'; var a={}; a[index] = 'x';}", | 973 "function f4(){var index='propertyName'; var a={}; a[index] = 'x';}", |
| 971 "f4", | 974 "f4", |
| 972 0, | 975 0, |
| 973 v8::internal::RelocInfo::CODE_TARGET, | 976 v8::internal::RelocInfo::CODE_TARGET, |
| 974 Builtins::builtin(Builtins::KeyedStoreIC_DebugBreak)); | 977 Isolate::Current()->builtins()->builtin( |
| 978 Builtins::KeyedStoreIC_DebugBreak)); |
| 975 CheckDebugBreakFunction( | 979 CheckDebugBreakFunction( |
| 976 &env, | 980 &env, |
| 977 "function f5(){var index='propertyName'; var a={}; return a[index];}", | 981 "function f5(){var index='propertyName'; var a={}; return a[index];}", |
| 978 "f5", | 982 "f5", |
| 979 0, | 983 0, |
| 980 v8::internal::RelocInfo::CODE_TARGET, | 984 v8::internal::RelocInfo::CODE_TARGET, |
| 981 Builtins::builtin(Builtins::KeyedLoadIC_DebugBreak)); | 985 Isolate::Current()->builtins()->builtin( |
| 986 Builtins::KeyedLoadIC_DebugBreak)); |
| 982 #endif | 987 #endif |
| 983 | 988 |
| 984 // Check the debug break code stubs for call ICs with different number of | 989 // Check the debug break code stubs for call ICs with different number of |
| 985 // parameters. | 990 // parameters. |
| 986 Handle<Code> debug_break_0 = v8::internal::ComputeCallDebugBreak(0); | 991 Handle<Code> debug_break_0 = v8::internal::ComputeCallDebugBreak(0); |
| 987 Handle<Code> debug_break_1 = v8::internal::ComputeCallDebugBreak(1); | 992 Handle<Code> debug_break_1 = v8::internal::ComputeCallDebugBreak(1); |
| 988 Handle<Code> debug_break_4 = v8::internal::ComputeCallDebugBreak(4); | 993 Handle<Code> debug_break_4 = v8::internal::ComputeCallDebugBreak(4); |
| 989 | 994 |
| 990 CheckDebugBreakFunction(&env, | 995 CheckDebugBreakFunction(&env, |
| 991 "function f4_0(){x();}", "f4_0", | 996 "function f4_0(){x();}", "f4_0", |
| (...skipping 5574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6566 expected_context = v8::Context::New(); | 6571 expected_context = v8::Context::New(); |
| 6567 v8::Context::Scope context_scope(expected_context); | 6572 v8::Context::Scope context_scope(expected_context); |
| 6568 v8::Script::Compile(v8::String::New("(function(){debugger;})();"))->Run(); | 6573 v8::Script::Compile(v8::String::New("(function(){debugger;})();"))->Run(); |
| 6569 expected_context.Dispose(); | 6574 expected_context.Dispose(); |
| 6570 expected_context.Clear(); | 6575 expected_context.Clear(); |
| 6571 v8::Debug::SetDebugEventListener(NULL); | 6576 v8::Debug::SetDebugEventListener(NULL); |
| 6572 expected_context_data = v8::Handle<v8::Value>(); | 6577 expected_context_data = v8::Handle<v8::Value>(); |
| 6573 CheckDebuggerUnloaded(); | 6578 CheckDebuggerUnloaded(); |
| 6574 } | 6579 } |
| 6575 | 6580 |
| OLD | NEW |