OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/assembler.h" | 5 #include "src/assembler.h" |
6 #include "src/codegen.h" | 6 #include "src/codegen.h" |
7 #include "src/compiler/linkage.h" | 7 #include "src/compiler/linkage.h" |
8 #include "src/compiler/raw-machine-assembler.h" | 8 #include "src/compiler/raw-machine-assembler.h" |
9 #include "src/machine-type.h" | 9 #include "src/machine-type.h" |
10 #include "src/register-configuration.h" | 10 #include "src/register-configuration.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 RegisterPairs() | 80 RegisterPairs() |
81 : Pairs(100, GetRegConfig()->num_allocatable_general_registers(), | 81 : Pairs(100, GetRegConfig()->num_allocatable_general_registers(), |
82 GetRegConfig()->allocatable_general_codes()) {} | 82 GetRegConfig()->allocatable_general_codes()) {} |
83 }; | 83 }; |
84 | 84 |
85 | 85 |
86 // Pairs of double registers. | 86 // Pairs of double registers. |
87 class Float32RegisterPairs : public Pairs { | 87 class Float32RegisterPairs : public Pairs { |
88 public: | 88 public: |
89 Float32RegisterPairs() | 89 Float32RegisterPairs() |
90 : Pairs( | 90 : Pairs(100, GetRegConfig()->num_allocatable_aliased_double_registers(), |
91 100, | 91 GetRegConfig()->allocatable_double_codes()) {} |
92 #if V8_TARGET_ARCH_ARM | |
93 // TODO(bbudge) Modify wasm linkage to allow use of all float regs. | |
94 GetRegConfig()->num_allocatable_double_registers() / 2 - 2, | |
95 #else | |
96 GetRegConfig()->num_allocatable_double_registers(), | |
97 #endif | |
98 GetRegConfig()->allocatable_double_codes()) { | |
99 } | |
100 }; | 92 }; |
101 | 93 |
102 | 94 |
103 // Pairs of double registers. | 95 // Pairs of double registers. |
104 class Float64RegisterPairs : public Pairs { | 96 class Float64RegisterPairs : public Pairs { |
105 public: | 97 public: |
106 Float64RegisterPairs() | 98 Float64RegisterPairs() |
107 : Pairs(100, GetRegConfig()->num_allocatable_double_registers(), | 99 : Pairs(100, GetRegConfig()->num_allocatable_double_registers(), |
108 GetRegConfig()->allocatable_double_codes()) {} | 100 GetRegConfig()->allocatable_double_codes()) {} |
109 }; | 101 }; |
(...skipping 18 matching lines...) Expand all Loading... |
128 int fp_offset; | 120 int fp_offset; |
129 int* fp_regs; | 121 int* fp_regs; |
130 | 122 |
131 int stack_offset; | 123 int stack_offset; |
132 | 124 |
133 LinkageLocation Next(MachineType type) { | 125 LinkageLocation Next(MachineType type) { |
134 if (IsFloatingPoint(type.representation())) { | 126 if (IsFloatingPoint(type.representation())) { |
135 // Allocate a floating point register/stack location. | 127 // Allocate a floating point register/stack location. |
136 if (fp_offset < fp_count) { | 128 if (fp_offset < fp_count) { |
137 int code = fp_regs[fp_offset++]; | 129 int code = fp_regs[fp_offset++]; |
138 #if V8_TARGET_ARCH_ARM | |
139 // TODO(bbudge) Modify wasm linkage to allow use of all float regs. | |
140 if (type.representation() == MachineRepresentation::kFloat32) code *= 2; | |
141 #endif | |
142 return LinkageLocation::ForRegister(code, type); | 130 return LinkageLocation::ForRegister(code, type); |
143 } else { | 131 } else { |
144 int offset = -1 - stack_offset; | 132 int offset = -1 - stack_offset; |
145 stack_offset += StackWords(type); | 133 stack_offset += StackWords(type); |
146 return LinkageLocation::ForCallerFrameSlot(offset, type); | 134 return LinkageLocation::ForCallerFrameSlot(offset, type); |
147 } | 135 } |
148 } else { | 136 } else { |
149 // Allocate a general purpose register/stack location. | 137 // Allocate a general purpose register/stack location. |
150 if (gp_offset < gp_count) { | 138 if (gp_offset < gp_count) { |
151 return LinkageLocation::ForRegister(gp_regs[gp_offset++], type); | 139 return LinkageLocation::ForRegister(gp_regs[gp_offset++], type); |
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1203 TestStackSlot(MachineType::Float32(), magic); | 1191 TestStackSlot(MachineType::Float32(), magic); |
1204 } | 1192 } |
1205 | 1193 |
1206 TEST(RunStackSlotFloat64) { | 1194 TEST(RunStackSlotFloat64) { |
1207 double magic = 3456.375; | 1195 double magic = 3456.375; |
1208 TestStackSlot(MachineType::Float64(), magic); | 1196 TestStackSlot(MachineType::Float64(), magic); |
1209 } | 1197 } |
1210 } // namespace compiler | 1198 } // namespace compiler |
1211 } // namespace internal | 1199 } // namespace internal |
1212 } // namespace v8 | 1200 } // namespace v8 |
OLD | NEW |