ladybird/Userland/Libraries/LibJS/Tests/builtins
Linus Groh cf168fac50 LibJS: Implement [[Call]] and [[Construct]] internal slots properly
This patch implements:

- Spec compliant [[Call]] and [[Construct]] internal slots, as virtual
  FunctionObject::internal_{call,construct}(). These effectively replace
  the old virtual FunctionObject::{call,construct}(), but with several
  advantages:
  - Clear and consistent naming, following the object internal methods
  - Use of completions
  - internal_construct() returns an Object, and not Value! This has been
    a source of confusion for a long time, since in the spec there's
    always an Object returned but the Value return type in LibJS meant
    that this could not be fully trusted and something could screw you
    over.
  - Arguments are passed explicitly in form of a MarkedValueList,
    allowing manipulation (BoundFunction). We still put them on the
    execution context as a lot of code depends on it (VM::arguments()),
    but not from the Call() / Construct() AOs anymore, which now allows
    for bypassing them and invoking [[Call]] / [[Construct]] directly.
    Nothing but Call() / Construct() themselves do that at the moment,
    but future additions to ECMA262 or already existing web specs might.
- Spec compliant, standalone Call() and Construct() AOs: currently the
  closest we have is VM::{call,construct}(), but those try to cater to
  all the different function object subclasses at once, resulting in a
  horrible mess and calling AOs with functions they should never be
  called with; most prominently PrepareForOrdinaryCall and
  OrdinaryCallBindThis, which are only for ECMAScriptFunctionObject.

As a result this also contains an implicit optimization: we no longer
need to create a new function environment for NativeFunctions - which,
worth mentioning, is what started this whole crusade in the first place
:^)
2021-10-09 14:29:20 +01:00
..
AggregateError
Array LibJS: Prevent stack overflow in flatten_into_array() 2021-08-15 11:24:30 +01:00
ArrayBuffer
Atomics LibJS: Implement Atomics.isLockFree 2021-07-14 22:13:15 +01:00
BigInt LibJS: Change wording of ErrorType::NotA to be independent of context 2021-09-12 00:16:39 +02:00
Boolean LibJS: Change wording of ErrorType::NotA to be independent of context 2021-09-12 00:16:39 +02:00
DataView LibJS: Use Checked<T> for offsets in the SetViewValue AO 2021-08-11 22:56:58 +01:00
Date LibJS: Change wording of ErrorType::NotA to be independent of context 2021-09-12 00:16:39 +02:00
Error
FinalizationRegistry test-js: Add a mark_as_garbage method to force GC to collect that object 2021-09-08 08:53:02 +01:00
Function LibJS: Change wording of ErrorType::NotA to be independent of context 2021-09-12 00:16:39 +02:00
functions
Infinity
Intl LibJS: Change wording of ErrorType::NotA to be independent of context 2021-09-12 00:16:39 +02:00
JSON
Map LibJS/Tests: Test iteration order of Map.prototype.entries() 2021-08-13 23:54:08 +01:00
Math
NaN
Number LibJS: Change wording of ErrorType::NotA to be independent of context 2021-09-12 00:16:39 +02:00
Object LibJS/Tests: Remove two leftover console.log() calls 2021-07-28 21:57:30 +01:00
Promise LibJS: Change wording of ErrorType::NotA to be independent of context 2021-09-12 00:16:39 +02:00
Proxy LibJS: Prevent stack overflow if Proxy handler's __proto__ is the Proxy 2021-09-05 22:17:09 +01:00
Reflect LibJS: Implement [[Call]] and [[Construct]] internal slots properly 2021-10-09 14:29:20 +01:00
RegExp LibJS: Implement RegExp.prototype.compile 2021-08-20 19:16:33 +02:00
Set
String LibJS: Implement ECMA-402 String.prototype.toLocale{Lower,Upper}Case 2021-09-06 15:24:27 +01:00
Symbol LibJS: Rename OrdinaryFunctionObject to ECMAScriptFunctionObject 2021-09-25 17:51:30 +02:00
Temporal LibJS: Change wording of ErrorType::NotA to be independent of context 2021-09-12 00:16:39 +02:00
TypedArray LibJS: Change wording of ErrorType::NotA to be independent of context 2021-09-12 00:16:39 +02:00
WeakMap test-js: Add a mark_as_garbage method to force GC to collect that object 2021-09-08 08:53:02 +01:00
WeakRef
WeakSet test-js: Add a mark_as_garbage method to force GC to collect that object 2021-09-08 08:53:02 +01:00