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 4499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4510 LOperand* output = instr->result(); | 4510 LOperand* output = instr->result(); |
4511 ASSERT(output->IsDoubleRegister()); | 4511 ASSERT(output->IsDoubleRegister()); |
4512 if (input->IsRegister()) { | 4512 if (input->IsRegister()) { |
4513 __ Cvtlsi2sd(ToDoubleRegister(output), ToRegister(input)); | 4513 __ Cvtlsi2sd(ToDoubleRegister(output), ToRegister(input)); |
4514 } else { | 4514 } else { |
4515 __ Cvtlsi2sd(ToDoubleRegister(output), ToOperand(input)); | 4515 __ Cvtlsi2sd(ToDoubleRegister(output), ToOperand(input)); |
4516 } | 4516 } |
4517 } | 4517 } |
4518 | 4518 |
4519 | 4519 |
4520 void LCodeGen::DoInteger32ToSmi(LInteger32ToSmi* instr) { | |
4521 LOperand* input = instr->value(); | |
4522 ASSERT(input->IsRegister()); | |
4523 LOperand* output = instr->result(); | |
4524 __ Integer32ToSmi(ToRegister(output), ToRegister(input)); | |
4525 if (!instr->hydrogen()->value()->HasRange() || | |
4526 !instr->hydrogen()->value()->range()->IsInSmiRange()) { | |
4527 DeoptimizeIf(overflow, instr->environment()); | |
4528 } | |
4529 } | |
4530 | |
4531 | |
4532 void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) { | 4520 void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) { |
4533 LOperand* input = instr->value(); | 4521 LOperand* input = instr->value(); |
4534 LOperand* output = instr->result(); | 4522 LOperand* output = instr->result(); |
4535 LOperand* temp = instr->temp(); | 4523 LOperand* temp = instr->temp(); |
4536 | 4524 |
4537 __ LoadUint32(ToDoubleRegister(output), | 4525 __ LoadUint32(ToDoubleRegister(output), |
4538 ToRegister(input), | 4526 ToRegister(input), |
4539 ToDoubleRegister(temp)); | 4527 ToDoubleRegister(temp)); |
4540 } | 4528 } |
4541 | 4529 |
4542 | 4530 |
4543 void LCodeGen::DoUint32ToSmi(LUint32ToSmi* instr) { | |
4544 LOperand* input = instr->value(); | |
4545 ASSERT(input->IsRegister()); | |
4546 LOperand* output = instr->result(); | |
4547 if (!instr->hydrogen()->value()->HasRange() || | |
4548 !instr->hydrogen()->value()->range()->IsInSmiRange() || | |
4549 instr->hydrogen()->value()->range()->upper() == kMaxInt) { | |
4550 // The Range class can't express upper bounds in the (kMaxInt, kMaxUint32] | |
4551 // interval, so we treat kMaxInt as a sentinel for this entire interval. | |
4552 __ testl(ToRegister(input), Immediate(0x80000000)); | |
4553 DeoptimizeIf(not_zero, instr->environment()); | |
4554 } | |
4555 __ Integer32ToSmi(ToRegister(output), ToRegister(input)); | |
4556 } | |
4557 | |
4558 | |
4559 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { | 4531 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { |
4560 LOperand* input = instr->value(); | 4532 LOperand* input = instr->value(); |
4561 ASSERT(input->IsRegister() && input->Equals(instr->result())); | 4533 ASSERT(input->IsRegister() && input->Equals(instr->result())); |
4562 Register reg = ToRegister(input); | 4534 Register reg = ToRegister(input); |
4563 | 4535 |
4564 __ Integer32ToSmi(reg, reg); | 4536 __ Integer32ToSmi(reg, reg); |
4565 } | 4537 } |
4566 | 4538 |
4567 | 4539 |
4568 void LCodeGen::DoNumberTagU(LNumberTagU* instr) { | 4540 void LCodeGen::DoNumberTagU(LNumberTagU* instr) { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4683 __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); | 4655 __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); |
4684 RecordSafepointWithRegisters( | 4656 RecordSafepointWithRegisters( |
4685 instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); | 4657 instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); |
4686 __ movp(kScratchRegister, rax); | 4658 __ movp(kScratchRegister, rax); |
4687 } | 4659 } |
4688 __ movp(reg, kScratchRegister); | 4660 __ movp(reg, kScratchRegister); |
4689 } | 4661 } |
4690 | 4662 |
4691 | 4663 |
4692 void LCodeGen::DoSmiTag(LSmiTag* instr) { | 4664 void LCodeGen::DoSmiTag(LSmiTag* instr) { |
4693 ASSERT(instr->value()->Equals(instr->result())); | 4665 HChange* hchange = instr->hydrogen(); |
4694 Register input = ToRegister(instr->value()); | 4666 Register input = ToRegister(instr->value()); |
4695 ASSERT(!instr->hydrogen_value()->CheckFlag(HValue::kCanOverflow)); | 4667 Register output = ToRegister(instr->result()); |
4696 __ Integer32ToSmi(input, input); | 4668 if (hchange->CheckFlag(HValue::kCanOverflow) && |
| 4669 hchange->value()->CheckFlag(HValue::kUint32)) { |
| 4670 __ testl(input, Immediate(0x80000000)); |
| 4671 DeoptimizeIf(not_zero, instr->environment()); |
| 4672 } |
| 4673 __ Integer32ToSmi(output, input); |
| 4674 if (hchange->CheckFlag(HValue::kCanOverflow) && |
| 4675 !hchange->value()->CheckFlag(HValue::kUint32)) { |
| 4676 DeoptimizeIf(overflow, instr->environment()); |
| 4677 } |
4697 } | 4678 } |
4698 | 4679 |
4699 | 4680 |
4700 void LCodeGen::DoSmiUntag(LSmiUntag* instr) { | 4681 void LCodeGen::DoSmiUntag(LSmiUntag* instr) { |
4701 ASSERT(instr->value()->Equals(instr->result())); | 4682 ASSERT(instr->value()->Equals(instr->result())); |
4702 Register input = ToRegister(instr->value()); | 4683 Register input = ToRegister(instr->value()); |
4703 if (instr->needs_check()) { | 4684 if (instr->needs_check()) { |
4704 Condition is_smi = __ CheckSmi(input); | 4685 Condition is_smi = __ CheckSmi(input); |
4705 DeoptimizeIf(NegateCondition(is_smi), instr->environment()); | 4686 DeoptimizeIf(NegateCondition(is_smi), instr->environment()); |
4706 } else { | 4687 } else { |
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5653 FixedArray::kHeaderSize - kPointerSize)); | 5634 FixedArray::kHeaderSize - kPointerSize)); |
5654 __ bind(&done); | 5635 __ bind(&done); |
5655 } | 5636 } |
5656 | 5637 |
5657 | 5638 |
5658 #undef __ | 5639 #undef __ |
5659 | 5640 |
5660 } } // namespace v8::internal | 5641 } } // namespace v8::internal |
5661 | 5642 |
5662 #endif // V8_TARGET_ARCH_X64 | 5643 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |