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 6047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6058 // Issue a continue command if this event will not cause the VM to start | 6058 // Issue a continue command if this event will not cause the VM to start |
6059 // running. | 6059 // running. |
6060 if (!message.WillStartRunning()) { | 6060 if (!message.WillStartRunning()) { |
6061 SendContinueCommand(); | 6061 SendContinueCommand(); |
6062 } | 6062 } |
6063 } | 6063 } |
6064 | 6064 |
6065 | 6065 |
6066 // Test that a debug break can be scheduled while in a message handler. | 6066 // Test that a debug break can be scheduled while in a message handler. |
6067 TEST(DebugBreakInMessageHandler) { | 6067 TEST(DebugBreakInMessageHandler) { |
| 6068 i::FLAG_turbo_inlining = false; // Make sure g is not inlined into f. |
6068 DebugLocalContext env; | 6069 DebugLocalContext env; |
6069 v8::HandleScope scope(env->GetIsolate()); | 6070 v8::HandleScope scope(env->GetIsolate()); |
6070 | 6071 |
6071 v8::Debug::SetMessageHandler(DebugBreakMessageHandler); | 6072 v8::Debug::SetMessageHandler(DebugBreakMessageHandler); |
6072 | 6073 |
6073 // Test functions. | 6074 // Test functions. |
6074 const char* script = "function f() { debugger; g(); } function g() { }"; | 6075 const char* script = "function f() { debugger; g(); } function g() { }"; |
6075 CompileRun(script); | 6076 CompileRun(script); |
6076 v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast( | 6077 v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast( |
6077 env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f"))); | 6078 env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f"))); |
6078 v8::Local<v8::Function> g = v8::Local<v8::Function>::Cast( | 6079 v8::Local<v8::Function> g = v8::Local<v8::Function>::Cast( |
6079 env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "g"))); | 6080 env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "g"))); |
6080 | 6081 |
6081 // Call f then g. The debugger statement in f will casue a break which will | 6082 // Call f then g. The debugger statement in f will cause a break which will |
6082 // cause another break. | 6083 // cause another break. |
6083 f->Call(env->Global(), 0, NULL); | 6084 f->Call(env->Global(), 0, NULL); |
6084 CHECK_EQ(2, message_handler_break_hit_count); | 6085 CHECK_EQ(2, message_handler_break_hit_count); |
6085 // Calling g will not cause any additional breaks. | 6086 // Calling g will not cause any additional breaks. |
6086 g->Call(env->Global(), 0, NULL); | 6087 g->Call(env->Global(), 0, NULL); |
6087 CHECK_EQ(2, message_handler_break_hit_count); | 6088 CHECK_EQ(2, message_handler_break_hit_count); |
6088 } | 6089 } |
6089 | 6090 |
6090 | 6091 |
6091 #ifndef V8_INTERPRETED_REGEXP | 6092 #ifndef V8_INTERPRETED_REGEXP |
(...skipping 1551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7643 CompileRun("function foo() {}; foo();"); | 7644 CompileRun("function foo() {}; foo();"); |
7644 --after_compile_handler_depth; | 7645 --after_compile_handler_depth; |
7645 } | 7646 } |
7646 | 7647 |
7647 | 7648 |
7648 TEST(NoInterruptsInDebugListener) { | 7649 TEST(NoInterruptsInDebugListener) { |
7649 DebugLocalContext env; | 7650 DebugLocalContext env; |
7650 v8::Debug::SetDebugEventListener(NoInterruptsOnDebugEvent); | 7651 v8::Debug::SetDebugEventListener(NoInterruptsOnDebugEvent); |
7651 CompileRun("void(0);"); | 7652 CompileRun("void(0);"); |
7652 } | 7653 } |
OLD | NEW |