| 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 4665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4676 DeoptimizeIf(NegateCondition(is_smi), instr->environment()); | 4676 DeoptimizeIf(NegateCondition(is_smi), instr->environment()); |
| 4677 } else { | 4677 } else { |
| 4678 __ AssertSmi(input); | 4678 __ AssertSmi(input); |
| 4679 } | 4679 } |
| 4680 __ SmiToInteger32(input, input); | 4680 __ SmiToInteger32(input, input); |
| 4681 } | 4681 } |
| 4682 | 4682 |
| 4683 | 4683 |
| 4684 void LCodeGen::EmitNumberUntagD(Register input_reg, | 4684 void LCodeGen::EmitNumberUntagD(Register input_reg, |
| 4685 XMMRegister result_reg, | 4685 XMMRegister result_reg, |
| 4686 bool deoptimize_on_undefined, | 4686 bool allow_undefined_as_nan, |
| 4687 bool deoptimize_on_minus_zero, | 4687 bool deoptimize_on_minus_zero, |
| 4688 LEnvironment* env, | 4688 LEnvironment* env, |
| 4689 NumberUntagDMode mode) { | 4689 NumberUntagDMode mode) { |
| 4690 Label load_smi, done; | 4690 Label load_smi, done; |
| 4691 | 4691 |
| 4692 STATIC_ASSERT(NUMBER_CANDIDATE_IS_ANY_TAGGED_CONVERT_HOLE > | 4692 STATIC_ASSERT(NUMBER_CANDIDATE_IS_ANY_TAGGED_CONVERT_HOLE > |
| 4693 NUMBER_CANDIDATE_IS_ANY_TAGGED); | 4693 NUMBER_CANDIDATE_IS_ANY_TAGGED); |
| 4694 if (mode >= NUMBER_CANDIDATE_IS_ANY_TAGGED) { | 4694 if (mode >= NUMBER_CANDIDATE_IS_ANY_TAGGED) { |
| 4695 // Smi check. | 4695 // Smi check. |
| 4696 __ JumpIfSmi(input_reg, &load_smi, Label::kNear); | 4696 __ JumpIfSmi(input_reg, &load_smi, Label::kNear); |
| 4697 | 4697 |
| 4698 // Heap number map check. | 4698 // Heap number map check. |
| 4699 __ CompareRoot(FieldOperand(input_reg, HeapObject::kMapOffset), | 4699 __ CompareRoot(FieldOperand(input_reg, HeapObject::kMapOffset), |
| 4700 Heap::kHeapNumberMapRootIndex); | 4700 Heap::kHeapNumberMapRootIndex); |
| 4701 if (deoptimize_on_undefined) { | 4701 if (!allow_undefined_as_nan) { |
| 4702 DeoptimizeIf(not_equal, env); | 4702 DeoptimizeIf(not_equal, env); |
| 4703 } else { | 4703 } else { |
| 4704 Label heap_number, convert; | 4704 Label heap_number, convert; |
| 4705 __ j(equal, &heap_number, Label::kNear); | 4705 __ j(equal, &heap_number, Label::kNear); |
| 4706 | 4706 |
| 4707 // Convert undefined (and hole) to NaN. Compute NaN as 0/0. | 4707 // Convert undefined (and hole) to NaN. Compute NaN as 0/0. |
| 4708 __ CompareRoot(input_reg, Heap::kUndefinedValueRootIndex); | 4708 __ CompareRoot(input_reg, Heap::kUndefinedValueRootIndex); |
| 4709 if (mode == NUMBER_CANDIDATE_IS_ANY_TAGGED_CONVERT_HOLE) { | 4709 if (mode == NUMBER_CANDIDATE_IS_ANY_TAGGED_CONVERT_HOLE) { |
| 4710 __ j(equal, &convert, Label::kNear); | 4710 __ j(equal, &convert, Label::kNear); |
| 4711 __ CompareRoot(input_reg, Heap::kTheHoleValueRootIndex); | 4711 __ CompareRoot(input_reg, Heap::kTheHoleValueRootIndex); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4827 if (value->type().IsSmi()) { | 4827 if (value->type().IsSmi()) { |
| 4828 mode = NUMBER_CANDIDATE_IS_SMI; | 4828 mode = NUMBER_CANDIDATE_IS_SMI; |
| 4829 } else if (value->IsLoadKeyed()) { | 4829 } else if (value->IsLoadKeyed()) { |
| 4830 HLoadKeyed* load = HLoadKeyed::cast(value); | 4830 HLoadKeyed* load = HLoadKeyed::cast(value); |
| 4831 if (load->UsesMustHandleHole()) { | 4831 if (load->UsesMustHandleHole()) { |
| 4832 mode = NUMBER_CANDIDATE_IS_ANY_TAGGED_CONVERT_HOLE; | 4832 mode = NUMBER_CANDIDATE_IS_ANY_TAGGED_CONVERT_HOLE; |
| 4833 } | 4833 } |
| 4834 } | 4834 } |
| 4835 | 4835 |
| 4836 EmitNumberUntagD(input_reg, result_reg, | 4836 EmitNumberUntagD(input_reg, result_reg, |
| 4837 instr->hydrogen()->deoptimize_on_undefined(), | 4837 instr->hydrogen()->allow_undefined_as_nan(), |
| 4838 instr->hydrogen()->deoptimize_on_minus_zero(), | 4838 instr->hydrogen()->deoptimize_on_minus_zero(), |
| 4839 instr->environment(), | 4839 instr->environment(), |
| 4840 mode); | 4840 mode); |
| 4841 } | 4841 } |
| 4842 | 4842 |
| 4843 | 4843 |
| 4844 void LCodeGen::DoDoubleToI(LDoubleToI* instr) { | 4844 void LCodeGen::DoDoubleToI(LDoubleToI* instr) { |
| 4845 LOperand* input = instr->value(); | 4845 LOperand* input = instr->value(); |
| 4846 ASSERT(input->IsDoubleRegister()); | 4846 ASSERT(input->IsDoubleRegister()); |
| 4847 LOperand* result = instr->result(); | 4847 LOperand* result = instr->result(); |
| (...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5693 FixedArray::kHeaderSize - kPointerSize)); | 5693 FixedArray::kHeaderSize - kPointerSize)); |
| 5694 __ bind(&done); | 5694 __ bind(&done); |
| 5695 } | 5695 } |
| 5696 | 5696 |
| 5697 | 5697 |
| 5698 #undef __ | 5698 #undef __ |
| 5699 | 5699 |
| 5700 } } // namespace v8::internal | 5700 } } // namespace v8::internal |
| 5701 | 5701 |
| 5702 #endif // V8_TARGET_ARCH_X64 | 5702 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |