OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 2448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2459 // TODO(all): Implement TempFPRegister. | 2459 // TODO(all): Implement TempFPRegister. |
2460 LOperand* double_temp1 = FixedTemp(d24); // This was chosen arbitrarily. | 2460 LOperand* double_temp1 = FixedTemp(d24); // This was chosen arbitrarily. |
2461 LOperand* temp1 = TempRegister(); | 2461 LOperand* temp1 = TempRegister(); |
2462 LOperand* temp2 = TempRegister(); | 2462 LOperand* temp2 = TempRegister(); |
2463 LOperand* temp3 = TempRegister(); | 2463 LOperand* temp3 = TempRegister(); |
2464 LMathExp* result = new(zone()) LMathExp(input, double_temp1, | 2464 LMathExp* result = new(zone()) LMathExp(input, double_temp1, |
2465 temp1, temp2, temp3); | 2465 temp1, temp2, temp3); |
2466 return DefineAsRegister(result); | 2466 return DefineAsRegister(result); |
2467 } | 2467 } |
2468 case kMathFloor: { | 2468 case kMathFloor: { |
2469 ASSERT(instr->representation().IsInteger32()); | |
2470 ASSERT(instr->value()->representation().IsDouble()); | 2469 ASSERT(instr->value()->representation().IsDouble()); |
2471 // TODO(jbramley): ARM64 can easily handle a double argument with frintm, | |
2472 // but we're never asked for it here. At the moment, we fall back to the | |
2473 // runtime if the result doesn't fit, like the other architectures. | |
2474 LOperand* input = UseRegisterAtStart(instr->value()); | 2470 LOperand* input = UseRegisterAtStart(instr->value()); |
2475 LMathFloor* result = new(zone()) LMathFloor(input); | 2471 if (instr->representation().IsInteger32()) { |
2476 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); | 2472 LMathFloorI* result = new(zone()) LMathFloorI(input); |
| 2473 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); |
| 2474 } else { |
| 2475 ASSERT(instr->representation().IsDouble()); |
| 2476 LMathFloorD* result = new(zone()) LMathFloorD(input); |
| 2477 return DefineAsRegister(result); |
| 2478 } |
2477 } | 2479 } |
2478 case kMathLog: { | 2480 case kMathLog: { |
2479 ASSERT(instr->representation().IsDouble()); | 2481 ASSERT(instr->representation().IsDouble()); |
2480 ASSERT(instr->value()->representation().IsDouble()); | 2482 ASSERT(instr->value()->representation().IsDouble()); |
2481 LOperand* input = UseFixedDouble(instr->value(), d0); | 2483 LOperand* input = UseFixedDouble(instr->value(), d0); |
2482 LMathLog* result = new(zone()) LMathLog(input); | 2484 LMathLog* result = new(zone()) LMathLog(input); |
2483 return MarkAsCall(DefineFixedDouble(result, d0), instr); | 2485 return MarkAsCall(DefineFixedDouble(result, d0), instr); |
2484 } | 2486 } |
2485 case kMathPowHalf: { | 2487 case kMathPowHalf: { |
2486 ASSERT(instr->representation().IsDouble()); | 2488 ASSERT(instr->representation().IsDouble()); |
2487 ASSERT(instr->value()->representation().IsDouble()); | 2489 ASSERT(instr->value()->representation().IsDouble()); |
2488 LOperand* input = UseRegister(instr->value()); | 2490 LOperand* input = UseRegister(instr->value()); |
2489 return DefineAsRegister(new(zone()) LMathPowHalf(input)); | 2491 return DefineAsRegister(new(zone()) LMathPowHalf(input)); |
2490 } | 2492 } |
2491 case kMathRound: { | 2493 case kMathRound: { |
2492 ASSERT(instr->representation().IsInteger32()); | |
2493 ASSERT(instr->value()->representation().IsDouble()); | 2494 ASSERT(instr->value()->representation().IsDouble()); |
2494 // TODO(jbramley): As with kMathFloor, we can probably handle double | |
2495 // results fairly easily, but we are never asked for them. | |
2496 LOperand* input = UseRegister(instr->value()); | 2495 LOperand* input = UseRegister(instr->value()); |
2497 LOperand* temp = FixedTemp(d24); // Choosen arbitrarily. | 2496 if (instr->representation().IsInteger32()) { |
2498 LMathRound* result = new(zone()) LMathRound(input, temp); | 2497 LMathRoundI* result = new(zone()) LMathRoundI(input, FixedTemp(d24)); |
2499 return AssignEnvironment(DefineAsRegister(result)); | 2498 return AssignEnvironment(DefineAsRegister(result)); |
| 2499 } else { |
| 2500 ASSERT(instr->representation().IsDouble()); |
| 2501 LMathRoundD* result = |
| 2502 new(zone()) LMathRoundD(input, TempRegister()); |
| 2503 return DefineAsRegister(result); |
| 2504 } |
2500 } | 2505 } |
2501 case kMathSqrt: { | 2506 case kMathSqrt: { |
2502 ASSERT(instr->representation().IsDouble()); | 2507 ASSERT(instr->representation().IsDouble()); |
2503 ASSERT(instr->value()->representation().IsDouble()); | 2508 ASSERT(instr->value()->representation().IsDouble()); |
2504 LOperand* input = UseRegisterAtStart(instr->value()); | 2509 LOperand* input = UseRegisterAtStart(instr->value()); |
2505 return DefineAsRegister(new(zone()) LMathSqrt(input)); | 2510 return DefineAsRegister(new(zone()) LMathSqrt(input)); |
2506 } | 2511 } |
2507 case kMathClz32: { | 2512 case kMathClz32: { |
2508 ASSERT(instr->representation().IsInteger32()); | 2513 ASSERT(instr->representation().IsInteger32()); |
2509 ASSERT(instr->value()->representation().IsInteger32()); | 2514 ASSERT(instr->value()->representation().IsInteger32()); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2575 | 2580 |
2576 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { | 2581 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { |
2577 LOperand* receiver = UseRegister(instr->receiver()); | 2582 LOperand* receiver = UseRegister(instr->receiver()); |
2578 LOperand* function = UseRegister(instr->function()); | 2583 LOperand* function = UseRegister(instr->function()); |
2579 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); | 2584 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); |
2580 return AssignEnvironment(DefineAsRegister(result)); | 2585 return AssignEnvironment(DefineAsRegister(result)); |
2581 } | 2586 } |
2582 | 2587 |
2583 | 2588 |
2584 } } // namespace v8::internal | 2589 } } // namespace v8::internal |
OLD | NEW |