Skip to content

Commit

Permalink
src,test: enable per_context.js shim
Browse files Browse the repository at this point in the history
This reverts commit f5d29d5. It also
updates the shim to use shim `wake` using `notify`.

Refs: nodejs#565
Refs: nodejs#567
Refs: nodejs/node#22844
  • Loading branch information
kfarnung committed Sep 18, 2018
1 parent 49e76bc commit 36aaa95
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 20 deletions.
20 changes: 6 additions & 14 deletions lib/internal/per_context.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,18 @@

// https://github.com/nodejs/node/issues/21219
// Adds Atomics.notify and warns on first usage of Atomics.wake
// https://github.com/v8/v8/commit/c79206b363 adds Atomics.notify so
// now we alias Atomics.wake to notify so that we can remove it
// semver major without worrying about V8.

const AtomicsWake = global.Atomics.wake;
const AtomicsNotify = global.Atomics.notify;
const ReflectApply = global.Reflect.apply;

// wrap for function.name
function notify(...args) {
return ReflectApply(AtomicsWake, this, args);
}

const warning = 'Atomics.wake will be removed in a future version, ' +
'use Atomics.notify instead.';

let wakeWarned = false;
function wake(...args) {
function wake(typedArray, index, count) {
if (!wakeWarned) {
wakeWarned = true;

Expand All @@ -32,16 +30,10 @@
}
}

return ReflectApply(AtomicsWake, this, args);
return ReflectApply(AtomicsNotify, this, arguments);
}

global.Object.defineProperties(global.Atomics, {
notify: {
value: notify,
writable: true,
enumerable: false,
configurable: true,
},
wake: {
value: wake,
writable: true,
Expand Down
2 changes: 0 additions & 2 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2978,7 +2978,6 @@ Local<Context> NewContext(Isolate* isolate,
context->SetEmbedderData(
ContextEmbedderIndex::kAllowWasmCodeGeneration, True(isolate));

#ifndef NODE_ENGINE_CHAKRACORE
{
// Run lib/internal/per_context.js
Context::Scope context_scope(context);
Expand All @@ -2989,7 +2988,6 @@ Local<Context> NewContext(Isolate* isolate,
&per_context_src).ToLocalChecked();
s->Run(context).ToLocalChecked();
}
#endif

return context;
}
Expand Down
4 changes: 0 additions & 4 deletions test/parallel/parallel.status
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,6 @@ test-vm-createcacheddata : SKIP
# Issue: https://github.com/nodejs/node-chakracore/issues/563
test-zlib-unused-weak : SKIP

# Removed the wake->notify shim code
# Issue: https://github.com/nodejs/node-chakracore/issues/565
test-atomics-notify : SKIP

# These tests rely on V8's custom heap dumping and validation
test-heapdump-dns : SKIP
test-heapdump-fs-promise : SKIP
Expand Down

0 comments on commit 36aaa95

Please sign in to comment.