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 <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); | 28 MachineSignature::Builder msig(zone, return_count, param_count); |
29 LocationSignature::Builder locations(zone, return_count, param_count); | 29 LocationSignature::Builder locations(zone, return_count, param_count); |
30 const RegisterConfiguration* config = | 30 const RegisterConfiguration* config = RegisterConfiguration::Turbofan(); |
31 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN); | |
32 | 31 |
33 // Add return location(s). | 32 // Add return location(s). |
34 CHECK(return_count <= config->num_allocatable_general_registers()); | 33 CHECK(return_count <= config->num_allocatable_general_registers()); |
35 for (int i = 0; i < return_count; i++) { | 34 for (int i = 0; i < return_count; i++) { |
36 msig.AddReturn(MachineType::Int32()); | 35 msig.AddReturn(MachineType::Int32()); |
37 locations.AddReturn( | 36 locations.AddReturn( |
38 LinkageLocation::ForRegister(config->allocatable_general_codes()[i])); | 37 LinkageLocation::ForRegister(config->allocatable_general_codes()[i])); |
39 } | 38 } |
40 | 39 |
41 // Add register and/or stack parameter(s). | 40 // Add register and/or stack parameter(s). |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 OFStream os(stdout); | 110 OFStream os(stdout); |
112 code2->Disassemble("three_value_call", os); | 111 code2->Disassemble("three_value_call", os); |
113 } | 112 } |
114 #endif | 113 #endif |
115 CHECK_EQ((123 + 456) + (123 - 456) + (123 * 456), mt.Call()); | 114 CHECK_EQ((123 + 456) + (123 - 456) + (123 * 456), mt.Call()); |
116 } | 115 } |
117 | 116 |
118 } // namespace compiler | 117 } // namespace compiler |
119 } // namespace internal | 118 } // namespace internal |
120 } // namespace v8 | 119 } // namespace v8 |
OLD | NEW |