mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:57:43 +00:00
LibJS: Cache commonly used FlyStrings in the VM
Roughly 7% of test-js runtime was spent creating FlyStrings from string literals. This patch frontloads that work and caches all the commonly used names in LibJS on a CommonPropertyNames struct that hangs off VM.
This commit is contained in:
parent
9f6c5f68b6
commit
7b863330dc
45 changed files with 651 additions and 392 deletions
|
@ -738,7 +738,7 @@ Value ordinary_has_instance(GlobalObject& global_object, Value lhs, Value rhs)
|
|||
return Value(false);
|
||||
|
||||
Object* lhs_object = &lhs.as_object();
|
||||
auto rhs_prototype = rhs_function.get("prototype");
|
||||
auto rhs_prototype = rhs_function.get(vm.names.prototype);
|
||||
if (vm.exception())
|
||||
return {};
|
||||
|
||||
|
@ -1013,8 +1013,9 @@ TriState abstract_relation(GlobalObject& global_object, bool left_first, Value l
|
|||
size_t length_of_array_like(GlobalObject& global_object, Value value)
|
||||
{
|
||||
ASSERT(value.is_object());
|
||||
auto result = value.as_object().get("length");
|
||||
if (global_object.vm().exception())
|
||||
auto& vm = global_object.vm();
|
||||
auto result = value.as_object().get(vm.names.length);
|
||||
if (vm.exception())
|
||||
return 0;
|
||||
return result.to_size_t(global_object);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue