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 6560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6571 break_point_hit_count = 0; | 6571 break_point_hit_count = 0; |
6572 script_collected_count = 0; | 6572 script_collected_count = 0; |
6573 DebugLocalContext env; | 6573 DebugLocalContext env; |
6574 v8::HandleScope scope(env->GetIsolate()); | 6574 v8::HandleScope scope(env->GetIsolate()); |
6575 | 6575 |
6576 // Request the loaded scripts to initialize the debugger script cache. | 6576 // Request the loaded scripts to initialize the debugger script cache. |
6577 debug->GetLoadedScripts(); | 6577 debug->GetLoadedScripts(); |
6578 | 6578 |
6579 // Do garbage collection to ensure that only the script in this test will be | 6579 // Do garbage collection to ensure that only the script in this test will be |
6580 // collected afterwards. | 6580 // collected afterwards. |
6581 HEAP->CollectAllGarbage(Heap::kNoGCFlags); | 6581 HEAP->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); |
6582 | 6582 |
6583 script_collected_count = 0; | 6583 script_collected_count = 0; |
6584 v8::Debug::SetDebugEventListener(DebugEventScriptCollectedEvent, | 6584 v8::Debug::SetDebugEventListener(DebugEventScriptCollectedEvent, |
6585 v8::Undefined()); | 6585 v8::Undefined()); |
6586 { | 6586 { |
6587 v8::Script::Compile(v8::String::New("eval('a=1')"))->Run(); | 6587 v8::Script::Compile(v8::String::New("eval('a=1')"))->Run(); |
6588 v8::Script::Compile(v8::String::New("eval('a=2')"))->Run(); | 6588 v8::Script::Compile(v8::String::New("eval('a=2')"))->Run(); |
6589 } | 6589 } |
6590 | 6590 |
6591 // Do garbage collection to collect the script above which is no longer | 6591 // Do garbage collection to collect the script above which is no longer |
6592 // referenced. | 6592 // referenced. |
6593 HEAP->CollectAllGarbage(Heap::kNoGCFlags); | 6593 HEAP->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); |
6594 | 6594 |
6595 CHECK_EQ(2, script_collected_count); | 6595 CHECK_EQ(2, script_collected_count); |
6596 | 6596 |
6597 v8::Debug::SetDebugEventListener(NULL); | 6597 v8::Debug::SetDebugEventListener(NULL); |
6598 CheckDebuggerUnloaded(); | 6598 CheckDebuggerUnloaded(); |
6599 } | 6599 } |
6600 | 6600 |
6601 | 6601 |
6602 // Debug event listener which counts the script collected events. | 6602 // Debug event listener which counts the script collected events. |
6603 int script_collected_message_count = 0; | 6603 int script_collected_message_count = 0; |
(...skipping 29 matching lines...) Expand all Loading... |
6633 v8::Local<v8::Context> local_context = | 6633 v8::Local<v8::Context> local_context = |
6634 v8::Local<v8::Context>::New(isolate, context); | 6634 v8::Local<v8::Context>::New(isolate, context); |
6635 local_context->Enter(); | 6635 local_context->Enter(); |
6636 } | 6636 } |
6637 | 6637 |
6638 // Request the loaded scripts to initialize the debugger script cache. | 6638 // Request the loaded scripts to initialize the debugger script cache. |
6639 debug->GetLoadedScripts(); | 6639 debug->GetLoadedScripts(); |
6640 | 6640 |
6641 // Do garbage collection to ensure that only the script in this test will be | 6641 // Do garbage collection to ensure that only the script in this test will be |
6642 // collected afterwards. | 6642 // collected afterwards. |
6643 HEAP->CollectAllGarbage(Heap::kNoGCFlags); | 6643 HEAP->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); |
6644 | 6644 |
6645 v8::Debug::SetMessageHandler2(ScriptCollectedMessageHandler); | 6645 v8::Debug::SetMessageHandler2(ScriptCollectedMessageHandler); |
6646 v8::Script::Compile(v8::String::New("eval('a=1')"))->Run(); | 6646 v8::Script::Compile(v8::String::New("eval('a=1')"))->Run(); |
6647 v8::Script::Compile(v8::String::New("eval('a=2')"))->Run(); | 6647 v8::Script::Compile(v8::String::New("eval('a=2')"))->Run(); |
6648 | 6648 |
6649 // Leave context | 6649 // Leave context |
6650 { | 6650 { |
6651 v8::HandleScope scope(isolate); | 6651 v8::HandleScope scope(isolate); |
6652 v8::Local<v8::Context> local_context = | 6652 v8::Local<v8::Context> local_context = |
6653 v8::Local<v8::Context>::New(isolate, context); | 6653 v8::Local<v8::Context>::New(isolate, context); |
6654 local_context->Exit(); | 6654 local_context->Exit(); |
6655 } | 6655 } |
6656 context.Dispose(isolate); | 6656 context.Dispose(isolate); |
6657 | 6657 |
6658 // Do garbage collection to collect the script above which is no longer | 6658 // Do garbage collection to collect the script above which is no longer |
6659 // referenced. | 6659 // referenced. |
6660 HEAP->CollectAllGarbage(Heap::kNoGCFlags); | 6660 HEAP->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); |
6661 | 6661 |
6662 CHECK_EQ(2, script_collected_message_count); | 6662 CHECK_EQ(2, script_collected_message_count); |
6663 | 6663 |
6664 v8::Debug::SetMessageHandler2(NULL); | 6664 v8::Debug::SetMessageHandler2(NULL); |
6665 } | 6665 } |
6666 | 6666 |
6667 | 6667 |
6668 // Debug event listener which counts the after compile events. | 6668 // Debug event listener which counts the after compile events. |
6669 int after_compile_message_count = 0; | 6669 int after_compile_message_count = 0; |
6670 static void AfterCompileMessageHandler(const v8::Debug::Message& message) { | 6670 static void AfterCompileMessageHandler(const v8::Debug::Message& message) { |
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7572 TEST(LiveEditDisabled) { | 7572 TEST(LiveEditDisabled) { |
7573 v8::internal::FLAG_allow_natives_syntax = true; | 7573 v8::internal::FLAG_allow_natives_syntax = true; |
7574 LocalContext env; | 7574 LocalContext env; |
7575 v8::HandleScope scope(env->GetIsolate()); | 7575 v8::HandleScope scope(env->GetIsolate()); |
7576 v8::Debug::SetLiveEditEnabled(false); | 7576 v8::Debug::SetLiveEditEnabled(false); |
7577 CompileRun("%LiveEditCompareStrings('', '')"); | 7577 CompileRun("%LiveEditCompareStrings('', '')"); |
7578 } | 7578 } |
7579 | 7579 |
7580 | 7580 |
7581 #endif // ENABLE_DEBUGGER_SUPPORT | 7581 #endif // ENABLE_DEBUGGER_SUPPORT |
OLD | NEW |