Age | Commit message (Collapse) | Author |
|
"Records" in the spec are basically C++ classes, so let's drop this
mouthful of a suffix.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Defined by https://tc39.es/ecma262/#sec-ordinaryfunctioncreate step #17
and by https://tc39.es/ecma262/#sec-createbuiltinfunction step #6.
|
|
This is equivalent to 58d6a2d0192b7860ecb2edb4aa5d36b389213a15 but for
the left shift operation.
|
|
|
|
|
|
Specifically, we immediately return an empty string when `this` is an
empty string, instead of wasting time in a loop doing nothing N times.
|
|
Specifically, we now cast to a u32 instead of an i32, as well as use
the validity check required by the specification. The current
constructor is still quite far from the specification, as we directly
set the indexed properties' length instead of going through the Array's
overriden DefineOwnProperty. (and as a result the checks imposed by the
ArraySetLength abstract operation)
|
|
|
|
|
|
This allows us to support parsing and serializing BigIntegers to and
from any base N (such that 2 <= N <= 36).
|
|
This is not exactly compliant with the specification, but our current
bound function implementation isn't either, so its not currently
possible to implement it the way the specification requires.
|
|
As well as bring it generally closer to the specification.
|
|
Copy/paste error from toBeTrue().
|
|
|
|
This patch adds a new ArgumentsObject class to represent what the spec
calls "Arguments Exotic Objects"
These are constructed by the new CreateMappedArgumentsObject when the
`arguments` identifier is resolved in a callee context.
The implementation is incomplete and doesn't yet support mapping of
the parameter variables to the indexed properties of `arguments`.
|
|
This includes checking that the target is a constructor, not just a
function, as well as switching the order of the list creation and
argument validation to match the specification, to ensure correct
exception throwing order.
|
|
This includes not throwing a custom exception and using the
length_of_array_like abstract operation where required.
|
|
This patch implements the IsSimpleParameterList static semantics for
ordinary function objects.
We now also create an unmapped arguments object for callee contexts
with non-simple parameter lists, instead of only doing it in strict
mode. Covered by test262.
|
|
|
|
This makes the implicit run-time assertion in PropertyName::to_string()
into an explicit compile-time requirement, removes a wasteful FlyString
-> PropertyName -> FlyString construction from NativeFunction::create()
and allows setting the function name to a null string for anonymous
native functions.
|
|
This is done by just using the built-in ceiling and subtracting from
the result if its in the 0.5 range.
|
|
|
|
This regressed recently and would only output a bunch of '[object Foo]',
the reason being that String(value) failed in some cases - which is
easily fixed by trying that first and using Object.prototype.toString()
as a fallback in the case of an exception :^)
|
|
|
|
|
|
Now that JS function objects are JS::FunctionObject, we can stop
qualifying AK::Function and just say "Function" everywhere. Nice. :^)
|
|
These are basically what the spec calls "ordinary function objects",
so let's have the name reflect that. :^)
|
|
|
|
The unsigned shift right implementation was already doing this, but
the spec requires a mod32 of rhs before the shift for the signed shift
right implementation as well. Caught by UBSAN and oss-fuzz.
|
|
If the value we get after fmod in Value::to_u32 is negative, UBSAN
complains that -N is out of bounds for u32. An extra static cast to i64
makes it stop complaining. An alternative implementation could add 2^32
if the fmod'd value is negative. Caught by UBSAN and oss-fuzz.
|
|
Resolves a FIXME.
|
|
Resolves a FIXME.
|
|
|
|
Resolves a FIXME.
|
|
This makes it easier to follow the code and compare it to the spec.
|
|
Also move the others outside of their functions.
|
|
The `arguments` object should only have the *arguments* as numeric
properties, not the *parameters*.
Given this function:
function foo(a, b) {
return arguments.length;
}
Calling foo() with no arguments now correctly returns 0 instead of 2.
|
|
I accidentally renamed these to verify_cast() when doing the global
AK::downcast() rename.
|
|
This was a standalone function previously (get_method()), but instead of
passing a Value to it, we can just make it a method.
Also add spec step comments and fix the receiver value by using GetV().
|
|
Like Get(), but with any value instead of an object - it's calling
ToObject() for us and passes the value to [[Get]]() as the receiver.
This will be used in GetMethod() (and a couple of other places, which
can be updated over time).
I also tried something new here: adding the three steps from the spec as
inline comments :^)
|
|
This is only used by Error and its subclasses, so it doesn't need to be
available to all objects.
|
|
These tests are correct as other engines pass them but are now broken
|
|
This reverts commit f102b563
The reverted to behavior is not correct for example with a double proxy
But this change lead to problems with DOMNodes
|
|
If we define a property with just a setter/getter (not both) we must:
- take the previous getter/setter if defined on the actual object
- overwrite the other to nullptr if it is from a prototype
|