mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-19 06:29:43 +00:00
LibJS: Make internal_define_own_property()
save added property offset
...in `PropertyDescriptor`. This is required for the upcoming change that needs to know offset of newly added properties to set up inline caching.
This commit is contained in:
parent
ede6314cb6
commit
a54215c07d
Notes:
github-actions[bot]
2025-09-17 10:45:42 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: a54215c07d
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6204
32 changed files with 88 additions and 60 deletions
|
@ -457,8 +457,10 @@ void ECMAScriptFunctionObject::initialize(Realm& realm)
|
|||
prototype->put_direct(realm.intrinsics().normal_function_prototype_constructor_offset(), this);
|
||||
put_direct(realm.intrinsics().normal_function_prototype_offset(), prototype);
|
||||
} else {
|
||||
MUST(define_property_or_throw(vm.names.length, { .value = Value(function_length()), .writable = false, .enumerable = false, .configurable = true }));
|
||||
MUST(define_property_or_throw(vm.names.name, { .value = m_name_string, .writable = false, .enumerable = false, .configurable = true }));
|
||||
PropertyDescriptor length_descriptor { .value = Value(function_length()), .writable = false, .enumerable = false, .configurable = true };
|
||||
MUST(define_property_or_throw(vm.names.length, length_descriptor));
|
||||
PropertyDescriptor name_descriptor { .value = m_name_string, .writable = false, .enumerable = false, .configurable = true };
|
||||
MUST(define_property_or_throw(vm.names.name, name_descriptor));
|
||||
|
||||
if (!is_arrow_function()) {
|
||||
Object* prototype = nullptr;
|
||||
|
@ -915,7 +917,8 @@ void ECMAScriptFunctionObject::set_name(Utf16FlyString const& name)
|
|||
auto& vm = this->vm();
|
||||
const_cast<SharedFunctionInstanceData&>(shared_data()).m_name = name;
|
||||
m_name_string = PrimitiveString::create(vm, name);
|
||||
MUST(define_property_or_throw(vm.names.name, { .value = m_name_string, .writable = false, .enumerable = false, .configurable = true }));
|
||||
PropertyDescriptor descriptor { .value = m_name_string, .writable = false, .enumerable = false, .configurable = true };
|
||||
MUST(define_property_or_throw(vm.names.name, descriptor));
|
||||
}
|
||||
|
||||
ECMAScriptFunctionObject::ClassData& ECMAScriptFunctionObject::ensure_class_data() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue