| OLD | NEW |
| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 return static_cast<State>(Memory::int_at(address() + offset)); | 81 return static_cast<State>(Memory::int_at(address() + offset)); |
| 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 StackFrame::StackFrame(StackFrameIterator* iterator) |
| 92 : iterator_(iterator), isolate_(iterator_->isolate()) { |
| 93 } |
| 94 |
| 95 |
| 91 inline StackHandler* StackFrame::top_handler() const { | 96 inline StackHandler* StackFrame::top_handler() const { |
| 92 return iterator_->handler(); | 97 return iterator_->handler(); |
| 93 } | 98 } |
| 94 | 99 |
| 95 | 100 |
| 96 inline Code* StackFrame::GetContainingCode(Isolate* isolate, Address pc) { | 101 inline Code* StackFrame::GetContainingCode(Isolate* isolate, Address pc) { |
| 97 return isolate->pc_to_code_cache()->GetCacheEntry(pc)->code; | 102 return isolate->pc_to_code_cache()->GetCacheEntry(pc)->code; |
| 98 } | 103 } |
| 99 | 104 |
| 100 | 105 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 | 166 |
| 162 | 167 |
| 163 inline Object* JavaScriptFrame::function() const { | 168 inline Object* JavaScriptFrame::function() const { |
| 164 Object* result = function_slot_object(); | 169 Object* result = function_slot_object(); |
| 165 ASSERT(result->IsJSFunction()); | 170 ASSERT(result->IsJSFunction()); |
| 166 return result; | 171 return result; |
| 167 } | 172 } |
| 168 | 173 |
| 169 | 174 |
| 170 template<typename Iterator> | 175 template<typename Iterator> |
| 176 inline JavaScriptFrameIteratorTemp<Iterator>::JavaScriptFrameIteratorTemp( |
| 177 Isolate* isolate) |
| 178 : iterator_(isolate) { |
| 179 if (!done()) Advance(); |
| 180 } |
| 181 |
| 182 template<typename Iterator> |
| 171 inline JavaScriptFrame* JavaScriptFrameIteratorTemp<Iterator>::frame() const { | 183 inline JavaScriptFrame* JavaScriptFrameIteratorTemp<Iterator>::frame() const { |
| 172 // TODO(1233797): The frame hierarchy needs to change. It's | 184 // TODO(1233797): The frame hierarchy needs to change. It's |
| 173 // problematic that we can't use the safe-cast operator to cast to | 185 // problematic that we can't use the safe-cast operator to cast to |
| 174 // the JavaScript frame type, because we may encounter arguments | 186 // the JavaScript frame type, because we may encounter arguments |
| 175 // adaptor frames. | 187 // adaptor frames. |
| 176 StackFrame* frame = iterator_.frame(); | 188 StackFrame* frame = iterator_.frame(); |
| 177 ASSERT(frame->is_java_script() || frame->is_arguments_adaptor()); | 189 ASSERT(frame->is_java_script() || frame->is_arguments_adaptor()); |
| 178 return static_cast<JavaScriptFrame*>(frame); | 190 return static_cast<JavaScriptFrame*>(frame); |
| 179 } | 191 } |
| 180 | 192 |
| 181 | 193 |
| 182 template<typename Iterator> | 194 template<typename Iterator> |
| 183 JavaScriptFrameIteratorTemp<Iterator>::JavaScriptFrameIteratorTemp( | 195 JavaScriptFrameIteratorTemp<Iterator>::JavaScriptFrameIteratorTemp( |
| 184 StackFrame::Id id) { | 196 Isolate* isolate, StackFrame::Id id) |
| 185 while (!done()) { | 197 : iterator_(isolate) { |
| 186 Advance(); | 198 AdvanceToId(id); |
| 187 if (frame()->id() == id) return; | |
| 188 } | |
| 189 } | 199 } |
| 190 | 200 |
| 191 | 201 |
| 192 template<typename Iterator> | 202 template<typename Iterator> |
| 193 void JavaScriptFrameIteratorTemp<Iterator>::Advance() { | 203 void JavaScriptFrameIteratorTemp<Iterator>::Advance() { |
| 194 do { | 204 do { |
| 195 iterator_.Advance(); | 205 iterator_.Advance(); |
| 196 } while (!iterator_.done() && !iterator_.frame()->is_java_script()); | 206 } while (!iterator_.done() && !iterator_.frame()->is_java_script()); |
| 197 } | 207 } |
| 198 | 208 |
| 199 | 209 |
| 200 template<typename Iterator> | 210 template<typename Iterator> |
| 201 void JavaScriptFrameIteratorTemp<Iterator>::AdvanceToArgumentsFrame() { | 211 void JavaScriptFrameIteratorTemp<Iterator>::AdvanceToArgumentsFrame() { |
| 202 if (!frame()->has_adapted_arguments()) return; | 212 if (!frame()->has_adapted_arguments()) return; |
| 203 iterator_.Advance(); | 213 iterator_.Advance(); |
| 204 ASSERT(iterator_.frame()->is_arguments_adaptor()); | 214 ASSERT(iterator_.frame()->is_arguments_adaptor()); |
| 205 } | 215 } |
| 206 | 216 |
| 207 | 217 |
| 208 template<typename Iterator> | 218 template<typename Iterator> |
| 219 void JavaScriptFrameIteratorTemp<Iterator>::AdvanceToId(StackFrame::Id id) { |
| 220 while (!done()) { |
| 221 Advance(); |
| 222 if (frame()->id() == id) return; |
| 223 } |
| 224 } |
| 225 |
| 226 |
| 227 template<typename Iterator> |
| 209 void JavaScriptFrameIteratorTemp<Iterator>::Reset() { | 228 void JavaScriptFrameIteratorTemp<Iterator>::Reset() { |
| 210 iterator_.Reset(); | 229 iterator_.Reset(); |
| 211 if (!done()) Advance(); | 230 if (!done()) Advance(); |
| 212 } | 231 } |
| 213 | 232 |
| 214 | 233 |
| 215 } } // namespace v8::internal | 234 } } // namespace v8::internal |
| 216 | 235 |
| 217 #endif // V8_FRAMES_INL_H_ | 236 #endif // V8_FRAMES_INL_H_ |
| OLD | NEW |