tmikov / jscomp Goto Github PK
View Code? Open in Web Editor NEWAhead of time JavaScript compiler
License: Apache License 2.0
Ahead of time JavaScript compiler
License: Apache License 2.0
It seems like it would be beneficial to specialize 1-character strings so we don't need a heap allocation for simply extracting a character (e.g. x = "aaaaa"[2]).
Not implemented yet
It is a global read-only variable. We don't currently support those.
parseInt() returns a results for huge integers that differ from Node and JS, and they all differ from my reading of the spec.
ECMAScript 5.1 says "The thisArg value is passed without modification as the this value. This is a change from Edition 3, where a undefined or null thisArg is replaced with the global object and ToObject is applied to all other values and that result is passed as the this value."
However both Mozilla and V8 seem to obey this only in strict mode. In non-strict mode they always perform autoboxing. Probably for compatibility reasons.
This issue is simply to note this. In the future we might decide to do something about it.
Associate a source location (line and file name) with every IR instruction, just like we are currently doing with the call instructions.
When running make runtime
, I'm presented with this syntax error:
cd runtime/deps/libuv && ./gyp_uv.py
File "./gyp_uv.py", line 39
print 'Error running GYP'
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print('Error running GYP')?
make: *** [Makefile:26: runtime/deps/libuv/out/Makefile] Error 1
Code generation is invalid for large integer constants.
That behavior best matches the behavior of a Node.js app
For obvious reasons. We might need to store the stack trace in the exception (duh!).
Since we are using setjmp/longjmp, non-volatile variables are (practically speaking) undefined after the longjmp(). Currently we are handling this (as well the needed code duplication for 'finally') by generating a nested function for the handler and forcing all variables it uses to be flagged as escaping.
Ideally we should track which variables are used by the handler (and by "used" I mean live values before the handler runs) and force them to memory.
Array.prototype.sort() is an extremely slow implementation:
Either via a separate managed object, or directly a new tag type. If the former, possibly more data could be stored in the managed object.
Doing it correctly in Unicode is not that easy and the current use cases didn't need it to work in Unicode. With that said, I hate leaving library functions half-implemented (String.prototype.split(), I am looking at you as well!)
function badfunc (a, b)
{
return (a ? '/' : 'a') || '.';
}
See bugs/badfuncex.js
var f = function myfunc () { myfunc(); }
doesn't compile
It was always known that Browserify's "Buffer" implementation was a temporary fix - it was cool because it worked without modification, validating the compiler, but was probably slow.
Well, now it is known how slow it really is - it takes half the running time of the compiler when compiling anything. It appends every character to the string using two additions. This causes immense pressure on the garbage collector among other things.
See bugs/tostr1.js
I'm getting the following build log:
root@91b8df194dd4:/usr/local/lib/jscomp# ./jsc examples/factorial.js -o factorial
/usr/local/lib/jscomp/runtime/js/modules/buffer/index.js:117:7: warning: operator '==' is not recommended
/usr/local/lib/jscomp/runtime/js/modules/buffer/index.js:221:13: warning: operator '!=' is not recommended
/usr/local/lib/jscomp/runtime/js/modules/buffer/index.js:342:10: warning: condition is always true
/usr/local/lib/jscomp/runtime/js/modules/buffer/node_modules/is-array/index.js:32:20: warning: operator '==' is not recommended
runtime/release/libuv.a(signal.o): In function `uv__signal_block_and_lock':
/usr/local/lib/jscomp/runtime/deps/libuv/out/../src/unix/signal.c:102: undefined reference to `pthread_sigmask'
runtime/release/libuv.a(signal.o): In function `uv__signal_unlock_and_unblock':
/usr/local/lib/jscomp/runtime/deps/libuv/out/../src/unix/signal.c:114: undefined reference to `pthread_sigmask'
runtime/release/libuv.a(signal.o): In function `uv__signal_global_once_init':
/usr/local/lib/jscomp/runtime/deps/libuv/out/../src/unix/signal.c:67: undefined reference to `pthread_once'
runtime/release/libuv.a(signal.o): In function `uv__signal_block_and_lock':
/usr/local/lib/jscomp/runtime/deps/libuv/out/../src/unix/signal.c:102: undefined reference to `pthread_sigmask'
runtime/release/libuv.a(signal.o): In function `uv__signal_unlock_and_unblock':
/usr/local/lib/jscomp/runtime/deps/libuv/out/../src/unix/signal.c:114: undefined reference to `pthread_sigmask'
/usr/local/lib/jscomp/runtime/deps/libuv/out/../src/unix/signal.c:114: undefined reference to `pthread_sigmask'
runtime/release/libuv.a(thread.o): In function `uv_thread_create':
/usr/local/lib/jscomp/runtime/deps/libuv/out/../src/unix/thread.c:66: undefined reference to `pthread_create'
runtime/release/libuv.a(thread.o): In function `uv_thread_join':
/usr/local/lib/jscomp/runtime/deps/libuv/out/../src/unix/thread.c:80: undefined reference to `pthread_join'
runtime/release/libuv.a(thread.o): In function `uv_mutex_trylock':
/usr/local/lib/jscomp/runtime/deps/libuv/out/../src/unix/thread.c:130: undefined reference to `pthread_mutex_trylock'
runtime/release/libuv.a(thread.o): In function `uv_rwlock_init':
/usr/local/lib/jscomp/runtime/deps/libuv/out/../src/unix/thread.c:145: undefined reference to `pthread_rwlock_init'
runtime/release/libuv.a(thread.o): In function `uv_rwlock_destroy':
/usr/local/lib/jscomp/runtime/deps/libuv/out/../src/unix/thread.c:150: undefined reference to `pthread_rwlock_destroy'
runtime/release/libuv.a(thread.o): In function `uv_rwlock_rdlock':
/usr/local/lib/jscomp/runtime/deps/libuv/out/../src/unix/thread.c:156: undefined reference to `pthread_rwlock_rdlock'
runtime/release/libuv.a(thread.o): In function `uv_rwlock_tryrdlock':
/usr/local/lib/jscomp/runtime/deps/libuv/out/../src/unix/thread.c:164: undefined reference to `pthread_rwlock_tryrdlock'
runtime/release/libuv.a(thread.o): In function `uv_rwlock_rdunlock':
thread.c:(.text.uv_rwlock_rdunlock+0x5): undefined reference to `pthread_rwlock_unlock'
runtime/release/libuv.a(thread.o): In function `uv_rwlock_wrlock':
/usr/local/lib/jscomp/runtime/deps/libuv/out/../src/unix/thread.c:179: undefined reference to `pthread_rwlock_wrlock'
runtime/release/libuv.a(thread.o): In function `uv_rwlock_trywrlock':
/usr/local/lib/jscomp/runtime/deps/libuv/out/../src/unix/thread.c:187: undefined reference to `pthread_rwlock_trywrlock'
runtime/release/libuv.a(thread.o): In function `uv_rwlock_wrunlock':
/usr/local/lib/jscomp/runtime/deps/libuv/out/../src/unix/thread.c:196: undefined reference to `pthread_rwlock_unlock'
runtime/release/libuv.a(thread.o): In function `uv_once':
/usr/local/lib/jscomp/runtime/deps/libuv/out/../src/unix/thread.c:202: undefined reference to `pthread_once'
runtime/release/libuv.a(thread.o): In function `uv_sem_init':
/usr/local/lib/jscomp/runtime/deps/libuv/out/../src/unix/thread.c:268: undefined reference to `sem_init'
runtime/release/libuv.a(thread.o): In function `uv_sem_destroy':
/usr/local/lib/jscomp/runtime/deps/libuv/out/../src/unix/thread.c:275: undefined reference to `sem_destroy'
runtime/release/libuv.a(thread.o): In function `uv_sem_post':
/usr/local/lib/jscomp/runtime/deps/libuv/out/../src/unix/thread.c:281: undefined reference to `sem_post'
runtime/release/libuv.a(thread.o): In function `uv_sem_wait':
/usr/local/lib/jscomp/runtime/deps/libuv/out/../src/unix/thread.c:290: undefined reference to `sem_wait'
runtime/release/libuv.a(thread.o): In function `uv_sem_trywait':
/usr/local/lib/jscomp/runtime/deps/libuv/out/../src/unix/thread.c:302: undefined reference to `sem_trywait'
runtime/release/libuv.a(thread.o): In function `uv_cond_init':
/usr/local/lib/jscomp/runtime/deps/libuv/out/../src/unix/thread.c:334: undefined reference to `pthread_condattr_setclock'
runtime/release/libuv.a(thread.o): In function `uv_barrier_init':
/usr/local/lib/jscomp/runtime/deps/libuv/out/../src/unix/thread.c:481: undefined reference to `pthread_barrier_init'
runtime/release/libuv.a(thread.o): In function `uv_barrier_destroy':
/usr/local/lib/jscomp/runtime/deps/libuv/out/../src/unix/thread.c:486: undefined reference to `pthread_barrier_destroy'
runtime/release/libuv.a(thread.o): In function `uv_barrier_wait':
/usr/local/lib/jscomp/runtime/deps/libuv/out/../src/unix/thread.c:492: undefined reference to `pthread_barrier_wait'
runtime/release/libuv.a(thread.o): In function `uv_key_create':
/usr/local/lib/jscomp/runtime/deps/libuv/out/../src/unix/thread.c:501: undefined reference to `pthread_key_create'
runtime/release/libuv.a(thread.o): In function `uv_key_delete':
/usr/local/lib/jscomp/runtime/deps/libuv/out/../src/unix/thread.c:506: undefined reference to `pthread_key_delete'
runtime/release/libuv.a(thread.o): In function `uv_key_get':
/usr/local/lib/jscomp/runtime/deps/libuv/out/../src/unix/thread.c:512: undefined reference to `pthread_getspecific'
runtime/release/libuv.a(thread.o): In function `uv_key_set':
/usr/local/lib/jscomp/runtime/deps/libuv/out/../src/unix/thread.c:517: undefined reference to `pthread_setspecific'
runtime/release/libuv.a(linux-core.o): In function `uv__io_poll':
/usr/local/lib/jscomp/runtime/deps/libuv/out/../src/unix/linux-core.c:252: undefined reference to `pthread_sigmask'
/usr/local/lib/jscomp/runtime/deps/libuv/out/../src/unix/linux-core.c:231: undefined reference to `pthread_sigmask'
collect2: error: ld returned 1 exit status
error: child process terminated with code 1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.