Add a testcase for a bug that I had during the development. This code uses the asm...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Oct 2013 23:18:38 +0000 (23:18 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Oct 2013 23:18:38 +0000 (23:18 +0000)
https://bugs.webkit.org/show_bug.cgi?id=122286

Patch by Nadav Rotem <nrotem@apple.com> on 2013-10-03
Reviewed by Filip Pizlo.

* js/regress/asmjs_bool_bug-expected.txt: Added.
* js/regress/asmjs_bool_bug.html: Added.
* js/regress/script-tests/asmjs_bool_bug.js: Added.
(strlen):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@156865 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/js/regress/asmjs_bool_bug-expected.txt [new file with mode: 0644]
LayoutTests/js/regress/asmjs_bool_bug.html [new file with mode: 0644]
LayoutTests/js/regress/script-tests/asmjs_bool_bug.js [new file with mode: 0644]

index 2699a371a7edcbcb8aa04388401ef1d0250ca28a..7234f37614f7ef9462732e4f890a79b34fd928e3 100644 (file)
@@ -1,3 +1,15 @@
+2013-10-03  Nadav Rotem  <nrotem@apple.com>
+
+        Add a testcase for a bug that I had during the development. This code uses the asm.js style.
+        https://bugs.webkit.org/show_bug.cgi?id=122286
+
+        Reviewed by Filip Pizlo.
+
+        * js/regress/asmjs_bool_bug-expected.txt: Added.
+        * js/regress/asmjs_bool_bug.html: Added.
+        * js/regress/script-tests/asmjs_bool_bug.js: Added.
+        (strlen):
+
 2013-10-03  Manuel Rego Casasnovas  <rego@igalia.com>
 
         [CSS Regions] Layout Test for selecting text in 2 regions
diff --git a/LayoutTests/js/regress/asmjs_bool_bug-expected.txt b/LayoutTests/js/regress/asmjs_bool_bug-expected.txt
new file mode 100644 (file)
index 0000000..9975637
--- /dev/null
@@ -0,0 +1,10 @@
+JSRegress/asmjs_bool_bug
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS no exception thrown
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/js/regress/asmjs_bool_bug.html b/LayoutTests/js/regress/asmjs_bool_bug.html
new file mode 100644 (file)
index 0000000..a3eaabd
--- /dev/null
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+</head>
+<body>
+<script src="resources/regress-pre.js"></script>
+<script src="script-tests/asmjs_bool_bug.js"></script>
+<script src="resources/regress-post.js"></script>
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/js/regress/script-tests/asmjs_bool_bug.js b/LayoutTests/js/regress/script-tests/asmjs_bool_bug.js
new file mode 100644 (file)
index 0000000..c78a8fb
--- /dev/null
@@ -0,0 +1,31 @@
+// The strlen function is derived from here:
+// http://kripken.github.io/mloc_emscripten_talk/#/20
+
+var MEM8  = new Uint8Array(1024);
+
+// Calculate length of C string:
+function strlen(ptr) {
+  ptr = ptr|0;
+  var curr = 0;
+  curr = ptr;
+  while (MEM8[curr]|0 != 0) {
+    curr = (curr + 1)|0;
+  }
+  return (curr - ptr)|0;
+}
+
+//----- Test driver ----
+
+for (i = 0; i < 1024; i++) {
+ MEM8[i] = i%198;
+}
+
+MEM8[7] = 0;
+
+var sum = 0
+for (i = 0; i < 1000000; i++) {
+  sum += strlen(5);
+}
+
+if (sum != 2000000)
+    throw "Bad result: " + result;