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

Side by Side Diff: test/cctest/compiler/test-multiple-return.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
« no previous file with comments | « src/compiler/x87/instruction-selector-x87.cc ('k') | test/cctest/compiler/test-run-machops.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <cmath> 5 #include <cmath>
6 #include <functional> 6 #include <functional>
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/assembler.h" 9 #include "src/assembler.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
11 #include "src/base/utils/random-number-generator.h" 11 #include "src/base/utils/random-number-generator.h"
12 #include "src/codegen.h" 12 #include "src/codegen.h"
13 #include "src/compiler.h" 13 #include "src/compiler.h"
14 #include "src/compiler/linkage.h" 14 #include "src/compiler/linkage.h"
15 #include "src/macro-assembler.h" 15 #include "src/macro-assembler.h"
16 #include "test/cctest/cctest.h" 16 #include "test/cctest/cctest.h"
17 #include "test/cctest/compiler/codegen-tester.h" 17 #include "test/cctest/compiler/codegen-tester.h"
18 #include "test/cctest/compiler/value-helper.h" 18 #include "test/cctest/compiler/value-helper.h"
19 19
20 namespace v8 { 20 namespace v8 {
21 namespace internal { 21 namespace internal {
22 namespace compiler { 22 namespace compiler {
23 23
24 namespace { 24 namespace {
25 25
26 CallDescriptor* GetCallDescriptor(Zone* zone, int return_count, 26 CallDescriptor* GetCallDescriptor(Zone* zone, int return_count,
27 int param_count) { 27 int param_count) {
28 MachineSignature::Builder msig(zone, return_count, param_count);
29 LocationSignature::Builder locations(zone, return_count, param_count); 28 LocationSignature::Builder locations(zone, return_count, param_count);
30 const RegisterConfiguration* config = RegisterConfiguration::Turbofan(); 29 const RegisterConfiguration* config = RegisterConfiguration::Turbofan();
31 30
32 // Add return location(s). 31 // Add return location(s).
33 CHECK(return_count <= config->num_allocatable_general_registers()); 32 CHECK(return_count <= config->num_allocatable_general_registers());
34 for (int i = 0; i < return_count; i++) { 33 for (int i = 0; i < return_count; i++) {
35 msig.AddReturn(MachineType::Int32()); 34 locations.AddReturn(LinkageLocation::ForRegister(
36 locations.AddReturn( 35 config->allocatable_general_codes()[i], MachineType::AnyTagged()));
37 LinkageLocation::ForRegister(config->allocatable_general_codes()[i]));
38 } 36 }
39 37
40 // Add register and/or stack parameter(s). 38 // Add register and/or stack parameter(s).
41 CHECK(param_count <= config->num_allocatable_general_registers()); 39 CHECK(param_count <= config->num_allocatable_general_registers());
42 for (int i = 0; i < param_count; i++) { 40 for (int i = 0; i < param_count; i++) {
43 msig.AddParam(MachineType::Int32()); 41 locations.AddParam(LinkageLocation::ForRegister(
44 locations.AddParam( 42 config->allocatable_general_codes()[i], MachineType::AnyTagged()));
45 LinkageLocation::ForRegister(config->allocatable_general_codes()[i]));
46 } 43 }
47 44
48 const RegList kCalleeSaveRegisters = 0; 45 const RegList kCalleeSaveRegisters = 0;
49 const RegList kCalleeSaveFPRegisters = 0; 46 const RegList kCalleeSaveFPRegisters = 0;
50 47
51 // The target for WASM calls is always a code object. 48 // The target for WASM calls is always a code object.
52 MachineType target_type = MachineType::AnyTagged(); 49 MachineType target_type = MachineType::AnyTagged();
53 LinkageLocation target_loc = LinkageLocation::ForAnyRegister(); 50 LinkageLocation target_loc = LinkageLocation::ForAnyRegister();
54 return new (zone) CallDescriptor( // -- 51 return new (zone) CallDescriptor( // --
55 CallDescriptor::kCallCodeObject, // kind 52 CallDescriptor::kCallCodeObject, // kind
56 target_type, // target MachineType 53 target_type, // target MachineType
57 target_loc, // target location 54 target_loc, // target location
58 msig.Build(), // machine_sig
59 locations.Build(), // location_sig 55 locations.Build(), // location_sig
60 0, // js_parameter_count 56 0, // js_parameter_count
61 compiler::Operator::kNoProperties, // properties 57 compiler::Operator::kNoProperties, // properties
62 kCalleeSaveRegisters, // callee-saved registers 58 kCalleeSaveRegisters, // callee-saved registers
63 kCalleeSaveFPRegisters, // callee-saved fp regs 59 kCalleeSaveFPRegisters, // callee-saved fp regs
64 CallDescriptor::kNoFlags, // flags 60 CallDescriptor::kNoFlags, // flags
65 "c-call"); 61 "c-call");
66 } 62 }
67 } // namespace 63 } // namespace
68 64
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 OFStream os(stdout); 106 OFStream os(stdout);
111 code2->Disassemble("three_value_call", os); 107 code2->Disassemble("three_value_call", os);
112 } 108 }
113 #endif 109 #endif
114 CHECK_EQ((123 + 456) + (123 - 456) + (123 * 456), mt.Call()); 110 CHECK_EQ((123 + 456) + (123 - 456) + (123 * 456), mt.Call());
115 } 111 }
116 112
117 } // namespace compiler 113 } // namespace compiler
118 } // namespace internal 114 } // namespace internal
119 } // namespace v8 115 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/x87/instruction-selector-x87.cc ('k') | test/cctest/compiler/test-run-machops.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698