summaryrefslogtreecommitdiff
path: root/deps/v8/src/compiler/code-assembler.h
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/compiler/code-assembler.h')
-rw-r--r--deps/v8/src/compiler/code-assembler.h146
1 files changed, 70 insertions, 76 deletions
diff --git a/deps/v8/src/compiler/code-assembler.h b/deps/v8/src/compiler/code-assembler.h
index 5d5cb5e00d..166257d5ec 100644
--- a/deps/v8/src/compiler/code-assembler.h
+++ b/deps/v8/src/compiler/code-assembler.h
@@ -7,6 +7,7 @@
#include <map>
#include <memory>
+#include <initializer_list>
// Clients of this interface shouldn't depend on lots of compiler internals.
// Do not include anything from src/compiler here!
@@ -23,11 +24,13 @@
#include "src/objects/heap-number.h"
#include "src/objects/js-array-buffer.h"
#include "src/objects/js-collection.h"
+#include "src/objects/js-proxy.h"
#include "src/objects/map.h"
#include "src/objects/maybe-object.h"
#include "src/objects/oddball.h"
#include "src/runtime/runtime.h"
#include "src/source-position.h"
+#include "src/type-traits.h"
#include "src/zone/zone-containers.h"
namespace v8 {
@@ -104,6 +107,18 @@ struct Int32T : Word32T {
struct Uint32T : Word32T {
static constexpr MachineType kMachineType = MachineType::Uint32();
};
+struct Int16T : Int32T {
+ static constexpr MachineType kMachineType = MachineType::Int16();
+};
+struct Uint16T : Uint32T {
+ static constexpr MachineType kMachineType = MachineType::Uint16();
+};
+struct Int8T : Int16T {
+ static constexpr MachineType kMachineType = MachineType::Int8();
+};
+struct Uint8T : Uint16T {
+ static constexpr MachineType kMachineType = MachineType::Uint8();
+};
struct Word64T : IntegralT {
static const MachineRepresentation kMachineRepresentation =
@@ -362,9 +377,9 @@ class RawMachineAssembler;
class RawMachineLabel;
class SourcePositionTable;
-typedef ZoneVector<CodeAssemblerVariable*> CodeAssemblerVariableList;
+using CodeAssemblerVariableList = ZoneVector<CodeAssemblerVariable*>;
-typedef std::function<void()> CodeAssemblerCallback;
+using CodeAssemblerCallback = std::function<void()>;
template <class T, class U>
struct is_subtype {
@@ -699,13 +714,14 @@ class V8_EXPORT_PRIVATE CodeAssembler {
}
Node* function = code_assembler_->ExternalConstant(
ExternalReference::check_object_type());
- code_assembler_->CallCFunction3(
- MachineType::AnyTagged(), MachineType::AnyTagged(),
- MachineType::TaggedSigned(), MachineType::AnyTagged(), function,
- node_,
- code_assembler_->SmiConstant(
- static_cast<int>(ObjectTypeOf<A>::value)),
- code_assembler_->StringConstant(location_));
+ code_assembler_->CallCFunction(
+ function, MachineType::AnyTagged(),
+ std::make_pair(MachineType::AnyTagged(), node_),
+ std::make_pair(MachineType::TaggedSigned(),
+ code_assembler_->SmiConstant(
+ static_cast<int>(ObjectTypeOf<A>::value))),
+ std::make_pair(MachineType::AnyTagged(),
+ code_assembler_->StringConstant(location_)));
}
#endif
return TNode<A>::UncheckedCast(node_);
@@ -942,6 +958,7 @@ class V8_EXPORT_PRIVATE CodeAssembler {
// Store value to raw memory location.
Node* Store(Node* base, Node* value);
Node* Store(Node* base, Node* offset, Node* value);
+ Node* StoreEphemeronKey(Node* base, Node* offset, Node* value);
Node* StoreNoWriteBarrier(MachineRepresentation rep, Node* base, Node* value);
Node* StoreNoWriteBarrier(MachineRepresentation rep, Node* base, Node* offset,
Node* value);
@@ -953,7 +970,7 @@ class V8_EXPORT_PRIVATE CodeAssembler {
// Optimized memory operations that map to Turbofan simplified nodes.
TNode<HeapObject> OptimizedAllocate(TNode<IntPtrT> size,
- PretenureFlag pretenure);
+ AllocationType allocation);
void OptimizedStoreField(MachineRepresentation rep, TNode<HeapObject> object,
int offset, Node* value,
WriteBarrierKind write_barrier);
@@ -1167,6 +1184,10 @@ class V8_EXPORT_PRIVATE CodeAssembler {
// Projections
Node* Projection(int index, Node* value);
+ // Pointer compression and decompression.
+ Node* ChangeTaggedToCompressed(Node* tagged);
+ Node* ChangeCompressedToTagged(Node* compressed);
+
template <int index, class T1, class T2>
TNode<typename std::tuple_element<index, std::tuple<T1, T2>>::type>
Projection(TNode<PairT<T1, T2>> value) {
@@ -1325,64 +1346,30 @@ class V8_EXPORT_PRIVATE CodeAssembler {
Node* CallCFunctionN(Signature<MachineType>* signature, int input_count,
Node* const* inputs);
- // Call to a C function with one argument.
- Node* CallCFunction1(MachineType return_type, MachineType arg0_type,
- Node* function, Node* arg0);
-
- // Call to a C function with one argument, while saving/restoring caller
- // registers except the register used for return value.
- Node* CallCFunction1WithCallerSavedRegisters(MachineType return_type,
- MachineType arg0_type,
- Node* function, Node* arg0,
- SaveFPRegsMode mode);
-
- // Call to a C function with two arguments.
- Node* CallCFunction2(MachineType return_type, MachineType arg0_type,
- MachineType arg1_type, Node* function, Node* arg0,
- Node* arg1);
-
- // Call to a C function with three arguments.
- Node* CallCFunction3(MachineType return_type, MachineType arg0_type,
- MachineType arg1_type, MachineType arg2_type,
- Node* function, Node* arg0, Node* arg1, Node* arg2);
-
- // Call to a C function with three arguments, while saving/restoring caller
- // registers except the register used for return value.
- Node* CallCFunction3WithCallerSavedRegisters(
- MachineType return_type, MachineType arg0_type, MachineType arg1_type,
- MachineType arg2_type, Node* function, Node* arg0, Node* arg1, Node* arg2,
- SaveFPRegsMode mode);
-
- // Call to a C function with four arguments.
- Node* CallCFunction4(MachineType return_type, MachineType arg0_type,
- MachineType arg1_type, MachineType arg2_type,
- MachineType arg3_type, Node* function, Node* arg0,
- Node* arg1, Node* arg2, Node* arg3);
-
- // Call to a C function with five arguments.
- Node* CallCFunction5(MachineType return_type, MachineType arg0_type,
- MachineType arg1_type, MachineType arg2_type,
- MachineType arg3_type, MachineType arg4_type,
- Node* function, Node* arg0, Node* arg1, Node* arg2,
- Node* arg3, Node* arg4);
-
- // Call to a C function with six arguments.
- Node* CallCFunction6(MachineType return_type, MachineType arg0_type,
- MachineType arg1_type, MachineType arg2_type,
- MachineType arg3_type, MachineType arg4_type,
- MachineType arg5_type, Node* function, Node* arg0,
- Node* arg1, Node* arg2, Node* arg3, Node* arg4,
- Node* arg5);
-
- // Call to a C function with nine arguments.
- Node* CallCFunction9(MachineType return_type, MachineType arg0_type,
- MachineType arg1_type, MachineType arg2_type,
- MachineType arg3_type, MachineType arg4_type,
- MachineType arg5_type, MachineType arg6_type,
- MachineType arg7_type, MachineType arg8_type,
- Node* function, Node* arg0, Node* arg1, Node* arg2,
- Node* arg3, Node* arg4, Node* arg5, Node* arg6,
- Node* arg7, Node* arg8);
+ // Type representing C function argument with type info.
+ using CFunctionArg = std::pair<MachineType, Node*>;
+
+ // Call to a C function.
+ template <class... CArgs>
+ Node* CallCFunction(Node* function, MachineType return_type, CArgs... cargs) {
+ static_assert(v8::internal::conjunction<
+ std::is_convertible<CArgs, CFunctionArg>...>::value,
+ "invalid argument types");
+ return CallCFunction(function, return_type, {cargs...});
+ }
+
+ // Call to a C function, while saving/restoring caller registers.
+ template <class... CArgs>
+ Node* CallCFunctionWithCallerSavedRegisters(Node* function,
+ MachineType return_type,
+ SaveFPRegsMode mode,
+ CArgs... cargs) {
+ static_assert(v8::internal::conjunction<
+ std::is_convertible<CArgs, CFunctionArg>...>::value,
+ "invalid argument types");
+ return CallCFunctionWithCallerSavedRegisters(function, return_type, mode,
+ {cargs...});
+ }
// Exception handling support.
void GotoIfException(Node* node, Label* if_exception,
@@ -1416,6 +1403,13 @@ class V8_EXPORT_PRIVATE CodeAssembler {
private:
void HandleException(Node* result);
+ Node* CallCFunction(Node* function, MachineType return_type,
+ std::initializer_list<CFunctionArg> args);
+
+ Node* CallCFunctionWithCallerSavedRegisters(
+ Node* function, MachineType return_type, SaveFPRegsMode mode,
+ std::initializer_list<CFunctionArg> args);
+
TNode<Object> CallRuntimeImpl(Runtime::FunctionId function,
TNode<Object> context,
std::initializer_list<TNode<Object>> args);
@@ -1463,7 +1457,7 @@ class V8_EXPORT_PRIVATE CodeAssembler {
DISALLOW_COPY_AND_ASSIGN(CodeAssembler);
};
-class CodeAssemblerVariable {
+class V8_EXPORT_PRIVATE CodeAssemblerVariable {
public:
explicit CodeAssemblerVariable(CodeAssembler* assembler,
MachineRepresentation rep);
@@ -1533,7 +1527,7 @@ class TypedCodeAssemblerVariable : public CodeAssemblerVariable {
using CodeAssemblerVariable::Bind;
};
-class CodeAssemblerLabel {
+class V8_EXPORT_PRIVATE CodeAssemblerLabel {
public:
enum Type { kDeferred, kNonDeferred };
@@ -1649,8 +1643,8 @@ class CodeAssemblerParameterizedLabel
}
};
-typedef CodeAssemblerParameterizedLabel<Object>
- CodeAssemblerExceptionHandlerLabel;
+using CodeAssemblerExceptionHandlerLabel =
+ CodeAssemblerParameterizedLabel<Object>;
class V8_EXPORT_PRIVATE CodeAssemblerState {
public:
@@ -1705,7 +1699,7 @@ class V8_EXPORT_PRIVATE CodeAssemblerState {
CodeAssemblerCallback call_prologue_;
CodeAssemblerCallback call_epilogue_;
std::vector<CodeAssemblerExceptionHandlerLabel*> exception_handler_labels_;
- typedef uint32_t VariableId;
+ using VariableId = uint32_t;
VariableId next_variable_id_ = 0;
VariableId NextVariableId() { return next_variable_id_++; }
@@ -1713,7 +1707,7 @@ class V8_EXPORT_PRIVATE CodeAssemblerState {
DISALLOW_COPY_AND_ASSIGN(CodeAssemblerState);
};
-class CodeAssemblerScopedExceptionHandler {
+class V8_EXPORT_PRIVATE CodeAssemblerScopedExceptionHandler {
public:
CodeAssemblerScopedExceptionHandler(
CodeAssembler* assembler, CodeAssemblerExceptionHandlerLabel* label);
@@ -1737,9 +1731,9 @@ class CodeAssemblerScopedExceptionHandler {
} // namespace compiler
#if defined(V8_HOST_ARCH_32_BIT)
-typedef Smi BInt;
+using BInt = Smi;
#elif defined(V8_HOST_ARCH_64_BIT)
-typedef IntPtrT BInt;
+using BInt = IntPtrT;
#else
#error Unknown architecture.
#endif