summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Object.cpp
AgeCommit message (Collapse)Author
2020-03-16LibJS: Add "Heap" and "Runtime" subdirectoriesAndreas Kling
Let's try to keep LibJS tidy as it expands. :^)
2020-03-16LibJS: Loosen type system0xtechnobabble
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.
2020-03-15LibJS: Pass "this" as an Object* to NativeFunction callbacksAndreas Kling
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.
2020-03-15LibJS: Add a mechanism for callback-based object propertiesAndreas Kling
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. :^)
2020-03-15LibJS: Remove debug spam in Object::get()Andreas Kling
2020-03-15LibJS: Add ObjectPrototype and implement hasOwnProperty()Andreas Kling
All Objects will now have ObjectPrototype as their prototype, unless overridden.
2020-03-15LibJS: Add basic prototype supportAndreas Kling
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! :^)
2020-03-13LibJS: Add Object::put_native_function() for convenienceAndreas Kling
This makes it a little bit nicer to add native function properties to JavaScript objects. Thanks to Sergey for suggesting it! :^)
2020-03-09LibJS: Add a convenience helper for visiting a JS::ValueAndreas Kling
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).
2020-03-09LibJS: Make the GC marking phase cycle-proofAndreas Kling
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. :^)
2020-03-08LibJS: Add a basic mark&sweep garbage collector :^)Andreas Kling
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-07LibJS: Start building a JavaScript engine for SerenityOS :^)Andreas Kling
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. :^)