OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/common-operator.h" | 5 #include "src/compiler/common-operator.h" |
6 #include "src/compiler/graph.h" | 6 #include "src/compiler/graph.h" |
7 #include "src/compiler/linkage.h" | 7 #include "src/compiler/linkage.h" |
8 #include "src/compiler/node.h" | 8 #include "src/compiler/node.h" |
9 #include "test/unittests/test-utils.h" | 9 #include "test/unittests/test-utils.h" |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 class LinkageTailCall : public TestWithZone { | 22 class LinkageTailCall : public TestWithZone { |
23 protected: | 23 protected: |
24 CallDescriptor* NewStandardCallDescriptor(LocationSignature* locations) { | 24 CallDescriptor* NewStandardCallDescriptor(LocationSignature* locations) { |
25 DCHECK(arraysize(kMachineTypes) >= | 25 DCHECK(arraysize(kMachineTypes) >= |
26 locations->return_count() + locations->parameter_count()); | 26 locations->return_count() + locations->parameter_count()); |
27 MachineSignature* types = new (zone()) MachineSignature( | 27 MachineSignature* types = new (zone()) MachineSignature( |
28 locations->return_count(), locations->parameter_count(), kMachineTypes); | 28 locations->return_count(), locations->parameter_count(), kMachineTypes); |
29 return new (zone()) | 29 return new (zone()) |
30 CallDescriptor(CallDescriptor::kCallCodeObject, kMachAnyTagged, | 30 CallDescriptor(CallDescriptor::kCallCodeObject, kMachAnyTagged, |
31 LinkageLocation::AnyRegister(), | 31 LinkageLocation::ForAnyRegister(), |
32 types, // machine_sig | 32 types, // machine_sig |
33 locations, // location_sig | 33 locations, // location_sig |
34 0, // js_parameter_count | 34 0, // js_parameter_count |
35 Operator::kNoProperties, // properties | 35 Operator::kNoProperties, // properties |
36 0, // callee-saved | 36 0, // callee-saved |
37 0, // callee-saved fp | 37 0, // callee-saved fp |
38 CallDescriptor::kNoFlags, // flags, | 38 CallDescriptor::kNoFlags, // flags, |
39 ""); | 39 ""); |
40 } | 40 } |
41 | 41 |
42 LinkageLocation StackLocation(int loc) { return LinkageLocation(-loc); } | 42 LinkageLocation StackLocation(int loc) { |
| 43 return LinkageLocation::ForCallerFrameSlot(-loc); |
| 44 } |
43 | 45 |
44 LinkageLocation RegisterLocation(int loc) { return LinkageLocation(loc); } | 46 LinkageLocation RegisterLocation(int loc) { |
| 47 return LinkageLocation::ForRegister(loc); |
| 48 } |
45 }; | 49 }; |
46 | 50 |
47 | 51 |
48 TEST_F(LinkageTailCall, EmptyToEmpty) { | 52 TEST_F(LinkageTailCall, EmptyToEmpty) { |
49 LocationSignature locations(0, 0, nullptr); | 53 LocationSignature locations(0, 0, nullptr); |
50 CallDescriptor* desc = NewStandardCallDescriptor(&locations); | 54 CallDescriptor* desc = NewStandardCallDescriptor(&locations); |
51 CommonOperatorBuilder common(zone()); | 55 CommonOperatorBuilder common(zone()); |
52 const Operator* op = common.Call(desc); | 56 const Operator* op = common.Call(desc); |
53 Node* const node = Node::New(zone(), 1, op, 0, nullptr, false); | 57 Node* const node = Node::New(zone(), 1, op, 0, nullptr, false); |
54 EXPECT_TRUE(desc->CanTailCall(node)); | 58 EXPECT_TRUE(desc->CanTailCall(node)); |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 Node* parameters[] = {p0, p1, p2, p3, p4}; | 315 Node* parameters[] = {p0, p1, p2, p3, p4}; |
312 const Operator* op = common.Call(desc2); | 316 const Operator* op = common.Call(desc2); |
313 Node* const node = | 317 Node* const node = |
314 Node::New(zone(), 1, op, arraysize(parameters), parameters, false); | 318 Node::New(zone(), 1, op, arraysize(parameters), parameters, false); |
315 EXPECT_FALSE(desc1->CanTailCall(node)); | 319 EXPECT_FALSE(desc1->CanTailCall(node)); |
316 } | 320 } |
317 | 321 |
318 } // namespace compiler | 322 } // namespace compiler |
319 } // namespace internal | 323 } // namespace internal |
320 } // namespace v8 | 324 } // namespace v8 |
OLD | NEW |