Git Product home page Git Product logo

tmikov / jscomp Goto Github PK

View Code? Open in Web Editor NEW
229.0 229.0 8.0 5.34 MB

Ahead of time JavaScript compiler

License: Apache License 2.0

Makefile 1.76% JavaScript 21.97% Shell 3.57% HTML 5.25% TypeScript 1.70% CMake 0.26% C++ 2.35% C 40.75% Perl 0.09% Batchfile 0.19% Groff 4.61% Python 16.74% Assembly 0.01% Objective-C 0.11% Objective-C++ 0.01% Swift 0.01% Emacs Lisp 0.11% NSIS 0.02% M4 0.49%

jscomp's People

Contributors

ericlu88 avatar ericvw avatar minadaky avatar tmikov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jscomp's Issues

add 'undefined'

It is a global read-only variable. We don't currently support those.

autoboxing of 'this' in non-strict mode

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.

Add line numbers debugging support

Associate a source location (line and file name) with every IR instruction, just like we are currently doing with the call instructions.

Awkward make issue

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

Better exception handling

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.

Improve Array.prototype.sort()

Array.prototype.sort() is an extremely slow implementation:

  • it is completely generic. For example it doesn't benefit if it is run on an actual Array or a TypedArray, where it could use much faster direct access to elements.
  • it uses exchange sort (yes, I know, but I wanted to get something going in a very short time)

Ability to wrap a native pointer

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.

toLower/UpperCase only converts ASCII characters

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!)

Buffer.utf8Slice takes half of the running time of the compiler

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.

Undefined reference to `pthread_sigmask`

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

Dockerfile here

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.