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