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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 if (gp_offset < gp_count) { | 147 if (gp_offset < gp_count) { |
148 return LinkageLocation::ForRegister(gp_regs[gp_offset++]); | 148 return LinkageLocation::ForRegister(gp_regs[gp_offset++]); |
149 } else { | 149 } else { |
150 int offset = -1 - stack_offset; | 150 int offset = -1 - stack_offset; |
151 stack_offset += StackWords(type); | 151 stack_offset += StackWords(type); |
152 return LinkageLocation::ForCallerFrameSlot(offset); | 152 return LinkageLocation::ForCallerFrameSlot(offset); |
153 } | 153 } |
154 } | 154 } |
155 } | 155 } |
156 int StackWords(MachineType type) { | 156 int StackWords(MachineType type) { |
157 // TODO(titzer): hack. float32 occupies 8 bytes on stack. | 157 int size = 1 << ElementSizeLog2Of(type.representation()); |
158 int size = IsFloatingPoint(type.representation()) | |
159 ? kDoubleSize | |
160 : (1 << ElementSizeLog2Of(type.representation())); | |
161 return size <= kPointerSize ? 1 : size / kPointerSize; | 158 return size <= kPointerSize ? 1 : size / kPointerSize; |
162 } | 159 } |
163 void Reset() { | 160 void Reset() { |
164 fp_offset = 0; | 161 fp_offset = 0; |
165 gp_offset = 0; | 162 gp_offset = 0; |
166 stack_offset = 0; | 163 stack_offset = 0; |
167 } | 164 } |
168 }; | 165 }; |
169 | 166 |
170 | 167 |
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1258 TestStackSlot(MachineType::Float32(), magic); | 1255 TestStackSlot(MachineType::Float32(), magic); |
1259 } | 1256 } |
1260 | 1257 |
1261 TEST(RunStackSlotFloat64) { | 1258 TEST(RunStackSlotFloat64) { |
1262 double magic = 3456.375; | 1259 double magic = 3456.375; |
1263 TestStackSlot(MachineType::Float64(), magic); | 1260 TestStackSlot(MachineType::Float64(), magic); |
1264 } | 1261 } |
1265 } // namespace compiler | 1262 } // namespace compiler |
1266 } // namespace internal | 1263 } // namespace internal |
1267 } // namespace v8 | 1264 } // namespace v8 |
OLD | NEW |