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

Commit

Permalink
deps: Expose --harmony-simd in node+chakracore
Browse files Browse the repository at this point in the history
Exposed `--harmony-simd` through `chakrashim` and pass it
down to chakracore. This fix most of the basic scenario failures
post merge.

PR-URL: #74
Reviewed-By: Jianchun Xu <[email protected]>
  • Loading branch information
kunalspathak committed Jun 2, 2016
1 parent 2684f39 commit 5556a39
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
8 changes: 5 additions & 3 deletions deps/chakrashim/src/jsrtisolateshim.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ IsolateShim::~IsolateShim() {
assert(this->prevnext == nullptr);
}

/* static */ v8::Isolate * IsolateShim::New() {
/* static */ v8::Isolate * IsolateShim::New(bool enableSimd) {
// CHAKRA-TODO: Disable multiple isolate for now until it is fully implemented
if (s_isolateList != nullptr) {
CHAKRA_UNIMPLEMENTED_("multiple isolate");
Expand All @@ -60,8 +60,10 @@ IsolateShim::~IsolateShim() {
JsRuntimeHandle runtime;
JsErrorCode error =
JsCreateRuntime(static_cast<JsRuntimeAttributes>(
JsRuntimeAttributeAllowScriptInterrupt |
JsRuntimeAttributeEnableExperimentalFeatures),
JsRuntimeAttributeAllowScriptInterrupt |
JsRuntimeAttributeEnableExperimentalFeatures |
(enableSimd? JsRuntimeAttributeEnableSimdjsFeature :
JsRuntimeAttributeNone)),
nullptr, &runtime);
if (error != JsNoError) {
return nullptr;
Expand Down
2 changes: 1 addition & 1 deletion deps/chakrashim/src/jsrtisolateshim.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class IsolateShim {
bool Dispose();
bool IsDisposing();

static v8::Isolate * New();
static v8::Isolate * New(bool enableSimd = false);
static v8::Isolate * GetCurrentAsIsolate();
static IsolateShim * GetCurrent();
static IsolateShim * FromIsolate(v8::Isolate * isolate);
Expand Down
3 changes: 2 additions & 1 deletion deps/chakrashim/src/v8isolate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ namespace v8 {

HeapProfiler dummyHeapProfiler;
CpuProfiler dummyCpuProfiler;
extern bool g_enableSimdjs;

Isolate* Isolate::New(const CreateParams& params) {
Isolate* iso = jsrt::IsolateShim::New();
Isolate* iso = jsrt::IsolateShim::New(g_enableSimdjs);
if (params.array_buffer_allocator) {
V8::SetArrayBufferAllocator(params.array_buffer_allocator);
}
Expand Down
6 changes: 6 additions & 0 deletions deps/chakrashim/src/v8v8.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ namespace v8 {
bool g_disposed = false;
bool g_exposeGC = false;
bool g_useStrict = false;
bool g_enableSimdjs = false;
ArrayBuffer::Allocator* g_arrayBufferAllocator = nullptr;

const char *V8::GetVersion() {
Expand Down Expand Up @@ -97,6 +98,11 @@ void V8::SetFlagsFromCommandLine(int *argc, char **argv, bool remove_flags) {
if (remove_flags) {
argv[i] = nullptr;
}
} else if (equals("--harmony-simd", arg) || equals("--harmony_simd", arg)) {
g_enableSimdjs = true;
if (remove_flags) {
argv[i] = nullptr;
}
} else if (remove_flags &&
(startsWith(
arg, "--debug") // Ignore some flags to reduce unit test noise
Expand Down

0 comments on commit 5556a39

Please sign in to comment.