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

Side by Side Diff: src/frames.cc

Issue 40290: Experimental: Merge 1395:1441 from bleeding_edge branch to the... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/global/
Patch Set: Created 11 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/frames.h ('k') | src/frames-inl.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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 StackFrameIterator::StackFrameIterator() 67 StackFrameIterator::StackFrameIterator()
68 : STACK_FRAME_TYPE_LIST(INITIALIZE_SINGLETON) 68 : STACK_FRAME_TYPE_LIST(INITIALIZE_SINGLETON)
69 frame_(NULL), handler_(NULL), thread_(Top::GetCurrentThread()) { 69 frame_(NULL), handler_(NULL), thread_(Top::GetCurrentThread()) {
70 Reset(); 70 Reset();
71 } 71 }
72 StackFrameIterator::StackFrameIterator(ThreadLocalTop* t) 72 StackFrameIterator::StackFrameIterator(ThreadLocalTop* t)
73 : STACK_FRAME_TYPE_LIST(INITIALIZE_SINGLETON) 73 : STACK_FRAME_TYPE_LIST(INITIALIZE_SINGLETON)
74 frame_(NULL), handler_(NULL), thread_(t) { 74 frame_(NULL), handler_(NULL), thread_(t) {
75 Reset(); 75 Reset();
76 } 76 }
77 StackFrameIterator::StackFrameIterator(bool reset)
78 : STACK_FRAME_TYPE_LIST(INITIALIZE_SINGLETON)
79 frame_(NULL), handler_(NULL), thread_(Top::GetCurrentThread()) {
80 if (reset) Reset();
81 }
77 #undef INITIALIZE_SINGLETON 82 #undef INITIALIZE_SINGLETON
78 83
79 84
80 void StackFrameIterator::Advance() { 85 void StackFrameIterator::Advance() {
81 ASSERT(!done()); 86 ASSERT(!done());
82 // Compute the state of the calling frame before restoring 87 // Compute the state of the calling frame before restoring
83 // callee-saved registers and unwinding handlers. This allows the 88 // callee-saved registers and unwinding handlers. This allows the
84 // frame code that computes the caller state to access the top 89 // frame code that computes the caller state to access the top
85 // handler and the value of any callee-saved register if needed. 90 // handler and the value of any callee-saved register if needed.
86 StackFrame::State state; 91 StackFrame::State state;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 result->state_ = *state; 129 result->state_ = *state;
125 return result; 130 return result;
126 131
127 #undef FRAME_TYPE_CASE 132 #undef FRAME_TYPE_CASE
128 } 133 }
129 134
130 135
131 // ------------------------------------------------------------------------- 136 // -------------------------------------------------------------------------
132 137
133 138
134 JavaScriptFrameIterator::JavaScriptFrameIterator(StackFrame::Id id) { 139 StackTraceFrameIterator::StackTraceFrameIterator() {
135 while (true) { 140 if (!done() && !frame()->function()->IsJSFunction()) Advance();
136 Advance();
137 if (frame()->id() == id) return;
138 }
139 } 141 }
140 142
141 143
142 void JavaScriptFrameIterator::Advance() { 144 void StackTraceFrameIterator::Advance() {
143 do { 145 while (true) {
144 iterator_.Advance(); 146 JavaScriptFrameIterator::Advance();
145 } while (!iterator_.done() && !iterator_.frame()->is_java_script()); 147 if (done()) return;
146 } 148 if (frame()->function()->IsJSFunction()) return;
147 149 }
148
149 void JavaScriptFrameIterator::AdvanceToArgumentsFrame() {
150 if (!frame()->has_adapted_arguments()) return;
151 iterator_.Advance();
152 ASSERT(iterator_.frame()->is_arguments_adaptor());
153 }
154
155
156 void JavaScriptFrameIterator::Reset() {
157 iterator_.Reset();
158 Advance();
159 } 150 }
160 151
161 152
162 // ------------------------------------------------------------------------- 153 // -------------------------------------------------------------------------
163 154
164 155
156 SafeStackFrameIterator::SafeStackFrameIterator(
157 Address low_bound, Address high_bound) :
158 low_bound_(low_bound), high_bound_(high_bound),
159 is_working_iterator_(IsInBounds(low_bound, high_bound,
160 Top::c_entry_fp(Top::GetCurrentThread()))),
161 iteration_done_(!is_working_iterator_), iterator_(is_working_iterator_) {
162 }
163
164
165 void SafeStackFrameIterator::Advance() {
166 ASSERT(is_working_iterator_);
167 ASSERT(!done());
168 StackFrame* frame = iterator_.frame();
169 iteration_done_ =
170 !IsGoodStackAddress(frame->sp()) || !IsGoodStackAddress(frame->fp());
171 if (!iteration_done_) {
172 iterator_.Advance();
173 if (!iterator_.done()) {
174 // Check that we have actually moved to the previous frame in the stack
175 StackFrame* prev_frame = iterator_.frame();
176 iteration_done_ =
177 prev_frame->sp() < frame->sp() || prev_frame->fp() < frame->fp();
178 }
179 }
180 }
181
182
183 void SafeStackFrameIterator::Reset() {
184 if (is_working_iterator_) {
185 iterator_.Reset();
186 iteration_done_ = false;
187 }
188 }
189
190
191 // -------------------------------------------------------------------------
192
193
194 #ifdef ENABLE_LOGGING_AND_PROFILING
195 SafeStackTraceFrameIterator::SafeStackTraceFrameIterator(
196 Address low_bound, Address high_bound) :
197 SafeJavaScriptFrameIterator(low_bound, high_bound) {
198 if (!done() && !frame()->function()->IsJSFunction()) Advance();
199 }
200
201
202 void SafeStackTraceFrameIterator::Advance() {
203 while (true) {
204 SafeJavaScriptFrameIterator::Advance();
205 if (done()) return;
206 if (frame()->function()->IsJSFunction()) return;
207 }
208 }
209 #endif
210
211
212 // -------------------------------------------------------------------------
213
214
165 void StackHandler::Cook(Code* code) { 215 void StackHandler::Cook(Code* code) {
166 ASSERT(MarkCompactCollector::IsCompacting()); 216 ASSERT(MarkCompactCollector::IsCompacting());
167 ASSERT(code->contains(pc())); 217 ASSERT(code->contains(pc()));
168 set_pc(AddressFrom<Address>(pc() - code->instruction_start())); 218 set_pc(AddressFrom<Address>(pc() - code->instruction_start()));
169 } 219 }
170 220
171 221
172 void StackHandler::Uncook(Code* code) { 222 void StackHandler::Uncook(Code* code) {
173 ASSERT(MarkCompactCollector::IsCompacting()); 223 ASSERT(MarkCompactCollector::IsCompacting());
174 set_pc(code->instruction_start() + OffsetFrom(pc())); 224 set_pc(code->instruction_start() + OffsetFrom(pc()));
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 reg_code[i++] = r; 639 reg_code[i++] = r;
590 640
591 ASSERT(i == kNumJSCallerSaved); 641 ASSERT(i == kNumJSCallerSaved);
592 } 642 }
593 ASSERT(0 <= n && n < kNumJSCallerSaved); 643 ASSERT(0 <= n && n < kNumJSCallerSaved);
594 return reg_code[n]; 644 return reg_code[n];
595 } 645 }
596 646
597 647
598 } } // namespace v8::internal 648 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/frames.h ('k') | src/frames-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698