summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2023-01-27 22:00:31 +0000
committerLinus Groh <mail@linusgroh.de>2023-01-28 00:41:18 +0000
commit0f4bbfdfb7e2f155fc05893f4846ec245056454c (patch)
tree03b60a7695e6e107ac36d1a169da074e91fd13cf /Userland/Libraries
parent6d6ea1fffe44bf5a289439d34a558b0de5c1972f (diff)
downloadserenity-0f4bbfdfb7e2f155fc05893f4846ec245056454c.zip
LibJS: Add spec comments to FunctionPrototype
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibJS/Runtime/FunctionPrototype.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/FunctionPrototype.cpp b/Userland/Libraries/LibJS/Runtime/FunctionPrototype.cpp
index fc5329f8f9..20530adb18 100644
--- a/Userland/Libraries/LibJS/Runtime/FunctionPrototype.cpp
+++ b/Userland/Libraries/LibJS/Runtime/FunctionPrototype.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020-2022, Linus Groh <linusg@serenityos.org>
+ * Copyright (c) 2020-2023, Linus Groh <linusg@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@@ -145,7 +145,7 @@ JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::to_string)
// 1. Let func be the this value.
auto function_value = vm.this_value();
- // If func is not a function, let's bail out early. The order of this step is not observable.
+ // OPTIMIZATION: If func is not a function, bail out early. The order of this step is not observable.
if (!function_value.is_function()) {
// 5. Throw a TypeError exception.
return vm.throw_completion<TypeError>(ErrorType::NotAnObjectOfType, "Function");
@@ -175,6 +175,8 @@ JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::to_string)
// 20.2.3.6 Function.prototype [ @@hasInstance ] ( V ), https://tc39.es/ecma262/#sec-function.prototype-@@hasinstance
JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::symbol_has_instance)
{
+ // 1. Let F be the this value.
+ // 2. Return ? OrdinaryHasInstance(F, V).
return TRY(ordinary_has_instance(vm, vm.argument(0), vm.this_value()));
}