| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 // Return the code of the n-th saved register available to JavaScript. | 43 // Return the code of the n-th saved register available to JavaScript. |
| 44 int JSCallerSavedCode(int n); | 44 int JSCallerSavedCode(int n); |
| 45 | 45 |
| 46 | 46 |
| 47 // Forward declarations. | 47 // Forward declarations. |
| 48 class StackFrameIterator; | 48 class StackFrameIterator; |
| 49 class ThreadLocalTop; | 49 class ThreadLocalTop; |
| 50 class Isolate; | 50 class Isolate; |
| 51 | 51 |
| 52 class PcToCodeCache { | 52 class InnerPointerToCodeCache { |
| 53 public: | 53 public: |
| 54 struct PcToCodeCacheEntry { | 54 struct InnerPointerToCodeCacheEntry { |
| 55 Address pc; | 55 Address inner_pointer; |
| 56 Code* code; | 56 Code* code; |
| 57 SafepointEntry safepoint_entry; | 57 SafepointEntry safepoint_entry; |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 explicit PcToCodeCache(Isolate* isolate) : isolate_(isolate) { | 60 explicit InnerPointerToCodeCache(Isolate* isolate) : isolate_(isolate) { |
| 61 Flush(); | 61 Flush(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 Code* GcSafeFindCodeForPc(Address pc); | 64 Code* GcSafeFindCodeForInnerPointer(Address inner_pointer); |
| 65 Code* GcSafeCastToCode(HeapObject* object, Address pc); | 65 Code* GcSafeCastToCode(HeapObject* object, Address inner_pointer); |
| 66 | 66 |
| 67 void Flush() { | 67 void Flush() { |
| 68 memset(&cache_[0], 0, sizeof(cache_)); | 68 memset(&cache_[0], 0, sizeof(cache_)); |
| 69 } | 69 } |
| 70 | 70 |
| 71 PcToCodeCacheEntry* GetCacheEntry(Address pc); | 71 InnerPointerToCodeCacheEntry* GetCacheEntry(Address inner_pointer); |
| 72 | 72 |
| 73 private: | 73 private: |
| 74 PcToCodeCacheEntry* cache(int index) { return &cache_[index]; } | 74 InnerPointerToCodeCacheEntry* cache(int index) { return &cache_[index]; } |
| 75 | 75 |
| 76 Isolate* isolate_; | 76 Isolate* isolate_; |
| 77 | 77 |
| 78 static const int kPcToCodeCacheSize = 1024; | 78 static const int kInnerPointerToCodeCacheSize = 1024; |
| 79 PcToCodeCacheEntry cache_[kPcToCodeCacheSize]; | 79 InnerPointerToCodeCacheEntry cache_[kInnerPointerToCodeCacheSize]; |
| 80 | 80 |
| 81 DISALLOW_COPY_AND_ASSIGN(PcToCodeCache); | 81 DISALLOW_COPY_AND_ASSIGN(InnerPointerToCodeCache); |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 | 84 |
| 85 class StackHandler BASE_EMBEDDED { | 85 class StackHandler BASE_EMBEDDED { |
| 86 public: | 86 public: |
| 87 enum State { | 87 enum State { |
| 88 ENTRY, | 88 ENTRY, |
| 89 TRY_CATCH, | 89 TRY_CATCH, |
| 90 TRY_FINALLY | 90 TRY_FINALLY |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 // Get the address of this stack handler. | 93 // Get the address of this stack handler. |
| 94 inline Address address() const; | 94 inline Address address() const; |
| 95 | 95 |
| 96 // Get the next stack handler in the chain. | 96 // Get the next stack handler in the chain. |
| 97 inline StackHandler* next() const; | 97 inline StackHandler* next() const; |
| 98 | 98 |
| 99 // Tells whether the given address is inside this handler. | 99 // Tells whether the given address is inside this handler. |
| 100 inline bool includes(Address address) const; | 100 inline bool includes(Address address) const; |
| 101 | 101 |
| 102 // Garbage collection support. | 102 // Garbage collection support. |
| 103 inline void Iterate(ObjectVisitor* v, Code* holder) const; | 103 inline void Iterate(ObjectVisitor* v, Code* holder) const; |
| 104 | 104 |
| 105 // Conversion support. | 105 // Conversion support. |
| 106 static inline StackHandler* FromAddress(Address address); | 106 static inline StackHandler* FromAddress(Address address); |
| 107 | 107 |
| 108 // Testers | 108 // Testers |
| 109 bool is_entry() { return state() == ENTRY; } | 109 inline bool is_entry() const; |
| 110 bool is_try_catch() { return state() == TRY_CATCH; } | 110 inline bool is_try_catch() const; |
| 111 bool is_try_finally() { return state() == TRY_FINALLY; } | 111 inline bool is_try_finally() const; |
| 112 | 112 |
| 113 private: | 113 private: |
| 114 // Accessors. | 114 // Accessors. |
| 115 inline State state() const; | 115 inline State state() const; |
| 116 | 116 |
| 117 inline Object** context_address() const; | 117 inline Object** context_address() const; |
| 118 inline Address* pc_address() const; | 118 inline Address* pc_address() const; |
| 119 | 119 |
| 120 DISALLOW_IMPLICIT_CONSTRUCTORS(StackHandler); | 120 DISALLOW_IMPLICIT_CONSTRUCTORS(StackHandler); |
| 121 }; | 121 }; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 132 V(ARGUMENTS_ADAPTOR, ArgumentsAdaptorFrame) | 132 V(ARGUMENTS_ADAPTOR, ArgumentsAdaptorFrame) |
| 133 | 133 |
| 134 | 134 |
| 135 // Abstract base class for all stack frames. | 135 // Abstract base class for all stack frames. |
| 136 class StackFrame BASE_EMBEDDED { | 136 class StackFrame BASE_EMBEDDED { |
| 137 public: | 137 public: |
| 138 #define DECLARE_TYPE(type, ignore) type, | 138 #define DECLARE_TYPE(type, ignore) type, |
| 139 enum Type { | 139 enum Type { |
| 140 NONE = 0, | 140 NONE = 0, |
| 141 STACK_FRAME_TYPE_LIST(DECLARE_TYPE) | 141 STACK_FRAME_TYPE_LIST(DECLARE_TYPE) |
| 142 NUMBER_OF_TYPES | 142 NUMBER_OF_TYPES, |
| 143 // Used by FrameScope to indicate that the stack frame is constructed |
| 144 // manually and the FrameScope does not need to emit code. |
| 145 MANUAL |
| 143 }; | 146 }; |
| 144 #undef DECLARE_TYPE | 147 #undef DECLARE_TYPE |
| 145 | 148 |
| 146 // Opaque data type for identifying stack frames. Used extensively | 149 // Opaque data type for identifying stack frames. Used extensively |
| 147 // by the debugger. | 150 // by the debugger. |
| 148 // ID_MIN_VALUE and ID_MAX_VALUE are specified to ensure that enumeration type | 151 // ID_MIN_VALUE and ID_MAX_VALUE are specified to ensure that enumeration type |
| 149 // has correct value range (see Issue 830 for more details). | 152 // has correct value range (see Issue 830 for more details). |
| 150 enum Id { | 153 enum Id { |
| 151 ID_MIN_VALUE = kMinInt, | 154 ID_MIN_VALUE = kMinInt, |
| 152 ID_MAX_VALUE = kMaxInt, | 155 ID_MAX_VALUE = kMaxInt, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 bool HasHandler() const; | 211 bool HasHandler() const; |
| 209 | 212 |
| 210 // Get the type of this frame. | 213 // Get the type of this frame. |
| 211 virtual Type type() const = 0; | 214 virtual Type type() const = 0; |
| 212 | 215 |
| 213 // Get the code associated with this frame. | 216 // Get the code associated with this frame. |
| 214 // This method could be called during marking phase of GC. | 217 // This method could be called during marking phase of GC. |
| 215 virtual Code* unchecked_code() const = 0; | 218 virtual Code* unchecked_code() const = 0; |
| 216 | 219 |
| 217 // Get the code associated with this frame. | 220 // Get the code associated with this frame. |
| 218 Code* LookupCode() const { | 221 inline Code* LookupCode() const; |
| 219 return GetContainingCode(isolate(), pc()); | |
| 220 } | |
| 221 | 222 |
| 222 // Get the code object that contains the given pc. | 223 // Get the code object that contains the given pc. |
| 223 static inline Code* GetContainingCode(Isolate* isolate, Address pc); | 224 static inline Code* GetContainingCode(Isolate* isolate, Address pc); |
| 224 | 225 |
| 225 // Get the code object containing the given pc and fill in the | 226 // Get the code object containing the given pc and fill in the |
| 226 // safepoint entry and the number of stack slots. The pc must be at | 227 // safepoint entry and the number of stack slots. The pc must be at |
| 227 // a safepoint. | 228 // a safepoint. |
| 228 static Code* GetSafepointData(Isolate* isolate, | 229 static Code* GetSafepointData(Isolate* isolate, |
| 229 Address pc, | 230 Address pc, |
| 230 SafepointEntry* safepoint_entry, | 231 SafepointEntry* safepoint_entry, |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 // Garbage collection support. | 293 // Garbage collection support. |
| 293 virtual void Iterate(ObjectVisitor* v) const; | 294 virtual void Iterate(ObjectVisitor* v) const; |
| 294 | 295 |
| 295 static EntryFrame* cast(StackFrame* frame) { | 296 static EntryFrame* cast(StackFrame* frame) { |
| 296 ASSERT(frame->is_entry()); | 297 ASSERT(frame->is_entry()); |
| 297 return static_cast<EntryFrame*>(frame); | 298 return static_cast<EntryFrame*>(frame); |
| 298 } | 299 } |
| 299 virtual void SetCallerFp(Address caller_fp); | 300 virtual void SetCallerFp(Address caller_fp); |
| 300 | 301 |
| 301 protected: | 302 protected: |
| 302 explicit EntryFrame(StackFrameIterator* iterator) : StackFrame(iterator) { } | 303 inline explicit EntryFrame(StackFrameIterator* iterator); |
| 303 | 304 |
| 304 // The caller stack pointer for entry frames is always zero. The | 305 // The caller stack pointer for entry frames is always zero. The |
| 305 // real information about the caller frame is available through the | 306 // real information about the caller frame is available through the |
| 306 // link to the top exit frame. | 307 // link to the top exit frame. |
| 307 virtual Address GetCallerStackPointer() const { return 0; } | 308 virtual Address GetCallerStackPointer() const { return 0; } |
| 308 | 309 |
| 309 private: | 310 private: |
| 310 virtual void ComputeCallerState(State* state) const; | 311 virtual void ComputeCallerState(State* state) const; |
| 311 virtual Type GetCallerState(State* state) const; | 312 virtual Type GetCallerState(State* state) const; |
| 312 | 313 |
| 313 friend class StackFrameIterator; | 314 friend class StackFrameIterator; |
| 314 }; | 315 }; |
| 315 | 316 |
| 316 | 317 |
| 317 class EntryConstructFrame: public EntryFrame { | 318 class EntryConstructFrame: public EntryFrame { |
| 318 public: | 319 public: |
| 319 virtual Type type() const { return ENTRY_CONSTRUCT; } | 320 virtual Type type() const { return ENTRY_CONSTRUCT; } |
| 320 | 321 |
| 321 virtual Code* unchecked_code() const; | 322 virtual Code* unchecked_code() const; |
| 322 | 323 |
| 323 static EntryConstructFrame* cast(StackFrame* frame) { | 324 static EntryConstructFrame* cast(StackFrame* frame) { |
| 324 ASSERT(frame->is_entry_construct()); | 325 ASSERT(frame->is_entry_construct()); |
| 325 return static_cast<EntryConstructFrame*>(frame); | 326 return static_cast<EntryConstructFrame*>(frame); |
| 326 } | 327 } |
| 327 | 328 |
| 328 protected: | 329 protected: |
| 329 explicit EntryConstructFrame(StackFrameIterator* iterator) | 330 inline explicit EntryConstructFrame(StackFrameIterator* iterator); |
| 330 : EntryFrame(iterator) { } | |
| 331 | 331 |
| 332 private: | 332 private: |
| 333 friend class StackFrameIterator; | 333 friend class StackFrameIterator; |
| 334 }; | 334 }; |
| 335 | 335 |
| 336 | 336 |
| 337 // Exit frames are used to exit JavaScript execution and go to C. | 337 // Exit frames are used to exit JavaScript execution and go to C. |
| 338 class ExitFrame: public StackFrame { | 338 class ExitFrame: public StackFrame { |
| 339 public: | 339 public: |
| 340 virtual Type type() const { return EXIT; } | 340 virtual Type type() const { return EXIT; } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 354 } | 354 } |
| 355 | 355 |
| 356 // Compute the state and type of an exit frame given a frame | 356 // Compute the state and type of an exit frame given a frame |
| 357 // pointer. Used when constructing the first stack frame seen by an | 357 // pointer. Used when constructing the first stack frame seen by an |
| 358 // iterator and the frames following entry frames. | 358 // iterator and the frames following entry frames. |
| 359 static Type GetStateForFramePointer(Address fp, State* state); | 359 static Type GetStateForFramePointer(Address fp, State* state); |
| 360 static Address ComputeStackPointer(Address fp); | 360 static Address ComputeStackPointer(Address fp); |
| 361 static void FillState(Address fp, Address sp, State* state); | 361 static void FillState(Address fp, Address sp, State* state); |
| 362 | 362 |
| 363 protected: | 363 protected: |
| 364 explicit ExitFrame(StackFrameIterator* iterator) : StackFrame(iterator) { } | 364 inline explicit ExitFrame(StackFrameIterator* iterator); |
| 365 | 365 |
| 366 virtual Address GetCallerStackPointer() const; | 366 virtual Address GetCallerStackPointer() const; |
| 367 | 367 |
| 368 private: | 368 private: |
| 369 virtual void ComputeCallerState(State* state) const; | 369 virtual void ComputeCallerState(State* state) const; |
| 370 | 370 |
| 371 friend class StackFrameIterator; | 371 friend class StackFrameIterator; |
| 372 }; | 372 }; |
| 373 | 373 |
| 374 | 374 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 387 static Object* GetExpression(Address fp, int index); | 387 static Object* GetExpression(Address fp, int index); |
| 388 | 388 |
| 389 virtual void SetCallerFp(Address caller_fp); | 389 virtual void SetCallerFp(Address caller_fp); |
| 390 | 390 |
| 391 static StandardFrame* cast(StackFrame* frame) { | 391 static StandardFrame* cast(StackFrame* frame) { |
| 392 ASSERT(frame->is_standard()); | 392 ASSERT(frame->is_standard()); |
| 393 return static_cast<StandardFrame*>(frame); | 393 return static_cast<StandardFrame*>(frame); |
| 394 } | 394 } |
| 395 | 395 |
| 396 protected: | 396 protected: |
| 397 explicit StandardFrame(StackFrameIterator* iterator) | 397 inline explicit StandardFrame(StackFrameIterator* iterator); |
| 398 : StackFrame(iterator) { } | |
| 399 | 398 |
| 400 virtual void ComputeCallerState(State* state) const; | 399 virtual void ComputeCallerState(State* state) const; |
| 401 | 400 |
| 402 // Accessors. | 401 // Accessors. |
| 403 inline Address caller_fp() const; | 402 inline Address caller_fp() const; |
| 404 inline Address caller_pc() const; | 403 inline Address caller_pc() const; |
| 405 | 404 |
| 406 // Computes the address of the PC field in the standard frame given | 405 // Computes the address of the PC field in the standard frame given |
| 407 // by the provided frame pointer. | 406 // by the provided frame pointer. |
| 408 static inline Address ComputePCAddress(Address fp); | 407 static inline Address ComputePCAddress(Address fp); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 | 506 |
| 508 // Build a list with summaries for this frame including all inlined frames. | 507 // Build a list with summaries for this frame including all inlined frames. |
| 509 virtual void Summarize(List<FrameSummary>* frames); | 508 virtual void Summarize(List<FrameSummary>* frames); |
| 510 | 509 |
| 511 static JavaScriptFrame* cast(StackFrame* frame) { | 510 static JavaScriptFrame* cast(StackFrame* frame) { |
| 512 ASSERT(frame->is_java_script()); | 511 ASSERT(frame->is_java_script()); |
| 513 return static_cast<JavaScriptFrame*>(frame); | 512 return static_cast<JavaScriptFrame*>(frame); |
| 514 } | 513 } |
| 515 | 514 |
| 516 protected: | 515 protected: |
| 517 explicit JavaScriptFrame(StackFrameIterator* iterator) | 516 inline explicit JavaScriptFrame(StackFrameIterator* iterator); |
| 518 : StandardFrame(iterator) { } | |
| 519 | 517 |
| 520 virtual Address GetCallerStackPointer() const; | 518 virtual Address GetCallerStackPointer() const; |
| 521 | 519 |
| 522 virtual int GetNumberOfIncomingArguments() const; | 520 virtual int GetNumberOfIncomingArguments() const; |
| 523 | 521 |
| 524 // Garbage collection support. Iterates over incoming arguments, | 522 // Garbage collection support. Iterates over incoming arguments, |
| 525 // receiver, and any callee-saved registers. | 523 // receiver, and any callee-saved registers. |
| 526 void IterateArguments(ObjectVisitor* v) const; | 524 void IterateArguments(ObjectVisitor* v) const; |
| 527 | 525 |
| 528 private: | 526 private: |
| (...skipping 16 matching lines...) Expand all Loading... |
| 545 // Return a list with JSFunctions of this frame. | 543 // Return a list with JSFunctions of this frame. |
| 546 // The functions are ordered bottom-to-top (i.e. functions.last() | 544 // The functions are ordered bottom-to-top (i.e. functions.last() |
| 547 // is the top-most activation) | 545 // is the top-most activation) |
| 548 virtual void GetFunctions(List<JSFunction*>* functions); | 546 virtual void GetFunctions(List<JSFunction*>* functions); |
| 549 | 547 |
| 550 virtual void Summarize(List<FrameSummary>* frames); | 548 virtual void Summarize(List<FrameSummary>* frames); |
| 551 | 549 |
| 552 DeoptimizationInputData* GetDeoptimizationData(int* deopt_index); | 550 DeoptimizationInputData* GetDeoptimizationData(int* deopt_index); |
| 553 | 551 |
| 554 protected: | 552 protected: |
| 555 explicit OptimizedFrame(StackFrameIterator* iterator) | 553 inline explicit OptimizedFrame(StackFrameIterator* iterator); |
| 556 : JavaScriptFrame(iterator) { } | |
| 557 | 554 |
| 558 private: | 555 private: |
| 559 friend class StackFrameIterator; | 556 friend class StackFrameIterator; |
| 560 }; | 557 }; |
| 561 | 558 |
| 562 | 559 |
| 563 // Arguments adaptor frames are automatically inserted below | 560 // Arguments adaptor frames are automatically inserted below |
| 564 // JavaScript frames when the actual number of parameters does not | 561 // JavaScript frames when the actual number of parameters does not |
| 565 // match the formal number of parameters. | 562 // match the formal number of parameters. |
| 566 class ArgumentsAdaptorFrame: public JavaScriptFrame { | 563 class ArgumentsAdaptorFrame: public JavaScriptFrame { |
| 567 public: | 564 public: |
| 568 virtual Type type() const { return ARGUMENTS_ADAPTOR; } | 565 virtual Type type() const { return ARGUMENTS_ADAPTOR; } |
| 569 | 566 |
| 570 // Determine the code for the frame. | 567 // Determine the code for the frame. |
| 571 virtual Code* unchecked_code() const; | 568 virtual Code* unchecked_code() const; |
| 572 | 569 |
| 573 static ArgumentsAdaptorFrame* cast(StackFrame* frame) { | 570 static ArgumentsAdaptorFrame* cast(StackFrame* frame) { |
| 574 ASSERT(frame->is_arguments_adaptor()); | 571 ASSERT(frame->is_arguments_adaptor()); |
| 575 return static_cast<ArgumentsAdaptorFrame*>(frame); | 572 return static_cast<ArgumentsAdaptorFrame*>(frame); |
| 576 } | 573 } |
| 577 | 574 |
| 578 // Printing support. | 575 // Printing support. |
| 579 virtual void Print(StringStream* accumulator, | 576 virtual void Print(StringStream* accumulator, |
| 580 PrintMode mode, | 577 PrintMode mode, |
| 581 int index) const; | 578 int index) const; |
| 582 | 579 |
| 583 protected: | 580 protected: |
| 584 explicit ArgumentsAdaptorFrame(StackFrameIterator* iterator) | 581 inline explicit ArgumentsAdaptorFrame(StackFrameIterator* iterator); |
| 585 : JavaScriptFrame(iterator) { } | |
| 586 | 582 |
| 587 virtual int GetNumberOfIncomingArguments() const { | 583 virtual int GetNumberOfIncomingArguments() const; |
| 588 return Smi::cast(GetExpression(0))->value(); | |
| 589 } | |
| 590 | 584 |
| 591 virtual Address GetCallerStackPointer() const; | 585 virtual Address GetCallerStackPointer() const; |
| 592 | 586 |
| 593 private: | 587 private: |
| 594 friend class StackFrameIterator; | 588 friend class StackFrameIterator; |
| 595 }; | 589 }; |
| 596 | 590 |
| 597 | 591 |
| 598 class InternalFrame: public StandardFrame { | 592 class InternalFrame: public StandardFrame { |
| 599 public: | 593 public: |
| 600 virtual Type type() const { return INTERNAL; } | 594 virtual Type type() const { return INTERNAL; } |
| 601 | 595 |
| 602 // Garbage collection support. | 596 // Garbage collection support. |
| 603 virtual void Iterate(ObjectVisitor* v) const; | 597 virtual void Iterate(ObjectVisitor* v) const; |
| 604 | 598 |
| 605 // Determine the code for the frame. | 599 // Determine the code for the frame. |
| 606 virtual Code* unchecked_code() const; | 600 virtual Code* unchecked_code() const; |
| 607 | 601 |
| 608 static InternalFrame* cast(StackFrame* frame) { | 602 static InternalFrame* cast(StackFrame* frame) { |
| 609 ASSERT(frame->is_internal()); | 603 ASSERT(frame->is_internal()); |
| 610 return static_cast<InternalFrame*>(frame); | 604 return static_cast<InternalFrame*>(frame); |
| 611 } | 605 } |
| 612 | 606 |
| 613 protected: | 607 protected: |
| 614 explicit InternalFrame(StackFrameIterator* iterator) | 608 inline explicit InternalFrame(StackFrameIterator* iterator); |
| 615 : StandardFrame(iterator) { } | |
| 616 | 609 |
| 617 virtual Address GetCallerStackPointer() const; | 610 virtual Address GetCallerStackPointer() const; |
| 618 | 611 |
| 619 private: | 612 private: |
| 620 friend class StackFrameIterator; | 613 friend class StackFrameIterator; |
| 621 }; | 614 }; |
| 622 | 615 |
| 623 | 616 |
| 624 // Construct frames are special trampoline frames introduced to handle | 617 // Construct frames are special trampoline frames introduced to handle |
| 625 // function invocations through 'new'. | 618 // function invocations through 'new'. |
| 626 class ConstructFrame: public InternalFrame { | 619 class ConstructFrame: public InternalFrame { |
| 627 public: | 620 public: |
| 628 virtual Type type() const { return CONSTRUCT; } | 621 virtual Type type() const { return CONSTRUCT; } |
| 629 | 622 |
| 630 static ConstructFrame* cast(StackFrame* frame) { | 623 static ConstructFrame* cast(StackFrame* frame) { |
| 631 ASSERT(frame->is_construct()); | 624 ASSERT(frame->is_construct()); |
| 632 return static_cast<ConstructFrame*>(frame); | 625 return static_cast<ConstructFrame*>(frame); |
| 633 } | 626 } |
| 634 | 627 |
| 635 protected: | 628 protected: |
| 636 explicit ConstructFrame(StackFrameIterator* iterator) | 629 inline explicit ConstructFrame(StackFrameIterator* iterator); |
| 637 : InternalFrame(iterator) { } | |
| 638 | 630 |
| 639 private: | 631 private: |
| 640 friend class StackFrameIterator; | 632 friend class StackFrameIterator; |
| 641 }; | 633 }; |
| 642 | 634 |
| 643 | 635 |
| 644 class StackFrameIterator BASE_EMBEDDED { | 636 class StackFrameIterator BASE_EMBEDDED { |
| 645 public: | 637 public: |
| 646 // An iterator that iterates over the current thread's stack, | 638 // An iterator that iterates over the current thread's stack, |
| 647 // and uses current isolate. | 639 // and uses current isolate. |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 public: | 700 public: |
| 709 JavaScriptFrameIteratorTemp() { if (!done()) Advance(); } | 701 JavaScriptFrameIteratorTemp() { if (!done()) Advance(); } |
| 710 | 702 |
| 711 inline explicit JavaScriptFrameIteratorTemp(Isolate* isolate); | 703 inline explicit JavaScriptFrameIteratorTemp(Isolate* isolate); |
| 712 | 704 |
| 713 // Skip frames until the frame with the given id is reached. | 705 // Skip frames until the frame with the given id is reached. |
| 714 explicit JavaScriptFrameIteratorTemp(StackFrame::Id id) { AdvanceToId(id); } | 706 explicit JavaScriptFrameIteratorTemp(StackFrame::Id id) { AdvanceToId(id); } |
| 715 | 707 |
| 716 inline JavaScriptFrameIteratorTemp(Isolate* isolate, StackFrame::Id id); | 708 inline JavaScriptFrameIteratorTemp(Isolate* isolate, StackFrame::Id id); |
| 717 | 709 |
| 718 JavaScriptFrameIteratorTemp(Address fp, Address sp, | 710 JavaScriptFrameIteratorTemp(Address fp, |
| 719 Address low_bound, Address high_bound) : | 711 Address sp, |
| 712 Address low_bound, |
| 713 Address high_bound) : |
| 720 iterator_(fp, sp, low_bound, high_bound) { | 714 iterator_(fp, sp, low_bound, high_bound) { |
| 721 if (!done()) Advance(); | 715 if (!done()) Advance(); |
| 722 } | 716 } |
| 723 | 717 |
| 724 JavaScriptFrameIteratorTemp(Isolate* isolate, | 718 JavaScriptFrameIteratorTemp(Isolate* isolate, |
| 725 Address fp, Address sp, | 719 Address fp, |
| 726 Address low_bound, Address high_bound) : | 720 Address sp, |
| 721 Address low_bound, |
| 722 Address high_bound) : |
| 727 iterator_(isolate, fp, sp, low_bound, high_bound) { | 723 iterator_(isolate, fp, sp, low_bound, high_bound) { |
| 728 if (!done()) Advance(); | 724 if (!done()) Advance(); |
| 729 } | 725 } |
| 730 | 726 |
| 731 inline JavaScriptFrame* frame() const; | 727 inline JavaScriptFrame* frame() const; |
| 732 | 728 |
| 733 bool done() const { return iterator_.done(); } | 729 bool done() const { return iterator_.done(); } |
| 734 void Advance(); | 730 void Advance(); |
| 735 | 731 |
| 736 // Advance to the frame holding the arguments for the current | 732 // Advance to the frame holding the arguments for the current |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 869 }; | 865 }; |
| 870 | 866 |
| 871 | 867 |
| 872 // Reads all frames on the current stack and copies them into the current | 868 // Reads all frames on the current stack and copies them into the current |
| 873 // zone memory. | 869 // zone memory. |
| 874 Vector<StackFrame*> CreateStackMap(); | 870 Vector<StackFrame*> CreateStackMap(); |
| 875 | 871 |
| 876 } } // namespace v8::internal | 872 } } // namespace v8::internal |
| 877 | 873 |
| 878 #endif // V8_FRAMES_H_ | 874 #endif // V8_FRAMES_H_ |
| OLD | NEW |