aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJukka Jylänki <jujjyl@gmail.com>2014-03-16 04:08:02 +0200
committerJukka Jylänki <jujjyl@gmail.com>2014-03-28 23:06:17 -0400
commitbbc711d5c719bbd14cd7849309e89608ae13d287 (patch)
tree0ea137dd83103c8ce0df5a29454b86ffc471b45c
parent0967703fd279255e2f479e6bba9bb7ef48e1c7d6 (diff)
Migrate to using musl 0.9.13 strpbrk for better asm.js performance.
-rw-r--r--src/library.js17
-rw-r--r--system/lib/libc/musl/src/string/strpbrk.c7
-rw-r--r--system/lib/libcextra.symbols1
-rw-r--r--tools/system_libs.py1
4 files changed, 9 insertions, 17 deletions
diff --git a/src/library.js b/src/library.js
index 6f8fba5e..e7298721 100644
--- a/src/library.js
+++ b/src/library.js
@@ -3639,23 +3639,6 @@ LibraryManager.library = {
return pdest|0;
},
- strpbrk: function(ptr1, ptr2) {
- var curr;
- var searchSet = {};
- while (1) {
- var curr = {{{ makeGetValue('ptr2++', 0, 'i8') }}};
- if (!curr) break;
- searchSet[curr] = 1;
- }
- while (1) {
- curr = {{{ makeGetValue('ptr1', 0, 'i8') }}};
- if (!curr) break;
- if (curr in searchSet) return ptr1;
- ptr1++;
- }
- return 0;
- },
-
__strtok_state: 0,
strtok__deps: ['__strtok_state', 'strtok_r'],
strtok__postset: '___strtok_state = Runtime.staticAlloc(4);',
diff --git a/system/lib/libc/musl/src/string/strpbrk.c b/system/lib/libc/musl/src/string/strpbrk.c
new file mode 100644
index 00000000..55947c64
--- /dev/null
+++ b/system/lib/libc/musl/src/string/strpbrk.c
@@ -0,0 +1,7 @@
+#include <string.h>
+
+char *strpbrk(const char *s, const char *b)
+{
+ s += strcspn(s, b);
+ return *s ? (char *)s : 0;
+}
diff --git a/system/lib/libcextra.symbols b/system/lib/libcextra.symbols
index 06e68c92..7846f153 100644
--- a/system/lib/libcextra.symbols
+++ b/system/lib/libcextra.symbols
@@ -126,6 +126,7 @@
T strncat
T strndup
T strnlen
+ T strpbrk
T strrchr
T strsep
T strspn
diff --git a/tools/system_libs.py b/tools/system_libs.py
index 527c573a..b6acd0a1 100644
--- a/tools/system_libs.py
+++ b/tools/system_libs.py
@@ -254,6 +254,7 @@ def calculate(temp_files, in_temp, stdout, stderr):
'strncat.c',
'strndup.c',
'strnlen.c',
+ 'strpbrk.c',
'strrchr.c',
'strsep.c',
'strspn.c',