Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
[Merge chakra-core/ChakraCore@d8112a6ce8] [MERGE #3443 @obastemur] Ma…
Browse files Browse the repository at this point in the history
…ke expensive entryRecord on Stack check is Debug Only

Merge pull request #3443 from obastemur:imp_jsrt_ver

Improves JSRT API calls performance >10%
  • Loading branch information
chakrabot authored and kfarnung committed Aug 10, 2017
1 parent 4276b7e commit 2585880
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions deps/chakrashim/core/lib/Runtime/Base/ThreadContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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();
}
Expand All @@ -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();
}
Expand Down

0 comments on commit 2585880

Please sign in to comment.