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 6571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6617 TEST(ScriptCollectedEventContext) { | 6613 TEST(ScriptCollectedEventContext) { |
6618 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 6614 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
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 v8::Local<v8::Context> local_context = v8::Context::New(isolate); |
Sven Panne
2013/05/28 11:06:52
Can't we use Context::Scope here? BTW: It would be
| |
6624 context.Reset(isolate, local_context); | |
6625 local_context->Enter(); | |
6628 } | 6626 } |
6629 context->Enter(); | |
6630 | 6627 |
6631 // Request the loaded scripts to initialize the debugger script cache. | 6628 // Request the loaded scripts to initialize the debugger script cache. |
6632 debug->GetLoadedScripts(); | 6629 debug->GetLoadedScripts(); |
6633 | 6630 |
6634 // Do garbage collection to ensure that only the script in this test will be | 6631 // Do garbage collection to ensure that only the script in this test will be |
6635 // collected afterwards. | 6632 // collected afterwards. |
6636 HEAP->CollectAllGarbage(Heap::kNoGCFlags); | 6633 HEAP->CollectAllGarbage(Heap::kNoGCFlags); |
6637 | 6634 |
6638 v8::Debug::SetMessageHandler2(ScriptCollectedMessageHandler); | 6635 v8::Debug::SetMessageHandler2(ScriptCollectedMessageHandler); |
6639 v8::Script::Compile(v8::String::New("eval('a=1')"))->Run(); | 6636 v8::Script::Compile(v8::String::New("eval('a=1')"))->Run(); |
6640 v8::Script::Compile(v8::String::New("eval('a=2')"))->Run(); | 6637 v8::Script::Compile(v8::String::New("eval('a=2')"))->Run(); |
6641 | 6638 |
6642 context->Exit(); | 6639 { |
6640 v8::HandleScope scope(isolate); | |
6641 v8::Local<v8::Context> local_context = | |
6642 v8::Local<v8::Context>::New(isolate, context); | |
6643 local_context->Exit(); | |
6644 } | |
6643 context.Dispose(isolate); | 6645 context.Dispose(isolate); |
6644 | 6646 |
6645 // Do garbage collection to collect the script above which is no longer | 6647 // Do garbage collection to collect the script above which is no longer |
6646 // referenced. | 6648 // referenced. |
6647 HEAP->CollectAllGarbage(Heap::kNoGCFlags); | 6649 HEAP->CollectAllGarbage(Heap::kNoGCFlags); |
6648 | 6650 |
6649 CHECK_EQ(2, script_collected_message_count); | 6651 CHECK_EQ(2, script_collected_message_count); |
6650 | 6652 |
6651 v8::Debug::SetMessageHandler2(NULL); | 6653 v8::Debug::SetMessageHandler2(NULL); |
6652 } | 6654 } |
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7560 TEST(LiveEditDisabled) { | 7562 TEST(LiveEditDisabled) { |
7561 v8::internal::FLAG_allow_natives_syntax = true; | 7563 v8::internal::FLAG_allow_natives_syntax = true; |
7562 LocalContext env; | 7564 LocalContext env; |
7563 v8::HandleScope scope(env->GetIsolate()); | 7565 v8::HandleScope scope(env->GetIsolate()); |
7564 v8::Debug::SetLiveEditEnabled(false); | 7566 v8::Debug::SetLiveEditEnabled(false); |
7565 CompileRun("%LiveEditCompareStrings('', '')"); | 7567 CompileRun("%LiveEditCompareStrings('', '')"); |
7566 } | 7568 } |
7567 | 7569 |
7568 | 7570 |
7569 #endif // ENABLE_DEBUGGER_SUPPORT | 7571 #endif // ENABLE_DEBUGGER_SUPPORT |
OLD | NEW |