1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:57:35 +00:00

LibJS: Split Value::Type::Number into Int32 and Double

We now store 32-bit integers as 32-bit integers directly which avoids
having to convert them from doubles when they're only used as 32-bit
integers anyway. :^)

This patch feels a bit incomplete and there's a lot of opportunities
to take advantage of this information. We'll have to find and exploit
them eventually.
This commit is contained in:
Andreas Kling 2021-03-21 18:03:00 +01:00
parent 630d83be8f
commit c8382c32e9
4 changed files with 69 additions and 28 deletions

View file

@ -729,7 +729,8 @@ Value UnaryExpression::execute(Interpreter& interpreter, GlobalObject& global_ob
// yes, this is on purpose. yes, this is how javascript works.
// yes, it's silly.
return js_string(vm, "object");
case Value::Type::Number:
case Value::Type::Int32:
case Value::Type::Double:
return js_string(vm, "number");
case Value::Type::String:
return js_string(vm, "string");