mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:47:35 +00:00
LibJS/Bytecode: Avoid Value==Value in Call built-in fast path
Comparing two Values has to call the generic same_value() helper, and we can avoid this by simply using a stronger type for built-in native function handlers.
This commit is contained in:
parent
1060c63bd8
commit
01e9eee7dd
2 changed files with 8 additions and 5 deletions
|
@ -52,14 +52,14 @@ public:
|
|||
HostDefined* host_defined() { return m_host_defined; }
|
||||
void set_host_defined(OwnPtr<HostDefined> host_defined) { m_host_defined = move(host_defined); }
|
||||
|
||||
void define_builtin(Bytecode::Builtin builtin, Value value)
|
||||
void define_builtin(Bytecode::Builtin builtin, NonnullGCPtr<NativeFunction> value)
|
||||
{
|
||||
m_builtins[to_underlying(builtin)] = value;
|
||||
}
|
||||
|
||||
Value get_builtin_value(Bytecode::Builtin builtin)
|
||||
NonnullGCPtr<NativeFunction> get_builtin_value(Bytecode::Builtin builtin)
|
||||
{
|
||||
return m_builtins[to_underlying(builtin)];
|
||||
return *m_builtins[to_underlying(builtin)];
|
||||
}
|
||||
|
||||
static FlatPtr global_environment_offset() { return OFFSET_OF(Realm, m_global_environment); }
|
||||
|
@ -74,7 +74,7 @@ private:
|
|||
GCPtr<Object> m_global_object; // [[GlobalObject]]
|
||||
GCPtr<GlobalEnvironment> m_global_environment; // [[GlobalEnv]]
|
||||
OwnPtr<HostDefined> m_host_defined; // [[HostDefined]]
|
||||
AK::Array<Value, to_underlying(Bytecode::Builtin::__Count)> m_builtins;
|
||||
AK::Array<GCPtr<NativeFunction>, to_underlying(Bytecode::Builtin::__Count)> m_builtins;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue