| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 ->allocatable_general_codes()) {} | 84 ->allocatable_general_codes()) {} |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 | 87 |
| 88 // Pairs of double registers. | 88 // Pairs of double registers. |
| 89 class Float32RegisterPairs : public Pairs { | 89 class Float32RegisterPairs : public Pairs { |
| 90 public: | 90 public: |
| 91 Float32RegisterPairs() | 91 Float32RegisterPairs() |
| 92 : Pairs( | 92 : Pairs( |
| 93 100, | 93 100, |
| 94 #if V8_TARGET_ARCH_ARM |
| 95 // TODO(bbudge) Modify wasm linkage to allow use of all float regs. |
| 94 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) | 96 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) |
| 95 ->num_allocatable_aliased_double_registers(), | 97 ->num_allocatable_double_registers() / |
| 98 2 - |
| 99 2, |
| 100 #else |
| 96 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) | 101 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) |
| 97 ->allocatable_double_codes()) {} | 102 ->num_allocatable_double_registers(), |
| 103 #endif |
| 104 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) |
| 105 ->allocatable_double_codes()) { |
| 106 } |
| 98 }; | 107 }; |
| 99 | 108 |
| 100 | 109 |
| 101 // Pairs of double registers. | 110 // Pairs of double registers. |
| 102 class Float64RegisterPairs : public Pairs { | 111 class Float64RegisterPairs : public Pairs { |
| 103 public: | 112 public: |
| 104 Float64RegisterPairs() | 113 Float64RegisterPairs() |
| 105 : Pairs( | 114 : Pairs( |
| 106 100, | 115 100, |
| 107 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) | 116 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) |
| 108 ->num_allocatable_aliased_double_registers(), | 117 ->num_allocatable_double_registers(), |
| 109 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) | 118 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) |
| 110 ->allocatable_double_codes()) {} | 119 ->allocatable_double_codes()) {} |
| 111 }; | 120 }; |
| 112 | 121 |
| 113 | 122 |
| 114 // Helper for allocating either an GP or FP reg, or the next stack slot. | 123 // Helper for allocating either an GP or FP reg, or the next stack slot. |
| 115 struct Allocator { | 124 struct Allocator { |
| 116 Allocator(int* gp, int gpc, int* fp, int fpc) | 125 Allocator(int* gp, int gpc, int* fp, int fpc) |
| 117 : gp_count(gpc), | 126 : gp_count(gpc), |
| 118 gp_offset(0), | 127 gp_offset(0), |
| (...skipping 10 matching lines...) Expand all Loading... |
| 129 int fp_count; | 138 int fp_count; |
| 130 int fp_offset; | 139 int fp_offset; |
| 131 int* fp_regs; | 140 int* fp_regs; |
| 132 | 141 |
| 133 int stack_offset; | 142 int stack_offset; |
| 134 | 143 |
| 135 LinkageLocation Next(MachineType type) { | 144 LinkageLocation Next(MachineType type) { |
| 136 if (IsFloatingPoint(type.representation())) { | 145 if (IsFloatingPoint(type.representation())) { |
| 137 // Allocate a floating point register/stack location. | 146 // Allocate a floating point register/stack location. |
| 138 if (fp_offset < fp_count) { | 147 if (fp_offset < fp_count) { |
| 139 return LinkageLocation::ForRegister(fp_regs[fp_offset++]); | 148 int code = fp_regs[fp_offset++]; |
| 149 #if V8_TARGET_ARCH_ARM |
| 150 // TODO(bbudge) Modify wasm linkage to allow use of all float regs. |
| 151 if (type.representation() == MachineRepresentation::kFloat32) code *= 2; |
| 152 #endif |
| 153 return LinkageLocation::ForRegister(code); |
| 140 } else { | 154 } else { |
| 141 int offset = -1 - stack_offset; | 155 int offset = -1 - stack_offset; |
| 142 stack_offset += StackWords(type); | 156 stack_offset += StackWords(type); |
| 143 return LinkageLocation::ForCallerFrameSlot(offset); | 157 return LinkageLocation::ForCallerFrameSlot(offset); |
| 144 } | 158 } |
| 145 } else { | 159 } else { |
| 146 // Allocate a general purpose register/stack location. | 160 // Allocate a general purpose register/stack location. |
| 147 if (gp_offset < gp_count) { | 161 if (gp_offset < gp_count) { |
| 148 return LinkageLocation::ForRegister(gp_regs[gp_offset++]); | 162 return LinkageLocation::ForRegister(gp_regs[gp_offset++]); |
| 149 } else { | 163 } else { |
| (...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1255 TestStackSlot(MachineType::Float32(), magic); | 1269 TestStackSlot(MachineType::Float32(), magic); |
| 1256 } | 1270 } |
| 1257 | 1271 |
| 1258 TEST(RunStackSlotFloat64) { | 1272 TEST(RunStackSlotFloat64) { |
| 1259 double magic = 3456.375; | 1273 double magic = 3456.375; |
| 1260 TestStackSlot(MachineType::Float64(), magic); | 1274 TestStackSlot(MachineType::Float64(), magic); |
| 1261 } | 1275 } |
| 1262 } // namespace compiler | 1276 } // namespace compiler |
| 1263 } // namespace internal | 1277 } // namespace internal |
| 1264 } // namespace v8 | 1278 } // namespace v8 |
| OLD | NEW |