aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/autodebugger.py7
-rw-r--r--tools/scan_js.py20
-rw-r--r--tools/shared.py1
3 files changed, 26 insertions, 2 deletions
diff --git a/tools/autodebugger.py b/tools/autodebugger.py
index 65ddc641..51661ec7 100644
--- a/tools/autodebugger.py
+++ b/tools/autodebugger.py
@@ -16,12 +16,15 @@ MEMCPY = False
POSTAMBLE = '''
@.emscripten.autodebug.str = private constant [10 x i8] c"AD:%d,%d\\0A\\00", align 1 ; [#uses=1]
@.emscripten.autodebug.str.f = private constant [11 x i8] c"AD:%d,%lf\\0A\\00", align 1 ; [#uses=1]
+@.emscripten.autodebug.str.64 = private constant [13 x i8] c"AD:%d,%d,%d\\0A\\00", align 1 ; [#uses=1]
; [#uses=1]
define void @emscripten_autodebug_i64(i32 %line, i64 %value) {
entry:
- %0 = sitofp i64 %value to double ; [#uses=1]
- %1 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([11 x i8]* @.emscripten.autodebug.str.f, i32 0, i32 0), i32 %line, double %0) ; [#uses=0]
+ %0 = trunc i64 %value to i32
+ %1 = lshr i64 %value, 32
+ %2 = trunc i64 %1 to i32
+ %3 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([13 x i8]* @.emscripten.autodebug.str.64, i32 0, i32 0), i32 %line, i32 %0, i32 %2) ; [#uses=0]
br label %return
return: ; preds = %entry
diff --git a/tools/scan_js.py b/tools/scan_js.py
new file mode 100644
index 00000000..eeff7c7c
--- /dev/null
+++ b/tools/scan_js.py
@@ -0,0 +1,20 @@
+'''
+Finds why a .js file is large by printing functions by size
+'''
+
+import os, sys
+
+funcs = []
+i = 0
+inside = None
+for line in open(sys.argv[1]):
+ i += 1
+ if line.startswith('function _'):
+ inside = line.replace('function ', '').replace('\n', '')
+ start = i
+ elif inside and line.startswith('}'):
+ funcs.append((inside, i-start))
+ inside = None
+
+print '\n'.join(map(lambda func: str(func[1]) + ':' + func[0], sorted(funcs, key=lambda func: -func[1])))
+
diff --git a/tools/shared.py b/tools/shared.py
index 4e5f3d6a..17887afe 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -344,6 +344,7 @@ class Settings:
Settings.CORRECT_OVERFLOWS = 0
Settings.CORRECT_ROUNDINGS = 0
Settings.DOUBLE_MODE = 0
+ Settings.PRECISE_I64_MATH = 0
if noisy: print >> sys.stderr, 'Warning: Applying some potentially unsafe optimizations! (Use -O2 if this fails.)'
global Settings