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

Side by Side Diff: src/frames-inl.h

Issue 6794019: Simplify isolates access during stack iteration (WAS: Move SafeStackFrameIterator::active_count_...) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: A couple more changes Created 9 years, 8 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
« src/frames.cc ('K') | « src/frames.cc ('k') | src/isolate.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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 } 82 }
83 83
84 84
85 inline Address* StackHandler::pc_address() const { 85 inline Address* StackHandler::pc_address() const {
86 const int offset = StackHandlerConstants::kPCOffset; 86 const int offset = StackHandlerConstants::kPCOffset;
87 return reinterpret_cast<Address*>(address() + offset); 87 return reinterpret_cast<Address*>(address() + offset);
88 } 88 }
89 89
90 90
91 inline StackHandler* StackFrame::top_handler() const { 91 inline StackHandler* StackFrame::top_handler() const {
92 ASSERT((tagged_isolate_ptr_ & kIsolateTag) == 0);
92 return iterator_->handler(); 93 return iterator_->handler();
93 } 94 }
94 95
95 96
97 inline Isolate* StackFrame::isolate() const {
Vitaly Repeshko 2011/04/04 20:37:08 I'm not convinced we need this tricky stuff. Usual
mnaganov (inactive) 2011/04/05 08:28:23 I agree. I was in a premature optimization mood. S
98 if ((tagged_isolate_ptr_ & kIsolateTag) == 0) {
99 return iterator_->isolate();
100 } else {
101 return reinterpret_cast<Isolate*>(tagged_isolate_ptr_ & ~kIsolateTag);
102 }
103 }
104
105
96 inline Code* StackFrame::GetContainingCode(Isolate* isolate, Address pc) { 106 inline Code* StackFrame::GetContainingCode(Isolate* isolate, Address pc) {
97 return isolate->pc_to_code_cache()->GetCacheEntry(pc)->code; 107 return isolate->pc_to_code_cache()->GetCacheEntry(pc)->code;
98 } 108 }
99 109
100 110
101 inline Object* StandardFrame::GetExpression(int index) const { 111 inline Object* StandardFrame::GetExpression(int index) const {
102 return Memory::Object_at(GetExpressionAddress(index)); 112 return Memory::Object_at(GetExpressionAddress(index));
103 } 113 }
104 114
105 115
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 171
162 172
163 inline Object* JavaScriptFrame::function() const { 173 inline Object* JavaScriptFrame::function() const {
164 Object* result = function_slot_object(); 174 Object* result = function_slot_object();
165 ASSERT(result->IsJSFunction()); 175 ASSERT(result->IsJSFunction());
166 return result; 176 return result;
167 } 177 }
168 178
169 179
170 template<typename Iterator> 180 template<typename Iterator>
181 inline JavaScriptFrameIteratorTemp<Iterator>::JavaScriptFrameIteratorTemp(
182 Isolate* isolate)
183 : iterator_(isolate) {
184 if (!done()) Advance();
185 }
186
187 template<typename Iterator>
171 inline JavaScriptFrame* JavaScriptFrameIteratorTemp<Iterator>::frame() const { 188 inline JavaScriptFrame* JavaScriptFrameIteratorTemp<Iterator>::frame() const {
172 // TODO(1233797): The frame hierarchy needs to change. It's 189 // TODO(1233797): The frame hierarchy needs to change. It's
173 // problematic that we can't use the safe-cast operator to cast to 190 // problematic that we can't use the safe-cast operator to cast to
174 // the JavaScript frame type, because we may encounter arguments 191 // the JavaScript frame type, because we may encounter arguments
175 // adaptor frames. 192 // adaptor frames.
176 StackFrame* frame = iterator_.frame(); 193 StackFrame* frame = iterator_.frame();
177 ASSERT(frame->is_java_script() || frame->is_arguments_adaptor()); 194 ASSERT(frame->is_java_script() || frame->is_arguments_adaptor());
178 return static_cast<JavaScriptFrame*>(frame); 195 return static_cast<JavaScriptFrame*>(frame);
179 } 196 }
180 197
181 198
182 template<typename Iterator> 199 template<typename Iterator>
183 JavaScriptFrameIteratorTemp<Iterator>::JavaScriptFrameIteratorTemp( 200 JavaScriptFrameIteratorTemp<Iterator>::JavaScriptFrameIteratorTemp(
184 StackFrame::Id id) { 201 Isolate* isolate, StackFrame::Id id)
185 while (!done()) { 202 : iterator_(isolate) {
186 Advance(); 203 AdvanceToId(id);
187 if (frame()->id() == id) return;
188 }
189 } 204 }
190 205
191 206
192 template<typename Iterator> 207 template<typename Iterator>
193 void JavaScriptFrameIteratorTemp<Iterator>::Advance() { 208 void JavaScriptFrameIteratorTemp<Iterator>::Advance() {
194 do { 209 do {
195 iterator_.Advance(); 210 iterator_.Advance();
196 } while (!iterator_.done() && !iterator_.frame()->is_java_script()); 211 } while (!iterator_.done() && !iterator_.frame()->is_java_script());
197 } 212 }
198 213
199 214
200 template<typename Iterator> 215 template<typename Iterator>
201 void JavaScriptFrameIteratorTemp<Iterator>::AdvanceToArgumentsFrame() { 216 void JavaScriptFrameIteratorTemp<Iterator>::AdvanceToArgumentsFrame() {
202 if (!frame()->has_adapted_arguments()) return; 217 if (!frame()->has_adapted_arguments()) return;
203 iterator_.Advance(); 218 iterator_.Advance();
204 ASSERT(iterator_.frame()->is_arguments_adaptor()); 219 ASSERT(iterator_.frame()->is_arguments_adaptor());
205 } 220 }
206 221
207 222
208 template<typename Iterator> 223 template<typename Iterator>
224 void JavaScriptFrameIteratorTemp<Iterator>::AdvanceToId(StackFrame::Id id) {
225 while (!done()) {
226 Advance();
227 if (frame()->id() == id) return;
228 }
229 }
230
231
232 template<typename Iterator>
209 void JavaScriptFrameIteratorTemp<Iterator>::Reset() { 233 void JavaScriptFrameIteratorTemp<Iterator>::Reset() {
210 iterator_.Reset(); 234 iterator_.Reset();
211 if (!done()) Advance(); 235 if (!done()) Advance();
212 } 236 }
213 237
214 238
215 } } // namespace v8::internal 239 } } // namespace v8::internal
216 240
217 #endif // V8_FRAMES_INL_H_ 241 #endif // V8_FRAMES_INL_H_
OLDNEW
« src/frames.cc ('K') | « src/frames.cc ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698