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

Commit 8f00534

Browse files
committed
deps: Modified chakracore to enable/disable SIMD
Currently chakracore has `SIMD` under experimental flag which is ON by default. However recently v8 added this feature under experimental mode. This fails basic scenario of `util-inspect`. Temporarily addressed this by exposing a flag in `chakracore` that will control if `SIMD` will be present on global object or not. Long time solution would be to expose config flags to JSRT layer so that ES6 experimental features can be turned ON/OFF on demand. Opened chakra-core/ChakraCore#1064 to track this in chakracore. PR-URL: #76 Reviewed-By: Jianchun Xu <Jianchun.Xu@microsoft.com>
1 parent 7cd4c61 commit 8f00534

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

deps/chakrashim/core/lib/Runtime/Base/ThreadContext.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ ThreadContext::RecyclableData::RecyclableData(Recycler *const recycler) :
9999
#define ALLOC_XDATA (false)
100100
#endif
101101

102-
ThreadContext::ThreadContext(AllocationPolicyManager * allocationPolicyManager, JsUtil::ThreadService::ThreadServiceCallback threadServiceCallback, bool enableExperimentalFeatures) :
102+
ThreadContext::ThreadContext(AllocationPolicyManager * allocationPolicyManager, JsUtil::ThreadService::ThreadServiceCallback threadServiceCallback, bool enableExperimentalFeatures, bool enableSimdjsFeature) :
103103
currentThreadId(::GetCurrentThreadId()),
104104
stackLimitForCurrentThread(0),
105105
stackProber(nullptr),
@@ -176,7 +176,7 @@ ThreadContext::ThreadContext(AllocationPolicyManager * allocationPolicyManager,
176176
dynamicObjectEnumeratorCacheMap(&HeapAllocator::Instance, 16),
177177
//threadContextFlags(ThreadContextFlagNoFlag),
178178
telemetryBlock(&localTelemetryBlock),
179-
configuration(enableExperimentalFeatures),
179+
configuration(enableExperimentalFeatures, enableSimdjsFeature),
180180
jsrtRuntime(nullptr),
181181
rootPendingClose(nullptr),
182182
wellKnownHostTypeHTMLAllCollectionTypeId(Js::TypeIds_Undefined),

deps/chakrashim/core/lib/Runtime/Base/ThreadContext.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,12 +309,13 @@ class JITTimer
309309
class ThreadConfiguration
310310
{
311311
public:
312-
ThreadConfiguration(bool enableExperimentalFeatures)
312+
ThreadConfiguration(bool enableExperimentalFeatures, bool enableSimdjsFeature)
313313
{
314314
CopyGlobalFlags();
315315
if (enableExperimentalFeatures)
316316
{
317317
EnableExperimentalFeatures();
318+
m_Simdjs = enableSimdjsFeature;
318319
}
319320
}
320321

@@ -1004,7 +1005,7 @@ class ThreadContext sealed :
10041005
ArenaAllocator* GetThreadAlloc() { return &threadAlloc; }
10051006
static CriticalSection * GetCriticalSection() { return &s_csThreadContext; }
10061007

1007-
ThreadContext(AllocationPolicyManager * allocationPolicyManager = nullptr, JsUtil::ThreadService::ThreadServiceCallback threadServiceCallback = nullptr, bool enableExperimentalFeatures = false);
1008+
ThreadContext(AllocationPolicyManager * allocationPolicyManager = nullptr, JsUtil::ThreadService::ThreadServiceCallback threadServiceCallback = nullptr, bool enableExperimentalFeatures = false, bool enableSimdjsFeature = false);
10081009
static void Add(ThreadContext *threadContext);
10091010

10101011
ThreadConfiguration const * GetConfig() const { return &configuration; }

deps/chakrashim/core/lib/jsrt/Jsrt.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ STDAPI_(JsErrorCode) JsCreateRuntime(_In_ JsRuntimeAttributes attributes, _In_op
8383
JsRuntimeAttributeDisableEval |
8484
JsRuntimeAttributeDisableNativeCodeGeneration |
8585
JsRuntimeAttributeEnableExperimentalFeatures |
86-
JsRuntimeAttributeDispatchSetExceptionsToDebugger
86+
JsRuntimeAttributeDispatchSetExceptionsToDebugger |
87+
JsRuntimeAttributeEnableSimdjsFeature
8788
#ifdef ENABLE_DEBUG_CONFIG_OPTIONS
8889
| JsRuntimeAttributeSerializeLibraryByteCode
8990
#endif
@@ -97,7 +98,8 @@ STDAPI_(JsErrorCode) JsCreateRuntime(_In_ JsRuntimeAttributes attributes, _In_op
9798

9899
AllocationPolicyManager * policyManager = HeapNew(AllocationPolicyManager, (attributes & JsRuntimeAttributeDisableBackgroundWork) == 0);
99100
bool enableExperimentalFeatures = (attributes & JsRuntimeAttributeEnableExperimentalFeatures) != 0;
100-
ThreadContext * threadContext = HeapNew(ThreadContext, policyManager, threadService, enableExperimentalFeatures);
101+
bool enableSimdjsFeature = (attributes & JsRuntimeAttributeEnableSimdjsFeature) != 0;
102+
ThreadContext * threadContext = HeapNew(ThreadContext, policyManager, threadService, enableExperimentalFeatures, enableSimdjsFeature);
101103

102104
if (((attributes & JsRuntimeAttributeDisableBackgroundWork) != 0)
103105
#ifdef ENABLE_DEBUG_CONFIG_OPTIONS

deps/chakrashim/core/lib/jsrt/chakracommon.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,13 @@
313313
/// Calling <c>JsSetException</c> will also dispatch the exception to the script debugger
314314
/// (if any) giving the debugger a chance to break on the exception.
315315
/// </summary>
316-
JsRuntimeAttributeDispatchSetExceptionsToDebugger = 0x00000040
316+
JsRuntimeAttributeDispatchSetExceptionsToDebugger = 0x00000040,
317+
/// <summary>
318+
/// Runtime will enable Simdjs experimental feature. Valid only if used with
319+
/// JsRuntimeAttributeEnableExperimentalFeatures
320+
/// </summary>
321+
JsRuntimeAttributeEnableSimdjsFeature = 0x00000080
322+
317323
} JsRuntimeAttributes;
318324

319325
/// <summary>

0 commit comments

Comments
 (0)