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

Side by Side Diff: src/frames.h

Issue 1702593002: More simplification and unification of frame handling (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix arm64 Created 4 years, 10 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 | « src/deoptimizer.cc ('k') | src/frames.cc » ('j') | no next file with comments »
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 // 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 V(EXIT, ExitFrame) \ 104 V(EXIT, ExitFrame) \
105 V(JAVA_SCRIPT, JavaScriptFrame) \ 105 V(JAVA_SCRIPT, JavaScriptFrame) \
106 V(OPTIMIZED, OptimizedFrame) \ 106 V(OPTIMIZED, OptimizedFrame) \
107 V(INTERPRETED, InterpretedFrame) \ 107 V(INTERPRETED, InterpretedFrame) \
108 V(STUB, StubFrame) \ 108 V(STUB, StubFrame) \
109 V(STUB_FAILURE_TRAMPOLINE, StubFailureTrampolineFrame) \ 109 V(STUB_FAILURE_TRAMPOLINE, StubFailureTrampolineFrame) \
110 V(INTERNAL, InternalFrame) \ 110 V(INTERNAL, InternalFrame) \
111 V(CONSTRUCT, ConstructFrame) \ 111 V(CONSTRUCT, ConstructFrame) \
112 V(ARGUMENTS_ADAPTOR, ArgumentsAdaptorFrame) 112 V(ARGUMENTS_ADAPTOR, ArgumentsAdaptorFrame)
113 113
114 // Every pointer in a frame has a slot id. On 32-bit platforms, doubles consume
115 // two slots.
116 //
117 // Stack slot indices >= 0 access the callee stack with slot 0 corresponding to
118 // the callee's saved return address and 1 corresponding to the saved frame
119 // pointer. Some frames have additional information stored in the fixed header,
120 // for example JSFunctions store the function context and marker in the fixed
121 // header, with slot index 2 corresponding to the current function context and 3
122 // corresponding to the frame marker/JSFunction.
123 //
124 // slot JS frame
125 // +-----------------+--------------------------------
126 // -n-1 | parameter 0 | ^
127 // |- - - - - - - - -| |
128 // -n | | Caller
129 // ... | ... | frame slots
130 // -2 | parameter n-1 | (slot < 0)
131 // |- - - - - - - - -| |
132 // -1 | parameter n | v
133 // -----+-----------------+--------------------------------
134 // 0 | return addr | ^ ^
135 // |- - - - - - - - -| | |
136 // 1 | saved frame ptr | Fixed |
137 // |- - - - - - - - -| Header <-- frame ptr |
138 // 2 | [Constant Pool] | | |
139 // |- - - - - - - - -| | |
140 // 2+cp | Context | | if a constant pool |
141 // |- - - - - - - - -| | is used, cp = 1, |
142 // 3+cp |JSFunction/Marker| v otherwise, cp = 0 |
143 // +-----------------+---- |
144 // 4+cp | | ^ Callee
145 // |- - - - - - - - -| | frame slots
146 // ... | | Frame slots (slot >= 0)
147 // |- - - - - - - - -| | |
148 // | | v |
149 // -----+-----------------+----- <-- stack ptr -------------
150 //
114 151
115 class StandardFrameConstants : public AllStatic { 152 class StandardFrameConstants : public AllStatic {
116 public: 153 public:
117 // Fixed part of the frame consists of return address, caller fp, 154 // Fixed part of the frame consists of return address, caller fp,
118 // constant pool (if FLAG_enable_embedded_constant_pool), context, and 155 // constant pool (if FLAG_enable_embedded_constant_pool), context, and
119 // function. StandardFrame::IterateExpressions assumes that kLastObjectOffset 156 // function. StandardFrame::IterateExpressions assumes that kLastObjectOffset
120 // is the last object pointer. 157 // is the last object pointer.
121 static const int kCPSlotSize = 158 static const int kCPSlotSize =
122 FLAG_enable_embedded_constant_pool ? kPointerSize : 0; 159 FLAG_enable_embedded_constant_pool ? kPointerSize : 0;
123 static const int kFixedFrameSizeFromFp = 2 * kPointerSize + kCPSlotSize; 160 static const int kFixedFrameSizeFromFp = 2 * kPointerSize + kCPSlotSize;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 static const int kLastParamFromRegisterPointer = 240 static const int kLastParamFromRegisterPointer =
204 StandardFrameConstants::kFixedFrameSize + 4 * kPointerSize; 241 StandardFrameConstants::kFixedFrameSize + 4 * kPointerSize;
205 242
206 static const int kBytecodeOffsetFromRegisterPointer = 1 * kPointerSize; 243 static const int kBytecodeOffsetFromRegisterPointer = 1 * kPointerSize;
207 static const int kBytecodeArrayFromRegisterPointer = 2 * kPointerSize; 244 static const int kBytecodeArrayFromRegisterPointer = 2 * kPointerSize;
208 static const int kNewTargetFromRegisterPointer = 3 * kPointerSize; 245 static const int kNewTargetFromRegisterPointer = 3 * kPointerSize;
209 static const int kFunctionFromRegisterPointer = 4 * kPointerSize; 246 static const int kFunctionFromRegisterPointer = 4 * kPointerSize;
210 static const int kContextFromRegisterPointer = 5 * kPointerSize; 247 static const int kContextFromRegisterPointer = 5 * kPointerSize;
211 }; 248 };
212 249
250 inline static int FPOffsetToFrameSlot(int frame_offset) {
251 return StandardFrameConstants::kFixedSlotCountAboveFp - 1 -
252 frame_offset / kPointerSize;
253 }
254
255 inline static int FrameSlotToFPOffset(int slot) {
256 return (StandardFrameConstants::kFixedSlotCountAboveFp - 1 - slot) *
257 kPointerSize;
258 }
213 259
214 // Abstract base class for all stack frames. 260 // Abstract base class for all stack frames.
215 class StackFrame BASE_EMBEDDED { 261 class StackFrame BASE_EMBEDDED {
216 public: 262 public:
217 #define DECLARE_TYPE(type, ignore) type, 263 #define DECLARE_TYPE(type, ignore) type,
218 enum Type { 264 enum Type {
219 NONE = 0, 265 NONE = 0,
220 STACK_FRAME_TYPE_LIST(DECLARE_TYPE) 266 STACK_FRAME_TYPE_LIST(DECLARE_TYPE)
221 NUMBER_OF_TYPES, 267 NUMBER_OF_TYPES,
222 // Used by FrameScope to indicate that the stack frame is constructed 268 // Used by FrameScope to indicate that the stack frame is constructed
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 1055
1010 1056
1011 // Reads all frames on the current stack and copies them into the current 1057 // Reads all frames on the current stack and copies them into the current
1012 // zone memory. 1058 // zone memory.
1013 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); 1059 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone);
1014 1060
1015 } // namespace internal 1061 } // namespace internal
1016 } // namespace v8 1062 } // namespace v8
1017 1063
1018 #endif // V8_FRAMES_H_ 1064 #endif // V8_FRAMES_H_
OLDNEW
« no previous file with comments | « src/deoptimizer.cc ('k') | src/frames.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698