LibJS: Add Object::define_property_without_transition() helper

This allows us to avoid transitioning in two common cases, saving some
time during object construction.
This commit is contained in:
Andreas Kling 2020-10-06 16:57:02 +02:00
parent 21ac343211
commit 4c33209011
Notes: sideshowbarker 2024-07-19 02:00:30 +09:00
3 changed files with 10 additions and 3 deletions

View file

@ -69,7 +69,7 @@ void ScriptFunction::initialize(GlobalObject& global_object)
Function::initialize(global_object);
if (!m_is_arrow_function) {
Object* prototype = Object::create_empty(global_object);
prototype->define_property("constructor", this, Attribute::Writable | Attribute::Configurable);
prototype->define_property_without_transition("constructor", this, Attribute::Writable | Attribute::Configurable);
define_property("prototype", prototype, 0);
}
define_native_property("length", length_getter, nullptr, Attribute::Configurable);