v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
number-builtins-reducer-inl.h
Go to the documentation of this file.
1// Copyright 2024 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef V8_BUILTINS_NUMBER_BUILTINS_REDUCER_INL_H_
6#define V8_BUILTINS_NUMBER_BUILTINS_REDUCER_INL_H_
7
9
10namespace v8::internal {
11
13
14using namespace compiler::turboshaft; // NOLINT(build/namespaces)
15
16template <typename Next>
17class NumberBuiltinsReducer : public Next {
18 public:
19 BUILTIN_REDUCER(NumberBuiltins)
20
21 V<Object> BitwiseNot(V<Context> context, V<Object> input) {
22 Label<Object> done(this);
23 Label<Word32> if_number(this);
24 Label<BigInt> if_bigint(this);
25 __ template TaggedToWord32OrBigIntImpl<Object::Conversion::kToNumeric>(
26 context, input, IsKnownTaggedPointer::kNo, if_number, &if_bigint,
27 nullptr);
28
29 // Number case.
30 {
31 BIND(if_number, w32);
32 V<Number> temp = __ ConvertInt32ToNumber(__ Word32BitwiseNot(w32));
33 IF (__ IsSmi(temp)) {
35 } ELSE {
36 __ CombineFeedback(BinaryOperationFeedback::kNumber);
37 }
38 GOTO(done, temp);
39 }
40
41 // BigInt case.
42 {
43 BIND(if_bigint, bigint_value);
44 if (__ HasFeedbackCollector()) {
45 // Feedback has been set already in `TaggedToWord32OrBigIntImpl`.
47 }
48 GOTO(done, __ CallRuntime_BigIntUnaryOp(isolate_, context, bigint_value,
49 ::Operation::kBitwiseNot));
50 }
51
52 BIND(done, result);
53 return result;
54 }
55
56 private:
58};
59
61
62} // namespace v8::internal
63
64#endif // V8_BUILTINS_NUMBER_BUILTINS_REDUCER_INL_H_
#define BIND(label)
#define ELSE
#define GOTO(label,...)
#define TSA_DCHECK(assembler, condition)
#define IF(...)
union v8::internal::@341::BuiltinMetadata::KindSpecificData data
V< Object > BitwiseNot(V< Context > context, V< Object > input)
Isolate * isolate
ZoneVector< RpoNumber > & result
V8_INLINE constexpr bool IsSmi(TaggedImpl< kRefType, StorageType > obj)
Definition objects.h:665
#define BUILTIN_REDUCER(name)