aboutsummaryrefslogtreecommitdiff
path: root/deps/v8/test/unittests/compiler/backend/instruction-selector-unittest.h
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/test/unittests/compiler/backend/instruction-selector-unittest.h')
-rw-r--r--deps/v8/test/unittests/compiler/backend/instruction-selector-unittest.h91
1 files changed, 49 insertions, 42 deletions
diff --git a/deps/v8/test/unittests/compiler/backend/instruction-selector-unittest.h b/deps/v8/test/unittests/compiler/backend/instruction-selector-unittest.h
index 3c4374101c..0ffe182e04 100644
--- a/deps/v8/test/unittests/compiler/backend/instruction-selector-unittest.h
+++ b/deps/v8/test/unittests/compiler/backend/instruction-selector-unittest.h
@@ -9,9 +9,9 @@
#include <set>
#include "src/base/utils/random-number-generator.h"
+#include "src/codegen/macro-assembler.h"
#include "src/compiler/backend/instruction-selector.h"
#include "src/compiler/raw-machine-assembler.h"
-#include "src/macro-assembler.h"
#include "test/unittests/test-utils.h"
namespace v8 {
@@ -88,6 +88,52 @@ class InstructionSelectorTest : public TestWithNativeContextAndZone {
const FrameStateFunctionInfo* GetFrameStateFunctionInfo(int parameter_count,
int local_count);
+ // Create a simple call descriptor for testing.
+ static CallDescriptor* MakeSimpleCallDescriptor(Zone* zone,
+ MachineSignature* msig) {
+ LocationSignature::Builder locations(zone, msig->return_count(),
+ msig->parameter_count());
+
+ // Add return location(s).
+ const int return_count = static_cast<int>(msig->return_count());
+ for (int i = 0; i < return_count; i++) {
+ locations.AddReturn(
+ LinkageLocation::ForCallerFrameSlot(-1 - i, msig->GetReturn(i)));
+ }
+
+ // Just put all parameters on the stack.
+ const int parameter_count = static_cast<int>(msig->parameter_count());
+ unsigned slot_index = -1;
+ for (int i = 0; i < parameter_count; i++) {
+ locations.AddParam(
+ LinkageLocation::ForCallerFrameSlot(slot_index, msig->GetParam(i)));
+
+ // Slots are kSystemPointerSize sized. This reserves enough for space
+ // for types that might be bigger, eg. Simd128.
+ slot_index -=
+ std::max(1, ElementSizeInBytes(msig->GetParam(i).representation()) /
+ kSystemPointerSize);
+ }
+
+ const RegList kCalleeSaveRegisters = 0;
+ const RegList kCalleeSaveFPRegisters = 0;
+
+ MachineType target_type = MachineType::Pointer();
+ LinkageLocation target_loc = LinkageLocation::ForAnyRegister();
+
+ return new (zone) CallDescriptor( // --
+ CallDescriptor::kCallAddress, // kind
+ target_type, // target MachineType
+ target_loc, // target location
+ locations.Build(), // location_sig
+ 0, // stack_parameter_count
+ Operator::kNoProperties, // properties
+ kCalleeSaveRegisters, // callee-saved registers
+ kCalleeSaveFPRegisters, // callee-saved fp regs
+ CallDescriptor::kCanUseRoots, // flags
+ "iselect-test-call");
+ }
+
private:
CallDescriptor* MakeCallDescriptor(Zone* zone, MachineType return_type) {
MachineSignature::Builder builder(zone, 1, 0);
@@ -125,46 +171,7 @@ class InstructionSelectorTest : public TestWithNativeContextAndZone {
return MakeSimpleCallDescriptor(zone, builder.Build());
}
- private:
InstructionSelectorTest* test_;
-
- // Create a simple call descriptor for testing.
- CallDescriptor* MakeSimpleCallDescriptor(Zone* zone,
- MachineSignature* msig) {
- LocationSignature::Builder locations(zone, msig->return_count(),
- msig->parameter_count());
-
- // Add return location(s).
- const int return_count = static_cast<int>(msig->return_count());
- for (int i = 0; i < return_count; i++) {
- locations.AddReturn(
- LinkageLocation::ForCallerFrameSlot(-1 - i, msig->GetReturn(i)));
- }
-
- // Just put all parameters on the stack.
- const int parameter_count = static_cast<int>(msig->parameter_count());
- for (int i = 0; i < parameter_count; i++) {
- locations.AddParam(
- LinkageLocation::ForCallerFrameSlot(-1 - i, msig->GetParam(i)));
- }
-
- const RegList kCalleeSaveRegisters = 0;
- const RegList kCalleeSaveFPRegisters = 0;
-
- MachineType target_type = MachineType::Pointer();
- LinkageLocation target_loc = LinkageLocation::ForAnyRegister();
- return new (zone) CallDescriptor( // --
- CallDescriptor::kCallAddress, // kind
- target_type, // target MachineType
- target_loc, // target location
- locations.Build(), // location_sig
- 0, // stack_parameter_count
- Operator::kNoProperties, // properties
- kCalleeSaveRegisters, // callee-saved registers
- kCalleeSaveFPRegisters, // callee-saved fp regs
- CallDescriptor::kCanUseRoots, // flags
- "iselect-test-call");
- }
};
class Stream final {
@@ -272,8 +279,8 @@ class InstructionSelectorTest : public TestWithNativeContextAndZone {
friend class StreamBuilder;
- typedef std::map<int, Constant> ConstantMap;
- typedef std::map<NodeId, int> VirtualRegisters;
+ using ConstantMap = std::map<int, Constant>;
+ using VirtualRegisters = std::map<NodeId, int>;
ConstantMap constants_;
ConstantMap immediates_;