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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 // Generator support to preserve stack handlers. | 136 // Generator support to preserve stack handlers. |
137 void Unwind(Isolate* isolate, FixedArray* array, int offset, | 137 void Unwind(Isolate* isolate, FixedArray* array, int offset, |
138 int previous_handler_offset) const; | 138 int previous_handler_offset) const; |
139 int Rewind(Isolate* isolate, FixedArray* array, int offset, Address fp); | 139 int Rewind(Isolate* isolate, FixedArray* array, int offset, Address fp); |
140 | 140 |
141 private: | 141 private: |
142 // Accessors. | 142 // Accessors. |
143 inline Kind kind() const; | 143 inline Kind kind() const; |
144 inline unsigned index() const; | 144 inline unsigned index() const; |
145 | 145 |
| 146 inline Object** constant_pool_address() const; |
146 inline Object** context_address() const; | 147 inline Object** context_address() const; |
147 inline Object** code_address() const; | 148 inline Object** code_address() const; |
148 inline void SetFp(Address slot, Address fp); | 149 inline void SetFp(Address slot, Address fp); |
149 | 150 |
150 DISALLOW_IMPLICIT_CONSTRUCTORS(StackHandler); | 151 DISALLOW_IMPLICIT_CONSTRUCTORS(StackHandler); |
151 }; | 152 }; |
152 | 153 |
153 | 154 |
154 #define STACK_FRAME_TYPE_LIST(V) \ | 155 #define STACK_FRAME_TYPE_LIST(V) \ |
155 V(ENTRY, EntryFrame) \ | 156 V(ENTRY, EntryFrame) \ |
156 V(ENTRY_CONSTRUCT, EntryConstructFrame) \ | 157 V(ENTRY_CONSTRUCT, EntryConstructFrame) \ |
157 V(EXIT, ExitFrame) \ | 158 V(EXIT, ExitFrame) \ |
158 V(JAVA_SCRIPT, JavaScriptFrame) \ | 159 V(JAVA_SCRIPT, JavaScriptFrame) \ |
159 V(OPTIMIZED, OptimizedFrame) \ | 160 V(OPTIMIZED, OptimizedFrame) \ |
160 V(STUB, StubFrame) \ | 161 V(STUB, StubFrame) \ |
161 V(STUB_FAILURE_TRAMPOLINE, StubFailureTrampolineFrame) \ | 162 V(STUB_FAILURE_TRAMPOLINE, StubFailureTrampolineFrame) \ |
162 V(INTERNAL, InternalFrame) \ | 163 V(INTERNAL, InternalFrame) \ |
163 V(CONSTRUCT, ConstructFrame) \ | 164 V(CONSTRUCT, ConstructFrame) \ |
164 V(ARGUMENTS_ADAPTOR, ArgumentsAdaptorFrame) | 165 V(ARGUMENTS_ADAPTOR, ArgumentsAdaptorFrame) |
165 | 166 |
166 | 167 |
167 class StandardFrameConstants : public AllStatic { | 168 class StandardFrameConstants : public AllStatic { |
168 public: | 169 public: |
169 // Fixed part of the frame consists of return address, caller fp, | 170 // Fixed part of the frame consists of return address, caller fp, |
170 // constant pool (if FLAG_enable_ool_constant_pool), context, and function. | 171 // constant pool (if FLAG_enable_ool_constant_pool), context, and function. |
171 // StandardFrame::IterateExpressions assumes that kContextOffset is the last | 172 // StandardFrame::IterateExpressions assumes that kLastObjectOffset is the |
172 // object pointer. | 173 // last object pointer. |
173 static const int kCPSlotSize = | 174 static const int kCPSlotSize = |
174 FLAG_enable_ool_constant_pool ? kPointerSize : 0; | 175 FLAG_enable_ool_constant_pool ? kPointerSize : 0; |
175 static const int kFixedFrameSizeFromFp = 2 * kPointerSize + kCPSlotSize; | 176 static const int kFixedFrameSizeFromFp = 2 * kPointerSize + kCPSlotSize; |
176 static const int kFixedFrameSize = kPCOnStackSize + kFPOnStackSize + | 177 static const int kFixedFrameSize = kPCOnStackSize + kFPOnStackSize + |
177 kFixedFrameSizeFromFp; | 178 kFixedFrameSizeFromFp; |
178 static const int kExpressionsOffset = -3 * kPointerSize - kCPSlotSize; | 179 static const int kExpressionsOffset = -3 * kPointerSize - kCPSlotSize; |
179 static const int kMarkerOffset = -2 * kPointerSize - kCPSlotSize; | 180 static const int kMarkerOffset = -2 * kPointerSize - kCPSlotSize; |
180 static const int kContextOffset = -1 * kPointerSize - kCPSlotSize; | 181 static const int kContextOffset = -1 * kPointerSize - kCPSlotSize; |
181 static const int kConstantPoolOffset = FLAG_enable_ool_constant_pool ? | 182 static const int kConstantPoolOffset = FLAG_enable_ool_constant_pool ? |
182 -1 * kPointerSize : 0; | 183 -1 * kPointerSize : 0; |
183 static const int kCallerFPOffset = 0 * kPointerSize; | 184 static const int kCallerFPOffset = 0 * kPointerSize; |
184 static const int kCallerPCOffset = +1 * kFPOnStackSize; | 185 static const int kCallerPCOffset = +1 * kFPOnStackSize; |
185 static const int kCallerSPOffset = kCallerPCOffset + 1 * kPCOnStackSize; | 186 static const int kCallerSPOffset = kCallerPCOffset + 1 * kPCOnStackSize; |
| 187 |
| 188 static const int kLastObjectOffset = FLAG_enable_ool_constant_pool ? |
| 189 kConstantPoolOffset : kContextOffset; |
186 }; | 190 }; |
187 | 191 |
188 | 192 |
189 // Abstract base class for all stack frames. | 193 // Abstract base class for all stack frames. |
190 class StackFrame BASE_EMBEDDED { | 194 class StackFrame BASE_EMBEDDED { |
191 public: | 195 public: |
192 #define DECLARE_TYPE(type, ignore) type, | 196 #define DECLARE_TYPE(type, ignore) type, |
193 enum Type { | 197 enum Type { |
194 NONE = 0, | 198 NONE = 0, |
195 STACK_FRAME_TYPE_LIST(DECLARE_TYPE) | 199 STACK_FRAME_TYPE_LIST(DECLARE_TYPE) |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 | 420 |
417 | 421 |
418 // Exit frames are used to exit JavaScript execution and go to C. | 422 // Exit frames are used to exit JavaScript execution and go to C. |
419 class ExitFrame: public StackFrame { | 423 class ExitFrame: public StackFrame { |
420 public: | 424 public: |
421 virtual Type type() const { return EXIT; } | 425 virtual Type type() const { return EXIT; } |
422 | 426 |
423 virtual Code* unchecked_code() const; | 427 virtual Code* unchecked_code() const; |
424 | 428 |
425 Object*& code_slot() const; | 429 Object*& code_slot() const; |
| 430 Object*& constant_pool_slot() const; |
426 | 431 |
427 // Garbage collection support. | 432 // Garbage collection support. |
428 virtual void Iterate(ObjectVisitor* v) const; | 433 virtual void Iterate(ObjectVisitor* v) const; |
429 | 434 |
430 virtual void SetCallerFp(Address caller_fp); | 435 virtual void SetCallerFp(Address caller_fp); |
431 | 436 |
432 static ExitFrame* cast(StackFrame* frame) { | 437 static ExitFrame* cast(StackFrame* frame) { |
433 ASSERT(frame->is_exit()); | 438 ASSERT(frame->is_exit()); |
434 return static_cast<ExitFrame*>(frame); | 439 return static_cast<ExitFrame*>(frame); |
435 } | 440 } |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 }; | 941 }; |
937 | 942 |
938 | 943 |
939 // Reads all frames on the current stack and copies them into the current | 944 // Reads all frames on the current stack and copies them into the current |
940 // zone memory. | 945 // zone memory. |
941 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); | 946 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); |
942 | 947 |
943 } } // namespace v8::internal | 948 } } // namespace v8::internal |
944 | 949 |
945 #endif // V8_FRAMES_H_ | 950 #endif // V8_FRAMES_H_ |
OLD | NEW |