LibJS: Mark ArgumentsObject as non-interfering if parameter list empty
If the parameter list is empty, there are no mappings to worry about. This allows various internal property access optimizations. 1.17x speedup on Octane/raytrace.js
This commit is contained in:
parent
1dcf137d02
commit
e6521d8ead
3 changed files with 4 additions and 4 deletions
|
|
@ -1164,7 +1164,7 @@ Object* create_mapped_arguments_object(VM& vm, FunctionObject& function, Nonnull
|
|||
// 7. Set obj.[[Set]] as specified in 10.4.4.4.
|
||||
// 8. Set obj.[[Delete]] as specified in 10.4.4.5.
|
||||
// 9. Set obj.[[Prototype]] to %Object.prototype%.
|
||||
auto object = realm.create<ArgumentsObject>(realm, environment);
|
||||
auto object = realm.create<ArgumentsObject>(realm, environment, formals->is_empty());
|
||||
|
||||
// 14. Let index be 0.
|
||||
// 15. Repeat, while index < len,
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ namespace JS {
|
|||
|
||||
GC_DEFINE_ALLOCATOR(ArgumentsObject);
|
||||
|
||||
ArgumentsObject::ArgumentsObject(Realm& realm, Environment& environment)
|
||||
: Object(realm.intrinsics().mapped_arguments_object_shape(), MayInterfereWithIndexedPropertyAccess::Yes)
|
||||
ArgumentsObject::ArgumentsObject(Realm& realm, Environment& environment, bool parameter_list_is_empty)
|
||||
: Object(realm.intrinsics().mapped_arguments_object_shape(), parameter_list_is_empty ? MayInterfereWithIndexedPropertyAccess::No : MayInterfereWithIndexedPropertyAccess::Yes)
|
||||
, m_environment(environment)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public:
|
|||
void set_mapped_names(Vector<Utf16FlyString> mapped_names) { m_mapped_names = move(mapped_names); }
|
||||
|
||||
private:
|
||||
ArgumentsObject(Realm&, Environment&);
|
||||
ArgumentsObject(Realm&, Environment&, bool parameter_list_is_empty);
|
||||
|
||||
[[nodiscard]] bool parameter_map_has(PropertyKey const&) const;
|
||||
[[nodiscard]] Value get_from_parameter_map(PropertyKey const&) const;
|
||||
|
|
|
|||
Loading…
Reference in a new issue