Index: test/mjsunit/d8-worker-spawn-worker.js |
diff --git a/test/mjsunit/compiler/osr-nested.js b/test/mjsunit/d8-worker-spawn-worker.js |
similarity index 79% |
copy from test/mjsunit/compiler/osr-nested.js |
copy to test/mjsunit/d8-worker-spawn-worker.js |
index 4bdb0828ca2272332701c579bcbf9952cf43e6a4..b9d7f9ade4fd116837c275a73867eeda26076e5a 100644 |
--- a/test/mjsunit/compiler/osr-nested.js |
+++ b/test/mjsunit/d8-worker-spawn-worker.js |
@@ -1,4 +1,4 @@ |
-// Copyright 2013 the V8 project authors. All rights reserved. |
+// Copyright 2015 the V8 project authors. All rights reserved. |
// Redistribution and use in source and binary forms, with or without |
// modification, are permitted provided that the following conditions are |
// met: |
@@ -25,22 +25,22 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-// Flags: --use-osr |
+if (this.Worker) { |
+ function f() { |
+ var g = function () { |
+ postMessage(42); |
+ }; |
-function f() { |
- var sum = 0; |
- for (var i = 0; i < 10; i++) { |
- for (var j = 0; j < 100000; j++) { |
- var x = i + 2; |
- var y = x + 5; |
- var z = y + 3; |
- sum += z; |
- } |
- } |
- return sum; |
-} |
+ var w = new Worker(g); |
+ onmessage = function(parentMsg) { |
+ w.postMessage(parentMsg); |
+ var childMsg = w.getMessage(); |
+ postMessage(childMsg); |
+ }; |
+ } |
-assertEquals(14500000, f()); |
-assertEquals(14500000, f()); |
-assertEquals(14500000, f()); |
+ var w = new Worker(f); |
+ w.postMessage(9); |
+ assertEquals(42, w.getMessage()); |
+} |