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 "src/compiler/code-generator.h" | 5 #include "src/compiler/code-generator.h" |
6 | 6 |
7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/compiler/code-generator-impl.h" | 8 #include "src/compiler/code-generator-impl.h" |
9 #include "src/compiler/gap-resolver.h" | 9 #include "src/compiler/gap-resolver.h" |
10 #include "src/compiler/node-matchers.h" | 10 #include "src/compiler/node-matchers.h" |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 __ PrepareCallCFunction(0, 2, kScratchReg); \ | 430 __ PrepareCallCFunction(0, 2, kScratchReg); \ |
431 __ MovToFloatParameters(i.InputDoubleRegister(0), \ | 431 __ MovToFloatParameters(i.InputDoubleRegister(0), \ |
432 i.InputDoubleRegister(1)); \ | 432 i.InputDoubleRegister(1)); \ |
433 __ CallCFunction(ExternalReference::mod_two_doubles_operation(isolate()), \ | 433 __ CallCFunction(ExternalReference::mod_two_doubles_operation(isolate()), \ |
434 0, 2); \ | 434 0, 2); \ |
435 __ MovFromFloatResult(i.OutputDoubleRegister()); \ | 435 __ MovFromFloatResult(i.OutputDoubleRegister()); \ |
436 DCHECK_EQ(LeaveRC, i.OutputRCBit()); \ | 436 DCHECK_EQ(LeaveRC, i.OutputRCBit()); \ |
437 } while (0) | 437 } while (0) |
438 | 438 |
439 | 439 |
| 440 #define ASSEMBLE_FLOAT_LOG() \ |
| 441 do { \ |
| 442 FrameScope scope(masm(), StackFrame::MANUAL); \ |
| 443 __ PrepareCallCFunction(0, 1, kScratchReg); \ |
| 444 __ MovToFloatParameter(i.InputDoubleRegister(0)); \ |
| 445 __ CallCFunction(ExternalReference::math_log_double_function(isolate()), \ |
| 446 0, 1); \ |
| 447 __ MovFromFloatResult(i.OutputDoubleRegister()); \ |
| 448 DCHECK_EQ(LeaveRC, i.OutputRCBit()); \ |
| 449 } while (0) |
| 450 |
440 #define ASSEMBLE_FLOAT_MAX(scratch_reg) \ | 451 #define ASSEMBLE_FLOAT_MAX(scratch_reg) \ |
441 do { \ | 452 do { \ |
442 __ fsub(scratch_reg, i.InputDoubleRegister(0), i.InputDoubleRegister(1)); \ | 453 __ fsub(scratch_reg, i.InputDoubleRegister(0), i.InputDoubleRegister(1)); \ |
443 __ fsel(i.OutputDoubleRegister(), scratch_reg, i.InputDoubleRegister(0), \ | 454 __ fsel(i.OutputDoubleRegister(), scratch_reg, i.InputDoubleRegister(0), \ |
444 i.InputDoubleRegister(1)); \ | 455 i.InputDoubleRegister(1)); \ |
445 } while (0) | 456 } while (0) |
446 | 457 |
447 | 458 |
448 #define ASSEMBLE_FLOAT_MIN(scratch_reg) \ | 459 #define ASSEMBLE_FLOAT_MIN(scratch_reg) \ |
449 do { \ | 460 do { \ |
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1222 #if V8_TARGET_ARCH_PPC64 | 1233 #if V8_TARGET_ARCH_PPC64 |
1223 case kPPC_ModU64: | 1234 case kPPC_ModU64: |
1224 ASSEMBLE_MODULO(divdu, mulld); | 1235 ASSEMBLE_MODULO(divdu, mulld); |
1225 break; | 1236 break; |
1226 #endif | 1237 #endif |
1227 case kPPC_ModDouble: | 1238 case kPPC_ModDouble: |
1228 // TODO(bmeurer): We should really get rid of this special instruction, | 1239 // TODO(bmeurer): We should really get rid of this special instruction, |
1229 // and generate a CallAddress instruction instead. | 1240 // and generate a CallAddress instruction instead. |
1230 ASSEMBLE_FLOAT_MODULO(); | 1241 ASSEMBLE_FLOAT_MODULO(); |
1231 break; | 1242 break; |
| 1243 case kPPC_LogDouble: |
| 1244 // TODO(bmeurer): We should really get rid of this special instruction, |
| 1245 // and generate a CallAddress instruction instead. |
| 1246 ASSEMBLE_FLOAT_LOG(); |
| 1247 break; |
1232 case kPPC_Neg: | 1248 case kPPC_Neg: |
1233 __ neg(i.OutputRegister(), i.InputRegister(0), LeaveOE, i.OutputRCBit()); | 1249 __ neg(i.OutputRegister(), i.InputRegister(0), LeaveOE, i.OutputRCBit()); |
1234 break; | 1250 break; |
1235 case kPPC_MaxDouble: | 1251 case kPPC_MaxDouble: |
1236 ASSEMBLE_FLOAT_MAX(kScratchDoubleReg); | 1252 ASSEMBLE_FLOAT_MAX(kScratchDoubleReg); |
1237 break; | 1253 break; |
1238 case kPPC_MinDouble: | 1254 case kPPC_MinDouble: |
1239 ASSEMBLE_FLOAT_MIN(kScratchDoubleReg); | 1255 ASSEMBLE_FLOAT_MIN(kScratchDoubleReg); |
1240 break; | 1256 break; |
1241 case kPPC_AbsDouble: | 1257 case kPPC_AbsDouble: |
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2114 padding_size -= v8::internal::Assembler::kInstrSize; | 2130 padding_size -= v8::internal::Assembler::kInstrSize; |
2115 } | 2131 } |
2116 } | 2132 } |
2117 } | 2133 } |
2118 | 2134 |
2119 #undef __ | 2135 #undef __ |
2120 | 2136 |
2121 } // namespace compiler | 2137 } // namespace compiler |
2122 } // namespace internal | 2138 } // namespace internal |
2123 } // namespace v8 | 2139 } // namespace v8 |
OLD | NEW |