mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
LibJS/JIT: Add fast path for Int32 | Int32
This commit is contained in:
parent
82635083dc
commit
3a5c177025
Notes:
sideshowbarker
2024-07-16 21:42:29 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/3a5c177025 Pull-request: https://github.com/SerenityOS/serenity/pull/21672
2 changed files with 29 additions and 1 deletions
|
@ -655,6 +655,35 @@ void Compiler::compile_bitwise_and(Bytecode::Op::BitwiseAnd const& op)
|
|||
end.link(m_assembler);
|
||||
}
|
||||
|
||||
static Value cxx_bitwise_or(VM& vm, Value lhs, Value rhs)
|
||||
{
|
||||
return TRY_OR_SET_EXCEPTION(bitwise_or(vm, lhs, rhs));
|
||||
}
|
||||
|
||||
void Compiler::compile_bitwise_or(Bytecode::Op::BitwiseOr const& op)
|
||||
{
|
||||
load_vm_register(ARG1, op.lhs());
|
||||
load_accumulator(ARG2);
|
||||
|
||||
Assembler::Label end {};
|
||||
|
||||
branch_if_both_int32(ARG1, ARG2, [&] {
|
||||
// NOTE: Since both sides are Int32, we know that the upper 32 bits are nothing but the INT32_TAG.
|
||||
// This means we can get away with just a simple 64-bit bitwise or.
|
||||
m_assembler.bitwise_or(
|
||||
Assembler::Operand::Register(ARG1),
|
||||
Assembler::Operand::Register(ARG2));
|
||||
|
||||
store_accumulator(ARG1);
|
||||
m_assembler.jump(end);
|
||||
});
|
||||
|
||||
native_call((void*)cxx_bitwise_or);
|
||||
store_accumulator(RET);
|
||||
check_exception();
|
||||
end.link(m_assembler);
|
||||
}
|
||||
|
||||
static ThrowCompletionOr<Value> not_(VM&, Value value)
|
||||
{
|
||||
return Value(!value.to_boolean());
|
||||
|
|
|
@ -54,7 +54,6 @@ private:
|
|||
O(LooselyEquals, abstract_equals) \
|
||||
O(StrictlyInequals, typed_inequals) \
|
||||
O(StrictlyEquals, typed_equals) \
|
||||
O(BitwiseOr, bitwise_or) \
|
||||
O(BitwiseXor, bitwise_xor) \
|
||||
O(LeftShift, left_shift) \
|
||||
O(RightShift, right_shift) \
|
||||
|
|
Loading…
Reference in a new issue