| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 3610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3621 if (instr->needs_check()) { | 3621 if (instr->needs_check()) { |
| 3622 __ test(ToRegister(input), Immediate(kSmiTagMask)); | 3622 __ test(ToRegister(input), Immediate(kSmiTagMask)); |
| 3623 DeoptimizeIf(not_zero, instr->environment()); | 3623 DeoptimizeIf(not_zero, instr->environment()); |
| 3624 } | 3624 } |
| 3625 __ SmiUntag(ToRegister(input)); | 3625 __ SmiUntag(ToRegister(input)); |
| 3626 } | 3626 } |
| 3627 | 3627 |
| 3628 | 3628 |
| 3629 void LCodeGen::EmitNumberUntagD(Register input_reg, | 3629 void LCodeGen::EmitNumberUntagD(Register input_reg, |
| 3630 XMMRegister result_reg, | 3630 XMMRegister result_reg, |
| 3631 bool deoptimize_on_undefined, |
| 3631 LEnvironment* env) { | 3632 LEnvironment* env) { |
| 3632 Label load_smi, heap_number, done; | 3633 Label load_smi, done; |
| 3633 | 3634 |
| 3634 // Smi check. | 3635 // Smi check. |
| 3635 __ test(input_reg, Immediate(kSmiTagMask)); | 3636 __ test(input_reg, Immediate(kSmiTagMask)); |
| 3636 __ j(zero, &load_smi, Label::kNear); | 3637 __ j(zero, &load_smi, Label::kNear); |
| 3637 | 3638 |
| 3638 // Heap number map check. | 3639 // Heap number map check. |
| 3639 __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), | 3640 __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), |
| 3640 factory()->heap_number_map()); | 3641 factory()->heap_number_map()); |
| 3641 __ j(equal, &heap_number, Label::kNear); | 3642 if (deoptimize_on_undefined) { |
| 3643 DeoptimizeIf(not_equal, env); |
| 3644 } else { |
| 3645 Label heap_number; |
| 3646 __ j(equal, &heap_number, Label::kNear); |
| 3642 | 3647 |
| 3643 __ cmp(input_reg, factory()->undefined_value()); | 3648 __ cmp(input_reg, factory()->undefined_value()); |
| 3644 DeoptimizeIf(not_equal, env); | 3649 DeoptimizeIf(not_equal, env); |
| 3645 | 3650 |
| 3646 // Convert undefined to NaN. | 3651 // Convert undefined to NaN. |
| 3647 ExternalReference nan = ExternalReference::address_of_nan(); | 3652 ExternalReference nan = ExternalReference::address_of_nan(); |
| 3648 __ movdbl(result_reg, Operand::StaticVariable(nan)); | 3653 __ movdbl(result_reg, Operand::StaticVariable(nan)); |
| 3649 __ jmp(&done, Label::kNear); | 3654 __ jmp(&done, Label::kNear); |
| 3650 | 3655 |
| 3656 __ bind(&heap_number); |
| 3657 } |
| 3651 // Heap number to XMM conversion. | 3658 // Heap number to XMM conversion. |
| 3652 __ bind(&heap_number); | |
| 3653 __ movdbl(result_reg, FieldOperand(input_reg, HeapNumber::kValueOffset)); | 3659 __ movdbl(result_reg, FieldOperand(input_reg, HeapNumber::kValueOffset)); |
| 3654 __ jmp(&done, Label::kNear); | 3660 __ jmp(&done, Label::kNear); |
| 3655 | 3661 |
| 3656 // Smi to XMM conversion | 3662 // Smi to XMM conversion |
| 3657 __ bind(&load_smi); | 3663 __ bind(&load_smi); |
| 3658 __ SmiUntag(input_reg); // Untag smi before converting to float. | 3664 __ SmiUntag(input_reg); // Untag smi before converting to float. |
| 3659 __ cvtsi2sd(result_reg, Operand(input_reg)); | 3665 __ cvtsi2sd(result_reg, Operand(input_reg)); |
| 3660 __ SmiTag(input_reg); // Retag smi. | 3666 __ SmiTag(input_reg); // Retag smi. |
| 3661 __ bind(&done); | 3667 __ bind(&done); |
| 3662 } | 3668 } |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3774 | 3780 |
| 3775 void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) { | 3781 void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) { |
| 3776 LOperand* input = instr->InputAt(0); | 3782 LOperand* input = instr->InputAt(0); |
| 3777 ASSERT(input->IsRegister()); | 3783 ASSERT(input->IsRegister()); |
| 3778 LOperand* result = instr->result(); | 3784 LOperand* result = instr->result(); |
| 3779 ASSERT(result->IsDoubleRegister()); | 3785 ASSERT(result->IsDoubleRegister()); |
| 3780 | 3786 |
| 3781 Register input_reg = ToRegister(input); | 3787 Register input_reg = ToRegister(input); |
| 3782 XMMRegister result_reg = ToDoubleRegister(result); | 3788 XMMRegister result_reg = ToDoubleRegister(result); |
| 3783 | 3789 |
| 3784 EmitNumberUntagD(input_reg, result_reg, instr->environment()); | 3790 EmitNumberUntagD(input_reg, result_reg, |
| 3791 instr->hydrogen()->deoptimize_on_undefined(), |
| 3792 instr->environment()); |
| 3785 } | 3793 } |
| 3786 | 3794 |
| 3787 | 3795 |
| 3788 void LCodeGen::DoDoubleToI(LDoubleToI* instr) { | 3796 void LCodeGen::DoDoubleToI(LDoubleToI* instr) { |
| 3789 LOperand* input = instr->InputAt(0); | 3797 LOperand* input = instr->InputAt(0); |
| 3790 ASSERT(input->IsDoubleRegister()); | 3798 ASSERT(input->IsDoubleRegister()); |
| 3791 LOperand* result = instr->result(); | 3799 LOperand* result = instr->result(); |
| 3792 ASSERT(result->IsRegister()); | 3800 ASSERT(result->IsRegister()); |
| 3793 | 3801 |
| 3794 XMMRegister input_reg = ToDoubleRegister(input); | 3802 XMMRegister input_reg = ToDoubleRegister(input); |
| (...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4458 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 4466 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 4459 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); | 4467 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); |
| 4460 } | 4468 } |
| 4461 | 4469 |
| 4462 | 4470 |
| 4463 #undef __ | 4471 #undef __ |
| 4464 | 4472 |
| 4465 } } // namespace v8::internal | 4473 } } // namespace v8::internal |
| 4466 | 4474 |
| 4467 #endif // V8_TARGET_ARCH_IA32 | 4475 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |