v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
runtime-macro-shims.h
Go to the documentation of this file.
1// Copyright 2020 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_TORQUE_RUNTIME_MACRO_SHIMS_H_
6#define V8_TORQUE_RUNTIME_MACRO_SHIMS_H_
7
8// This file contains runtime implementations of a few macros that are defined
9// as external in Torque, so that generated runtime code can work.
10
11#include <cstdint>
12
14#include "src/utils/utils.h"
15
16namespace v8 {
17namespace internal {
18
19namespace TorqueRuntimeMacroShims {
21
22inline bool BoolConstant(bool b) { return b; }
23inline intptr_t ChangeInt32ToIntPtr(int32_t i) { return i; }
24inline uintptr_t ChangeUint32ToWord(uint32_t u) { return u; }
25inline intptr_t IntPtrAdd(intptr_t a, intptr_t b) { return a + b; }
26inline intptr_t IntPtrMul(intptr_t a, intptr_t b) { return a * b; }
27inline bool IntPtrLessThan(intptr_t a, intptr_t b) { return a < b; }
28inline bool IntPtrLessThanOrEqual(intptr_t a, intptr_t b) { return a <= b; }
29inline intptr_t Signed(uintptr_t u) { return static_cast<intptr_t>(u); }
30template <typename Smi>
31inline int32_t SmiUntag(Smi s) {
32 return s.value();
33}
34inline bool UintPtrLessThan(uintptr_t a, uintptr_t b) { return a < b; }
35inline uint32_t Unsigned(int32_t s) { return static_cast<uint32_t>(s); }
36#if V8_HOST_ARCH_64_BIT
37inline uintptr_t Unsigned(intptr_t s) { return static_cast<uintptr_t>(s); }
38#endif
39inline bool Word32Equal(uint32_t a, uint32_t b) { return a == b; }
40inline bool Word32NotEqual(uint32_t a, uint32_t b) { return a != b; }
42 return i.To<int32_t>();
43}
48 return i.To<intptr_t>();
49}
50
51inline void Print(const char* str) { PrintF("%s", str); }
52
53} // namespace CodeStubAssembler
54} // namespace TorqueRuntimeMacroShims
55} // namespace internal
56} // namespace v8
57
58#endif // V8_TORQUE_RUNTIME_MACRO_SHIMS_H_
int s
Definition mul-fft.cc:297
intptr_t ConstexprIntegerLiteralToIntptr(const IntegerLiteral &i)
void PrintF(const char *format,...)
Definition utils.cc:39