Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Side by Side Diff: src/debug.cc

Issue 669240: - Remove function boilerplate objects and use SharedFunctionInfos in... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Committed Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/data-flow.cc ('k') | src/factory.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 } 678 }
679 679
680 // Find source and name for the requested script. 680 // Find source and name for the requested script.
681 Handle<String> source_code = Bootstrapper::NativesSourceLookup(index); 681 Handle<String> source_code = Bootstrapper::NativesSourceLookup(index);
682 Vector<const char> name = Natives::GetScriptName(index); 682 Vector<const char> name = Natives::GetScriptName(index);
683 Handle<String> script_name = Factory::NewStringFromAscii(name); 683 Handle<String> script_name = Factory::NewStringFromAscii(name);
684 684
685 // Compile the script. 685 // Compile the script.
686 bool allow_natives_syntax = FLAG_allow_natives_syntax; 686 bool allow_natives_syntax = FLAG_allow_natives_syntax;
687 FLAG_allow_natives_syntax = true; 687 FLAG_allow_natives_syntax = true;
688 Handle<JSFunction> boilerplate; 688 Handle<SharedFunctionInfo> function_info;
689 boilerplate = Compiler::Compile(source_code, 689 function_info = Compiler::Compile(source_code,
690 script_name, 690 script_name,
691 0, 691 0, 0, NULL, NULL,
692 0, 692 Handle<String>::null(),
693 NULL, 693 NATIVES_CODE);
694 NULL,
695 Handle<String>::null(),
696 NATIVES_CODE);
697 FLAG_allow_natives_syntax = allow_natives_syntax; 694 FLAG_allow_natives_syntax = allow_natives_syntax;
698 695
699 // Silently ignore stack overflows during compilation. 696 // Silently ignore stack overflows during compilation.
700 if (boilerplate.is_null()) { 697 if (function_info.is_null()) {
701 ASSERT(Top::has_pending_exception()); 698 ASSERT(Top::has_pending_exception());
702 Top::clear_pending_exception(); 699 Top::clear_pending_exception();
703 return false; 700 return false;
704 } 701 }
705 702
706 // Execute the boilerplate function in the debugger context. 703 // Execute the shared function in the debugger context.
707 Handle<Context> context = Top::global_context(); 704 Handle<Context> context = Top::global_context();
708 bool caught_exception = false; 705 bool caught_exception = false;
709 Handle<JSFunction> function = 706 Handle<JSFunction> function =
710 Factory::NewFunctionFromBoilerplate(boilerplate, context); 707 Factory::NewFunctionFromSharedFunctionInfo(function_info, context);
711 Handle<Object> result = 708 Handle<Object> result =
712 Execution::TryCall(function, Handle<Object>(context->global()), 709 Execution::TryCall(function, Handle<Object>(context->global()),
713 0, NULL, &caught_exception); 710 0, NULL, &caught_exception);
714 711
715 // Check for caught exceptions. 712 // Check for caught exceptions.
716 if (caught_exception) { 713 if (caught_exception) {
717 Handle<Object> message = MessageHandler::MakeMessageObject( 714 Handle<Object> message = MessageHandler::MakeMessageObject(
718 "error_loading_debugger", NULL, Vector<Handle<Object> >::empty(), 715 "error_loading_debugger", NULL, Vector<Handle<Object> >::empty(),
719 Handle<String>()); 716 Handle<String>());
720 MessageHandler::ReportMessage(NULL, message); 717 MessageHandler::ReportMessage(NULL, message);
(...skipping 1314 matching lines...) Expand 10 before | Expand all | Expand 10 after
2035 if (caught_exception) { 2032 if (caught_exception) {
2036 return; 2033 return;
2037 } 2034 }
2038 // Process debug event. 2035 // Process debug event.
2039 ProcessDebugEvent(v8::AfterCompile, 2036 ProcessDebugEvent(v8::AfterCompile,
2040 Handle<JSObject>::cast(event_data), 2037 Handle<JSObject>::cast(event_data),
2041 true); 2038 true);
2042 } 2039 }
2043 2040
2044 2041
2045 void Debugger::OnNewFunction(Handle<JSFunction> function) {
2046 return;
2047 HandleScope scope;
2048
2049 // Bail out based on state or if there is no listener for this event
2050 if (Debug::InDebugger()) return;
2051 if (compiling_natives()) return;
2052 if (!Debugger::EventActive(v8::NewFunction)) return;
2053
2054 // Enter the debugger.
2055 EnterDebugger debugger;
2056 if (debugger.FailedToEnter()) return;
2057
2058 // Create the event object.
2059 bool caught_exception = false;
2060 Handle<Object> event_data = MakeNewFunctionEvent(function, &caught_exception);
2061 // Bail out and don't call debugger if exception.
2062 if (caught_exception) {
2063 return;
2064 }
2065 // Process debug event.
2066 ProcessDebugEvent(v8::NewFunction, Handle<JSObject>::cast(event_data), true);
2067 }
2068
2069
2070 void Debugger::OnScriptCollected(int id) { 2042 void Debugger::OnScriptCollected(int id) {
2071 HandleScope scope; 2043 HandleScope scope;
2072 2044
2073 // No more to do if not debugging. 2045 // No more to do if not debugging.
2074 if (!IsDebuggerActive()) return; 2046 if (!IsDebuggerActive()) return;
2075 if (!Debugger::EventActive(v8::ScriptCollected)) return; 2047 if (!Debugger::EventActive(v8::ScriptCollected)) return;
2076 2048
2077 // Enter the debugger. 2049 // Enter the debugger.
2078 EnterDebugger debugger; 2050 EnterDebugger debugger;
2079 if (debugger.FailedToEnter()) return; 2051 if (debugger.FailedToEnter()) return;
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
2806 { 2778 {
2807 Locker locker; 2779 Locker locker;
2808 Debugger::CallMessageDispatchHandler(); 2780 Debugger::CallMessageDispatchHandler();
2809 } 2781 }
2810 } 2782 }
2811 } 2783 }
2812 2784
2813 #endif // ENABLE_DEBUGGER_SUPPORT 2785 #endif // ENABLE_DEBUGGER_SUPPORT
2814 2786
2815 } } // namespace v8::internal 2787 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/data-flow.cc ('k') | src/factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698