@@ -93,7 +93,7 @@ namespace Js
9393 Assert (currentIndex == -1 );
9494 }
9595
96- static bool FromPhysicalFrame (InlinedFrameWalker& self, StackFrame& physicalFrame, Js::ScriptFunction *parent, bool fromBailout = false , int loopNum = -1 , bool noAlloc = false );
96+ static bool FromPhysicalFrame (InlinedFrameWalker& self, StackFrame& physicalFrame, Js::ScriptFunction *parent, bool fromBailout = false , int loopNum = -1 , const JavascriptStackWalker * const walker = nullptr , bool noAlloc = false );
9797 void Close ();
9898 bool Next (CallInfo& callInfo);
9999 size_t GetArgc () const ;
@@ -127,17 +127,8 @@ namespace Js
127127 return (InlinedFrame*)next;
128128 }
129129
130- static InlinedFrame *FromPhysicalFrame (StackFrame& currentFrame, void *entry, EntryPointInfo* entryPointInfo)
131- {
132- struct InlinedFrame *inlinedFrame = nullptr ;
133- if (!currentFrame.IsInStackCheckCode (entry))
134- {
135- void *frame = currentFrame.GetFrame ();
136- inlinedFrame = (struct InlinedFrame *)(((uint8 *)frame) - entryPointInfo->frameHeight );
137- }
130+ static InlinedFrame *FromPhysicalFrame (StackFrame& currentFrame, const JavascriptStackWalker * const stackWalker, void *entry, EntryPointInfo* entryPointInfo);
138131
139- return inlinedFrame;
140- }
141132 };
142133
143134 void Initialize (int32 frameCount, __in_ecount(frameCount) InlinedFrame **frames, Js::ScriptFunction *parent);
@@ -151,6 +142,30 @@ namespace Js
151142 int32 currentIndex;
152143 int32 frameCount;
153144 };
145+
146+ class InternalFrameInfo
147+ {
148+ public:
149+ void *codeAddress;
150+ void *framePointer;
151+ size_t stackCheckCodeHeight;
152+ InternalFrameType frameType;
153+ InternalFrameType loopBodyFrameType;
154+ bool frameConsumed;
155+
156+ InternalFrameInfo () :
157+ codeAddress (nullptr ),
158+ framePointer (nullptr ),
159+ stackCheckCodeHeight ((uint)-1 ),
160+ frameType (InternalFrameType_None),
161+ loopBodyFrameType (InternalFrameType_None),
162+ frameConsumed (false )
163+ {
164+ }
165+
166+ void Clear ();
167+ void Set (void *codeAddress, void *framePointer, size_t stackCheckCodeHeight, InternalFrameType frameType, InternalFrameType loopBodyFrameType);
168+ };
154169#endif
155170
156171 class JavascriptStackWalker
@@ -209,10 +224,10 @@ namespace Js
209224
210225 static bool TryIsTopJavaScriptFrameNative (ScriptContext* scriptContext, bool * istopFrameNative, bool ignoreLibraryCode = false );
211226
212- void SetCachedInternalFrameAddress ( void *address, InternalFrameType type );
213- void ClearCachedInternalFrameAddress ( );
214- void SetCachedInternalFrameInfoForLoopBody ();
215- bool IsCurrentPhysicalFrameForLoopBody () const ;
227+ void ClearCachedInternalFrameInfo ( );
228+ void SetCachedInternalFrameInfo (InternalFrameType frameType, InternalFrameType loopBodyFrameType );
229+ InternalFrameInfo GetCachedInternalFrameInfo () const { return this -> lastInternalFrameInfo ; }
230+ bool IsCurrentPhysicalFrameForLoopBody () const ;
216231
217232 // noinline, we want to use own stack frame.
218233 static __declspec (noinline) BOOL GetCaller(JavascriptFunction** ppFunc, ScriptContext* scriptContext);
@@ -301,7 +316,6 @@ namespace Js
301316 bool isJavascriptFrame : 1 ;
302317 bool isNativeLibraryFrame : 1 ;
303318 bool isInitialFrame : 1 ; // If we need to walk the initial frame
304- bool lastInternalFrameConsumed : 1 ;
305319 bool shouldDetectPartiallyInitializedInterpreterFrame : 1 ;
306320 bool previousInterpreterFrameIsFromBailout : 1 ;
307321 bool ehFramesBeingWalkedFromBailout : 1 ;
@@ -313,9 +327,7 @@ namespace Js
313327 Var GetCurrentNativeArgumentsObject () const ;
314328 void SetCurrentNativeArgumentsObject (Var args);
315329
316- void *lastInternalFrameAddress;
317- InternalFrameType lastInternalFrameType;
318- InternalFrameType lastInternalLoopBodyFrameType;
330+ InternalFrameInfo lastInternalFrameInfo;
319331
320332 mutable StackFrame currentFrame;
321333
0 commit comments