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

Side by Side Diff: src/liveedit.cc

Issue 17827005: Get rid of ZoneScope completely. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Suggestions from danno Created 7 years, 5 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/liveedit.h ('k') | src/runtime.cc » ('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 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 1814 matching lines...) Expand 10 before | Expand all | Expand 10 after
1825 return NULL; 1825 return NULL;
1826 } 1826 }
1827 private: 1827 private:
1828 Handle<JSArray> m_shared_info_array; 1828 Handle<JSArray> m_shared_info_array;
1829 Handle<JSArray> m_result; 1829 Handle<JSArray> m_result;
1830 }; 1830 };
1831 1831
1832 // Drops all call frame matched by target and all frames above them. 1832 // Drops all call frame matched by target and all frames above them.
1833 template<typename TARGET> 1833 template<typename TARGET>
1834 static const char* DropActivationsInActiveThreadImpl( 1834 static const char* DropActivationsInActiveThreadImpl(
1835 TARGET& target, bool do_drop, Zone* zone) { 1835 TARGET& target, bool do_drop) {
1836 Isolate* isolate = Isolate::Current(); 1836 Isolate* isolate = Isolate::Current();
1837 Debug* debug = isolate->debug(); 1837 Debug* debug = isolate->debug();
1838 ZoneScope scope(zone, DELETE_ON_EXIT); 1838 Zone zone(isolate);
1839 Vector<StackFrame*> frames = CreateStackMap(isolate, zone); 1839 Vector<StackFrame*> frames = CreateStackMap(isolate, &zone);
1840 1840
1841 1841
1842 int top_frame_index = -1; 1842 int top_frame_index = -1;
1843 int frame_index = 0; 1843 int frame_index = 0;
1844 for (; frame_index < frames.length(); frame_index++) { 1844 for (; frame_index < frames.length(); frame_index++) {
1845 StackFrame* frame = frames[frame_index]; 1845 StackFrame* frame = frames[frame_index];
1846 if (frame->id() == debug->break_frame_id()) { 1846 if (frame->id() == debug->break_frame_id()) {
1847 top_frame_index = frame_index; 1847 top_frame_index = frame_index;
1848 break; 1848 break;
1849 } 1849 }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1921 } 1921 }
1922 } 1922 }
1923 debug->FramesHaveBeenDropped(new_id, drop_mode, 1923 debug->FramesHaveBeenDropped(new_id, drop_mode,
1924 restarter_frame_function_pointer); 1924 restarter_frame_function_pointer);
1925 return NULL; 1925 return NULL;
1926 } 1926 }
1927 1927
1928 // Fills result array with statuses of functions. Modifies the stack 1928 // Fills result array with statuses of functions. Modifies the stack
1929 // removing all listed function if possible and if do_drop is true. 1929 // removing all listed function if possible and if do_drop is true.
1930 static const char* DropActivationsInActiveThread( 1930 static const char* DropActivationsInActiveThread(
1931 Handle<JSArray> shared_info_array, Handle<JSArray> result, bool do_drop, 1931 Handle<JSArray> shared_info_array, Handle<JSArray> result, bool do_drop) {
1932 Zone* zone) {
1933 MultipleFunctionTarget target(shared_info_array, result); 1932 MultipleFunctionTarget target(shared_info_array, result);
1934 1933
1935 const char* message = 1934 const char* message =
1936 DropActivationsInActiveThreadImpl(target, do_drop, zone); 1935 DropActivationsInActiveThreadImpl(target, do_drop);
1937 if (message) { 1936 if (message) {
1938 return message; 1937 return message;
1939 } 1938 }
1940 1939
1941 Isolate* isolate = shared_info_array->GetIsolate(); 1940 Isolate* isolate = shared_info_array->GetIsolate();
1942 int array_len = GetArrayLength(shared_info_array); 1941 int array_len = GetArrayLength(shared_info_array);
1943 1942
1944 // Replace "blocked on active" with "replaced on active" status. 1943 // Replace "blocked on active" with "replaced on active" status.
1945 for (int i = 0; i < array_len; i++) { 1944 for (int i = 0; i < array_len; i++) {
1946 if (result->GetElement(i) == 1945 if (result->GetElement(i) ==
(...skipping 26 matching lines...) Expand all
1973 } 1972 }
1974 1973
1975 private: 1974 private:
1976 Handle<JSArray> shared_info_array_; 1975 Handle<JSArray> shared_info_array_;
1977 Handle<JSArray> result_; 1976 Handle<JSArray> result_;
1978 bool has_blocked_functions_; 1977 bool has_blocked_functions_;
1979 }; 1978 };
1980 1979
1981 1980
1982 Handle<JSArray> LiveEdit::CheckAndDropActivations( 1981 Handle<JSArray> LiveEdit::CheckAndDropActivations(
1983 Handle<JSArray> shared_info_array, bool do_drop, Zone* zone) { 1982 Handle<JSArray> shared_info_array, bool do_drop) {
1984 Isolate* isolate = shared_info_array->GetIsolate(); 1983 Isolate* isolate = shared_info_array->GetIsolate();
1985 int len = GetArrayLength(shared_info_array); 1984 int len = GetArrayLength(shared_info_array);
1986 1985
1987 Handle<JSArray> result = isolate->factory()->NewJSArray(len); 1986 Handle<JSArray> result = isolate->factory()->NewJSArray(len);
1988 1987
1989 // Fill the default values. 1988 // Fill the default values.
1990 for (int i = 0; i < len; i++) { 1989 for (int i = 0; i < len; i++) {
1991 SetElementNonStrict( 1990 SetElementNonStrict(
1992 result, 1991 result,
1993 i, 1992 i,
1994 Handle<Smi>(Smi::FromInt(FUNCTION_AVAILABLE_FOR_PATCH), isolate)); 1993 Handle<Smi>(Smi::FromInt(FUNCTION_AVAILABLE_FOR_PATCH), isolate));
1995 } 1994 }
1996 1995
1997 1996
1998 // First check inactive threads. Fail if some functions are blocked there. 1997 // First check inactive threads. Fail if some functions are blocked there.
1999 InactiveThreadActivationsChecker inactive_threads_checker(shared_info_array, 1998 InactiveThreadActivationsChecker inactive_threads_checker(shared_info_array,
2000 result); 1999 result);
2001 Isolate::Current()->thread_manager()->IterateArchivedThreads( 2000 Isolate::Current()->thread_manager()->IterateArchivedThreads(
2002 &inactive_threads_checker); 2001 &inactive_threads_checker);
2003 if (inactive_threads_checker.HasBlockedFunctions()) { 2002 if (inactive_threads_checker.HasBlockedFunctions()) {
2004 return result; 2003 return result;
2005 } 2004 }
2006 2005
2007 // Try to drop activations from the current stack. 2006 // Try to drop activations from the current stack.
2008 const char* error_message = 2007 const char* error_message =
2009 DropActivationsInActiveThread(shared_info_array, result, do_drop, zone); 2008 DropActivationsInActiveThread(shared_info_array, result, do_drop);
2010 if (error_message != NULL) { 2009 if (error_message != NULL) {
2011 // Add error message as an array extra element. 2010 // Add error message as an array extra element.
2012 Vector<const char> vector_message(error_message, StrLength(error_message)); 2011 Vector<const char> vector_message(error_message, StrLength(error_message));
2013 Handle<String> str = isolate->factory()->NewStringFromAscii(vector_message); 2012 Handle<String> str = isolate->factory()->NewStringFromAscii(vector_message);
2014 SetElementNonStrict(result, len, str); 2013 SetElementNonStrict(result, len, str);
2015 } 2014 }
2016 return result; 2015 return result;
2017 } 2016 }
2018 2017
2019 2018
(...skipping 20 matching lines...) Expand all
2040 return m_saved_status; 2039 return m_saved_status;
2041 } 2040 }
2042 private: 2041 private:
2043 JavaScriptFrame* m_frame; 2042 JavaScriptFrame* m_frame;
2044 LiveEdit::FunctionPatchabilityStatus m_saved_status; 2043 LiveEdit::FunctionPatchabilityStatus m_saved_status;
2045 }; 2044 };
2046 2045
2047 2046
2048 // Finds a drops required frame and all frames above. 2047 // Finds a drops required frame and all frames above.
2049 // Returns error message or NULL. 2048 // Returns error message or NULL.
2050 const char* LiveEdit::RestartFrame(JavaScriptFrame* frame, Zone* zone) { 2049 const char* LiveEdit::RestartFrame(JavaScriptFrame* frame) {
2051 SingleFrameTarget target(frame); 2050 SingleFrameTarget target(frame);
2052 2051
2053 const char* result = DropActivationsInActiveThreadImpl(target, true, zone); 2052 const char* result = DropActivationsInActiveThreadImpl(target, true);
2054 if (result != NULL) { 2053 if (result != NULL) {
2055 return result; 2054 return result;
2056 } 2055 }
2057 if (target.saved_status() == LiveEdit::FUNCTION_BLOCKED_UNDER_NATIVE_CODE) { 2056 if (target.saved_status() == LiveEdit::FUNCTION_BLOCKED_UNDER_NATIVE_CODE) {
2058 return "Function is blocked under native code"; 2057 return "Function is blocked under native code";
2059 } 2058 }
2060 return NULL; 2059 return NULL;
2061 } 2060 }
2062 2061
2063 2062
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
2122 2121
2123 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { 2122 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) {
2124 return false; 2123 return false;
2125 } 2124 }
2126 2125
2127 #endif // ENABLE_DEBUGGER_SUPPORT 2126 #endif // ENABLE_DEBUGGER_SUPPORT
2128 2127
2129 2128
2130 2129
2131 } } // namespace v8::internal 2130 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/liveedit.h ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698