Commit graph

1114 commits

Author SHA1 Message Date
0xtechnobabble
65343388b8 LibJS: Add new bitwise and relational operators
Do note that when it comes to evaluating binary expressions, we are
asserting in multiple contexts that the values we're operating on are
numbers, we should probably handle other value types to be more tolerant
in the future, since for example, adding a number and a string, in
which case the number is converted to a string implicitly which is then
concatenated, although ugly, is valid javascript.
2020-03-09 19:33:07 +01:00
howar6hill
11aac6fdce
LibJS: Remove superfluous explicit in AST.h (#1395) 2020-03-09 14:37:08 +01:00
howar6hill
1c83c5ed08 LibJS: Implement While statements 2020-03-09 10:13:27 +01:00
Stephan Unverwerth
1207187e97 LibJS: GC: Remove clear_all_mark_bits()
Clearing all marked flags has been integrated into the sweep function,
saving an additional full iteration over the heap.
2020-03-09 07:32:09 +01:00
Andreas Kling
63e4b744ed LibJS: Add a basic mark&sweep garbage collector :^)
Objects can now be allocated via the interpreter's heap. Objects that
are allocated in this way will need to be provably reachable from at
least one of the known object graph roots.

The roots are currently determined by Heap::collect_roots().

Anything that wants be collectable garbage should inherit from Cell,
the fundamental atom of the GC heap.

This is pretty neat! :^)
2020-03-08 19:23:58 +01:00
0xtechnobabble
b6307beb6e LibJS: Implement if statements
If statements execute a certain action or an alternative one depending
on whether the tested condition is true or false, this commit helps
establish basic control flow capabilities in the AST.
2020-03-08 11:15:07 +01:00
0xtechnobabble
a96bf2c22e LibJS: Implement logical expressions
Logical expressions are expressions which can return either true or
false according to a provided condition.
2020-03-08 11:15:07 +01:00
0xtechnobabble
4e62dcd6e6 LibJS: Add typed comparison operator
The `===` operator allows us to compare two values while taking their
type into consideration.
2020-03-08 11:15:07 +01:00
0xtechnobabble
3fb0ff102c LibJS: Allow the dumping of literals that aren't numbers 2020-03-08 11:15:07 +01:00
Andreas Kling
0c7058aaa0 LibJS: Include the operator in BinaryExpression dumps 2020-03-07 23:17:07 +01:00
Andreas Kling
1611071ac7 LibJS: Flesh out JS::Value a little bit more 2020-03-07 23:17:07 +01:00
Andreas Kling
d52130836e LibJS: Simplify LogStream::operator<<(JS::Value) and move to .cpp file 2020-03-07 23:17:07 +01:00
Elisée Maurer
cbe0053a97 LibJS: Fix string representation for value of type undefined 2020-03-07 23:15:36 +01:00
Andreas Kling
f5476be702 LibJS: Start building a JavaScript engine for SerenityOS :^)
I always tell people to start building things by working on the thing
that seems the most interesting right now. The most interesting thing
here was an AST + simple interpreter, so that's where we start!

There is no lexer or parser yet, we build an AST directly and then
execute it in the interpreter, producing a return value.

This seems like the start of something interesting. :^)
2020-03-07 19:42:11 +01:00