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 11 matching lines...) Expand all Loading... |
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #ifdef ENABLE_DEBUGGER_SUPPORT | 28 #ifdef ENABLE_DEBUGGER_SUPPORT |
29 | 29 |
30 #include <stdlib.h> | 30 #include <stdlib.h> |
31 | 31 |
32 // TODO(dcarney): remove | |
33 #define V8_ALLOW_ACCESS_TO_PERSISTENT_ARROW | |
34 #define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT | |
35 | |
36 #include "v8.h" | 32 #include "v8.h" |
37 | 33 |
38 #include "api.h" | 34 #include "api.h" |
39 #include "cctest.h" | 35 #include "cctest.h" |
40 #include "compilation-cache.h" | 36 #include "compilation-cache.h" |
41 #include "debug.h" | 37 #include "debug.h" |
42 #include "deoptimizer.h" | 38 #include "deoptimizer.h" |
43 #include "platform.h" | 39 #include "platform.h" |
44 #include "stub-cache.h" | 40 #include "stub-cache.h" |
45 #include "utils.h" | 41 #include "utils.h" |
(...skipping 6573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6619 v8::internal::Debug* debug = | 6615 v8::internal::Debug* debug = |
6620 reinterpret_cast<v8::internal::Isolate*>(isolate)->debug(); | 6616 reinterpret_cast<v8::internal::Isolate*>(isolate)->debug(); |
6621 script_collected_message_count = 0; | 6617 script_collected_message_count = 0; |
6622 v8::HandleScope scope(isolate); | 6618 v8::HandleScope scope(isolate); |
6623 | 6619 |
6624 v8::Persistent<v8::Context> context; | 6620 v8::Persistent<v8::Context> context; |
6625 { | 6621 { |
6626 v8::HandleScope scope(isolate); | 6622 v8::HandleScope scope(isolate); |
6627 context.Reset(isolate, v8::Context::New(isolate)); | 6623 context.Reset(isolate, v8::Context::New(isolate)); |
6628 } | 6624 } |
6629 context->Enter(); | 6625 |
| 6626 // Enter context. We can't have a handle to the context in the outer |
| 6627 // scope, so we have to do it the hard way. |
| 6628 { |
| 6629 v8::HandleScope scope(isolate); |
| 6630 v8::Local<v8::Context> local_context = |
| 6631 v8::Local<v8::Context>::New(isolate, context); |
| 6632 local_context->Enter(); |
| 6633 } |
6630 | 6634 |
6631 // Request the loaded scripts to initialize the debugger script cache. | 6635 // Request the loaded scripts to initialize the debugger script cache. |
6632 debug->GetLoadedScripts(); | 6636 debug->GetLoadedScripts(); |
6633 | 6637 |
6634 // Do garbage collection to ensure that only the script in this test will be | 6638 // Do garbage collection to ensure that only the script in this test will be |
6635 // collected afterwards. | 6639 // collected afterwards. |
6636 HEAP->CollectAllGarbage(Heap::kNoGCFlags); | 6640 HEAP->CollectAllGarbage(Heap::kNoGCFlags); |
6637 | 6641 |
6638 v8::Debug::SetMessageHandler2(ScriptCollectedMessageHandler); | 6642 v8::Debug::SetMessageHandler2(ScriptCollectedMessageHandler); |
6639 v8::Script::Compile(v8::String::New("eval('a=1')"))->Run(); | 6643 v8::Script::Compile(v8::String::New("eval('a=1')"))->Run(); |
6640 v8::Script::Compile(v8::String::New("eval('a=2')"))->Run(); | 6644 v8::Script::Compile(v8::String::New("eval('a=2')"))->Run(); |
6641 | 6645 |
6642 context->Exit(); | 6646 // Leave context |
| 6647 { |
| 6648 v8::HandleScope scope(isolate); |
| 6649 v8::Local<v8::Context> local_context = |
| 6650 v8::Local<v8::Context>::New(isolate, context); |
| 6651 local_context->Exit(); |
| 6652 } |
6643 context.Dispose(isolate); | 6653 context.Dispose(isolate); |
6644 | 6654 |
6645 // Do garbage collection to collect the script above which is no longer | 6655 // Do garbage collection to collect the script above which is no longer |
6646 // referenced. | 6656 // referenced. |
6647 HEAP->CollectAllGarbage(Heap::kNoGCFlags); | 6657 HEAP->CollectAllGarbage(Heap::kNoGCFlags); |
6648 | 6658 |
6649 CHECK_EQ(2, script_collected_message_count); | 6659 CHECK_EQ(2, script_collected_message_count); |
6650 | 6660 |
6651 v8::Debug::SetMessageHandler2(NULL); | 6661 v8::Debug::SetMessageHandler2(NULL); |
6652 } | 6662 } |
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7560 TEST(LiveEditDisabled) { | 7570 TEST(LiveEditDisabled) { |
7561 v8::internal::FLAG_allow_natives_syntax = true; | 7571 v8::internal::FLAG_allow_natives_syntax = true; |
7562 LocalContext env; | 7572 LocalContext env; |
7563 v8::HandleScope scope(env->GetIsolate()); | 7573 v8::HandleScope scope(env->GetIsolate()); |
7564 v8::Debug::SetLiveEditEnabled(false); | 7574 v8::Debug::SetLiveEditEnabled(false); |
7565 CompileRun("%LiveEditCompareStrings('', '')"); | 7575 CompileRun("%LiveEditCompareStrings('', '')"); |
7566 } | 7576 } |
7567 | 7577 |
7568 | 7578 |
7569 #endif // ENABLE_DEBUGGER_SUPPORT | 7579 #endif // ENABLE_DEBUGGER_SUPPORT |
OLD | NEW |