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

Side by Side Diff: src/frames.cc

Issue 1172002: Does anyone need copy constructor for StackFrameIterator?
Patch Set: 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
« no previous file with comments | « src/frames.h ('k') | no next file » | 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 thread_(use_top ? Top::GetCurrentThread() : NULL), 84 thread_(use_top ? Top::GetCurrentThread() : NULL),
85 fp_(use_top ? NULL : fp), sp_(sp), 85 fp_(use_top ? NULL : fp), sp_(sp),
86 advance_(use_top ? &StackFrameIterator::AdvanceWithHandler : 86 advance_(use_top ? &StackFrameIterator::AdvanceWithHandler :
87 &StackFrameIterator::AdvanceWithoutHandler) { 87 &StackFrameIterator::AdvanceWithoutHandler) {
88 if (use_top || fp != NULL) { 88 if (use_top || fp != NULL) {
89 Reset(); 89 Reset();
90 } 90 }
91 JavaScriptFrame_.DisableHeapAccess(); 91 JavaScriptFrame_.DisableHeapAccess();
92 } 92 }
93 93
94 StackFrameIterator::StackFrameIterator(const StackFrameIterator& original)
95 : STACK_FRAME_TYPE_LIST(INITIALIZE_SINGLETON)
96 frame_(NULL) {
97 this->operator=(original);
98 }
99
100 void StackFrameIterator::operator =(const StackFrameIterator& original) {
101 this->frame_ = this->SingletonFor(original.frame_->type());
102 this->frame_->state_ = original.frame_->state_;
103
104 this->handler_ = original.handler_;
105 this->thread_ = original.thread_;
106 this->fp_ = original.fp_;
107 this->sp_ = original.sp_;
108 this->advance_ = original.advance_;
109 this->JavaScriptFrame_.disable_heap_access_ =
110 original.JavaScriptFrame_.disable_heap_access_;
111 }
112
94 #undef INITIALIZE_SINGLETON 113 #undef INITIALIZE_SINGLETON
95 114
96 115
97 void StackFrameIterator::AdvanceWithHandler() { 116 void StackFrameIterator::AdvanceWithHandler() {
98 ASSERT(!done()); 117 ASSERT(!done());
99 // Compute the state of the calling frame before restoring 118 // Compute the state of the calling frame before restoring
100 // callee-saved registers and unwinding handlers. This allows the 119 // callee-saved registers and unwinding handlers. This allows the
101 // frame code that computes the caller state to access the top 120 // frame code that computes the caller state to access the top
102 // handler and the value of any callee-saved register if needed. 121 // handler and the value of any callee-saved register if needed.
103 StackFrame::State state; 122 StackFrame::State state;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 case StackFrame::NONE: return NULL; 183 case StackFrame::NONE: return NULL;
165 STACK_FRAME_TYPE_LIST(FRAME_TYPE_CASE) 184 STACK_FRAME_TYPE_LIST(FRAME_TYPE_CASE)
166 default: break; 185 default: break;
167 } 186 }
168 return result; 187 return result;
169 188
170 #undef FRAME_TYPE_CASE 189 #undef FRAME_TYPE_CASE
171 } 190 }
172 191
173 192
193 bool operator==(const StackFrameIterator& one,
194 const StackFrameIterator& another) {
195 return one.frame()->id() == another.frame()->id();
196 }
197
198
174 // ------------------------------------------------------------------------- 199 // -------------------------------------------------------------------------
175 200
176 201
177 StackTraceFrameIterator::StackTraceFrameIterator() { 202 StackTraceFrameIterator::StackTraceFrameIterator() {
178 if (!done() && !IsValidFrame()) Advance(); 203 if (!done() && !IsValidFrame()) Advance();
179 } 204 }
180 205
181 206
182 void StackTraceFrameIterator::Advance() { 207 void StackTraceFrameIterator::Advance() {
183 while (true) { 208 while (true) {
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 reg_code[i++] = r; 784 reg_code[i++] = r;
760 785
761 ASSERT(i == kNumJSCallerSaved); 786 ASSERT(i == kNumJSCallerSaved);
762 } 787 }
763 ASSERT(0 <= n && n < kNumJSCallerSaved); 788 ASSERT(0 <= n && n < kNumJSCallerSaved);
764 return reg_code[n]; 789 return reg_code[n];
765 } 790 }
766 791
767 792
768 } } // namespace v8::internal 793 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/frames.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698