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

Side by Side Diff: src/frames.h

Issue 1010883002: Switch full-codegen from StackHandlers to handler table. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_cleanup-isolate-dead-code
Patch Set: Fix debugger-pause-on-promise-rejection. Created 5 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
« no previous file with comments | « src/debug.cc ('k') | src/frames.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_FRAMES_H_ 5 #ifndef V8_FRAMES_H_
6 #define V8_FRAMES_H_ 6 #define V8_FRAMES_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/handles.h" 9 #include "src/handles.h"
10 #include "src/safepoint-table.h" 10 #include "src/safepoint-table.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 Isolate* isolate_; 60 Isolate* isolate_;
61 61
62 static const int kInnerPointerToCodeCacheSize = 1024; 62 static const int kInnerPointerToCodeCacheSize = 1024;
63 InnerPointerToCodeCacheEntry cache_[kInnerPointerToCodeCacheSize]; 63 InnerPointerToCodeCacheEntry cache_[kInnerPointerToCodeCacheSize];
64 64
65 DISALLOW_COPY_AND_ASSIGN(InnerPointerToCodeCache); 65 DISALLOW_COPY_AND_ASSIGN(InnerPointerToCodeCache);
66 }; 66 };
67 67
68 68
69 // Every try-block pushes the context register.
70 class TryBlockConstant : public AllStatic {
71 public:
72 static const int kElementCount = 1;
73 };
74
75
69 class StackHandlerConstants : public AllStatic { 76 class StackHandlerConstants : public AllStatic {
70 public: 77 public:
71 static const int kNextOffset = 0 * kPointerSize; 78 static const int kNextOffset = 0 * kPointerSize;
72 static const int kStateOffset = 1 * kPointerSize;
73 #if V8_TARGET_LITTLE_ENDIAN || !V8_HOST_ARCH_64_BIT
74 static const int kStateIntOffset = kStateOffset;
75 #else
76 static const int kStateIntOffset = kStateOffset + kIntSize;
77 #endif
78 static const int kContextOffset = 2 * kPointerSize;
79 79
80 static const int kSize = kContextOffset + kPointerSize; 80 static const int kSize = kNextOffset + kPointerSize;
81 static const int kSlotCount = kSize >> kPointerSizeLog2; 81 static const int kSlotCount = kSize >> kPointerSizeLog2;
82 }; 82 };
83 83
84 84
85 class StackHandler BASE_EMBEDDED { 85 class StackHandler BASE_EMBEDDED {
86 public: 86 public:
87 enum Kind {
88 JS_ENTRY,
89 CATCH,
90 FINALLY,
91 };
92
93 // Get the address of this stack handler. 87 // Get the address of this stack handler.
94 inline Address address() const; 88 inline Address address() const;
95 89
96 // Get the next stack handler in the chain. 90 // Get the next stack handler in the chain.
97 inline StackHandler* next() const; 91 inline StackHandler* next() const;
98 92
99 // Tells whether the given address is inside this handler.
100 inline bool includes(Address address) const;
101
102 // Garbage collection support.
103 inline void Iterate(ObjectVisitor* v, Code* holder) const;
104
105 // Conversion support. 93 // Conversion support.
106 static inline StackHandler* FromAddress(Address address); 94 static inline StackHandler* FromAddress(Address address);
107 95
108 // Accessors.
109 inline Context* context() const;
110 inline int index() const;
111
112 // Generator support to preserve stack handlers.
113 void Unwind(Isolate* isolate, FixedArray* array, int offset,
114 int previous_handler_offset) const;
115 int Rewind(Isolate* isolate, FixedArray* array, int offset, Address fp);
116
117 private: 96 private:
118 inline Object** context_address() const;
119
120 DISALLOW_IMPLICIT_CONSTRUCTORS(StackHandler); 97 DISALLOW_IMPLICIT_CONSTRUCTORS(StackHandler);
121 }; 98 };
122 99
123 100
124 #define STACK_FRAME_TYPE_LIST(V) \ 101 #define STACK_FRAME_TYPE_LIST(V) \
125 V(ENTRY, EntryFrame) \ 102 V(ENTRY, EntryFrame) \
126 V(ENTRY_CONSTRUCT, EntryConstructFrame) \ 103 V(ENTRY_CONSTRUCT, EntryConstructFrame) \
127 V(EXIT, ExitFrame) \ 104 V(EXIT, ExitFrame) \
128 V(JAVA_SCRIPT, JavaScriptFrame) \ 105 V(JAVA_SCRIPT, JavaScriptFrame) \
129 V(OPTIMIZED, OptimizedFrame) \ 106 V(OPTIMIZED, OptimizedFrame) \
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 226
250 Address* pc_address() const { return state_.pc_address; } 227 Address* pc_address() const { return state_.pc_address; }
251 228
252 Address* constant_pool_address() const { 229 Address* constant_pool_address() const {
253 return state_.constant_pool_address; 230 return state_.constant_pool_address;
254 } 231 }
255 232
256 // Get the id of this stack frame. 233 // Get the id of this stack frame.
257 Id id() const { return static_cast<Id>(OffsetFrom(caller_sp())); } 234 Id id() const { return static_cast<Id>(OffsetFrom(caller_sp())); }
258 235
259 // Checks if this frame includes any stack handlers.
260 bool HasHandler() const;
261
262 // Get the top handler from the current stack iterator. 236 // Get the top handler from the current stack iterator.
263 inline StackHandler* top_handler() const; 237 inline StackHandler* top_handler() const;
264 238
265 // Get the type of this frame. 239 // Get the type of this frame.
266 virtual Type type() const = 0; 240 virtual Type type() const = 0;
267 241
268 // Get the code associated with this frame. 242 // Get the code associated with this frame.
269 // This method could be called during marking phase of GC. 243 // This method could be called during marking phase of GC.
270 virtual Code* unchecked_code() const = 0; 244 virtual Code* unchecked_code() const = 0;
271 245
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 static inline Address ComputeConstantPoolAddress(Address fp); 450 static inline Address ComputeConstantPoolAddress(Address fp);
477 451
478 // Iterate over expression stack including stack handlers, locals, 452 // Iterate over expression stack including stack handlers, locals,
479 // and parts of the fixed part including context and code fields. 453 // and parts of the fixed part including context and code fields.
480 void IterateExpressions(ObjectVisitor* v) const; 454 void IterateExpressions(ObjectVisitor* v) const;
481 455
482 // Returns the address of the n'th expression stack element. 456 // Returns the address of the n'th expression stack element.
483 Address GetExpressionAddress(int n) const; 457 Address GetExpressionAddress(int n) const;
484 static Address GetExpressionAddress(Address fp, int n); 458 static Address GetExpressionAddress(Address fp, int n);
485 459
486 // Determines if the n'th expression stack element is in a stack
487 // handler or not. Requires traversing all handlers in this frame.
488 bool IsExpressionInsideHandler(int n) const;
489
490 // Determines if the standard frame for the given frame pointer is 460 // Determines if the standard frame for the given frame pointer is
491 // an arguments adaptor frame. 461 // an arguments adaptor frame.
492 static inline bool IsArgumentsAdaptorFrame(Address fp); 462 static inline bool IsArgumentsAdaptorFrame(Address fp);
493 463
494 // Determines if the standard frame for the given frame pointer is a 464 // Determines if the standard frame for the given frame pointer is a
495 // construct frame. 465 // construct frame.
496 static inline bool IsConstructFrame(Address fp); 466 static inline bool IsConstructFrame(Address fp);
497 467
498 // Used by OptimizedFrames and StubFrames. 468 // Used by OptimizedFrames and StubFrames.
499 void IterateCompiledFrame(ObjectVisitor* v) const; 469 void IterateCompiledFrame(ObjectVisitor* v) const;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 inline Object* GetParameter(int index) const; 518 inline Object* GetParameter(int index) const;
549 inline int ComputeParametersCount() const { 519 inline int ComputeParametersCount() const {
550 return GetNumberOfIncomingArguments(); 520 return GetNumberOfIncomingArguments();
551 } 521 }
552 522
553 // Access the operand stack. 523 // Access the operand stack.
554 inline Address GetOperandSlot(int index) const; 524 inline Address GetOperandSlot(int index) const;
555 inline Object* GetOperand(int index) const; 525 inline Object* GetOperand(int index) const;
556 inline int ComputeOperandsCount() const; 526 inline int ComputeOperandsCount() const;
557 527
558 // Generator support to preserve operand stack and stack handlers. 528 // Generator support to preserve operand stack.
559 void SaveOperandStack(FixedArray* store, int* stack_handler_index) const; 529 void SaveOperandStack(FixedArray* store) const;
560 void RestoreOperandStack(FixedArray* store, int stack_handler_index); 530 void RestoreOperandStack(FixedArray* store);
561 531
562 // Debugger access. 532 // Debugger access.
563 void SetParameterValue(int index, Object* value) const; 533 void SetParameterValue(int index, Object* value) const;
564 534
565 // Check if this frame is a constructor frame invoked through 'new'. 535 // Check if this frame is a constructor frame invoked through 'new'.
566 bool IsConstructor() const; 536 bool IsConstructor() const;
567 537
568 // Check if this frame has "adapted" arguments in the sense that the 538 // Check if this frame has "adapted" arguments in the sense that the
569 // actual passed arguments are available in an arguments adaptor 539 // actual passed arguments are available in an arguments adaptor
570 // frame below it on the stack. 540 // frame below it on the stack.
(...skipping 13 matching lines...) Expand all
584 554
585 // Returns the levels of inlining for this frame. 555 // Returns the levels of inlining for this frame.
586 virtual int GetInlineCount() { return 1; } 556 virtual int GetInlineCount() { return 1; }
587 557
588 // Return a list with JSFunctions of this frame. 558 // Return a list with JSFunctions of this frame.
589 virtual void GetFunctions(List<JSFunction*>* functions); 559 virtual void GetFunctions(List<JSFunction*>* functions);
590 560
591 // Build a list with summaries for this frame including all inlined frames. 561 // Build a list with summaries for this frame including all inlined frames.
592 virtual void Summarize(List<FrameSummary>* frames); 562 virtual void Summarize(List<FrameSummary>* frames);
593 563
564 // Lookup exception handler for current {pc}, returns -1 if none found. Also
565 // returns the expected number of stack slots at the handler site.
566 virtual int LookupExceptionHandlerInTable(int* stack_slots);
567
594 // Architecture-specific register description. 568 // Architecture-specific register description.
595 static Register fp_register(); 569 static Register fp_register();
596 static Register context_register(); 570 static Register context_register();
597 static Register constant_pool_pointer_register(); 571 static Register constant_pool_pointer_register();
598 572
599 static JavaScriptFrame* cast(StackFrame* frame) { 573 static JavaScriptFrame* cast(StackFrame* frame) {
600 DCHECK(frame->is_java_script()); 574 DCHECK(frame->is_java_script());
601 return static_cast<JavaScriptFrame*>(frame); 575 return static_cast<JavaScriptFrame*>(frame);
602 } 576 }
603 577
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 630
657 virtual int GetInlineCount(); 631 virtual int GetInlineCount();
658 632
659 // Return a list with JSFunctions of this frame. 633 // Return a list with JSFunctions of this frame.
660 // The functions are ordered bottom-to-top (i.e. functions.last() 634 // The functions are ordered bottom-to-top (i.e. functions.last()
661 // is the top-most activation) 635 // is the top-most activation)
662 virtual void GetFunctions(List<JSFunction*>* functions); 636 virtual void GetFunctions(List<JSFunction*>* functions);
663 637
664 virtual void Summarize(List<FrameSummary>* frames); 638 virtual void Summarize(List<FrameSummary>* frames);
665 639
640 // Lookup exception handler for current {pc}, returns -1 if none found. Also
641 // returns the expected number of stack slots at the handler site.
642 virtual int LookupExceptionHandlerInTable(int* stack_slots);
643
666 DeoptimizationInputData* GetDeoptimizationData(int* deopt_index); 644 DeoptimizationInputData* GetDeoptimizationData(int* deopt_index);
667 645
668 protected: 646 protected:
669 inline explicit OptimizedFrame(StackFrameIteratorBase* iterator); 647 inline explicit OptimizedFrame(StackFrameIteratorBase* iterator);
670 648
671 private: 649 private:
672 JSFunction* LiteralAt(FixedArray* literal_array, int literal_id); 650 JSFunction* LiteralAt(FixedArray* literal_array, int literal_id);
673 651
674 friend class StackFrameIteratorBase; 652 friend class StackFrameIteratorBase;
675 }; 653 };
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 }; 897 };
920 898
921 899
922 // Reads all frames on the current stack and copies them into the current 900 // Reads all frames on the current stack and copies them into the current
923 // zone memory. 901 // zone memory.
924 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); 902 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone);
925 903
926 } } // namespace v8::internal 904 } } // namespace v8::internal
927 905
928 #endif // V8_FRAMES_H_ 906 #endif // V8_FRAMES_H_
OLDNEW
« no previous file with comments | « src/debug.cc ('k') | src/frames.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698