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

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: Platform ports 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/crankshaft/x64/lithium-x64.cc ('k') | no next file » | 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 |
Jarin 2016/02/17 11:48:31 There can be an optional constant pool here, no?
danno 2016/02/17 12:52:21 Fixed the picture. I plan to try to make the fp/ra
137 // |- - - - - - - - -| Header <-- frame ptr |
138 // 2 | Context | | |
139 // |- - - - - - - - -| | |
140 // 3 |JSFunction/Marker| v |
141 // +-----------------+---- |
142 // 4 | | ^ Callee
143 // |- - - - - - - - -| | frame slots
144 // ... | | Frame slots (slot >= 0)
145 // |- - - - - - - - -| | |
146 // | | v |
147 // -----+-----------------+----- <-- stack ptr -------------
148 //
114 149
115 class StandardFrameConstants : public AllStatic { 150 class StandardFrameConstants : public AllStatic {
116 public: 151 public:
117 // Fixed part of the frame consists of return address, caller fp, 152 // Fixed part of the frame consists of return address, caller fp,
118 // constant pool (if FLAG_enable_embedded_constant_pool), context, and 153 // constant pool (if FLAG_enable_embedded_constant_pool), context, and
119 // function. StandardFrame::IterateExpressions assumes that kLastObjectOffset 154 // function. StandardFrame::IterateExpressions assumes that kLastObjectOffset
120 // is the last object pointer. 155 // is the last object pointer.
121 static const int kCPSlotSize = 156 static const int kCPSlotSize =
122 FLAG_enable_embedded_constant_pool ? kPointerSize : 0; 157 FLAG_enable_embedded_constant_pool ? kPointerSize : 0;
123 static const int kFixedFrameSizeFromFp = 2 * kPointerSize + kCPSlotSize; 158 static const int kFixedFrameSizeFromFp = 2 * kPointerSize + kCPSlotSize;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 static const int kLastParamFromRegisterPointer = 235 static const int kLastParamFromRegisterPointer =
201 StandardFrameConstants::kFixedFrameSize + 4 * kPointerSize; 236 StandardFrameConstants::kFixedFrameSize + 4 * kPointerSize;
202 237
203 static const int kBytecodeOffsetFromRegisterPointer = 1 * kPointerSize; 238 static const int kBytecodeOffsetFromRegisterPointer = 1 * kPointerSize;
204 static const int kDispatchTableFromRegisterPointer = 2 * kPointerSize; 239 static const int kDispatchTableFromRegisterPointer = 2 * kPointerSize;
205 static const int kNewTargetFromRegisterPointer = 3 * kPointerSize; 240 static const int kNewTargetFromRegisterPointer = 3 * kPointerSize;
206 static const int kFunctionFromRegisterPointer = 4 * kPointerSize; 241 static const int kFunctionFromRegisterPointer = 4 * kPointerSize;
207 static const int kContextFromRegisterPointer = 5 * kPointerSize; 242 static const int kContextFromRegisterPointer = 5 * kPointerSize;
208 }; 243 };
209 244
245 inline static int FPOffsetToFrameSlot(int frame_offset) {
246 return StandardFrameConstants::kFixedSlotCountAboveFp - 1 -
247 frame_offset / kPointerSize;
248 }
249
250 inline static int FrameSlotToFPOffset(int slot) {
251 return (StandardFrameConstants::kFixedSlotCountAboveFp - 1 - slot) *
252 kPointerSize;
253 }
210 254
211 // Abstract base class for all stack frames. 255 // Abstract base class for all stack frames.
212 class StackFrame BASE_EMBEDDED { 256 class StackFrame BASE_EMBEDDED {
213 public: 257 public:
214 #define DECLARE_TYPE(type, ignore) type, 258 #define DECLARE_TYPE(type, ignore) type,
215 enum Type { 259 enum Type {
216 NONE = 0, 260 NONE = 0,
217 STACK_FRAME_TYPE_LIST(DECLARE_TYPE) 261 STACK_FRAME_TYPE_LIST(DECLARE_TYPE)
218 NUMBER_OF_TYPES, 262 NUMBER_OF_TYPES,
219 // Used by FrameScope to indicate that the stack frame is constructed 263 // Used by FrameScope to indicate that the stack frame is constructed
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 1051
1008 1052
1009 // Reads all frames on the current stack and copies them into the current 1053 // Reads all frames on the current stack and copies them into the current
1010 // zone memory. 1054 // zone memory.
1011 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); 1055 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone);
1012 1056
1013 } // namespace internal 1057 } // namespace internal
1014 } // namespace v8 1058 } // namespace v8
1015 1059
1016 #endif // V8_FRAMES_H_ 1060 #endif // V8_FRAMES_H_
OLDNEW
« no previous file with comments | « src/crankshaft/x64/lithium-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698