From 2585880651d1f5a76fa9d3a8a54536c66ba4924e Mon Sep 17 00:00:00 2001 From: chakrabot Date: Thu, 3 Aug 2017 03:01:53 -0700 Subject: [PATCH] [Merge Microsoft/Chakracore@d8112a6ce8] [MERGE #3443 @obastemur] Make expensive entryRecord on Stack check is Debug Only Merge pull request #3443 from obastemur:imp_jsrt_ver Improves JSRT API calls performance >10% --- .../core/lib/Runtime/Base/ThreadContext.cpp | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/deps/chakrashim/core/lib/Runtime/Base/ThreadContext.cpp b/deps/chakrashim/core/lib/Runtime/Base/ThreadContext.cpp index 9162a9cf80a..b6eca7775b1 100644 --- a/deps/chakrashim/core/lib/Runtime/Base/ThreadContext.cpp +++ b/deps/chakrashim/core/lib/Runtime/Base/ThreadContext.cpp @@ -1741,7 +1741,7 @@ ThreadContext::ProbeStack(size_t size, Js::ScriptContext *scriptContext, PVOID r PlatformAgnostic::PerfTrace::WritePerfMap(); } #endif - + // BACKGROUND-GC TODO: If we're stuck purely in JITted code, we should have the // background GC thread modify the threads stack limit to trigger the runtime stack probe if (this->callDispose && this->recycler->NeedDispose()) @@ -2206,8 +2206,13 @@ ThreadContext::PushEntryExitRecord(Js::ScriptEntryExitRecord * record) lastRecord->hasReentered = true; record->next = lastRecord; - // these are on stack, which grows down. if this condition doesn't hold, then the list somehow got messed up - if (!IsOnStack(lastRecord) || (uintptr_t)record >= (uintptr_t)lastRecord) + // these are on stack, which grows down. if this condition doesn't hold, + // then the list somehow got messed up + if ( +#if defined(JSRT_VERIFY_RUNTIME_STATE) || defined(DEBUG) + !IsOnStack(lastRecord) || +#endif + (uintptr_t)record >= (uintptr_t)lastRecord) { EntryExitRecord_Corrupted_fatal_error(); } @@ -2220,9 +2225,14 @@ void ThreadContext::PopEntryExitRecord(Js::ScriptEntryExitRecord * record) { AssertMsg(record && record == this->entryExitRecord, "Mismatch script entry/exit"); - // these are on stack, which grows down. if this condition doesn't hold, then the list somehow got messed up + // these are on stack, which grows down. if this condition doesn't hold, + // then the list somehow got messed up Js::ScriptEntryExitRecord * next = this->entryExitRecord->next; - if (next && (!IsOnStack(next) || (uintptr_t)this->entryExitRecord >= (uintptr_t)next)) + if (next && ( +#if defined(JSRT_VERIFY_RUNTIME_STATE) || defined(DEBUG) + !IsOnStack(next) || +#endif + (uintptr_t)this->entryExitRecord >= (uintptr_t)next)) { EntryExitRecord_Corrupted_fatal_error(); }