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

Commit

Permalink
deps: Modified chakracore to enable/disable SIMD
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
kunalspathak committed Jun 14, 2016
1 parent 7cd4c61 commit 8f00534
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
4 changes: 2 additions & 2 deletions deps/chakrashim/core/lib/Runtime/Base/ThreadContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ ThreadContext::RecyclableData::RecyclableData(Recycler *const recycler) :
#define ALLOC_XDATA (false)
#endif

ThreadContext::ThreadContext(AllocationPolicyManager * allocationPolicyManager, JsUtil::ThreadService::ThreadServiceCallback threadServiceCallback, bool enableExperimentalFeatures) :
ThreadContext::ThreadContext(AllocationPolicyManager * allocationPolicyManager, JsUtil::ThreadService::ThreadServiceCallback threadServiceCallback, bool enableExperimentalFeatures, bool enableSimdjsFeature) :
currentThreadId(::GetCurrentThreadId()),
stackLimitForCurrentThread(0),
stackProber(nullptr),
Expand Down Expand Up @@ -176,7 +176,7 @@ ThreadContext::ThreadContext(AllocationPolicyManager * allocationPolicyManager,
dynamicObjectEnumeratorCacheMap(&HeapAllocator::Instance, 16),
//threadContextFlags(ThreadContextFlagNoFlag),
telemetryBlock(&localTelemetryBlock),
configuration(enableExperimentalFeatures),
configuration(enableExperimentalFeatures, enableSimdjsFeature),
jsrtRuntime(nullptr),
rootPendingClose(nullptr),
wellKnownHostTypeHTMLAllCollectionTypeId(Js::TypeIds_Undefined),
Expand Down
5 changes: 3 additions & 2 deletions deps/chakrashim/core/lib/Runtime/Base/ThreadContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -309,12 +309,13 @@ class JITTimer
class ThreadConfiguration
{
public:
ThreadConfiguration(bool enableExperimentalFeatures)
ThreadConfiguration(bool enableExperimentalFeatures, bool enableSimdjsFeature)
{
CopyGlobalFlags();
if (enableExperimentalFeatures)
{
EnableExperimentalFeatures();
m_Simdjs = enableSimdjsFeature;
}
}

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

ThreadContext(AllocationPolicyManager * allocationPolicyManager = nullptr, JsUtil::ThreadService::ThreadServiceCallback threadServiceCallback = nullptr, bool enableExperimentalFeatures = false);
ThreadContext(AllocationPolicyManager * allocationPolicyManager = nullptr, JsUtil::ThreadService::ThreadServiceCallback threadServiceCallback = nullptr, bool enableExperimentalFeatures = false, bool enableSimdjsFeature = false);
static void Add(ThreadContext *threadContext);

ThreadConfiguration const * GetConfig() const { return &configuration; }
Expand Down
6 changes: 4 additions & 2 deletions deps/chakrashim/core/lib/jsrt/Jsrt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ STDAPI_(JsErrorCode) JsCreateRuntime(_In_ JsRuntimeAttributes attributes, _In_op
JsRuntimeAttributeDisableEval |
JsRuntimeAttributeDisableNativeCodeGeneration |
JsRuntimeAttributeEnableExperimentalFeatures |
JsRuntimeAttributeDispatchSetExceptionsToDebugger
JsRuntimeAttributeDispatchSetExceptionsToDebugger |
JsRuntimeAttributeEnableSimdjsFeature
#ifdef ENABLE_DEBUG_CONFIG_OPTIONS
| JsRuntimeAttributeSerializeLibraryByteCode
#endif
Expand All @@ -97,7 +98,8 @@ STDAPI_(JsErrorCode) JsCreateRuntime(_In_ JsRuntimeAttributes attributes, _In_op

AllocationPolicyManager * policyManager = HeapNew(AllocationPolicyManager, (attributes & JsRuntimeAttributeDisableBackgroundWork) == 0);
bool enableExperimentalFeatures = (attributes & JsRuntimeAttributeEnableExperimentalFeatures) != 0;
ThreadContext * threadContext = HeapNew(ThreadContext, policyManager, threadService, enableExperimentalFeatures);
bool enableSimdjsFeature = (attributes & JsRuntimeAttributeEnableSimdjsFeature) != 0;
ThreadContext * threadContext = HeapNew(ThreadContext, policyManager, threadService, enableExperimentalFeatures, enableSimdjsFeature);

if (((attributes & JsRuntimeAttributeDisableBackgroundWork) != 0)
#ifdef ENABLE_DEBUG_CONFIG_OPTIONS
Expand Down
8 changes: 7 additions & 1 deletion deps/chakrashim/core/lib/jsrt/chakracommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,13 @@
/// Calling <c>JsSetException</c> will also dispatch the exception to the script debugger
/// (if any) giving the debugger a chance to break on the exception.
/// </summary>
JsRuntimeAttributeDispatchSetExceptionsToDebugger = 0x00000040
JsRuntimeAttributeDispatchSetExceptionsToDebugger = 0x00000040,
/// <summary>
/// Runtime will enable Simdjs experimental feature. Valid only if used with
/// JsRuntimeAttributeEnableExperimentalFeatures
/// </summary>
JsRuntimeAttributeEnableSimdjsFeature = 0x00000080

} JsRuntimeAttributes;

/// <summary>
Expand Down

0 comments on commit 8f00534

Please sign in to comment.