| 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 7606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7617 "let y = 2; \n" | 7617 "let y = 2; \n" |
| 7618 "debugger; \n" | 7618 "debugger; \n" |
| 7619 "x * y", | 7619 "x * y", |
| 7620 30); | 7620 30); |
| 7621 ExpectInt32( | 7621 ExpectInt32( |
| 7622 "x = 1; y = 2; \n" | 7622 "x = 1; y = 2; \n" |
| 7623 "debugger;" | 7623 "debugger;" |
| 7624 "x * y", | 7624 "x * y", |
| 7625 30); | 7625 30); |
| 7626 } | 7626 } |
| 7627 |
| 7628 static int after_compile_handler_depth = 0; |
| 7629 static void HandleInterrupt(v8::Isolate* isolate, void* data) { |
| 7630 CHECK_EQ(0, after_compile_handler_depth); |
| 7631 } |
| 7632 |
| 7633 static void NoInterruptsOnDebugEvent( |
| 7634 const v8::Debug::EventDetails& event_details) { |
| 7635 if (event_details.GetEvent() != v8::AfterCompile) return; |
| 7636 ++after_compile_handler_depth; |
| 7637 // Do not allow nested AfterCompile events. |
| 7638 CHECK(after_compile_handler_depth <= 1); |
| 7639 v8::Isolate* isolate = event_details.GetEventContext()->GetIsolate(); |
| 7640 isolate->RequestInterrupt(&HandleInterrupt, nullptr); |
| 7641 CompileRun("function foo() {}; foo();"); |
| 7642 --after_compile_handler_depth; |
| 7643 } |
| 7644 |
| 7645 |
| 7646 TEST(NoInterruptsInDebugListener) { |
| 7647 DebugLocalContext env; |
| 7648 v8::Debug::SetDebugEventListener(NoInterruptsOnDebugEvent); |
| 7649 CompileRun("void(0);"); |
| 7650 } |
| OLD | NEW |