@@ -72,6 +72,18 @@ namespace Js
72
72
m_threadContext->SetTryCatchFrameAddr (m_prevTryCatchFrameAddr);
73
73
}
74
74
75
+ JavascriptExceptionOperators::HasBailedOutPtrStack::HasBailedOutPtrStack (ScriptContext* scriptContext, bool *hasBailedOutPtr)
76
+ {
77
+ m_threadContext = scriptContext->GetThreadContext ();
78
+ m_prevHasBailedOutPtr = m_threadContext->GetHasBailedOutBitPtr ();
79
+ scriptContext->GetThreadContext ()->SetHasBailedOutBitPtr (hasBailedOutPtr);
80
+ }
81
+
82
+ JavascriptExceptionOperators::HasBailedOutPtrStack::~HasBailedOutPtrStack ()
83
+ {
84
+ m_threadContext->SetHasBailedOutBitPtr (m_prevHasBailedOutPtr);
85
+ }
86
+
75
87
JavascriptExceptionOperators::PendingFinallyExceptionStack::PendingFinallyExceptionStack (ScriptContext* scriptContext, Js::JavascriptExceptionObject *exceptionObj)
76
88
{
77
89
m_threadContext = scriptContext->GetThreadContext ();
@@ -105,7 +117,8 @@ namespace Js
105
117
void *continuation = nullptr ;
106
118
JavascriptExceptionObject *exception = nullptr ;
107
119
void *tryCatchFrameAddr = nullptr ;
108
- scriptContext->GetThreadContext ()->SetHasBailedOutBitPtr ((bool *)((char *)frame + hasBailedOutOffset));
120
+
121
+ Js::JavascriptExceptionOperators::HasBailedOutPtrStack hasBailedOutPtrStack (scriptContext, (bool *)((char *)frame + hasBailedOutOffset));
109
122
110
123
PROBE_STACK (scriptContext, Constants::MinStackJitEHBailout + spillSize + argsSize);
111
124
{
@@ -148,15 +161,13 @@ namespace Js
148
161
// If we have bailed out, this exception is coming from the interpreter. It should not have been caught;
149
162
// it so happens that this catch was on the stack and caught the exception.
150
163
// Re-throw!
151
- scriptContext->GetThreadContext ()->SetHasBailedOutBitPtr (nullptr );
152
164
JavascriptExceptionOperators::DoThrow (exception, scriptContext);
153
165
}
154
166
155
167
Var exceptionObject = exception->GetThrownObject (scriptContext);
156
168
AssertMsg (exceptionObject, " Caught object is null." );
157
169
continuation = amd64_CallWithFakeFrame (catchAddr, frame, spillSize, argsSize, exceptionObject);
158
170
}
159
- scriptContext->GetThreadContext ()->SetHasBailedOutBitPtr (nullptr );
160
171
return continuation;
161
172
}
162
173
@@ -170,8 +181,8 @@ namespace Js
170
181
{
171
182
void *tryContinuation = nullptr ;
172
183
JavascriptExceptionObject *exception = nullptr ;
173
- scriptContext->GetThreadContext ()->SetHasBailedOutBitPtr ((bool *)((char *)frame + hasBailedOutOffset));
174
184
185
+ Js::JavascriptExceptionOperators::HasBailedOutPtrStack hasBailedOutPtrStack (scriptContext, (bool *)((char *)frame + hasBailedOutOffset));
175
186
PROBE_STACK (scriptContext, Constants::MinStackJitEHBailout + spillSize + argsSize);
176
187
177
188
try
@@ -213,7 +224,6 @@ namespace Js
213
224
// If we have bailed out, this exception is coming from the interpreter. It should not have been caught;
214
225
// it so happens that this catch was on the stack and caught the exception.
215
226
// Re-throw!
216
- scriptContext->GetThreadContext ()->SetHasBailedOutBitPtr (nullptr );
217
227
JavascriptExceptionOperators::DoThrow (exception, scriptContext);
218
228
}
219
229
@@ -224,7 +234,6 @@ namespace Js
224
234
}
225
235
}
226
236
227
- scriptContext->GetThreadContext ()->SetHasBailedOutBitPtr (nullptr );
228
237
return tryContinuation;
229
238
}
230
239
@@ -278,7 +287,7 @@ namespace Js
278
287
void *continuation = nullptr ;
279
288
JavascriptExceptionObject *exception = nullptr ;
280
289
void * tryCatchFrameAddr = nullptr ;
281
- scriptContext-> GetThreadContext ()-> SetHasBailedOutBitPtr (( bool *)((char *)localsPtr + hasBailedOutOffset));
290
+ Js::JavascriptExceptionOperators::HasBailedOutPtrStack hasBailedOutPtrStack ( scriptContext, ( bool *)((char *)framePtr + hasBailedOutOffset));
282
291
283
292
PROBE_STACK (scriptContext, Constants::MinStackJitEHBailout + argsSize);
284
293
{
@@ -324,7 +333,6 @@ namespace Js
324
333
// If we have bailed out, this exception is coming from the interpreter. It should not have been caught;
325
334
// it so happens that this catch was on the stack and caught the exception.
326
335
// Re-throw!
327
- scriptContext->GetThreadContext ()->SetHasBailedOutBitPtr (nullptr );
328
336
JavascriptExceptionOperators::DoThrow (exception, scriptContext);
329
337
}
330
338
@@ -337,7 +345,6 @@ namespace Js
337
345
#endif
338
346
}
339
347
340
- scriptContext->GetThreadContext ()->SetHasBailedOutBitPtr (nullptr );
341
348
return continuation;
342
349
}
343
350
@@ -352,7 +359,7 @@ namespace Js
352
359
{
353
360
void *tryContinuation = nullptr ;
354
361
JavascriptExceptionObject *exception = nullptr ;
355
- scriptContext-> GetThreadContext ()-> SetHasBailedOutBitPtr (( bool *)((char *)localsPtr + hasBailedOutOffset));
362
+ Js::JavascriptExceptionOperators::HasBailedOutPtrStack hasBailedOutPtrStack ( scriptContext, ( bool *)((char *)framePtr + hasBailedOutOffset));
356
363
357
364
PROBE_STACK (scriptContext, Constants::MinStackJitEHBailout + argsSize);
358
365
try
@@ -394,7 +401,6 @@ namespace Js
394
401
// If we have bailed out, this exception is coming from the interpreter. It should not have been caught;
395
402
// it so happens that this catch was on the stack and caught the exception.
396
403
// Re-throw!
397
- scriptContext->GetThreadContext ()->SetHasBailedOutBitPtr (nullptr );
398
404
JavascriptExceptionOperators::DoThrow (exception, scriptContext);
399
405
}
400
406
@@ -409,7 +415,6 @@ namespace Js
409
415
}
410
416
}
411
417
412
- scriptContext->GetThreadContext ()->SetHasBailedOutBitPtr (nullptr );
413
418
return tryContinuation;
414
419
}
415
420
@@ -473,7 +478,8 @@ namespace Js
473
478
void * continuationAddr = NULL ;
474
479
Js::JavascriptExceptionObject* pExceptionObject = NULL ;
475
480
void *tryCatchFrameAddr = nullptr ;
476
- scriptContext->GetThreadContext ()->SetHasBailedOutBitPtr ((bool *)((char *)framePtr + hasBailedOutOffset));
481
+
482
+ Js::JavascriptExceptionOperators::HasBailedOutPtrStack hasBailedOutPtrStack (scriptContext, (bool *)((char *)framePtr + hasBailedOutOffset));
477
483
478
484
PROBE_STACK (scriptContext, Constants::MinStackJitEHBailout);
479
485
{
@@ -571,7 +577,6 @@ namespace Js
571
577
// If we have bailed out, this exception is coming from the interpreter. It should not have been caught;
572
578
// it so happens that this catch was on the stack and caught the exception.
573
579
// Re-throw!
574
- scriptContext->GetThreadContext ()->SetHasBailedOutBitPtr (nullptr );
575
580
JavascriptExceptionOperators::DoThrow (pExceptionObject, scriptContext);
576
581
}
577
582
@@ -628,15 +633,15 @@ namespace Js
628
633
#endif
629
634
}
630
635
631
- scriptContext->GetThreadContext ()->SetHasBailedOutBitPtr (nullptr );
632
636
return continuationAddr;
633
637
}
634
638
635
639
void * JavascriptExceptionOperators::OP_TryFinally (void * tryAddr, void * handlerAddr, void * framePtr, int hasBailedOutOffset, ScriptContext *scriptContext)
636
640
{
637
641
Js::JavascriptExceptionObject* pExceptionObject = NULL ;
638
642
void * continuationAddr = NULL ;
639
- scriptContext->GetThreadContext ()->SetHasBailedOutBitPtr ((bool *)((char *)framePtr + hasBailedOutOffset));
643
+
644
+ Js::JavascriptExceptionOperators::HasBailedOutPtrStack hasBailedOutPtrStack (scriptContext, (bool *)((char *)framePtr + hasBailedOutOffset));
640
645
PROBE_STACK (scriptContext, Constants::MinStackJitEHBailout);
641
646
642
647
try
@@ -731,7 +736,6 @@ namespace Js
731
736
// If we have bailed out, this exception is coming from the interpreter. It should not have been caught;
732
737
// it so happens that this catch was on the stack and caught the exception.
733
738
// Re-throw!
734
- scriptContext->GetThreadContext ()->SetHasBailedOutBitPtr (nullptr );
735
739
JavascriptExceptionOperators::DoThrow (pExceptionObject, scriptContext);
736
740
}
737
741
@@ -799,7 +803,6 @@ namespace Js
799
803
}
800
804
}
801
805
802
- scriptContext->GetThreadContext ()->SetHasBailedOutBitPtr (nullptr );
803
806
return continuationAddr;
804
807
}
805
808
0 commit comments