| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 ScopedVector<char> data(s->Utf8Length() + 1); | 79 ScopedVector<char> data(s->Utf8Length() + 1); |
| 80 if (data.start() == NULL) { | 80 if (data.start() == NULL) { |
| 81 V8::FatalProcessOutOfMemory("PrintLn"); | 81 V8::FatalProcessOutOfMemory("PrintLn"); |
| 82 return; | 82 return; |
| 83 } | 83 } |
| 84 s->WriteUtf8(data.start()); | 84 s->WriteUtf8(data.start()); |
| 85 PrintF("%s\n", data.start()); | 85 PrintF("%s\n", data.start()); |
| 86 } | 86 } |
| 87 | 87 |
| 88 | 88 |
| 89 static Handle<Code> ComputeCallDebugPrepareStepIn(int argc, Code::Kind kind) { | 89 static Handle<Code> ComputeCallDebugPrepareStepIn(Isolate* isolate, |
| 90 Isolate* isolate = Isolate::Current(); | 90 int argc, |
| 91 Code::Kind kind) { |
| 91 return isolate->stub_cache()->ComputeCallDebugPrepareStepIn(argc, kind); | 92 return isolate->stub_cache()->ComputeCallDebugPrepareStepIn(argc, kind); |
| 92 } | 93 } |
| 93 | 94 |
| 94 | 95 |
| 95 static v8::Handle<v8::Context> GetDebugEventContext(Isolate* isolate) { | 96 static v8::Handle<v8::Context> GetDebugEventContext(Isolate* isolate) { |
| 96 Handle<Context> context = isolate->debug()->debugger_entry()->GetContext(); | 97 Handle<Context> context = isolate->debug()->debugger_entry()->GetContext(); |
| 97 // Isolate::context() may have been NULL when "script collected" event | 98 // Isolate::context() may have been NULL when "script collected" event |
| 98 // occured. | 99 // occured. |
| 99 if (context.is_null()) return v8::Local<v8::Context>(); | 100 if (context.is_null()) return v8::Local<v8::Context>(); |
| 100 Handle<Context> native_context(context->native_context()); | 101 Handle<Context> native_context(context->native_context()); |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 // construct call or CallFunction stub call. | 427 // construct call or CallFunction stub call. |
| 427 Address target = rinfo()->target_address(); | 428 Address target = rinfo()->target_address(); |
| 428 Handle<Code> target_code(Code::GetCodeFromTargetAddress(target)); | 429 Handle<Code> target_code(Code::GetCodeFromTargetAddress(target)); |
| 429 if (target_code->is_call_stub() || target_code->is_keyed_call_stub()) { | 430 if (target_code->is_call_stub() || target_code->is_keyed_call_stub()) { |
| 430 // Step in through IC call is handled by the runtime system. Therefore make | 431 // Step in through IC call is handled by the runtime system. Therefore make |
| 431 // sure that the any current IC is cleared and the runtime system is | 432 // sure that the any current IC is cleared and the runtime system is |
| 432 // called. If the executing code has a debug break at the location change | 433 // called. If the executing code has a debug break at the location change |
| 433 // the call in the original code as it is the code there that will be | 434 // the call in the original code as it is the code there that will be |
| 434 // executed in place of the debug break call. | 435 // executed in place of the debug break call. |
| 435 Handle<Code> stub = ComputeCallDebugPrepareStepIn( | 436 Handle<Code> stub = ComputeCallDebugPrepareStepIn( |
| 436 target_code->arguments_count(), target_code->kind()); | 437 isolate, target_code->arguments_count(), target_code->kind()); |
| 437 if (IsDebugBreak()) { | 438 if (IsDebugBreak()) { |
| 438 original_rinfo()->set_target_address(stub->entry()); | 439 original_rinfo()->set_target_address(stub->entry()); |
| 439 } else { | 440 } else { |
| 440 rinfo()->set_target_address(stub->entry()); | 441 rinfo()->set_target_address(stub->entry()); |
| 441 } | 442 } |
| 442 } else { | 443 } else { |
| 443 #ifdef DEBUG | 444 #ifdef DEBUG |
| 444 // All the following stuff is needed only for assertion checks so the code | 445 // All the following stuff is needed only for assertion checks so the code |
| 445 // is wrapped in ifdef. | 446 // is wrapped in ifdef. |
| 446 Handle<Code> maybe_call_function_stub = target_code; | 447 Handle<Code> maybe_call_function_stub = target_code; |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 Smi::FromInt(StackFrame::INTERNAL); | 627 Smi::FromInt(StackFrame::INTERNAL); |
| 627 | 628 |
| 628 return reinterpret_cast<Object**>(&Memory::Object_at( | 629 return reinterpret_cast<Object**>(&Memory::Object_at( |
| 629 fp + StandardFrameConstants::kContextOffset)); | 630 fp + StandardFrameConstants::kContextOffset)); |
| 630 } | 631 } |
| 631 | 632 |
| 632 const int Debug::kFrameDropperFrameSize = 4; | 633 const int Debug::kFrameDropperFrameSize = 4; |
| 633 | 634 |
| 634 | 635 |
| 635 void ScriptCache::Add(Handle<Script> script) { | 636 void ScriptCache::Add(Handle<Script> script) { |
| 636 GlobalHandles* global_handles = Isolate::Current()->global_handles(); | 637 GlobalHandles* global_handles = isolate_->global_handles(); |
| 637 // Create an entry in the hash map for the script. | 638 // Create an entry in the hash map for the script. |
| 638 int id = script->id()->value(); | 639 int id = script->id()->value(); |
| 639 HashMap::Entry* entry = | 640 HashMap::Entry* entry = |
| 640 HashMap::Lookup(reinterpret_cast<void*>(id), Hash(id), true); | 641 HashMap::Lookup(reinterpret_cast<void*>(id), Hash(id), true); |
| 641 if (entry->value != NULL) { | 642 if (entry->value != NULL) { |
| 642 ASSERT(*script == *reinterpret_cast<Script**>(entry->value)); | 643 ASSERT(*script == *reinterpret_cast<Script**>(entry->value)); |
| 643 return; | 644 return; |
| 644 } | 645 } |
| 645 // Globalize the script object, make it weak and use the location of the | 646 // Globalize the script object, make it weak and use the location of the |
| 646 // global handle as the value in the hash map. | 647 // global handle as the value in the hash map. |
| 647 Handle<Script> script_ = | 648 Handle<Script> script_ = |
| 648 Handle<Script>::cast( | 649 Handle<Script>::cast( |
| 649 (global_handles->Create(*script))); | 650 (global_handles->Create(*script))); |
| 650 global_handles->MakeWeak(reinterpret_cast<Object**>(script_.location()), | 651 global_handles->MakeWeak(reinterpret_cast<Object**>(script_.location()), |
| 651 this, | 652 this, |
| 652 ScriptCache::HandleWeakScript); | 653 ScriptCache::HandleWeakScript); |
| 653 entry->value = script_.location(); | 654 entry->value = script_.location(); |
| 654 } | 655 } |
| 655 | 656 |
| 656 | 657 |
| 657 Handle<FixedArray> ScriptCache::GetScripts() { | 658 Handle<FixedArray> ScriptCache::GetScripts() { |
| 658 Factory* factory = Isolate::Current()->factory(); | 659 Factory* factory = isolate_->factory(); |
| 659 Handle<FixedArray> instances = factory->NewFixedArray(occupancy()); | 660 Handle<FixedArray> instances = factory->NewFixedArray(occupancy()); |
| 660 int count = 0; | 661 int count = 0; |
| 661 for (HashMap::Entry* entry = Start(); entry != NULL; entry = Next(entry)) { | 662 for (HashMap::Entry* entry = Start(); entry != NULL; entry = Next(entry)) { |
| 662 ASSERT(entry->value != NULL); | 663 ASSERT(entry->value != NULL); |
| 663 if (entry->value != NULL) { | 664 if (entry->value != NULL) { |
| 664 instances->set(count, *reinterpret_cast<Script**>(entry->value)); | 665 instances->set(count, *reinterpret_cast<Script**>(entry->value)); |
| 665 count++; | 666 count++; |
| 666 } | 667 } |
| 667 } | 668 } |
| 668 return instances; | 669 return instances; |
| 669 } | 670 } |
| 670 | 671 |
| 671 | 672 |
| 672 void ScriptCache::ProcessCollectedScripts() { | 673 void ScriptCache::ProcessCollectedScripts() { |
| 673 Debugger* debugger = Isolate::Current()->debugger(); | 674 Debugger* debugger = isolate_->debugger(); |
| 674 for (int i = 0; i < collected_scripts_.length(); i++) { | 675 for (int i = 0; i < collected_scripts_.length(); i++) { |
| 675 debugger->OnScriptCollected(collected_scripts_[i]); | 676 debugger->OnScriptCollected(collected_scripts_[i]); |
| 676 } | 677 } |
| 677 collected_scripts_.Clear(); | 678 collected_scripts_.Clear(); |
| 678 } | 679 } |
| 679 | 680 |
| 680 | 681 |
| 681 void ScriptCache::Clear() { | 682 void ScriptCache::Clear() { |
| 682 GlobalHandles* global_handles = Isolate::Current()->global_handles(); | 683 GlobalHandles* global_handles = isolate_->global_handles(); |
| 683 // Iterate the script cache to get rid of all the weak handles. | 684 // Iterate the script cache to get rid of all the weak handles. |
| 684 for (HashMap::Entry* entry = Start(); entry != NULL; entry = Next(entry)) { | 685 for (HashMap::Entry* entry = Start(); entry != NULL; entry = Next(entry)) { |
| 685 ASSERT(entry != NULL); | 686 ASSERT(entry != NULL); |
| 686 Object** location = reinterpret_cast<Object**>(entry->value); | 687 Object** location = reinterpret_cast<Object**>(entry->value); |
| 687 ASSERT((*location)->IsScript()); | 688 ASSERT((*location)->IsScript()); |
| 688 global_handles->ClearWeakness(location); | 689 global_handles->ClearWeakness(location); |
| 689 global_handles->Destroy(location); | 690 global_handles->Destroy(location); |
| 690 } | 691 } |
| 691 // Clear the content of the hash map. | 692 // Clear the content of the hash map. |
| 692 HashMap::Clear(); | 693 HashMap::Clear(); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 node = debug->debug_info_list_; | 744 node = debug->debug_info_list_; |
| 744 while (node != NULL) { | 745 while (node != NULL) { |
| 745 ASSERT(node != reinterpret_cast<DebugInfoListNode*>(data)); | 746 ASSERT(node != reinterpret_cast<DebugInfoListNode*>(data)); |
| 746 node = node->next(); | 747 node = node->next(); |
| 747 } | 748 } |
| 748 #endif | 749 #endif |
| 749 } | 750 } |
| 750 | 751 |
| 751 | 752 |
| 752 DebugInfoListNode::DebugInfoListNode(DebugInfo* debug_info): next_(NULL) { | 753 DebugInfoListNode::DebugInfoListNode(DebugInfo* debug_info): next_(NULL) { |
| 753 GlobalHandles* global_handles = Isolate::Current()->global_handles(); | 754 GlobalHandles* global_handles = debug_info->GetIsolate()->global_handles(); |
| 754 // Globalize the request debug info object and make it weak. | 755 // Globalize the request debug info object and make it weak. |
| 755 debug_info_ = Handle<DebugInfo>::cast( | 756 debug_info_ = Handle<DebugInfo>::cast( |
| 756 (global_handles->Create(debug_info))); | 757 (global_handles->Create(debug_info))); |
| 757 global_handles->MakeWeak(reinterpret_cast<Object**>(debug_info_.location()), | 758 global_handles->MakeWeak(reinterpret_cast<Object**>(debug_info_.location()), |
| 758 this, | 759 this, |
| 759 Debug::HandleWeakDebugInfo); | 760 Debug::HandleWeakDebugInfo); |
| 760 } | 761 } |
| 761 | 762 |
| 762 | 763 |
| 763 DebugInfoListNode::~DebugInfoListNode() { | 764 DebugInfoListNode::~DebugInfoListNode() { |
| 764 Isolate::Current()->global_handles()->Destroy( | 765 debug_info_->GetIsolate()->global_handles()->Destroy( |
| 765 reinterpret_cast<Object**>(debug_info_.location())); | 766 reinterpret_cast<Object**>(debug_info_.location())); |
| 766 } | 767 } |
| 767 | 768 |
| 768 | 769 |
| 769 bool Debug::CompileDebuggerScript(int index) { | 770 bool Debug::CompileDebuggerScript(Isolate* isolate, int index) { |
| 770 Isolate* isolate = Isolate::Current(); | |
| 771 Factory* factory = isolate->factory(); | 771 Factory* factory = isolate->factory(); |
| 772 HandleScope scope(isolate); | 772 HandleScope scope(isolate); |
| 773 | 773 |
| 774 // Bail out if the index is invalid. | 774 // Bail out if the index is invalid. |
| 775 if (index == -1) { | 775 if (index == -1) { |
| 776 return false; | 776 return false; |
| 777 } | 777 } |
| 778 | 778 |
| 779 // Find source and name for the requested script. | 779 // Find source and name for the requested script. |
| 780 Handle<String> source_code = | 780 Handle<String> source_code = |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 if (caught_exception) { | 817 if (caught_exception) { |
| 818 ASSERT(!isolate->has_pending_exception()); | 818 ASSERT(!isolate->has_pending_exception()); |
| 819 MessageLocation computed_location; | 819 MessageLocation computed_location; |
| 820 isolate->ComputeLocation(&computed_location); | 820 isolate->ComputeLocation(&computed_location); |
| 821 Handle<Object> message = MessageHandler::MakeMessageObject( | 821 Handle<Object> message = MessageHandler::MakeMessageObject( |
| 822 isolate, "error_loading_debugger", &computed_location, | 822 isolate, "error_loading_debugger", &computed_location, |
| 823 Vector<Handle<Object> >::empty(), Handle<String>(), Handle<JSArray>()); | 823 Vector<Handle<Object> >::empty(), Handle<String>(), Handle<JSArray>()); |
| 824 ASSERT(!isolate->has_pending_exception()); | 824 ASSERT(!isolate->has_pending_exception()); |
| 825 if (!exception.is_null()) { | 825 if (!exception.is_null()) { |
| 826 isolate->set_pending_exception(*exception); | 826 isolate->set_pending_exception(*exception); |
| 827 MessageHandler::ReportMessage(Isolate::Current(), NULL, message); | 827 MessageHandler::ReportMessage(isolate, NULL, message); |
| 828 isolate->clear_pending_exception(); | 828 isolate->clear_pending_exception(); |
| 829 } | 829 } |
| 830 return false; | 830 return false; |
| 831 } | 831 } |
| 832 | 832 |
| 833 // Mark this script as native and return successfully. | 833 // Mark this script as native and return successfully. |
| 834 Handle<Script> script(Script::cast(function->shared()->script())); | 834 Handle<Script> script(Script::cast(function->shared()->script())); |
| 835 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); | 835 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); |
| 836 return true; | 836 return true; |
| 837 } | 837 } |
| 838 | 838 |
| 839 | 839 |
| 840 bool Debug::Load() { | 840 bool Debug::Load() { |
| 841 // Return if debugger is already loaded. | 841 // Return if debugger is already loaded. |
| 842 if (IsLoaded()) return true; | 842 if (IsLoaded()) return true; |
| 843 | 843 |
| 844 Debugger* debugger = isolate_->debugger(); | 844 Debugger* debugger = isolate_->debugger(); |
| 845 | 845 |
| 846 // Bail out if we're already in the process of compiling the native | 846 // Bail out if we're already in the process of compiling the native |
| 847 // JavaScript source code for the debugger. | 847 // JavaScript source code for the debugger. |
| 848 if (debugger->compiling_natives() || | 848 if (debugger->compiling_natives() || |
| 849 debugger->is_loading_debugger()) | 849 debugger->is_loading_debugger()) |
| 850 return false; | 850 return false; |
| 851 debugger->set_loading_debugger(true); | 851 debugger->set_loading_debugger(true); |
| 852 | 852 |
| 853 // Disable breakpoints and interrupts while compiling and running the | 853 // Disable breakpoints and interrupts while compiling and running the |
| 854 // debugger scripts including the context creation code. | 854 // debugger scripts including the context creation code. |
| 855 DisableBreak disable(true); | 855 DisableBreak disable(isolate_, true); |
| 856 PostponeInterruptsScope postpone(isolate_); | 856 PostponeInterruptsScope postpone(isolate_); |
| 857 | 857 |
| 858 // Create the debugger context. | 858 // Create the debugger context. |
| 859 HandleScope scope(isolate_); | 859 HandleScope scope(isolate_); |
| 860 Handle<Context> context = | 860 Handle<Context> context = |
| 861 isolate_->bootstrapper()->CreateEnvironment( | 861 isolate_->bootstrapper()->CreateEnvironment( |
| 862 Handle<Object>::null(), | 862 Handle<Object>::null(), |
| 863 v8::Handle<ObjectTemplate>(), | 863 v8::Handle<ObjectTemplate>(), |
| 864 NULL); | 864 NULL); |
| 865 | 865 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 879 JSReceiver::SetProperty(global, | 879 JSReceiver::SetProperty(global, |
| 880 key, | 880 key, |
| 881 Handle<Object>(global->builtins(), isolate_), | 881 Handle<Object>(global->builtins(), isolate_), |
| 882 NONE, | 882 NONE, |
| 883 kNonStrictMode), | 883 kNonStrictMode), |
| 884 false); | 884 false); |
| 885 | 885 |
| 886 // Compile the JavaScript for the debugger in the debugger context. | 886 // Compile the JavaScript for the debugger in the debugger context. |
| 887 debugger->set_compiling_natives(true); | 887 debugger->set_compiling_natives(true); |
| 888 bool caught_exception = | 888 bool caught_exception = |
| 889 !CompileDebuggerScript(Natives::GetIndex("mirror")) || | 889 !CompileDebuggerScript(isolate_, Natives::GetIndex("mirror")) || |
| 890 !CompileDebuggerScript(Natives::GetIndex("debug")); | 890 !CompileDebuggerScript(isolate_, Natives::GetIndex("debug")); |
| 891 | 891 |
| 892 if (FLAG_enable_liveedit) { | 892 if (FLAG_enable_liveedit) { |
| 893 caught_exception = caught_exception || | 893 caught_exception = caught_exception || |
| 894 !CompileDebuggerScript(Natives::GetIndex("liveedit")); | 894 !CompileDebuggerScript(isolate_, Natives::GetIndex("liveedit")); |
| 895 } | 895 } |
| 896 | 896 |
| 897 debugger->set_compiling_natives(false); | 897 debugger->set_compiling_natives(false); |
| 898 | 898 |
| 899 // Make sure we mark the debugger as not loading before we might | 899 // Make sure we mark the debugger as not loading before we might |
| 900 // return. | 900 // return. |
| 901 debugger->set_loading_debugger(false); | 901 debugger->set_loading_debugger(false); |
| 902 | 902 |
| 903 // Check for caught exceptions. | 903 // Check for caught exceptions. |
| 904 if (caught_exception) return false; | 904 if (caught_exception) return false; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 951 JavaScriptFrameIterator it(isolate_); | 951 JavaScriptFrameIterator it(isolate_); |
| 952 JavaScriptFrame* frame = it.frame(); | 952 JavaScriptFrame* frame = it.frame(); |
| 953 | 953 |
| 954 // Just continue if breaks are disabled or debugger cannot be loaded. | 954 // Just continue if breaks are disabled or debugger cannot be loaded. |
| 955 if (disable_break() || !Load()) { | 955 if (disable_break() || !Load()) { |
| 956 SetAfterBreakTarget(frame); | 956 SetAfterBreakTarget(frame); |
| 957 return heap->undefined_value(); | 957 return heap->undefined_value(); |
| 958 } | 958 } |
| 959 | 959 |
| 960 // Enter the debugger. | 960 // Enter the debugger. |
| 961 EnterDebugger debugger; | 961 EnterDebugger debugger(isolate_); |
| 962 if (debugger.FailedToEnter()) { | 962 if (debugger.FailedToEnter()) { |
| 963 return heap->undefined_value(); | 963 return heap->undefined_value(); |
| 964 } | 964 } |
| 965 | 965 |
| 966 // Postpone interrupt during breakpoint processing. | 966 // Postpone interrupt during breakpoint processing. |
| 967 PostponeInterruptsScope postpone(isolate_); | 967 PostponeInterruptsScope postpone(isolate_); |
| 968 | 968 |
| 969 // Get the debug info (create it if it does not exist). | 969 // Get the debug info (create it if it does not exist). |
| 970 Handle<SharedFunctionInfo> shared = | 970 Handle<SharedFunctionInfo> shared = |
| 971 Handle<SharedFunctionInfo>(frame->function()->shared()); | 971 Handle<SharedFunctionInfo>(frame->function()->shared()); |
| (...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1642 // Check whether a code stub with the specified major key is a possible break | 1642 // Check whether a code stub with the specified major key is a possible break |
| 1643 // location. | 1643 // location. |
| 1644 bool Debug::IsBreakStub(Code* code) { | 1644 bool Debug::IsBreakStub(Code* code) { |
| 1645 CodeStub::Major major_key = CodeStub::GetMajorKey(code); | 1645 CodeStub::Major major_key = CodeStub::GetMajorKey(code); |
| 1646 return major_key == CodeStub::CallFunction; | 1646 return major_key == CodeStub::CallFunction; |
| 1647 } | 1647 } |
| 1648 | 1648 |
| 1649 | 1649 |
| 1650 // Find the builtin to use for invoking the debug break | 1650 // Find the builtin to use for invoking the debug break |
| 1651 Handle<Code> Debug::FindDebugBreak(Handle<Code> code, RelocInfo::Mode mode) { | 1651 Handle<Code> Debug::FindDebugBreak(Handle<Code> code, RelocInfo::Mode mode) { |
| 1652 Isolate* isolate = Isolate::Current(); | 1652 Isolate* isolate = code->GetIsolate(); |
| 1653 | 1653 |
| 1654 // Find the builtin debug break function matching the calling convention | 1654 // Find the builtin debug break function matching the calling convention |
| 1655 // used by the call site. | 1655 // used by the call site. |
| 1656 if (code->is_inline_cache_stub()) { | 1656 if (code->is_inline_cache_stub()) { |
| 1657 switch (code->kind()) { | 1657 switch (code->kind()) { |
| 1658 case Code::CALL_IC: | 1658 case Code::CALL_IC: |
| 1659 case Code::KEYED_CALL_IC: | 1659 case Code::KEYED_CALL_IC: |
| 1660 return isolate->stub_cache()->ComputeCallDebugBreak( | 1660 return isolate->stub_cache()->ComputeCallDebugBreak( |
| 1661 code->arguments_count(), code->kind()); | 1661 code->arguments_count(), code->kind()); |
| 1662 | 1662 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1697 | 1697 |
| 1698 UNREACHABLE(); | 1698 UNREACHABLE(); |
| 1699 return Handle<Code>::null(); | 1699 return Handle<Code>::null(); |
| 1700 } | 1700 } |
| 1701 | 1701 |
| 1702 | 1702 |
| 1703 // Simple function for returning the source positions for active break points. | 1703 // Simple function for returning the source positions for active break points. |
| 1704 Handle<Object> Debug::GetSourceBreakLocations( | 1704 Handle<Object> Debug::GetSourceBreakLocations( |
| 1705 Handle<SharedFunctionInfo> shared, | 1705 Handle<SharedFunctionInfo> shared, |
| 1706 BreakPositionAlignment position_alignment) { | 1706 BreakPositionAlignment position_alignment) { |
| 1707 Isolate* isolate = Isolate::Current(); | 1707 Isolate* isolate = shared->GetIsolate(); |
| 1708 Heap* heap = isolate->heap(); | 1708 Heap* heap = isolate->heap(); |
| 1709 if (!HasDebugInfo(shared)) { | 1709 if (!HasDebugInfo(shared)) { |
| 1710 return Handle<Object>(heap->undefined_value(), isolate); | 1710 return Handle<Object>(heap->undefined_value(), isolate); |
| 1711 } | 1711 } |
| 1712 Handle<DebugInfo> debug_info = GetDebugInfo(shared); | 1712 Handle<DebugInfo> debug_info = GetDebugInfo(shared); |
| 1713 if (debug_info->GetBreakPointCount() == 0) { | 1713 if (debug_info->GetBreakPointCount() == 0) { |
| 1714 return Handle<Object>(heap->undefined_value(), isolate); | 1714 return Handle<Object>(heap->undefined_value(), isolate); |
| 1715 } | 1715 } |
| 1716 Handle<FixedArray> locations = | 1716 Handle<FixedArray> locations = |
| 1717 isolate->factory()->NewFixedArray(debug_info->GetBreakPointCount()); | 1717 isolate->factory()->NewFixedArray(debug_info->GetBreakPointCount()); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1876 ASSERT(!current_code->has_debug_break_slots()); | 1876 ASSERT(!current_code->has_debug_break_slots()); |
| 1877 | 1877 |
| 1878 CompilationInfoWithZone info(function); | 1878 CompilationInfoWithZone info(function); |
| 1879 info.MarkCompilingForDebugging(current_code); | 1879 info.MarkCompilingForDebugging(current_code); |
| 1880 ASSERT(!info.shared_info()->is_compiled()); | 1880 ASSERT(!info.shared_info()->is_compiled()); |
| 1881 ASSERT(!info.isolate()->has_pending_exception()); | 1881 ASSERT(!info.isolate()->has_pending_exception()); |
| 1882 | 1882 |
| 1883 // Use compile lazy which will end up compiling the full code in the | 1883 // Use compile lazy which will end up compiling the full code in the |
| 1884 // configuration configured above. | 1884 // configuration configured above. |
| 1885 bool result = Compiler::CompileLazy(&info); | 1885 bool result = Compiler::CompileLazy(&info); |
| 1886 ASSERT(result != Isolate::Current()->has_pending_exception()); | 1886 ASSERT(result != info.isolate()->has_pending_exception()); |
| 1887 info.isolate()->clear_pending_exception(); | 1887 info.isolate()->clear_pending_exception(); |
| 1888 #if DEBUG | 1888 #if DEBUG |
| 1889 if (result) { | 1889 if (result) { |
| 1890 Handle<Code> new_code(function->shared()->code()); | 1890 Handle<Code> new_code(function->shared()->code()); |
| 1891 ASSERT(new_code->has_debug_break_slots()); | 1891 ASSERT(new_code->has_debug_break_slots()); |
| 1892 ASSERT(current_code->is_compiled_optimizable() == | 1892 ASSERT(current_code->is_compiled_optimizable() == |
| 1893 new_code->is_compiled_optimizable()); | 1893 new_code->is_compiled_optimizable()); |
| 1894 } | 1894 } |
| 1895 #endif | 1895 #endif |
| 1896 return result; | 1896 return result; |
| (...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2530 | 2530 |
| 2531 // Perform two GCs to get rid of all unreferenced scripts. The first GC gets | 2531 // Perform two GCs to get rid of all unreferenced scripts. The first GC gets |
| 2532 // rid of all the cached script wrappers and the second gets rid of the | 2532 // rid of all the cached script wrappers and the second gets rid of the |
| 2533 // scripts which are no longer referenced. The second also sweeps precisely, | 2533 // scripts which are no longer referenced. The second also sweeps precisely, |
| 2534 // which saves us doing yet another GC to make the heap iterable. | 2534 // which saves us doing yet another GC to make the heap iterable. |
| 2535 heap->CollectAllGarbage(Heap::kNoGCFlags, "Debug::CreateScriptCache"); | 2535 heap->CollectAllGarbage(Heap::kNoGCFlags, "Debug::CreateScriptCache"); |
| 2536 heap->CollectAllGarbage(Heap::kMakeHeapIterableMask, | 2536 heap->CollectAllGarbage(Heap::kMakeHeapIterableMask, |
| 2537 "Debug::CreateScriptCache"); | 2537 "Debug::CreateScriptCache"); |
| 2538 | 2538 |
| 2539 ASSERT(script_cache_ == NULL); | 2539 ASSERT(script_cache_ == NULL); |
| 2540 script_cache_ = new ScriptCache(); | 2540 script_cache_ = new ScriptCache(isolate_); |
| 2541 | 2541 |
| 2542 // Scan heap for Script objects. | 2542 // Scan heap for Script objects. |
| 2543 int count = 0; | 2543 int count = 0; |
| 2544 HeapIterator iterator(heap); | 2544 HeapIterator iterator(heap); |
| 2545 DisallowHeapAllocation no_allocation; | 2545 DisallowHeapAllocation no_allocation; |
| 2546 | 2546 |
| 2547 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { | 2547 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { |
| 2548 if (obj->IsScript() && Script::cast(obj)->HasValidSource()) { | 2548 if (obj->IsScript() && Script::cast(obj)->HasValidSource()) { |
| 2549 script_cache_->Add(Handle<Script>(Script::cast(obj))); | 2549 script_cache_->Add(Handle<Script>(Script::cast(obj))); |
| 2550 count++; | 2550 count++; |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2750 if (uncaught) { | 2750 if (uncaught) { |
| 2751 // Uncaught exceptions are reported by either flags. | 2751 // Uncaught exceptions are reported by either flags. |
| 2752 if (!(debug->break_on_uncaught_exception() || | 2752 if (!(debug->break_on_uncaught_exception() || |
| 2753 debug->break_on_exception())) return; | 2753 debug->break_on_exception())) return; |
| 2754 } else { | 2754 } else { |
| 2755 // Caught exceptions are reported is activated. | 2755 // Caught exceptions are reported is activated. |
| 2756 if (!debug->break_on_exception()) return; | 2756 if (!debug->break_on_exception()) return; |
| 2757 } | 2757 } |
| 2758 | 2758 |
| 2759 // Enter the debugger. | 2759 // Enter the debugger. |
| 2760 EnterDebugger debugger; | 2760 EnterDebugger debugger(isolate_); |
| 2761 if (debugger.FailedToEnter()) return; | 2761 if (debugger.FailedToEnter()) return; |
| 2762 | 2762 |
| 2763 // Clear all current stepping setup. | 2763 // Clear all current stepping setup. |
| 2764 debug->ClearStepping(); | 2764 debug->ClearStepping(); |
| 2765 // Create the event data object. | 2765 // Create the event data object. |
| 2766 bool caught_exception = false; | 2766 bool caught_exception = false; |
| 2767 Handle<Object> exec_state = MakeExecutionState(&caught_exception); | 2767 Handle<Object> exec_state = MakeExecutionState(&caught_exception); |
| 2768 Handle<Object> event_data; | 2768 Handle<Object> event_data; |
| 2769 if (!caught_exception) { | 2769 if (!caught_exception) { |
| 2770 event_data = MakeExceptionEvent(exec_state, exception, uncaught, | 2770 event_data = MakeExceptionEvent(exec_state, exception, uncaught, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2816 | 2816 |
| 2817 void Debugger::OnBeforeCompile(Handle<Script> script) { | 2817 void Debugger::OnBeforeCompile(Handle<Script> script) { |
| 2818 HandleScope scope(isolate_); | 2818 HandleScope scope(isolate_); |
| 2819 | 2819 |
| 2820 // Bail out based on state or if there is no listener for this event | 2820 // Bail out based on state or if there is no listener for this event |
| 2821 if (isolate_->debug()->InDebugger()) return; | 2821 if (isolate_->debug()->InDebugger()) return; |
| 2822 if (compiling_natives()) return; | 2822 if (compiling_natives()) return; |
| 2823 if (!EventActive(v8::BeforeCompile)) return; | 2823 if (!EventActive(v8::BeforeCompile)) return; |
| 2824 | 2824 |
| 2825 // Enter the debugger. | 2825 // Enter the debugger. |
| 2826 EnterDebugger debugger; | 2826 EnterDebugger debugger(isolate_); |
| 2827 if (debugger.FailedToEnter()) return; | 2827 if (debugger.FailedToEnter()) return; |
| 2828 | 2828 |
| 2829 // Create the event data object. | 2829 // Create the event data object. |
| 2830 bool caught_exception = false; | 2830 bool caught_exception = false; |
| 2831 Handle<Object> event_data = MakeCompileEvent(script, true, &caught_exception); | 2831 Handle<Object> event_data = MakeCompileEvent(script, true, &caught_exception); |
| 2832 // Bail out and don't call debugger if exception. | 2832 // Bail out and don't call debugger if exception. |
| 2833 if (caught_exception) { | 2833 if (caught_exception) { |
| 2834 return; | 2834 return; |
| 2835 } | 2835 } |
| 2836 | 2836 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2853 // No more to do if not debugging. | 2853 // No more to do if not debugging. |
| 2854 if (!IsDebuggerActive()) return; | 2854 if (!IsDebuggerActive()) return; |
| 2855 | 2855 |
| 2856 // No compile events while compiling natives. | 2856 // No compile events while compiling natives. |
| 2857 if (compiling_natives()) return; | 2857 if (compiling_natives()) return; |
| 2858 | 2858 |
| 2859 // Store whether in debugger before entering debugger. | 2859 // Store whether in debugger before entering debugger. |
| 2860 bool in_debugger = debug->InDebugger(); | 2860 bool in_debugger = debug->InDebugger(); |
| 2861 | 2861 |
| 2862 // Enter the debugger. | 2862 // Enter the debugger. |
| 2863 EnterDebugger debugger; | 2863 EnterDebugger debugger(isolate_); |
| 2864 if (debugger.FailedToEnter()) return; | 2864 if (debugger.FailedToEnter()) return; |
| 2865 | 2865 |
| 2866 // If debugging there might be script break points registered for this | 2866 // If debugging there might be script break points registered for this |
| 2867 // script. Make sure that these break points are set. | 2867 // script. Make sure that these break points are set. |
| 2868 | 2868 |
| 2869 // Get the function UpdateScriptBreakPoints (defined in debug-debugger.js). | 2869 // Get the function UpdateScriptBreakPoints (defined in debug-debugger.js). |
| 2870 Handle<String> update_script_break_points_string = | 2870 Handle<String> update_script_break_points_string = |
| 2871 isolate_->factory()->InternalizeOneByteString( | 2871 isolate_->factory()->InternalizeOneByteString( |
| 2872 STATIC_ASCII_VECTOR("UpdateScriptBreakPoints")); | 2872 STATIC_ASCII_VECTOR("UpdateScriptBreakPoints")); |
| 2873 Handle<Object> update_script_break_points = | 2873 Handle<Object> update_script_break_points = |
| 2874 Handle<Object>( | 2874 Handle<Object>( |
| 2875 debug->debug_context()->global_object()->GetPropertyNoExceptionThrown( | 2875 debug->debug_context()->global_object()->GetPropertyNoExceptionThrown( |
| 2876 *update_script_break_points_string), | 2876 *update_script_break_points_string), |
| 2877 isolate_); | 2877 isolate_); |
| 2878 if (!update_script_break_points->IsJSFunction()) { | 2878 if (!update_script_break_points->IsJSFunction()) { |
| 2879 return; | 2879 return; |
| 2880 } | 2880 } |
| 2881 ASSERT(update_script_break_points->IsJSFunction()); | 2881 ASSERT(update_script_break_points->IsJSFunction()); |
| 2882 | 2882 |
| 2883 // Wrap the script object in a proper JS object before passing it | 2883 // Wrap the script object in a proper JS object before passing it |
| 2884 // to JavaScript. | 2884 // to JavaScript. |
| 2885 Handle<JSValue> wrapper = GetScriptWrapper(script); | 2885 Handle<JSValue> wrapper = GetScriptWrapper(script); |
| 2886 | 2886 |
| 2887 // Call UpdateScriptBreakPoints expect no exceptions. | 2887 // Call UpdateScriptBreakPoints expect no exceptions. |
| 2888 bool caught_exception; | 2888 bool caught_exception; |
| 2889 Handle<Object> argv[] = { wrapper }; | 2889 Handle<Object> argv[] = { wrapper }; |
| 2890 Execution::TryCall(Handle<JSFunction>::cast(update_script_break_points), | 2890 Execution::TryCall(Handle<JSFunction>::cast(update_script_break_points), |
| 2891 Isolate::Current()->js_builtins_object(), | 2891 isolate_->js_builtins_object(), |
| 2892 ARRAY_SIZE(argv), | 2892 ARRAY_SIZE(argv), |
| 2893 argv, | 2893 argv, |
| 2894 &caught_exception); | 2894 &caught_exception); |
| 2895 if (caught_exception) { | 2895 if (caught_exception) { |
| 2896 return; | 2896 return; |
| 2897 } | 2897 } |
| 2898 // Bail out based on state or if there is no listener for this event | 2898 // Bail out based on state or if there is no listener for this event |
| 2899 if (in_debugger && (after_compile_flags & SEND_WHEN_DEBUGGING) == 0) return; | 2899 if (in_debugger && (after_compile_flags & SEND_WHEN_DEBUGGING) == 0) return; |
| 2900 if (!Debugger::EventActive(v8::AfterCompile)) return; | 2900 if (!Debugger::EventActive(v8::AfterCompile)) return; |
| 2901 | 2901 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2916 | 2916 |
| 2917 void Debugger::OnScriptCollected(int id) { | 2917 void Debugger::OnScriptCollected(int id) { |
| 2918 HandleScope scope(isolate_); | 2918 HandleScope scope(isolate_); |
| 2919 | 2919 |
| 2920 // No more to do if not debugging. | 2920 // No more to do if not debugging. |
| 2921 if (isolate_->debug()->InDebugger()) return; | 2921 if (isolate_->debug()->InDebugger()) return; |
| 2922 if (!IsDebuggerActive()) return; | 2922 if (!IsDebuggerActive()) return; |
| 2923 if (!Debugger::EventActive(v8::ScriptCollected)) return; | 2923 if (!Debugger::EventActive(v8::ScriptCollected)) return; |
| 2924 | 2924 |
| 2925 // Enter the debugger. | 2925 // Enter the debugger. |
| 2926 EnterDebugger debugger; | 2926 EnterDebugger debugger(isolate_); |
| 2927 if (debugger.FailedToEnter()) return; | 2927 if (debugger.FailedToEnter()) return; |
| 2928 | 2928 |
| 2929 // Create the script collected state object. | 2929 // Create the script collected state object. |
| 2930 bool caught_exception = false; | 2930 bool caught_exception = false; |
| 2931 Handle<Object> event_data = MakeScriptCollectedEvent(id, | 2931 Handle<Object> event_data = MakeScriptCollectedEvent(id, |
| 2932 &caught_exception); | 2932 &caught_exception); |
| 2933 // Bail out and don't call debugger if exception. | 2933 // Bail out and don't call debugger if exception. |
| 2934 if (caught_exception) { | 2934 if (caught_exception) { |
| 2935 return; | 2935 return; |
| 2936 } | 2936 } |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3033 isolate_->global_object(), | 3033 isolate_->global_object(), |
| 3034 ARRAY_SIZE(argv), | 3034 ARRAY_SIZE(argv), |
| 3035 argv, | 3035 argv, |
| 3036 &caught_exception); | 3036 &caught_exception); |
| 3037 // Silently ignore exceptions from debug event listeners. | 3037 // Silently ignore exceptions from debug event listeners. |
| 3038 } | 3038 } |
| 3039 | 3039 |
| 3040 | 3040 |
| 3041 Handle<Context> Debugger::GetDebugContext() { | 3041 Handle<Context> Debugger::GetDebugContext() { |
| 3042 never_unload_debugger_ = true; | 3042 never_unload_debugger_ = true; |
| 3043 EnterDebugger debugger; | 3043 EnterDebugger debugger(isolate_); |
| 3044 return isolate_->debug()->debug_context(); | 3044 return isolate_->debug()->debug_context(); |
| 3045 } | 3045 } |
| 3046 | 3046 |
| 3047 | 3047 |
| 3048 void Debugger::UnloadDebugger() { | 3048 void Debugger::UnloadDebugger() { |
| 3049 Debug* debug = isolate_->debug(); | 3049 Debug* debug = isolate_->debug(); |
| 3050 | 3050 |
| 3051 // Make sure that there are no breakpoints left. | 3051 // Make sure that there are no breakpoints left. |
| 3052 debug->ClearAllBreakPoints(); | 3052 debug->ClearAllBreakPoints(); |
| 3053 | 3053 |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3386 } | 3386 } |
| 3387 | 3387 |
| 3388 | 3388 |
| 3389 Handle<Object> Debugger::Call(Handle<JSFunction> fun, | 3389 Handle<Object> Debugger::Call(Handle<JSFunction> fun, |
| 3390 Handle<Object> data, | 3390 Handle<Object> data, |
| 3391 bool* pending_exception) { | 3391 bool* pending_exception) { |
| 3392 // When calling functions in the debugger prevent it from beeing unloaded. | 3392 // When calling functions in the debugger prevent it from beeing unloaded. |
| 3393 Debugger::never_unload_debugger_ = true; | 3393 Debugger::never_unload_debugger_ = true; |
| 3394 | 3394 |
| 3395 // Enter the debugger. | 3395 // Enter the debugger. |
| 3396 EnterDebugger debugger; | 3396 EnterDebugger debugger(isolate_); |
| 3397 if (debugger.FailedToEnter()) { | 3397 if (debugger.FailedToEnter()) { |
| 3398 return isolate_->factory()->undefined_value(); | 3398 return isolate_->factory()->undefined_value(); |
| 3399 } | 3399 } |
| 3400 | 3400 |
| 3401 // Create the execution state. | 3401 // Create the execution state. |
| 3402 bool caught_exception = false; | 3402 bool caught_exception = false; |
| 3403 Handle<Object> exec_state = MakeExecutionState(&caught_exception); | 3403 Handle<Object> exec_state = MakeExecutionState(&caught_exception); |
| 3404 if (caught_exception) { | 3404 if (caught_exception) { |
| 3405 return isolate_->factory()->undefined_value(); | 3405 return isolate_->factory()->undefined_value(); |
| 3406 } | 3406 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 3431 // Provide stub message handler; V8 auto-continues each suspend | 3431 // Provide stub message handler; V8 auto-continues each suspend |
| 3432 // when there is no message handler; we doesn't need it. | 3432 // when there is no message handler; we doesn't need it. |
| 3433 // Once become suspended, V8 will stay so indefinitely long, until remote | 3433 // Once become suspended, V8 will stay so indefinitely long, until remote |
| 3434 // debugger connects and issues "continue" command. | 3434 // debugger connects and issues "continue" command. |
| 3435 Debugger::message_handler_ = StubMessageHandler2; | 3435 Debugger::message_handler_ = StubMessageHandler2; |
| 3436 v8::Debug::DebugBreak(); | 3436 v8::Debug::DebugBreak(); |
| 3437 } | 3437 } |
| 3438 | 3438 |
| 3439 if (Socket::SetUp()) { | 3439 if (Socket::SetUp()) { |
| 3440 if (agent_ == NULL) { | 3440 if (agent_ == NULL) { |
| 3441 agent_ = new DebuggerAgent(name, port); | 3441 agent_ = new DebuggerAgent(isolate_, name, port); |
| 3442 agent_->Start(); | 3442 agent_->Start(); |
| 3443 } | 3443 } |
| 3444 return true; | 3444 return true; |
| 3445 } | 3445 } |
| 3446 | 3446 |
| 3447 return false; | 3447 return false; |
| 3448 } | 3448 } |
| 3449 | 3449 |
| 3450 | 3450 |
| 3451 void Debugger::StopAgent() { | 3451 void Debugger::StopAgent() { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 3471 { | 3471 { |
| 3472 LockGuard<Mutex> lock_guard(&dispatch_handler_access_); | 3472 LockGuard<Mutex> lock_guard(&dispatch_handler_access_); |
| 3473 handler = Debugger::debug_message_dispatch_handler_; | 3473 handler = Debugger::debug_message_dispatch_handler_; |
| 3474 } | 3474 } |
| 3475 if (handler != NULL) { | 3475 if (handler != NULL) { |
| 3476 handler(); | 3476 handler(); |
| 3477 } | 3477 } |
| 3478 } | 3478 } |
| 3479 | 3479 |
| 3480 | 3480 |
| 3481 EnterDebugger::EnterDebugger() | 3481 EnterDebugger::EnterDebugger(Isolate* isolate) |
| 3482 : isolate_(Isolate::Current()), | 3482 : isolate_(isolate), |
| 3483 prev_(isolate_->debug()->debugger_entry()), | 3483 prev_(isolate_->debug()->debugger_entry()), |
| 3484 it_(isolate_), | 3484 it_(isolate_), |
| 3485 has_js_frames_(!it_.done()), | 3485 has_js_frames_(!it_.done()), |
| 3486 save_(isolate_) { | 3486 save_(isolate_) { |
| 3487 Debug* debug = isolate_->debug(); | 3487 Debug* debug = isolate_->debug(); |
| 3488 ASSERT(prev_ != NULL || !debug->is_interrupt_pending(PREEMPT)); | 3488 ASSERT(prev_ != NULL || !debug->is_interrupt_pending(PREEMPT)); |
| 3489 ASSERT(prev_ != NULL || !debug->is_interrupt_pending(DEBUGBREAK)); | 3489 ASSERT(prev_ != NULL || !debug->is_interrupt_pending(DEBUGBREAK)); |
| 3490 | 3490 |
| 3491 // Link recursive debugger entry. | 3491 // Link recursive debugger entry. |
| 3492 debug->set_debugger_entry(this); | 3492 debug->set_debugger_entry(this); |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3652 return v8::Handle<v8::String>(); | 3652 return v8::Handle<v8::String>(); |
| 3653 } | 3653 } |
| 3654 return scope.Close(v8::Utils::ToLocal(Handle<String>::cast(json))); | 3654 return scope.Close(v8::Utils::ToLocal(Handle<String>::cast(json))); |
| 3655 } else { | 3655 } else { |
| 3656 return v8::Utils::ToLocal(response_json_); | 3656 return v8::Utils::ToLocal(response_json_); |
| 3657 } | 3657 } |
| 3658 } | 3658 } |
| 3659 | 3659 |
| 3660 | 3660 |
| 3661 v8::Handle<v8::Context> MessageImpl::GetEventContext() const { | 3661 v8::Handle<v8::Context> MessageImpl::GetEventContext() const { |
| 3662 Isolate* isolate = Isolate::Current(); | 3662 Isolate* isolate = event_data_->GetIsolate(); |
| 3663 v8::Handle<v8::Context> context = GetDebugEventContext(isolate); | 3663 v8::Handle<v8::Context> context = GetDebugEventContext(isolate); |
| 3664 // Isolate::context() may be NULL when "script collected" event occures. | 3664 // Isolate::context() may be NULL when "script collected" event occures. |
| 3665 ASSERT(!context.IsEmpty() || event_ == v8::ScriptCollected); | 3665 ASSERT(!context.IsEmpty() || event_ == v8::ScriptCollected); |
| 3666 return context; | 3666 return context; |
| 3667 } | 3667 } |
| 3668 | 3668 |
| 3669 | 3669 |
| 3670 v8::Debug::ClientData* MessageImpl::GetClientData() const { | 3670 v8::Debug::ClientData* MessageImpl::GetClientData() const { |
| 3671 return client_data_; | 3671 return client_data_; |
| 3672 } | 3672 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 3693 return v8::Utils::ToLocal(exec_state_); | 3693 return v8::Utils::ToLocal(exec_state_); |
| 3694 } | 3694 } |
| 3695 | 3695 |
| 3696 | 3696 |
| 3697 v8::Handle<v8::Object> EventDetailsImpl::GetEventData() const { | 3697 v8::Handle<v8::Object> EventDetailsImpl::GetEventData() const { |
| 3698 return v8::Utils::ToLocal(event_data_); | 3698 return v8::Utils::ToLocal(event_data_); |
| 3699 } | 3699 } |
| 3700 | 3700 |
| 3701 | 3701 |
| 3702 v8::Handle<v8::Context> EventDetailsImpl::GetEventContext() const { | 3702 v8::Handle<v8::Context> EventDetailsImpl::GetEventContext() const { |
| 3703 return GetDebugEventContext(Isolate::Current()); | 3703 return GetDebugEventContext(exec_state_->GetIsolate()); |
| 3704 } | 3704 } |
| 3705 | 3705 |
| 3706 | 3706 |
| 3707 v8::Handle<v8::Value> EventDetailsImpl::GetCallbackData() const { | 3707 v8::Handle<v8::Value> EventDetailsImpl::GetCallbackData() const { |
| 3708 return v8::Utils::ToLocal(callback_data_); | 3708 return v8::Utils::ToLocal(callback_data_); |
| 3709 } | 3709 } |
| 3710 | 3710 |
| 3711 | 3711 |
| 3712 v8::Debug::ClientData* EventDetailsImpl::GetClientData() const { | 3712 v8::Debug::ClientData* EventDetailsImpl::GetClientData() const { |
| 3713 return client_data_; | 3713 return client_data_; |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3854 { | 3854 { |
| 3855 Locker locker(reinterpret_cast<v8::Isolate*>(isolate_)); | 3855 Locker locker(reinterpret_cast<v8::Isolate*>(isolate_)); |
| 3856 isolate_->debugger()->CallMessageDispatchHandler(); | 3856 isolate_->debugger()->CallMessageDispatchHandler(); |
| 3857 } | 3857 } |
| 3858 } | 3858 } |
| 3859 } | 3859 } |
| 3860 | 3860 |
| 3861 #endif // ENABLE_DEBUGGER_SUPPORT | 3861 #endif // ENABLE_DEBUGGER_SUPPORT |
| 3862 | 3862 |
| 3863 } } // namespace v8::internal | 3863 } } // namespace v8::internal |
| OLD | NEW |