Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 711 | 711 |
| 712 // Check for caught exceptions. | 712 // Check for caught exceptions. |
| 713 if (caught_exception) { | 713 if (caught_exception) { |
| 714 Handle<Object> message = MessageHandler::MakeMessageObject( | 714 Handle<Object> message = MessageHandler::MakeMessageObject( |
| 715 "error_loading_debugger", NULL, Vector<Handle<Object> >::empty(), | 715 "error_loading_debugger", NULL, Vector<Handle<Object> >::empty(), |
| 716 Handle<String>()); | 716 Handle<String>()); |
| 717 MessageHandler::ReportMessage(NULL, message); | 717 MessageHandler::ReportMessage(NULL, message); |
| 718 return false; | 718 return false; |
| 719 } | 719 } |
| 720 | 720 |
| 721 // Mark this script as native and return successfully. | 721 // Mark this script as native and return successfully. |
|
Erik Corry
2010/03/23 12:01:50
??
| |
| 722 Handle<Script> script(Script::cast(function->shared()->script())); | 722 Handle<Script> script(Script::cast(function->shared()->script())); |
| 723 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); | |
| 724 return true; | 723 return true; |
| 725 } | 724 } |
| 726 | 725 |
| 727 | 726 |
| 728 bool Debug::Load() { | 727 bool Debug::Load() { |
| 729 // Return if debugger is already loaded. | 728 // Return if debugger is already loaded. |
| 730 if (IsLoaded()) return true; | 729 if (IsLoaded()) return true; |
| 731 | 730 |
| 732 // Bail out if we're already in the process of compiling the native | 731 // Bail out if we're already in the process of compiling the native |
| 733 // JavaScript source code for the debugger. | 732 // JavaScript source code for the debugger. |
| (...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1675 Handle<JSObject>(Debug::debug_context()->global()), | 1674 Handle<JSObject>(Debug::debug_context()->global()), |
| 1676 0, NULL, &caught_exception); | 1675 0, NULL, &caught_exception); |
| 1677 } | 1676 } |
| 1678 | 1677 |
| 1679 | 1678 |
| 1680 void Debug::CreateScriptCache() { | 1679 void Debug::CreateScriptCache() { |
| 1681 HandleScope scope; | 1680 HandleScope scope; |
| 1682 | 1681 |
| 1683 // Perform two GCs to get rid of all unreferenced scripts. The first GC gets | 1682 // Perform two GCs to get rid of all unreferenced scripts. The first GC gets |
| 1684 // rid of all the cached script wrappers and the second gets rid of the | 1683 // rid of all the cached script wrappers and the second gets rid of the |
| 1685 // scripts which is no longer referenced. | 1684 // scripts which are no longer referenced. |
| 1686 Heap::CollectAllGarbage(false); | 1685 Heap::CollectAllGarbage(false); |
| 1687 Heap::CollectAllGarbage(false); | 1686 Heap::CollectAllGarbage(false); |
| 1688 | 1687 |
| 1689 ASSERT(script_cache_ == NULL); | 1688 ASSERT(script_cache_ == NULL); |
| 1690 script_cache_ = new ScriptCache(); | 1689 script_cache_ = new ScriptCache(); |
| 1691 | 1690 |
| 1692 // Scan heap for Script objects. | 1691 // Scan heap for Script objects. |
| 1693 int count = 0; | 1692 int count = 0; |
| 1694 HeapIterator iterator; | 1693 HeapIterator iterator; |
| 1695 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { | 1694 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1989 // Store whether in debugger before entering debugger. | 1988 // Store whether in debugger before entering debugger. |
| 1990 bool in_debugger = Debug::InDebugger(); | 1989 bool in_debugger = Debug::InDebugger(); |
| 1991 | 1990 |
| 1992 // Enter the debugger. | 1991 // Enter the debugger. |
| 1993 EnterDebugger debugger; | 1992 EnterDebugger debugger; |
| 1994 if (debugger.FailedToEnter()) return; | 1993 if (debugger.FailedToEnter()) return; |
| 1995 | 1994 |
| 1996 // If debugging there might be script break points registered for this | 1995 // If debugging there might be script break points registered for this |
| 1997 // script. Make sure that these break points are set. | 1996 // script. Make sure that these break points are set. |
| 1998 | 1997 |
| 1999 // Get the function UpdateScriptBreakPoints (defined in debug-delay.js). | 1998 // Get the function UpdateScriptBreakPoints (defined in debug-debugger.js). |
| 2000 Handle<Object> update_script_break_points = | 1999 Handle<Object> update_script_break_points = |
| 2001 Handle<Object>(Debug::debug_context()->global()->GetProperty( | 2000 Handle<Object>(Debug::debug_context()->global()->GetProperty( |
| 2002 *Factory::LookupAsciiSymbol("UpdateScriptBreakPoints"))); | 2001 *Factory::LookupAsciiSymbol("UpdateScriptBreakPoints"))); |
| 2003 if (!update_script_break_points->IsJSFunction()) { | 2002 if (!update_script_break_points->IsJSFunction()) { |
| 2004 return; | 2003 return; |
| 2005 } | 2004 } |
| 2006 ASSERT(update_script_break_points->IsJSFunction()); | 2005 ASSERT(update_script_break_points->IsJSFunction()); |
| 2007 | 2006 |
| 2008 // Wrap the script object in a proper JS object before passing it | 2007 // Wrap the script object in a proper JS object before passing it |
| 2009 // to JavaScript. | 2008 // to JavaScript. |
| (...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2778 { | 2777 { |
| 2779 Locker locker; | 2778 Locker locker; |
| 2780 Debugger::CallMessageDispatchHandler(); | 2779 Debugger::CallMessageDispatchHandler(); |
| 2781 } | 2780 } |
| 2782 } | 2781 } |
| 2783 } | 2782 } |
| 2784 | 2783 |
| 2785 #endif // ENABLE_DEBUGGER_SUPPORT | 2784 #endif // ENABLE_DEBUGGER_SUPPORT |
| 2786 | 2785 |
| 2787 } } // namespace v8::internal | 2786 } } // namespace v8::internal |
| OLD | NEW |