Age | Commit message (Collapse) | Author |
|
Let's try to keep LibJS tidy as it expands. :^)
|
|
This commits makes effort towards tolerating some of javascript's quirks
when it comes to its type system, note that the interpreter's way of
handling type coercion is still not mature at all, for example, we still
have to implement NaN instead of just crashing when trying to parse a
string and failing.
|
|
Instead of every NativeFunction callback having to ask the Interpreter
for the current "this" value and then converting it to an Object etc,
just pass "this" as an Object* directly.
|
|
This patch adds NativeProperty, which can be used to implement object
properties that have C++ getters and/or setters.
Use this to move String.prototype.length to its correct place. :^)
|
|
|
|
All Objects will now have ObjectPrototype as their prototype, unless
overridden.
|
|
Object will now traverse up the prototype chain when doing a get().
When a function is called on an object, that object will now also be
the "this" value inside the function. This stuff is probably not very
correct, but we will improve things as we go! :^)
|
|
This makes it a little bit nicer to add native function properties
to JavaScript objects.
Thanks to Sergey for suggesting it! :^)
|
|
We only really care to visit values if they refer to a Cell, but it's
nice to be able to say visit(some_value).
|
|
Don't visit cells that are already marked. This prevents the marking
phase from looping forever when two cells refer to each other.
Also do the marking directly from the CellVisitor, removing another
unnecessary phase of the 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! :^)
|
|
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. :^)
|