v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
builtins-bigint-gen.cc
Go to the documentation of this file.
1
// Copyright 2017 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
#include "
src/builtins/builtins-bigint-gen.h
"
6
7
#include "
src/builtins/builtins-utils-gen.h
"
8
#include "
src/builtins/builtins.h
"
9
#include "
src/codegen/code-stub-assembler-inl.h
"
10
#include "
src/objects/dictionary.h
"
11
12
namespace
v8
{
13
namespace
internal
{
14
15
#include "
src/codegen/define-code-stub-assembler-macros.inc
"
16
17
// https://tc39.github.io/proposal-bigint/#sec-to-big-int64
18
TF_BUILTIN
(BigIntToI64,
CodeStubAssembler
) {
19
if
(!
Is64
()) {
20
Unreachable();
21
return
;
22
}
23
24
auto
value = Parameter<Object>(Descriptor::kArgument);
25
auto
context = Parameter<Context>(Descriptor::kContext);
26
TNode<BigInt>
n = ToBigInt(context, value);
27
28
TVARIABLE
(
UintPtrT
, var_low);
29
TVARIABLE
(
UintPtrT
, var_high);
30
31
BigIntToRawBytes(n, &var_low, &var_high);
32
Return(var_low.value());
33
}
34
35
// https://tc39.github.io/proposal-bigint/#sec-to-big-int64
36
TF_BUILTIN
(BigIntToI32Pair,
CodeStubAssembler
) {
37
if
(!Is32()) {
38
Unreachable();
39
return
;
40
}
41
42
auto
value = Parameter<Object>(Descriptor::kArgument);
43
auto
context = Parameter<Context>(Descriptor::kContext);
44
TNode<BigInt>
bigint = ToBigInt(context, value);
45
46
TVARIABLE
(
UintPtrT
, var_low);
47
TVARIABLE
(
UintPtrT
, var_high);
48
49
BigIntToRawBytes(bigint, &var_low, &var_high);
50
Return(var_low.value(), var_high.value());
51
}
52
53
// https://tc39.github.io/proposal-bigint/#sec-bigint-constructor-number-value
54
TF_BUILTIN
(I64ToBigInt,
CodeStubAssembler
) {
55
if
(!
Is64
()) {
56
Unreachable();
57
return
;
58
}
59
60
auto
argument = UncheckedParameter<IntPtrT>(Descriptor::kArgument);
61
62
Return(BigIntFromInt64(argument));
63
}
64
65
// https://tc39.github.io/proposal-bigint/#sec-bigint-constructor-number-value
66
TF_BUILTIN
(I32PairToBigInt,
CodeStubAssembler
) {
67
if
(!Is32()) {
68
Unreachable();
69
return
;
70
}
71
72
auto
low = UncheckedParameter<IntPtrT>(Descriptor::kLow);
73
auto
high = UncheckedParameter<IntPtrT>(Descriptor::kHigh);
74
75
Return(BigIntFromInt32Pair(low, high));
76
}
77
78
#include "
src/codegen/undef-code-stub-assembler-macros.inc
"
79
80
}
// namespace internal
81
}
// namespace v8
TVARIABLE
#define TVARIABLE(...)
builtins-bigint-gen.h
builtins-utils-gen.h
TF_BUILTIN
#define TF_BUILTIN(Name, AssemblerBase)
Definition
builtins-utils-gen.h:30
builtins.h
v8::internal::CodeStubAssembler
Definition
code-stub-assembler.h:69
v8::internal::TNode
Definition
tnode.h:391
code-stub-assembler-inl.h
define-code-stub-assembler-macros.inc
dictionary.h
v8::internal::internal
internal
Definition
wasm-objects-inl.h:458
v8::internal::Is64
constexpr bool Is64()
Definition
v8-internal.h:210
v8
Definition
api-arguments-inl.h:19
v8::internal::UintPtrT
Definition
tnode.h:89
undef-code-stub-assembler-macros.inc
src
builtins
builtins-bigint-gen.cc
Generated on Sun Apr 6 2025 21:08:50 for v8 by
1.12.0