Commit Graph

621 Commits

Author SHA1 Message Date
gardhr
8c868344b2 Issue 114: Allow compile time limits to be configured. 2019-11-28 11:39:55 +01:00
Tor Andersson
6b522a0b1f Issue 115: Fix compilation of small floating point numbers.
The check for whether a number is an integer or not failed on number
too small because we were using an addition in the test.
2019-11-28 11:31:09 +01:00
Tor Andersson
6e62eb0923 Issue 113: Add a js_delglobal function. 2019-11-19 12:56:22 +01:00
Tor Andersson
3d3f473c39 Bug 701887: Create arguments if eval is present.
We can't know at compile time that the 'arguments' object will not be used
from the eval statement, so err on the side of caution and always create
the arguments object if eval can be called.
2019-11-19 12:53:28 +01:00
Tor Andersson
69b312d13b Fix coverity issue: memory corruption due to overlapping copy. 2019-09-06 12:15:31 +02:00
Tor Andersson
16049bbbdc Issue 107: Depend only on the exact files needed for install targets. 2019-07-03 20:25:19 +02:00
Tor Andersson
14dc9355bd Issue 102: Fix ASAN build when using GCC.
GCC's address sanitizer sets the __SANITIZE_ADDRESS__ macro instead.
1.0.6
2019-06-12 17:23:46 +02:00
Tor Andersson
e2b59201d5 Issue 105: Fix NULL dereferencing in regexp compiler.
"x(?:)" parses to Cat(Char(x), Empty), but the compiler couldn't handle
an empty right hand side of the Cat node.
2019-06-11 15:48:39 +02:00
Tor Andersson
eeea83a807 Issue 102: Workaround for address-sanitizer default realloc behavior. 2019-06-11 15:48:39 +02:00
Tor Andersson
bd79071a6f Add make uninstall target. 2019-05-27 11:19:26 +02:00
Tor Andersson
b9e14e53a0 Revert "Pacify valgrind: it doesn't know realloc(p, 0) is equivalent to free(p)."
This reverts commit 86feee5b7b.
2019-04-05 18:36:26 +02:00
Tor Andersson
00d4606c3b Bug 700937: Limit recursion in regexp matcher.
Also handle negative return code as an error in the JS bindings.
2019-04-04 12:41:04 +02:00
Tor Andersson
1e5479084b Bug 700947: Add missing ENDTRY opcode in try/catch/finally byte code.
In one of the code branches in handling exceptions in the catch block
we forgot to call the ENDTRY opcode to pop the inner hidden try.
This leads to an unbalanced exception stack which can cause a crash
due to us jumping to a stack frame that has already been exited.
2019-04-04 12:41:02 +02:00
Tor Andersson
da632ca08f Bug 700938: Fix stack overflow in numtostr as used by Number#toFixed().
32 is not enough to fit sprintf("%.20f", 1e20).
We need at least 43 bytes to fit that format.
Bump the static buffer size.
2019-04-02 10:55:22 +02:00
Tor Andersson
0c03f9c057 Add missing break statement. 2019-03-29 19:40:44 +01:00
Tor Andersson
52c22be9c4 Fix MSVC compile errors. 2019-03-25 21:00:59 +01:00
Tor Andersson
bb65f18fcc Set 'lightweight' and 'arguments' during compile pass.
Avoid doing a separate analysis pass by using the same bytecode for both
lightweight and non-lightweight functions.
2019-03-22 14:00:20 +01:00
Tor Andersson
f5de9d4d2e Remove line opcode in favor of storing the line for each instruction. 2019-03-22 14:00:20 +01:00
Tor Andersson
20d0fa04df Simplify opcodes: numbers and integer constants. 2019-03-22 14:00:20 +01:00
Tor Andersson
603977ae5b Add repr() function to shell, and use it in the REPL. 2019-03-22 14:00:20 +01:00
Tor Andersson
ffe0ca7d7f Issue 95: Improve error message when trying to call a non-callable. 2019-03-18 14:11:34 +01:00
Tor Andersson
5de1f97c52 Set appropriate internal class property of arguments object. 2019-03-18 14:11:34 +01:00
Tor Andersson
8b52b57782 Allow js_newobjectx to take null as prototype. 2019-03-18 14:11:34 +01:00
Tor Andersson
ed1c279896 Fix indentation. 2019-03-18 14:00:02 +01:00
Tor Andersson
9f0153a025 Fix typo in ctypeof. 2019-03-18 14:00:02 +01:00
Albert I
269904fca0 Fix Makefile install derps
* Introduced by commit cd97fb4

Signed-off-by: Albert I <krascgq@outlook.co.id>
2019-03-08 22:54:35 +01:00
Tor Andersson
2c24e194d4 Issue #92: Remove unimplemented function. 2019-03-08 14:09:10 +01:00
Tor Andersson
8e57b47c5d Only emit line ops for actual exit handler statements. 2019-03-08 12:55:21 +01:00
Tor Andersson
ce02a9d729 Handle empty scripts. 2019-03-08 10:57:32 +01:00
Tor Andersson
cb1d50bca4 Improve line number tracking in compiler. 2019-03-07 18:35:51 +01:00
Tor Andersson
914ae72a24 Improve line number tracking in parser.
Associate statements with their initial keyword, and expressions
with their operator token.
2019-03-07 16:08:06 +01:00
Tor Andersson
6a592abfc4 Use emitarg instead of emitraw to emit opcode arguments. 2019-03-07 16:08:06 +01:00
Tor Andersson
cd97fb4b5c Fix makefile install paths.
Install the current configuration, don't hardwire it to build/release.
2019-03-07 16:07:38 +01:00
Tor Andersson
e471b4dd6c Issue #83: Don't include $DESTDIR in pkg-config paths. 2019-02-25 12:48:20 +01:00
Tor Andersson
d3feec4365 Issue #85: Use explicit seed in Math.random(). 2019-02-25 12:15:56 +01:00
Tor Andersson
43c844510b Issue #84: Separate Makefile targets.
Don't automatically build static library when building the shell
or the shared library.
2019-02-25 11:57:40 +01:00
Tor Andersson
9f40dfb032 Take DESTDIR into account when creating pkg-config file.
Also only create the file when installing.
2019-02-12 12:19:26 +01:00
Tor Andersson
5f556004a2 Fix bugs in Number.prototype.toFixed and toExponential.
toPrecision does not behave correctly: it doesn't pad the number with
trailing zeroes to reach the desired precision.
2019-02-08 15:25:35 +01:00
Tor Andersson
28643e6afb Bug 697891: Parse all JSON string escapes. 2019-01-23 12:53:25 +01:00
Tor Andersson
bd9920c571 Handle null/undefined in OP_NEXTITER rather than creating empty iterator.
Only create an iterator for coercible types in OP_ITERATOR, and then
detect the lack of a real iterator in OP_NEXTITER.
Thus we don't need to allocate and push an empty iterator object for
these cases.
2019-01-07 13:28:22 +01:00
Tor Andersson
7be32a0f5f Bug 700441: Handle null and undefined expressions in for-in statement. 2019-01-04 10:58:30 +01:00
Tor Andersson
7f50591861 Bug 700429: Limit size of input regular expression program.
The size of the parsed syntax list could overflow. Allowing it to be
bigger than the compiled program makes no sense, so use the same size
limit when parsing as when compiling.
2019-01-02 16:05:24 +01:00
Tor Andersson
93447649b5 Make data tables in utftype.c const. 2018-11-26 10:40:22 +01:00
Tor Andersson
fcf0e3ebd7 Tweak numeric overflow check in regexp count parser. 2018-11-26 10:40:22 +01:00
Tor Andersson
245a6f97e6 Fix 700090, 700094, 700095: Iterate through lists in AST analysis passes. 2018-11-05 16:00:13 +01:00
Tor Andersson
81d5b30acc Initialize random seed for Math.random(). 2018-10-26 14:57:56 +02:00
Sebastian Rasmussen
7448a82448 Fix gcc compiler warnings about switch fallthroughs. 1.0.5 2018-09-11 12:47:31 +02:00
Tor Andersson
d4655ae888 Show system error message in js_loadfile. 2018-09-04 11:27:34 +02:00
Avi Halachmi (:avih)
924649a69e mujs shell: Add compile function.
The new compile function compiles a source code string as a script and
returns a callable object. The optional 'filename' argument is used to
format error messages and stack traces.
2018-09-04 11:27:34 +02:00
Tor Andersson
84858c335e mujs shell: Make the load function behave like in the SpiderMonkey shell. 2018-09-04 11:27:34 +02:00