| 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 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 // Bail out if the index is invalid. | 738 // Bail out if the index is invalid. |
| 739 if (index == -1) { | 739 if (index == -1) { |
| 740 return false; | 740 return false; |
| 741 } | 741 } |
| 742 | 742 |
| 743 // Find source and name for the requested script. | 743 // Find source and name for the requested script. |
| 744 Handle<String> source_code = | 744 Handle<String> source_code = |
| 745 isolate->bootstrapper()->NativesSourceLookup(index); | 745 isolate->bootstrapper()->NativesSourceLookup(index); |
| 746 Vector<const char> name = Natives::GetScriptName(index); | 746 Vector<const char> name = Natives::GetScriptName(index); |
| 747 Handle<String> script_name = factory->NewStringFromAscii(name); | 747 Handle<String> script_name = factory->NewStringFromAscii(name); |
| 748 Handle<Context> context = isolate->native_context(); |
| 748 | 749 |
| 749 // Compile the script. | 750 // Compile the script. |
| 750 Handle<SharedFunctionInfo> function_info; | 751 Handle<SharedFunctionInfo> function_info; |
| 751 function_info = Compiler::Compile(source_code, | 752 function_info = Compiler::Compile(source_code, |
| 752 script_name, | 753 script_name, |
| 753 0, 0, NULL, NULL, | 754 0, 0, |
| 755 context, |
| 756 NULL, NULL, |
| 754 Handle<String>::null(), | 757 Handle<String>::null(), |
| 755 NATIVES_CODE); | 758 NATIVES_CODE); |
| 756 | 759 |
| 757 // Silently ignore stack overflows during compilation. | 760 // Silently ignore stack overflows during compilation. |
| 758 if (function_info.is_null()) { | 761 if (function_info.is_null()) { |
| 759 ASSERT(isolate->has_pending_exception()); | 762 ASSERT(isolate->has_pending_exception()); |
| 760 isolate->clear_pending_exception(); | 763 isolate->clear_pending_exception(); |
| 761 return false; | 764 return false; |
| 762 } | 765 } |
| 763 | 766 |
| 764 // Execute the shared function in the debugger context. | 767 // Execute the shared function in the debugger context. |
| 765 Handle<Context> context = isolate->native_context(); | |
| 766 bool caught_exception; | 768 bool caught_exception; |
| 767 Handle<JSFunction> function = | 769 Handle<JSFunction> function = |
| 768 factory->NewFunctionFromSharedFunctionInfo(function_info, context); | 770 factory->NewFunctionFromSharedFunctionInfo(function_info, context); |
| 769 | 771 |
| 770 Handle<Object> exception = | 772 Handle<Object> exception = |
| 771 Execution::TryCall(function, Handle<Object>(context->global_object()), | 773 Execution::TryCall(function, Handle<Object>(context->global_object()), |
| 772 0, NULL, &caught_exception); | 774 0, NULL, &caught_exception); |
| 773 | 775 |
| 774 // Check for caught exceptions. | 776 // Check for caught exceptions. |
| 775 if (caught_exception) { | 777 if (caught_exception) { |
| (...skipping 2879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3655 { | 3657 { |
| 3656 Locker locker; | 3658 Locker locker; |
| 3657 Isolate::Current()->debugger()->CallMessageDispatchHandler(); | 3659 Isolate::Current()->debugger()->CallMessageDispatchHandler(); |
| 3658 } | 3660 } |
| 3659 } | 3661 } |
| 3660 } | 3662 } |
| 3661 | 3663 |
| 3662 #endif // ENABLE_DEBUGGER_SUPPORT | 3664 #endif // ENABLE_DEBUGGER_SUPPORT |
| 3663 | 3665 |
| 3664 } } // namespace v8::internal | 3666 } } // namespace v8::internal |
| OLD | NEW |