summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-08-28 17:37:00 +0100
committerLinus Groh <mail@linusgroh.de>2021-08-28 23:17:01 +0100
commit31bc9565f8a4afa5abfa3d50f4b02cdc697f26b1 (patch)
treed317569c1baa6307bab3ca2bb56ef28f6bbc2b2a /Userland/Libraries/LibJS
parent8bcda353a211392a2b8dd5448f463355fb4a5389 (diff)
downloadserenity-31bc9565f8a4afa5abfa3d50f4b02cdc697f26b1.zip
LibJS: Avoid transitions for name/length of native functions/accessors
Diffstat (limited to 'Userland/Libraries/LibJS')
-rw-r--r--Userland/Libraries/LibJS/Runtime/Object.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Object.cpp b/Userland/Libraries/LibJS/Runtime/Object.cpp
index fdb542150c..1d5e2bb54b 100644
--- a/Userland/Libraries/LibJS/Runtime/Object.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Object.cpp
@@ -1023,15 +1023,15 @@ void Object::define_native_accessor(PropertyName const& property_name, Function<
if (getter) {
auto name = String::formatted("get {}", formatted_property_name);
getter_function = NativeFunction::create(global_object(), name, move(getter));
- getter_function->define_direct_property(vm.names.length, Value(0), Attribute::Configurable);
- getter_function->define_direct_property(vm.names.name, js_string(vm, name), Attribute::Configurable);
+ getter_function->define_direct_property_without_transition(vm.names.length, Value(0), Attribute::Configurable);
+ getter_function->define_direct_property_without_transition(vm.names.name, js_string(vm, name), Attribute::Configurable);
}
FunctionObject* setter_function = nullptr;
if (setter) {
auto name = String::formatted("set {}", formatted_property_name);
setter_function = NativeFunction::create(global_object(), name, move(setter));
- setter_function->define_direct_property(vm.names.length, Value(1), Attribute::Configurable);
- setter_function->define_direct_property(vm.names.name, js_string(vm, name), Attribute::Configurable);
+ setter_function->define_direct_property_without_transition(vm.names.length, Value(1), Attribute::Configurable);
+ setter_function->define_direct_property_without_transition(vm.names.name, js_string(vm, name), Attribute::Configurable);
}
return define_direct_accessor(property_name, getter_function, setter_function, attribute);
}
@@ -1096,8 +1096,8 @@ void Object::define_native_function(PropertyName const& property_name, Function<
function_name = String::formatted("[{}]", property_name.as_symbol()->description());
}
auto* function = NativeFunction::create(global_object(), function_name, move(native_function));
- function->define_direct_property(vm.names.length, Value(length), Attribute::Configurable);
- function->define_direct_property(vm.names.name, js_string(vm, function_name), Attribute::Configurable);
+ function->define_direct_property_without_transition(vm.names.length, Value(length), Attribute::Configurable);
+ function->define_direct_property_without_transition(vm.names.name, js_string(vm, function_name), Attribute::Configurable);
define_direct_property(property_name, function, attribute);
}