Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1436)

Unified Diff: test/cctest/compiler/test-run-native-calls.cc

Issue 2586903002: [turbofan] Avoid allocation of temporary array of Nodes when generating calls. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/raw-machine-assembler.cc ('k') | test/unittests/compiler/instruction-selector-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/compiler/test-run-native-calls.cc
diff --git a/test/cctest/compiler/test-run-native-calls.cc b/test/cctest/compiler/test-run-native-calls.cc
index 89629ec09016384d543e0ba6c52a7ef6cddcb84a..e877d258b53434b775e3dd4d77f92e3f9b6878ee 100644
--- a/test/cctest/compiler/test-run-native-calls.cc
+++ b/test/cctest/compiler/test-run-native-calls.cc
@@ -458,12 +458,14 @@ class Computer {
CallDescriptor* cdesc = Linkage::GetSimplifiedCDescriptor(&zone, &csig);
RawMachineAssembler raw(isolate, &graph, cdesc);
Node* target = raw.HeapConstant(inner);
- Node** args = zone.NewArray<Node*>(num_params);
+ Node** inputs = zone.NewArray<Node*>(num_params + 1);
+ int input_count = 0;
+ inputs[input_count++] = target;
for (int i = 0; i < num_params; i++) {
- args[i] = io.MakeConstant(raw, io.input[i]);
+ inputs[input_count++] = io.MakeConstant(raw, io.input[i]);
}
- Node* call = raw.CallN(desc, target, args);
+ Node* call = raw.CallN(desc, input_count, inputs);
Node* store = io.StoreOutput(raw, call);
USE(store);
raw.Return(raw.Int32Constant(seed));
@@ -491,12 +493,14 @@ class Computer {
RawMachineAssembler raw(isolate, &graph, cdesc);
Node* base = raw.PointerConstant(io.input);
Node* target = raw.HeapConstant(inner);
- Node** args = zone.NewArray<Node*>(kMaxParamCount);
+ Node** inputs = zone.NewArray<Node*>(kMaxParamCount + 1);
+ int input_count = 0;
+ inputs[input_count++] = target;
for (int i = 0; i < num_params; i++) {
- args[i] = io.LoadInput(raw, base, i);
+ inputs[input_count++] = io.LoadInput(raw, base, i);
}
- Node* call = raw.CallN(desc, target, args);
+ Node* call = raw.CallN(desc, input_count, inputs);
Node* store = io.StoreOutput(raw, call);
USE(store);
raw.Return(raw.Int32Constant(seed));
@@ -588,13 +592,15 @@ static void CopyTwentyInt32(CallDescriptor* desc) {
RawMachineAssembler raw(isolate, &graph, cdesc);
Node* base = raw.PointerConstant(input);
Node* target = raw.HeapConstant(inner);
- Node** args = zone.NewArray<Node*>(kNumParams);
+ Node** inputs = zone.NewArray<Node*>(kNumParams + 1);
+ int input_count = 0;
+ inputs[input_count++] = target;
for (int i = 0; i < kNumParams; i++) {
Node* offset = raw.Int32Constant(i * sizeof(int32_t));
- args[i] = raw.Load(MachineType::Int32(), base, offset);
+ inputs[input_count++] = raw.Load(MachineType::Int32(), base, offset);
}
- Node* call = raw.CallN(desc, target, args);
+ Node* call = raw.CallN(desc, input_count, inputs);
raw.Return(call);
wrapper =
CompileGraph("CopyTwentyInt32-wrapper", cdesc, &graph, raw.Export());
@@ -970,12 +976,14 @@ static void Build_Select_With_Call(CallDescriptor* desc,
{
// Build a call to the function that does the select.
Node* target = raw.HeapConstant(inner);
- Node** args = raw.zone()->NewArray<Node*>(num_params);
+ Node** inputs = raw.zone()->NewArray<Node*>(num_params + 1);
+ int input_count = 0;
+ inputs[input_count++] = target;
for (int i = 0; i < num_params; i++) {
- args[i] = raw.Parameter(i);
+ inputs[input_count++] = raw.Parameter(i);
}
- Node* call = raw.CallN(desc, target, args);
+ Node* call = raw.CallN(desc, input_count, inputs);
raw.Return(call);
}
}
@@ -1075,7 +1083,9 @@ void MixedParamTest(int start) {
CallDescriptor* cdesc = Linkage::GetSimplifiedCDescriptor(&zone, &csig);
RawMachineAssembler raw(isolate, &graph, cdesc);
Node* target = raw.HeapConstant(select);
- Node** args = zone.NewArray<Node*>(num_params);
+ Node** inputs = zone.NewArray<Node*>(num_params + 1);
+ int input_count = 0;
+ inputs[input_count++] = target;
int64_t constant = 0x0102030405060708;
for (int i = 0; i < num_params; i++) {
MachineType param_type = sig->GetParam(i);
@@ -1102,11 +1112,11 @@ void MixedParamTest(int start) {
}
CHECK_NOT_NULL(konst);
- args[i] = konst;
+ inputs[input_count++] = konst;
constant += 0x1010101010101010;
}
- Node* call = raw.CallN(desc, target, args);
+ Node* call = raw.CallN(desc, input_count, inputs);
Node* store =
raw.StoreToPointer(output, sig->GetReturn().representation(), call);
USE(store);
@@ -1178,14 +1188,16 @@ void TestStackSlot(MachineType slot_type, T expected) {
BufferedRawMachineAssemblerTester<T> f(slot_type);
Node* target = f.HeapConstant(inner);
Node* stack_slot = f.StackSlot(slot_type.representation());
- Node* args[12];
+ Node* nodes[14];
+ int input_count = 0;
+ nodes[input_count++] = target;
for (int i = 0; i < 10; i++) {
- args[i] = f.Int32Constant(i);
+ nodes[input_count++] = f.Int32Constant(i);
}
- args[10] = f.Parameter(0);
- args[11] = stack_slot;
+ nodes[input_count++] = f.Parameter(0);
+ nodes[input_count++] = stack_slot;
- f.CallN(desc, target, args);
+ f.CallN(desc, input_count, nodes);
f.Return(f.Load(slot_type, stack_slot, f.IntPtrConstant(0)));
CHECK_EQ(expected, f.Call(expected));
« no previous file with comments | « src/compiler/raw-machine-assembler.cc ('k') | test/unittests/compiler/instruction-selector-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698