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

Side by Side Diff: test/unittests/compiler/linkage-tail-call-unittest.cc

Issue 2124023003: [turbofan] Add MachineType to LinkageLocation (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 5 months 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 unified diff | Download patch
OLDNEW
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
11 namespace v8 { 11 namespace v8 {
12 namespace internal { 12 namespace internal {
13 namespace compiler { 13 namespace compiler {
14 14
15 namespace { 15 namespace {
16 16
17 MachineType kMachineTypes[] = { 17 MachineType kMachineTypes[] = {
18 MachineType::AnyTagged(), MachineType::AnyTagged(), 18 MachineType::AnyTagged(), MachineType::AnyTagged(),
19 MachineType::AnyTagged(), MachineType::AnyTagged(), 19 MachineType::AnyTagged(), MachineType::AnyTagged(),
20 MachineType::AnyTagged(), MachineType::AnyTagged(), 20 MachineType::AnyTagged(), MachineType::AnyTagged(),
21 MachineType::AnyTagged(), MachineType::AnyTagged()}; 21 MachineType::AnyTagged(), MachineType::AnyTagged()};
22 } 22 }
23 23
24 class LinkageTailCall : public TestWithZone { 24 class LinkageTailCall : public TestWithZone {
25 protected: 25 protected:
26 CallDescriptor* NewStandardCallDescriptor(LocationSignature* locations) { 26 CallDescriptor* NewStandardCallDescriptor(LocationSignature* locations) {
27 DCHECK(arraysize(kMachineTypes) >= 27 DCHECK(arraysize(kMachineTypes) >=
28 locations->return_count() + locations->parameter_count()); 28 locations->return_count() + locations->parameter_count());
29 MachineSignature* types = new (zone()) MachineSignature( 29 return new (zone()) CallDescriptor(
30 locations->return_count(), locations->parameter_count(), kMachineTypes); 30 CallDescriptor::kCallCodeObject, MachineType::AnyTagged(),
31 return new (zone()) CallDescriptor(CallDescriptor::kCallCodeObject, 31 LinkageLocation::ForAnyRegister(MachineType::Pointer()),
32 MachineType::AnyTagged(), 32 locations, // location_sig
33 LinkageLocation::ForAnyRegister(), 33 0, // js_parameter_count
34 types, // machine_sig 34 Operator::kNoProperties, // properties
35 locations, // location_sig 35 0, // callee-saved
36 0, // js_parameter_count 36 0, // callee-saved fp
37 Operator::kNoProperties, // properties 37 CallDescriptor::kNoFlags, // flags,
38 0, // callee-saved 38 "");
39 0, // callee-saved fp
40 CallDescriptor::kNoFlags, // flags,
41 "");
42 } 39 }
43 40
44 LinkageLocation StackLocation(int loc) { 41 LinkageLocation StackLocation(int loc) {
45 return LinkageLocation::ForCallerFrameSlot(-loc); 42 return LinkageLocation::ForCallerFrameSlot(-loc, MachineType::Pointer());
46 } 43 }
47 44
48 LinkageLocation RegisterLocation(int loc) { 45 LinkageLocation RegisterLocation(int loc) {
49 return LinkageLocation::ForRegister(loc); 46 return LinkageLocation::ForRegister(loc, MachineType::Pointer());
50 } 47 }
51 }; 48 };
52 49
53 50
54 TEST_F(LinkageTailCall, EmptyToEmpty) { 51 TEST_F(LinkageTailCall, EmptyToEmpty) {
55 LocationSignature locations(0, 0, nullptr); 52 LocationSignature locations(0, 0, nullptr);
56 CallDescriptor* desc = NewStandardCallDescriptor(&locations); 53 CallDescriptor* desc = NewStandardCallDescriptor(&locations);
57 CommonOperatorBuilder common(zone()); 54 CommonOperatorBuilder common(zone());
58 const Operator* op = common.Call(desc); 55 const Operator* op = common.Call(desc);
59 Node* const node = Node::New(zone(), 1, op, 0, nullptr, false); 56 Node* const node = Node::New(zone(), 1, op, 0, nullptr, false);
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 Node* const node = 340 Node* const node =
344 Node::New(zone(), 1, op, arraysize(parameters), parameters, false); 341 Node::New(zone(), 1, op, arraysize(parameters), parameters, false);
345 int stack_param_delta = 0; 342 int stack_param_delta = 0;
346 EXPECT_TRUE(desc1->CanTailCall(node, &stack_param_delta)); 343 EXPECT_TRUE(desc1->CanTailCall(node, &stack_param_delta));
347 EXPECT_EQ(1, stack_param_delta); 344 EXPECT_EQ(1, stack_param_delta);
348 } 345 }
349 346
350 } // namespace compiler 347 } // namespace compiler
351 } // namespace internal 348 } // namespace internal
352 } // namespace v8 349 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/instruction-selector-unittest.h ('k') | test/unittests/compiler/tail-call-optimization-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698