OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 2686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2697 right_side.Unuse(); | 2697 right_side.Unuse(); |
2698 dest->Split(cc); | 2698 dest->Split(cc); |
2699 } | 2699 } |
2700 } else { | 2700 } else { |
2701 // Neither side is a constant Smi, constant 1-char string or constant null. | 2701 // Neither side is a constant Smi, constant 1-char string or constant null. |
2702 // If either side is a non-smi constant, or known to be a heap number skip | 2702 // If either side is a non-smi constant, or known to be a heap number skip |
2703 // the smi check. | 2703 // the smi check. |
2704 bool known_non_smi = | 2704 bool known_non_smi = |
2705 (left_side.is_constant() && !left_side.handle()->IsSmi()) || | 2705 (left_side.is_constant() && !left_side.handle()->IsSmi()) || |
2706 (right_side.is_constant() && !right_side.handle()->IsSmi()) || | 2706 (right_side.is_constant() && !right_side.handle()->IsSmi()) || |
2707 left_side.number_info().IsHeapNumber() || | 2707 left_side.number_info().IsDouble() || |
2708 right_side.number_info().IsHeapNumber(); | 2708 right_side.number_info().IsDouble(); |
2709 NaNInformation nan_info = | 2709 NaNInformation nan_info = |
2710 (CouldBeNaN(left_side) && CouldBeNaN(right_side)) ? | 2710 (CouldBeNaN(left_side) && CouldBeNaN(right_side)) ? |
2711 kBothCouldBeNaN : | 2711 kBothCouldBeNaN : |
2712 kCantBothBeNaN; | 2712 kCantBothBeNaN; |
2713 | 2713 |
2714 // Inline number comparison handling any combination of smi's and heap | 2714 // Inline number comparison handling any combination of smi's and heap |
2715 // numbers if: | 2715 // numbers if: |
2716 // code is in a loop | 2716 // code is in a loop |
2717 // the compare operation is different from equal | 2717 // the compare operation is different from equal |
2718 // compare is not a for-loop comparison | 2718 // compare is not a for-loop comparison |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2829 } | 2829 } |
2830 | 2830 |
2831 | 2831 |
2832 // Load a comparison operand to the FPU stack. This assumes that the operand has | 2832 // Load a comparison operand to the FPU stack. This assumes that the operand has |
2833 // already been checked and is a number. | 2833 // already been checked and is a number. |
2834 static void LoadComparisonOperand(MacroAssembler* masm_, | 2834 static void LoadComparisonOperand(MacroAssembler* masm_, |
2835 Result* operand, | 2835 Result* operand, |
2836 Result* left_side, | 2836 Result* left_side, |
2837 Result* right_side) { | 2837 Result* right_side) { |
2838 Label done; | 2838 Label done; |
2839 if (operand->number_info().IsHeapNumber()) { | 2839 if (operand->number_info().IsDouble()) { |
2840 // Operand is known to be a heap number, just load it. | 2840 // Operand is known to be a heap number, just load it. |
2841 __ fld_d(FieldOperand(operand->reg(), HeapNumber::kValueOffset)); | 2841 __ fld_d(FieldOperand(operand->reg(), HeapNumber::kValueOffset)); |
2842 } else if (operand->number_info().IsSmi()) { | 2842 } else if (operand->number_info().IsSmi()) { |
2843 // Operand is known to be a smi. Convert it to double and keep the original | 2843 // Operand is known to be a smi. Convert it to double and keep the original |
2844 // smi. | 2844 // smi. |
2845 __ SmiUntag(operand->reg()); | 2845 __ SmiUntag(operand->reg()); |
2846 __ push(operand->reg()); | 2846 __ push(operand->reg()); |
2847 __ fild_s(Operand(esp, 0)); | 2847 __ fild_s(Operand(esp, 0)); |
2848 __ pop(operand->reg()); | 2848 __ pop(operand->reg()); |
2849 __ SmiTag(operand->reg()); | 2849 __ SmiTag(operand->reg()); |
(...skipping 18 matching lines...) Expand all Loading... |
2868 | 2868 |
2869 // Load a comparison operand into into a XMM register. Jump to not_numbers jump | 2869 // Load a comparison operand into into a XMM register. Jump to not_numbers jump |
2870 // target passing the left and right result if the operand is not a number. | 2870 // target passing the left and right result if the operand is not a number. |
2871 static void LoadComparisonOperandSSE2(MacroAssembler* masm_, | 2871 static void LoadComparisonOperandSSE2(MacroAssembler* masm_, |
2872 Result* operand, | 2872 Result* operand, |
2873 XMMRegister reg, | 2873 XMMRegister reg, |
2874 Result* left_side, | 2874 Result* left_side, |
2875 Result* right_side, | 2875 Result* right_side, |
2876 JumpTarget* not_numbers) { | 2876 JumpTarget* not_numbers) { |
2877 Label done; | 2877 Label done; |
2878 if (operand->number_info().IsHeapNumber()) { | 2878 if (operand->number_info().IsDouble()) { |
2879 // Operand is known to be a heap number, just load it. | 2879 // Operand is known to be a heap number, just load it. |
2880 __ movdbl(reg, FieldOperand(operand->reg(), HeapNumber::kValueOffset)); | 2880 __ movdbl(reg, FieldOperand(operand->reg(), HeapNumber::kValueOffset)); |
2881 } else if (operand->number_info().IsSmi()) { | 2881 } else if (operand->number_info().IsSmi()) { |
2882 // Operand is known to be a smi. Convert it to double and keep the original | 2882 // Operand is known to be a smi. Convert it to double and keep the original |
2883 // smi. | 2883 // smi. |
2884 __ SmiUntag(operand->reg()); | 2884 __ SmiUntag(operand->reg()); |
2885 __ cvtsi2sd(reg, Operand(operand->reg())); | 2885 __ cvtsi2sd(reg, Operand(operand->reg())); |
2886 __ SmiTag(left_side->reg()); | 2886 __ SmiTag(left_side->reg()); |
2887 } else { | 2887 } else { |
2888 // Operand type not known, check for smi or heap number. | 2888 // Operand type not known, check for smi or heap number. |
(...skipping 7033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9922 // Output: eax, ecx are left and right integers for a bit op. | 9922 // Output: eax, ecx are left and right integers for a bit op. |
9923 void FloatingPointHelper::LoadNumbersAsIntegers(MacroAssembler* masm, | 9923 void FloatingPointHelper::LoadNumbersAsIntegers(MacroAssembler* masm, |
9924 NumberInfo number_info, | 9924 NumberInfo number_info, |
9925 bool use_sse3, | 9925 bool use_sse3, |
9926 Label* conversion_failure) { | 9926 Label* conversion_failure) { |
9927 // Check float operands. | 9927 // Check float operands. |
9928 Label arg1_is_object, check_undefined_arg1; | 9928 Label arg1_is_object, check_undefined_arg1; |
9929 Label arg2_is_object, check_undefined_arg2; | 9929 Label arg2_is_object, check_undefined_arg2; |
9930 Label load_arg2, done; | 9930 Label load_arg2, done; |
9931 | 9931 |
9932 if (!number_info.IsHeapNumber()) { | 9932 if (!number_info.IsDouble()) { |
9933 if (!number_info.IsSmi()) { | 9933 if (!number_info.IsSmi()) { |
9934 __ test(edx, Immediate(kSmiTagMask)); | 9934 __ test(edx, Immediate(kSmiTagMask)); |
9935 __ j(not_zero, &arg1_is_object); | 9935 __ j(not_zero, &arg1_is_object); |
9936 } else { | 9936 } else { |
9937 if (FLAG_debug_code) __ AbortIfNotSmi(edx); | 9937 if (FLAG_debug_code) __ AbortIfNotSmi(edx); |
9938 } | 9938 } |
9939 __ SmiUntag(edx); | 9939 __ SmiUntag(edx); |
9940 __ jmp(&load_arg2); | 9940 __ jmp(&load_arg2); |
9941 } | 9941 } |
9942 | 9942 |
9943 __ bind(&arg1_is_object); | 9943 __ bind(&arg1_is_object); |
9944 | 9944 |
9945 // Get the untagged integer version of the edx heap number in ecx. | 9945 // Get the untagged integer version of the edx heap number in ecx. |
9946 IntegerConvert(masm, edx, number_info, use_sse3, conversion_failure); | 9946 IntegerConvert(masm, edx, number_info, use_sse3, conversion_failure); |
9947 __ mov(edx, ecx); | 9947 __ mov(edx, ecx); |
9948 | 9948 |
9949 // Here edx has the untagged integer, eax has a Smi or a heap number. | 9949 // Here edx has the untagged integer, eax has a Smi or a heap number. |
9950 __ bind(&load_arg2); | 9950 __ bind(&load_arg2); |
9951 if (!number_info.IsHeapNumber()) { | 9951 if (!number_info.IsDouble()) { |
9952 // Test if arg2 is a Smi. | 9952 // Test if arg2 is a Smi. |
9953 if (!number_info.IsSmi()) { | 9953 if (!number_info.IsSmi()) { |
9954 __ test(eax, Immediate(kSmiTagMask)); | 9954 __ test(eax, Immediate(kSmiTagMask)); |
9955 __ j(not_zero, &arg2_is_object); | 9955 __ j(not_zero, &arg2_is_object); |
9956 } else { | 9956 } else { |
9957 if (FLAG_debug_code) __ AbortIfNotSmi(eax); | 9957 if (FLAG_debug_code) __ AbortIfNotSmi(eax); |
9958 } | 9958 } |
9959 __ SmiUntag(eax); | 9959 __ SmiUntag(eax); |
9960 __ mov(ecx, eax); | 9960 __ mov(ecx, eax); |
9961 __ jmp(&done); | 9961 __ jmp(&done); |
(...skipping 2579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12541 | 12541 |
12542 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) | 12542 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) |
12543 // tagged as a small integer. | 12543 // tagged as a small integer. |
12544 __ bind(&runtime); | 12544 __ bind(&runtime); |
12545 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); | 12545 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); |
12546 } | 12546 } |
12547 | 12547 |
12548 #undef __ | 12548 #undef __ |
12549 | 12549 |
12550 } } // namespace v8::internal | 12550 } } // namespace v8::internal |
OLD | NEW |