| OLD | NEW | 
|---|
| 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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 292 inline StubFailureTrampolineFrame::StubFailureTrampolineFrame( | 292 inline StubFailureTrampolineFrame::StubFailureTrampolineFrame( | 
| 293     StackFrameIterator* iterator) : StandardFrame(iterator) { | 293     StackFrameIterator* iterator) : StandardFrame(iterator) { | 
| 294 } | 294 } | 
| 295 | 295 | 
| 296 | 296 | 
| 297 inline ConstructFrame::ConstructFrame(StackFrameIterator* iterator) | 297 inline ConstructFrame::ConstructFrame(StackFrameIterator* iterator) | 
| 298     : InternalFrame(iterator) { | 298     : InternalFrame(iterator) { | 
| 299 } | 299 } | 
| 300 | 300 | 
| 301 | 301 | 
| 302 template<typename Iterator> | 302 inline JavaScriptFrameIterator::JavaScriptFrameIterator( | 
| 303 inline JavaScriptFrameIteratorTemp<Iterator>::JavaScriptFrameIteratorTemp( |  | 
| 304     Isolate* isolate) | 303     Isolate* isolate) | 
| 305     : iterator_(isolate) { | 304     : iterator_(isolate) { | 
| 306   if (!done()) Advance(); | 305   if (!done()) Advance(); | 
| 307 } | 306 } | 
| 308 | 307 | 
| 309 | 308 | 
| 310 template<typename Iterator> | 309 inline JavaScriptFrameIterator::JavaScriptFrameIterator( | 
| 311 inline JavaScriptFrameIteratorTemp<Iterator>::JavaScriptFrameIteratorTemp( |  | 
| 312     Isolate* isolate, ThreadLocalTop* top) | 310     Isolate* isolate, ThreadLocalTop* top) | 
| 313     : iterator_(isolate, top) { | 311     : iterator_(isolate, top) { | 
| 314   if (!done()) Advance(); | 312   if (!done()) Advance(); | 
| 315 } | 313 } | 
| 316 | 314 | 
| 317 | 315 | 
| 318 template<typename Iterator> | 316 inline JavaScriptFrame* JavaScriptFrameIterator::frame() const { | 
| 319 inline JavaScriptFrame* JavaScriptFrameIteratorTemp<Iterator>::frame() const { |  | 
| 320   // TODO(1233797): The frame hierarchy needs to change. It's | 317   // TODO(1233797): The frame hierarchy needs to change. It's | 
| 321   // problematic that we can't use the safe-cast operator to cast to | 318   // problematic that we can't use the safe-cast operator to cast to | 
| 322   // the JavaScript frame type, because we may encounter arguments | 319   // the JavaScript frame type, because we may encounter arguments | 
| 323   // adaptor frames. | 320   // adaptor frames. | 
| 324   StackFrame* frame = iterator_.frame(); | 321   StackFrame* frame = iterator_.frame(); | 
| 325   ASSERT(frame->is_java_script() || frame->is_arguments_adaptor()); | 322   ASSERT(frame->is_java_script() || frame->is_arguments_adaptor()); | 
| 326   return static_cast<JavaScriptFrame*>(frame); | 323   return static_cast<JavaScriptFrame*>(frame); | 
| 327 } | 324 } | 
| 328 | 325 | 
| 329 | 326 | 
| 330 template<typename Iterator> | 327 inline JavaScriptFrame* SafeStackTraceFrameIterator::frame() const { | 
| 331 JavaScriptFrameIteratorTemp<Iterator>::JavaScriptFrameIteratorTemp( | 328   // TODO(1233797): The frame hierarchy needs to change. It's | 
| 332     Isolate* isolate, StackFrame::Id id) | 329   // problematic that we can't use the safe-cast operator to cast to | 
| 333     : iterator_(isolate) { | 330   // the JavaScript frame type, because we may encounter arguments | 
| 334   AdvanceToId(id); | 331   // adaptor frames. | 
|  | 332   StackFrame* frame = iterator_.frame(); | 
|  | 333   ASSERT(frame->is_java_script()); | 
|  | 334   return static_cast<JavaScriptFrame*>(frame); | 
| 335 } | 335 } | 
| 336 | 336 | 
| 337 | 337 | 
| 338 template<typename Iterator> |  | 
| 339 void JavaScriptFrameIteratorTemp<Iterator>::Advance() { |  | 
| 340   do { |  | 
| 341     iterator_.Advance(); |  | 
| 342   } while (!iterator_.done() && !iterator_.frame()->is_java_script()); |  | 
| 343 } |  | 
| 344 |  | 
| 345 |  | 
| 346 template<typename Iterator> |  | 
| 347 void JavaScriptFrameIteratorTemp<Iterator>::AdvanceToArgumentsFrame() { |  | 
| 348   if (!frame()->has_adapted_arguments()) return; |  | 
| 349   iterator_.Advance(); |  | 
| 350   ASSERT(iterator_.frame()->is_arguments_adaptor()); |  | 
| 351 } |  | 
| 352 |  | 
| 353 |  | 
| 354 template<typename Iterator> |  | 
| 355 void JavaScriptFrameIteratorTemp<Iterator>::AdvanceToId(StackFrame::Id id) { |  | 
| 356   while (!done()) { |  | 
| 357     Advance(); |  | 
| 358     if (frame()->id() == id) return; |  | 
| 359   } |  | 
| 360 } |  | 
| 361 |  | 
| 362 |  | 
| 363 template<typename Iterator> |  | 
| 364 void JavaScriptFrameIteratorTemp<Iterator>::Reset() { |  | 
| 365   iterator_.Reset(); |  | 
| 366   if (!done()) Advance(); |  | 
| 367 } |  | 
| 368 |  | 
| 369 |  | 
| 370 } }  // namespace v8::internal | 338 } }  // namespace v8::internal | 
| 371 | 339 | 
| 372 #endif  // V8_FRAMES_INL_H_ | 340 #endif  // V8_FRAMES_INL_H_ | 
| OLD | NEW | 
|---|