Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Unified Diff: test/mjsunit/d8-worker-sharedarraybuffer.js

Issue 1218553004: Change d8 Worker API so it takes a string instead of a function. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: use template strings Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/d8-worker.js ('k') | test/mjsunit/d8-worker-spawn-worker.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/d8-worker-sharedarraybuffer.js
diff --git a/test/mjsunit/d8-worker-sharedarraybuffer.js b/test/mjsunit/d8-worker-sharedarraybuffer.js
index e10e738bf2bb05cec920721d640baabe2675c7ca..791529fc89402cfe8b8afcfc3965d7c3bbcd8711 100644
--- a/test/mjsunit/d8-worker-sharedarraybuffer.js
+++ b/test/mjsunit/d8-worker-sharedarraybuffer.js
@@ -27,27 +27,24 @@
// Flags: --harmony-sharedarraybuffer --harmony-atomics
-function f() {
- onmessage = function(m) {
- var sab = m;
- var ta = new Uint32Array(sab);
- if (sab.byteLength !== 16) {
- throw new Error("SharedArrayBuffer transfer byteLength");
- }
-
- for (var i = 0; i < 4; ++i) {
- if (ta[i] !== i) {
- throw new Error("SharedArrayBuffer transfer value " + i);
- }
- }
-
+var workerScript =
+ `onmessage = function(m) {
+ var sab = m;
+ var ta = new Uint32Array(sab);
+ if (sab.byteLength !== 16) {
+ throw new Error('SharedArrayBuffer transfer byteLength');
+ }
+ for (var i = 0; i < 4; ++i) {
+ if (ta[i] !== i) {
+ throw new Error('SharedArrayBuffer transfer value ' + i);
+ }
+ }
// Atomically update ta[0]
Atomics.store(ta, 0, 100);
- };
-}
+ };`;
if (this.Worker) {
- var w = new Worker(f);
+ var w = new Worker(workerScript);
var sab = new SharedArrayBuffer(16);
var ta = new Uint32Array(sab);
« no previous file with comments | « test/mjsunit/d8-worker.js ('k') | test/mjsunit/d8-worker-spawn-worker.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698