Chromium Code Reviews| 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_ool_constant_pool), context, and function. | 117 // constant pool (if FLAG_enable_embedded_constant_pool), context, and |
| 118 // StandardFrame::IterateExpressions assumes that kLastObjectOffset is the | 118 // function. StandardFrame::IterateExpressions assumes that kLastObjectOffset |
| 119 // last object pointer. | 119 // is the last object pointer. |
| 120 static const int kCPSlotSize = | 120 static const int kCPSlotSize = |
| 121 FLAG_enable_ool_constant_pool ? kPointerSize : 0; | 121 FLAG_enable_embedded_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 = kPCOnStackSize + kFPOnStackSize + | 123 static const int kFixedFrameSize = kPCOnStackSize + kFPOnStackSize + |
| 124 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 = FLAG_enable_ool_constant_pool ? | 128 static const int kConstantPoolOffset = kCPSlotSize ? -1 * kPointerSize : 0; |
|
rmcilroy
2015/05/20 14:32:11
nit - align '='
MTBrandyberry
2015/05/20 22:28:22
git cl format did this. Should I override?
rmcilroy
2015/05/22 12:21:22
Ahh right, in that case could you touch all the co
MTBrandyberry
2015/05/26 19:19:05
Acknowledged.
| |
| 129 -1 * kPointerSize : 0; | |
| 130 static const int kCallerFPOffset = 0 * kPointerSize; | 129 static const int kCallerFPOffset = 0 * kPointerSize; |
| 131 static const int kCallerPCOffset = +1 * kFPOnStackSize; | 130 static const int kCallerPCOffset = +1 * kFPOnStackSize; |
| 132 static const int kCallerSPOffset = kCallerPCOffset + 1 * kPCOnStackSize; | 131 static const int kCallerSPOffset = kCallerPCOffset + 1 * kPCOnStackSize; |
| 133 | 132 |
| 134 static const int kLastObjectOffset = FLAG_enable_ool_constant_pool ? | 133 static const int kLastObjectOffset = kContextOffset; |
|
rmcilroy
2015/05/20 14:32:11
ditto
MTBrandyberry
2015/05/20 22:28:22
see above
| |
| 135 kConstantPoolOffset : kContextOffset; | |
| 136 }; | 134 }; |
| 137 | 135 |
| 138 | 136 |
| 139 // Abstract base class for all stack frames. | 137 // Abstract base class for all stack frames. |
| 140 class StackFrame BASE_EMBEDDED { | 138 class StackFrame BASE_EMBEDDED { |
| 141 public: | 139 public: |
| 142 #define DECLARE_TYPE(type, ignore) type, | 140 #define DECLARE_TYPE(type, ignore) type, |
| 143 enum Type { | 141 enum Type { |
| 144 NONE = 0, | 142 NONE = 0, |
| 145 STACK_FRAME_TYPE_LIST(DECLARE_TYPE) | 143 STACK_FRAME_TYPE_LIST(DECLARE_TYPE) |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 208 | 206 |
| 209 // If this frame is optimized and was dynamically aligned return its old | 207 // If this frame is optimized and was dynamically aligned return its old |
| 210 // unaligned frame pointer. When the frame is deoptimized its FP will shift | 208 // unaligned frame pointer. When the frame is deoptimized its FP will shift |
| 211 // up one word and become unaligned. | 209 // up one word and become unaligned. |
| 212 Address UnpaddedFP() const; | 210 Address UnpaddedFP() const; |
| 213 | 211 |
| 214 Address pc() const { return *pc_address(); } | 212 Address pc() const { return *pc_address(); } |
| 215 void set_pc(Address pc) { *pc_address() = pc; } | 213 void set_pc(Address pc) { *pc_address() = pc; } |
| 216 | 214 |
| 217 Address constant_pool() const { return *constant_pool_address(); } | 215 Address constant_pool() const { return *constant_pool_address(); } |
| 218 void set_constant_pool(ConstantPoolArray* constant_pool) { | 216 void set_constant_pool(Address constant_pool) { |
| 219 *constant_pool_address() = reinterpret_cast<Address>(constant_pool); | 217 *constant_pool_address() = constant_pool; |
| 220 } | 218 } |
| 221 | 219 |
| 222 virtual void SetCallerFp(Address caller_fp) = 0; | 220 virtual void SetCallerFp(Address caller_fp) = 0; |
| 223 | 221 |
| 224 // Manually changes value of fp in this object. | 222 // Manually changes value of fp in this object. |
| 225 void UpdateFp(Address fp) { state_.fp = fp; } | 223 void UpdateFp(Address fp) { state_.fp = fp; } |
| 226 | 224 |
| 227 Address* pc_address() const { return state_.pc_address; } | 225 Address* pc_address() const { return state_.pc_address; } |
| 228 | 226 |
| 229 Address* constant_pool_address() const { | 227 Address* constant_pool_address() const { |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 251 | 249 |
| 252 // Get the code object containing the given pc and fill in the | 250 // Get the code object containing the given pc and fill in the |
| 253 // safepoint entry and the number of stack slots. The pc must be at | 251 // safepoint entry and the number of stack slots. The pc must be at |
| 254 // a safepoint. | 252 // a safepoint. |
| 255 static Code* GetSafepointData(Isolate* isolate, | 253 static Code* GetSafepointData(Isolate* isolate, |
| 256 Address pc, | 254 Address pc, |
| 257 SafepointEntry* safepoint_entry, | 255 SafepointEntry* safepoint_entry, |
| 258 unsigned* stack_slots); | 256 unsigned* stack_slots); |
| 259 | 257 |
| 260 virtual void Iterate(ObjectVisitor* v) const = 0; | 258 virtual void Iterate(ObjectVisitor* v) const = 0; |
| 261 static void IteratePc(ObjectVisitor* v, Address* pc_address, Code* holder); | 259 static void IteratePc(ObjectVisitor* v, Address* pc_address, |
| 260 Address* constant_pool_address, Code* holder); | |
| 262 | 261 |
| 263 // Sets a callback function for return-address rewriting profilers | 262 // Sets a callback function for return-address rewriting profilers |
| 264 // to resolve the location of a return address to the location of the | 263 // to resolve the location of a return address to the location of the |
| 265 // profiler's stashed return address. | 264 // profiler's stashed return address. |
| 266 static void SetReturnAddressLocationResolver( | 265 static void SetReturnAddressLocationResolver( |
| 267 ReturnAddressLocationResolver resolver); | 266 ReturnAddressLocationResolver resolver); |
| 268 | 267 |
| 269 // Resolves pc_address through the resolution address function if one is set. | 268 // Resolves pc_address through the resolution address function if one is set. |
| 270 static inline Address* ResolveReturnAddressLocation(Address* pc_address); | 269 static inline Address* ResolveReturnAddressLocation(Address* pc_address); |
| 271 | 270 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 373 | 372 |
| 374 | 373 |
| 375 // Exit frames are used to exit JavaScript execution and go to C. | 374 // Exit frames are used to exit JavaScript execution and go to C. |
| 376 class ExitFrame: public StackFrame { | 375 class ExitFrame: public StackFrame { |
| 377 public: | 376 public: |
| 378 virtual Type type() const { return EXIT; } | 377 virtual Type type() const { return EXIT; } |
| 379 | 378 |
| 380 virtual Code* unchecked_code() const; | 379 virtual Code* unchecked_code() const; |
| 381 | 380 |
| 382 Object*& code_slot() const; | 381 Object*& code_slot() const; |
| 383 Object*& constant_pool_slot() const; | |
| 384 | 382 |
| 385 // Garbage collection support. | 383 // Garbage collection support. |
| 386 virtual void Iterate(ObjectVisitor* v) const; | 384 virtual void Iterate(ObjectVisitor* v) const; |
| 387 | 385 |
| 388 virtual void SetCallerFp(Address caller_fp); | 386 virtual void SetCallerFp(Address caller_fp); |
| 389 | 387 |
| 390 static ExitFrame* cast(StackFrame* frame) { | 388 static ExitFrame* cast(StackFrame* frame) { |
| 391 DCHECK(frame->is_exit()); | 389 DCHECK(frame->is_exit()); |
| 392 return static_cast<ExitFrame*>(frame); | 390 return static_cast<ExitFrame*>(frame); |
| 393 } | 391 } |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 897 }; | 895 }; |
| 898 | 896 |
| 899 | 897 |
| 900 // Reads all frames on the current stack and copies them into the current | 898 // Reads all frames on the current stack and copies them into the current |
| 901 // zone memory. | 899 // zone memory. |
| 902 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); | 900 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); |
| 903 | 901 |
| 904 } } // namespace v8::internal | 902 } } // namespace v8::internal |
| 905 | 903 |
| 906 #endif // V8_FRAMES_H_ | 904 #endif // V8_FRAMES_H_ |
| OLD | NEW |