| OLD | NEW |
| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 V(STUB, StubFrame) \ | 107 V(STUB, StubFrame) \ |
| 108 V(STUB_FAILURE_TRAMPOLINE, StubFailureTrampolineFrame) \ | 108 V(STUB_FAILURE_TRAMPOLINE, StubFailureTrampolineFrame) \ |
| 109 V(INTERNAL, InternalFrame) \ | 109 V(INTERNAL, InternalFrame) \ |
| 110 V(CONSTRUCT, ConstructFrame) \ | 110 V(CONSTRUCT, ConstructFrame) \ |
| 111 V(ARGUMENTS_ADAPTOR, ArgumentsAdaptorFrame) | 111 V(ARGUMENTS_ADAPTOR, ArgumentsAdaptorFrame) |
| 112 | 112 |
| 113 | 113 |
| 114 class StandardFrameConstants : public AllStatic { | 114 class StandardFrameConstants : public AllStatic { |
| 115 public: | 115 public: |
| 116 // Fixed part of the frame consists of return address, caller fp, | 116 // Fixed part of the frame consists of return address, caller fp, |
| 117 // constant pool (if FLAG_enable_embedded_constant_pool), context, and | 117 // constant pool (if FLAG_enable_ool_constant_pool), context, and function. |
| 118 // function. StandardFrame::IterateExpressions assumes that kLastObjectOffset | 118 // StandardFrame::IterateExpressions assumes that kLastObjectOffset is the |
| 119 // is the last object pointer. | 119 // last object pointer. |
| 120 static const int kCPSlotSize = | 120 static const int kCPSlotSize = |
| 121 FLAG_enable_embedded_constant_pool ? kPointerSize : 0; | 121 FLAG_enable_ool_constant_pool ? kPointerSize : 0; |
| 122 static const int kFixedFrameSizeFromFp = 2 * kPointerSize + kCPSlotSize; | 122 static const int kFixedFrameSizeFromFp = 2 * kPointerSize + kCPSlotSize; |
| 123 static const int kFixedFrameSize = | 123 static const int kFixedFrameSize = kPCOnStackSize + kFPOnStackSize + |
| 124 kPCOnStackSize + kFPOnStackSize + kFixedFrameSizeFromFp; | 124 kFixedFrameSizeFromFp; |
| 125 static const int kExpressionsOffset = -3 * kPointerSize - kCPSlotSize; | 125 static const int kExpressionsOffset = -3 * kPointerSize - kCPSlotSize; |
| 126 static const int kMarkerOffset = -2 * kPointerSize - kCPSlotSize; | 126 static const int kMarkerOffset = -2 * kPointerSize - kCPSlotSize; |
| 127 static const int kContextOffset = -1 * kPointerSize - kCPSlotSize; | 127 static const int kContextOffset = -1 * kPointerSize - kCPSlotSize; |
| 128 static const int kConstantPoolOffset = kCPSlotSize ? -1 * kPointerSize : 0; | 128 static const int kConstantPoolOffset = FLAG_enable_ool_constant_pool ? |
| 129 static const int kCallerFPOffset = 0 * kPointerSize; | 129 -1 * kPointerSize : 0; |
| 130 static const int kCallerPCOffset = +1 * kFPOnStackSize; | 130 static const int kCallerFPOffset = 0 * kPointerSize; |
| 131 static const int kCallerSPOffset = kCallerPCOffset + 1 * kPCOnStackSize; | 131 static const int kCallerPCOffset = +1 * kFPOnStackSize; |
| 132 static const int kCallerSPOffset = kCallerPCOffset + 1 * kPCOnStackSize; |
| 132 | 133 |
| 133 static const int kLastObjectOffset = kContextOffset; | 134 static const int kLastObjectOffset = FLAG_enable_ool_constant_pool ? |
| 135 kConstantPoolOffset : kContextOffset; |
| 134 }; | 136 }; |
| 135 | 137 |
| 136 | 138 |
| 137 // Abstract base class for all stack frames. | 139 // Abstract base class for all stack frames. |
| 138 class StackFrame BASE_EMBEDDED { | 140 class StackFrame BASE_EMBEDDED { |
| 139 public: | 141 public: |
| 140 #define DECLARE_TYPE(type, ignore) type, | 142 #define DECLARE_TYPE(type, ignore) type, |
| 141 enum Type { | 143 enum Type { |
| 142 NONE = 0, | 144 NONE = 0, |
| 143 STACK_FRAME_TYPE_LIST(DECLARE_TYPE) | 145 STACK_FRAME_TYPE_LIST(DECLARE_TYPE) |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 | 208 |
| 207 // If this frame is optimized and was dynamically aligned return its old | 209 // If this frame is optimized and was dynamically aligned return its old |
| 208 // unaligned frame pointer. When the frame is deoptimized its FP will shift | 210 // unaligned frame pointer. When the frame is deoptimized its FP will shift |
| 209 // up one word and become unaligned. | 211 // up one word and become unaligned. |
| 210 Address UnpaddedFP() const; | 212 Address UnpaddedFP() const; |
| 211 | 213 |
| 212 Address pc() const { return *pc_address(); } | 214 Address pc() const { return *pc_address(); } |
| 213 void set_pc(Address pc) { *pc_address() = pc; } | 215 void set_pc(Address pc) { *pc_address() = pc; } |
| 214 | 216 |
| 215 Address constant_pool() const { return *constant_pool_address(); } | 217 Address constant_pool() const { return *constant_pool_address(); } |
| 216 void set_constant_pool(Address constant_pool) { | 218 void set_constant_pool(ConstantPoolArray* constant_pool) { |
| 217 *constant_pool_address() = constant_pool; | 219 *constant_pool_address() = reinterpret_cast<Address>(constant_pool); |
| 218 } | 220 } |
| 219 | 221 |
| 220 virtual void SetCallerFp(Address caller_fp) = 0; | 222 virtual void SetCallerFp(Address caller_fp) = 0; |
| 221 | 223 |
| 222 // Manually changes value of fp in this object. | 224 // Manually changes value of fp in this object. |
| 223 void UpdateFp(Address fp) { state_.fp = fp; } | 225 void UpdateFp(Address fp) { state_.fp = fp; } |
| 224 | 226 |
| 225 Address* pc_address() const { return state_.pc_address; } | 227 Address* pc_address() const { return state_.pc_address; } |
| 226 | 228 |
| 227 Address* constant_pool_address() const { | 229 Address* constant_pool_address() const { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 249 | 251 |
| 250 // Get the code object containing the given pc and fill in the | 252 // Get the code object containing the given pc and fill in the |
| 251 // safepoint entry and the number of stack slots. The pc must be at | 253 // safepoint entry and the number of stack slots. The pc must be at |
| 252 // a safepoint. | 254 // a safepoint. |
| 253 static Code* GetSafepointData(Isolate* isolate, | 255 static Code* GetSafepointData(Isolate* isolate, |
| 254 Address pc, | 256 Address pc, |
| 255 SafepointEntry* safepoint_entry, | 257 SafepointEntry* safepoint_entry, |
| 256 unsigned* stack_slots); | 258 unsigned* stack_slots); |
| 257 | 259 |
| 258 virtual void Iterate(ObjectVisitor* v) const = 0; | 260 virtual void Iterate(ObjectVisitor* v) const = 0; |
| 259 static void IteratePc(ObjectVisitor* v, Address* pc_address, | 261 static void IteratePc(ObjectVisitor* v, Address* pc_address, Code* holder); |
| 260 Address* constant_pool_address, Code* holder); | |
| 261 | 262 |
| 262 // Sets a callback function for return-address rewriting profilers | 263 // Sets a callback function for return-address rewriting profilers |
| 263 // to resolve the location of a return address to the location of the | 264 // to resolve the location of a return address to the location of the |
| 264 // profiler's stashed return address. | 265 // profiler's stashed return address. |
| 265 static void SetReturnAddressLocationResolver( | 266 static void SetReturnAddressLocationResolver( |
| 266 ReturnAddressLocationResolver resolver); | 267 ReturnAddressLocationResolver resolver); |
| 267 | 268 |
| 268 // Resolves pc_address through the resolution address function if one is set. | 269 // Resolves pc_address through the resolution address function if one is set. |
| 269 static inline Address* ResolveReturnAddressLocation(Address* pc_address); | 270 static inline Address* ResolveReturnAddressLocation(Address* pc_address); |
| 270 | 271 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 | 373 |
| 373 | 374 |
| 374 // Exit frames are used to exit JavaScript execution and go to C. | 375 // Exit frames are used to exit JavaScript execution and go to C. |
| 375 class ExitFrame: public StackFrame { | 376 class ExitFrame: public StackFrame { |
| 376 public: | 377 public: |
| 377 virtual Type type() const { return EXIT; } | 378 virtual Type type() const { return EXIT; } |
| 378 | 379 |
| 379 virtual Code* unchecked_code() const; | 380 virtual Code* unchecked_code() const; |
| 380 | 381 |
| 381 Object*& code_slot() const; | 382 Object*& code_slot() const; |
| 383 Object*& constant_pool_slot() const; |
| 382 | 384 |
| 383 // Garbage collection support. | 385 // Garbage collection support. |
| 384 virtual void Iterate(ObjectVisitor* v) const; | 386 virtual void Iterate(ObjectVisitor* v) const; |
| 385 | 387 |
| 386 virtual void SetCallerFp(Address caller_fp); | 388 virtual void SetCallerFp(Address caller_fp); |
| 387 | 389 |
| 388 static ExitFrame* cast(StackFrame* frame) { | 390 static ExitFrame* cast(StackFrame* frame) { |
| 389 DCHECK(frame->is_exit()); | 391 DCHECK(frame->is_exit()); |
| 390 return static_cast<ExitFrame*>(frame); | 392 return static_cast<ExitFrame*>(frame); |
| 391 } | 393 } |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 }; | 899 }; |
| 898 | 900 |
| 899 | 901 |
| 900 // Reads all frames on the current stack and copies them into the current | 902 // Reads all frames on the current stack and copies them into the current |
| 901 // zone memory. | 903 // zone memory. |
| 902 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); | 904 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); |
| 903 | 905 |
| 904 } } // namespace v8::internal | 906 } } // namespace v8::internal |
| 905 | 907 |
| 906 #endif // V8_FRAMES_H_ | 908 #endif // V8_FRAMES_H_ |
| OLD | NEW |