Age | Commit message (Collapse) | Author |
|
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.
|
|
|
|
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.
|
|
|
|
|
|
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.
|
|
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.
|
|
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
|
|
Before this it would always go through the native setter thus
modifying the array but now you can set length to anything
|
|
|
|
|
|
Fixes regressed with 0f9038b732a6e0f5830e5e95c0b2a1c78efea415.
|
|
|
|
|
|
|
|
ArrayIteratorPrototype::next seems to implement CreateArrayIterator,
which is an issue for a separate PR.
|
|
In the spec, object environments have a [[BindingObject]], so let's
call it the same thing in our implementation.
|
|
We already store the GlobalObject& in a base class, so no need to also
store it in the subclass. :^)
|
|
Also make use of OrdinaryCreateFromConstructor() instead of setting
the prototype manually.
This fixes 2 function tests in test262. :^)
|
|
Negative numeric properties are not a thing (and we even VERIFY()'d this
in the constructor). It still allows using types with a negative range
for now as we have various places using int for example (without
actually needing the negative range, but that's a different story).
u32 is the internal type of `m_number` already, so this now allows us to
leverage the full u32 range for numeric properties.
|
|
Requires a bunch of find-and-replace updates across LibJS, but
constructing a PropertyName from a nullptr Symbol* should not be
possible - let's enforce this at the compiler level instead of using
VERIFY() (and already dereference Symbol pointers at the call site).
|