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

Side by Side Diff: src/frames.h

Issue 14031028: Generators save and restore stack handlers (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Rebase to have the test suite expect boxed return values Created 7 years, 7 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 | « no previous file | src/frames.cc » ('j') | src/frames.cc » ('J')
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 // 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 public: 100 public:
101 enum Kind { 101 enum Kind {
102 JS_ENTRY, 102 JS_ENTRY,
103 CATCH, 103 CATCH,
104 FINALLY, 104 FINALLY,
105 LAST_KIND = FINALLY 105 LAST_KIND = FINALLY
106 }; 106 };
107 107
108 static const int kKindWidth = 2; 108 static const int kKindWidth = 2;
109 STATIC_ASSERT(LAST_KIND < (1 << kKindWidth)); 109 STATIC_ASSERT(LAST_KIND < (1 << kKindWidth));
110 static const int kIndexWidth = 32 - kKindWidth; 110 static const int kIndexWidth = 32 - kSmiTagSize - kKindWidth;
111 class KindField: public BitField<StackHandler::Kind, 0, kKindWidth> {}; 111 class KindField: public BitField<StackHandler::Kind, 0, kKindWidth> {};
112 class IndexField: public BitField<unsigned, kKindWidth, kIndexWidth> {}; 112 class IndexField: public BitField<unsigned, kKindWidth, kIndexWidth> {};
113 113
114 // Get the address of this stack handler. 114 // Get the address of this stack handler.
115 inline Address address() const; 115 inline Address address() const;
116 116
117 // Get the next stack handler in the chain. 117 // Get the next stack handler in the chain.
118 inline StackHandler* next() const; 118 inline StackHandler* next() const;
119 119
120 // Tells whether the given address is inside this handler. 120 // Tells whether the given address is inside this handler.
121 inline bool includes(Address address) const; 121 inline bool includes(Address address) const;
122 122
123 // Garbage collection support. 123 // Garbage collection support.
124 inline void Iterate(ObjectVisitor* v, Code* holder) const; 124 inline void Iterate(ObjectVisitor* v, Code* holder) const;
125 125
126 // Conversion support. 126 // Conversion support.
127 static inline StackHandler* FromAddress(Address address); 127 static inline StackHandler* FromAddress(Address address);
128 128
129 // Testers 129 // Testers
130 inline bool is_js_entry() const; 130 inline bool is_js_entry() const;
131 inline bool is_catch() const; 131 inline bool is_catch() const;
132 inline bool is_finally() const; 132 inline bool is_finally() const;
133 133
134 // Helpers to allow generators to capture and restore an activation's stack
135 // handlers.
Michael Starzinger 2013/05/07 09:55:44 nit: How about shortening the comment to just "Gen
136 void Unwind(Isolate* isolate, FixedArray* array, int offset,
137 Object *data) const;
Michael Starzinger 2013/05/07 09:55:44 Can we make "data" to be of type Smi? That would b
138 Object* Rewind(Isolate* isolate, FixedArray* array, int offset,
139 Address fp);
Michael Starzinger 2013/05/07 09:55:44 nit: Should fit into one line.
140
134 private: 141 private:
135 // Accessors. 142 // Accessors.
136 inline Kind kind() const; 143 inline Kind kind() const;
137 144
138 inline Object** context_address() const; 145 inline Object** context_address() const;
139 inline Object** code_address() const; 146 inline Object** code_address() const;
140 147
141 DISALLOW_IMPLICIT_CONSTRUCTORS(StackHandler); 148 DISALLOW_IMPLICIT_CONSTRUCTORS(StackHandler);
142 }; 149 };
143 150
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 inline Object* GetParameter(int index) const; 541 inline Object* GetParameter(int index) const;
535 inline int ComputeParametersCount() const { 542 inline int ComputeParametersCount() const {
536 return GetNumberOfIncomingArguments(); 543 return GetNumberOfIncomingArguments();
537 } 544 }
538 545
539 // Access the operand stack. 546 // Access the operand stack.
540 inline Address GetOperandSlot(int index) const; 547 inline Address GetOperandSlot(int index) const;
541 inline Object* GetOperand(int index) const; 548 inline Object* GetOperand(int index) const;
542 inline int ComputeOperandsCount() const; 549 inline int ComputeOperandsCount() const;
543 550
551 void SaveOperandStack(FixedArray* store, int* stack_handler_index) const;
Michael Starzinger 2013/05/07 09:55:44 nit: Maybe add a one-liner comment "Generator supp
552 void RestoreOperandStack(FixedArray* store, int stack_handler_index);
553
544 // Debugger access. 554 // Debugger access.
545 void SetParameterValue(int index, Object* value) const; 555 void SetParameterValue(int index, Object* value) const;
546 556
547 // Check if this frame is a constructor frame invoked through 'new'. 557 // Check if this frame is a constructor frame invoked through 'new'.
548 bool IsConstructor() const; 558 bool IsConstructor() const;
549 559
550 // Check if this frame has "adapted" arguments in the sense that the 560 // Check if this frame has "adapted" arguments in the sense that the
551 // actual passed arguments are available in an arguments adaptor 561 // actual passed arguments are available in an arguments adaptor
552 // frame below it on the stack. 562 // frame below it on the stack.
553 inline bool has_adapted_arguments() const; 563 inline bool has_adapted_arguments() const;
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 }; 999 };
990 1000
991 1001
992 // Reads all frames on the current stack and copies them into the current 1002 // Reads all frames on the current stack and copies them into the current
993 // zone memory. 1003 // zone memory.
994 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); 1004 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone);
995 1005
996 } } // namespace v8::internal 1006 } } // namespace v8::internal
997 1007
998 #endif // V8_FRAMES_H_ 1008 #endif // V8_FRAMES_H_
OLDNEW
« no previous file with comments | « no previous file | src/frames.cc » ('j') | src/frames.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698