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 4405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4416 __ movsd(xmm1, xmm3); | 4416 __ movsd(xmm1, xmm3); |
4417 __ sqrtsd(xmm1, xmm1); | 4417 __ sqrtsd(xmm1, xmm1); |
4418 __ jmp(&allocate_return); | 4418 __ jmp(&allocate_return); |
4419 | 4419 |
4420 // Test for 0.5. | 4420 // Test for 0.5. |
4421 __ bind(¬_minus_half); | 4421 __ bind(¬_minus_half); |
4422 // Load xmm2 with 0.5. | 4422 // Load xmm2 with 0.5. |
4423 // Since xmm3 is 1 and xmm2 is -0.5 this is simply xmm2 + xmm3. | 4423 // Since xmm3 is 1 and xmm2 is -0.5 this is simply xmm2 + xmm3. |
4424 __ addsd(xmm2, xmm3); | 4424 __ addsd(xmm2, xmm3); |
4425 // xmm2 now has 0.5. | 4425 // xmm2 now has 0.5. |
4426 __ comisd(xmm2, xmm1); | 4426 __ ucomisd(xmm2, xmm1); |
4427 call_runtime.Branch(not_equal); | 4427 call_runtime.Branch(not_equal); |
4428 | 4428 |
4429 // Calculates square root. | 4429 // Calculates square root. |
4430 __ movsd(xmm1, xmm0); | 4430 __ movsd(xmm1, xmm0); |
4431 __ sqrtsd(xmm1, xmm1); | 4431 __ sqrtsd(xmm1, xmm1); |
4432 | 4432 |
4433 JumpTarget done; | 4433 JumpTarget done; |
4434 Label failure, success; | 4434 Label failure, success; |
4435 __ bind(&allocate_return); | 4435 __ bind(&allocate_return); |
4436 // Make a copy of the frame to enable us to handle allocation | 4436 // Make a copy of the frame to enable us to handle allocation |
(...skipping 2062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6499 ControlDestination* dest) { | 6499 ControlDestination* dest) { |
6500 ASSERT(left_side->is_register()); | 6500 ASSERT(left_side->is_register()); |
6501 ASSERT(right_side->is_register()); | 6501 ASSERT(right_side->is_register()); |
6502 | 6502 |
6503 JumpTarget not_numbers; | 6503 JumpTarget not_numbers; |
6504 // Load left and right operand into registers xmm0 and xmm1 and compare. | 6504 // Load left and right operand into registers xmm0 and xmm1 and compare. |
6505 LoadComparisonOperand(masm_, left_side, xmm0, left_side, right_side, | 6505 LoadComparisonOperand(masm_, left_side, xmm0, left_side, right_side, |
6506 ¬_numbers); | 6506 ¬_numbers); |
6507 LoadComparisonOperand(masm_, right_side, xmm1, left_side, right_side, | 6507 LoadComparisonOperand(masm_, right_side, xmm1, left_side, right_side, |
6508 ¬_numbers); | 6508 ¬_numbers); |
6509 __ comisd(xmm0, xmm1); | 6509 __ ucomisd(xmm0, xmm1); |
6510 // Bail out if a NaN is involved. | 6510 // Bail out if a NaN is involved. |
6511 not_numbers.Branch(parity_even, left_side, right_side); | 6511 not_numbers.Branch(parity_even, left_side, right_side); |
6512 | 6512 |
6513 // Split to destination targets based on comparison. | 6513 // Split to destination targets based on comparison. |
6514 left_side->Unuse(); | 6514 left_side->Unuse(); |
6515 right_side->Unuse(); | 6515 right_side->Unuse(); |
6516 dest->true_target()->Branch(DoubleCondition(cc)); | 6516 dest->true_target()->Branch(DoubleCondition(cc)); |
6517 dest->false_target()->Jump(); | 6517 dest->false_target()->Jump(); |
6518 | 6518 |
6519 not_numbers.Bind(left_side, right_side); | 6519 not_numbers.Bind(left_side, right_side); |
(...skipping 2376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8896 __ movq(probe, | 8896 __ movq(probe, |
8897 FieldOperand(number_string_cache, | 8897 FieldOperand(number_string_cache, |
8898 index, | 8898 index, |
8899 times_1, | 8899 times_1, |
8900 FixedArray::kHeaderSize)); | 8900 FixedArray::kHeaderSize)); |
8901 __ JumpIfSmi(probe, not_found); | 8901 __ JumpIfSmi(probe, not_found); |
8902 ASSERT(CpuFeatures::IsSupported(SSE2)); | 8902 ASSERT(CpuFeatures::IsSupported(SSE2)); |
8903 CpuFeatures::Scope fscope(SSE2); | 8903 CpuFeatures::Scope fscope(SSE2); |
8904 __ movsd(xmm0, FieldOperand(object, HeapNumber::kValueOffset)); | 8904 __ movsd(xmm0, FieldOperand(object, HeapNumber::kValueOffset)); |
8905 __ movsd(xmm1, FieldOperand(probe, HeapNumber::kValueOffset)); | 8905 __ movsd(xmm1, FieldOperand(probe, HeapNumber::kValueOffset)); |
8906 __ comisd(xmm0, xmm1); | 8906 __ ucomisd(xmm0, xmm1); |
8907 __ j(parity_even, not_found); // Bail out if NaN is involved. | 8907 __ j(parity_even, not_found); // Bail out if NaN is involved. |
8908 __ j(not_equal, not_found); // The cache did not contain this value. | 8908 __ j(not_equal, not_found); // The cache did not contain this value. |
8909 __ jmp(&load_result_from_cache); | 8909 __ jmp(&load_result_from_cache); |
8910 } | 8910 } |
8911 | 8911 |
8912 __ bind(&is_smi); | 8912 __ bind(&is_smi); |
8913 __ movq(scratch, object); | 8913 __ movq(scratch, object); |
8914 __ SmiToInteger32(scratch, scratch); | 8914 __ SmiToInteger32(scratch, scratch); |
8915 GenerateConvertHashCodeToIndex(masm, scratch, mask); | 8915 GenerateConvertHashCodeToIndex(masm, scratch, mask); |
8916 | 8916 |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9103 | 9103 |
9104 // Generate the number comparison code. | 9104 // Generate the number comparison code. |
9105 if (include_number_compare_) { | 9105 if (include_number_compare_) { |
9106 Label non_number_comparison; | 9106 Label non_number_comparison; |
9107 Label unordered; | 9107 Label unordered; |
9108 FloatingPointHelper::LoadFloatOperand(masm, rdx, xmm0, | 9108 FloatingPointHelper::LoadFloatOperand(masm, rdx, xmm0, |
9109 &non_number_comparison); | 9109 &non_number_comparison); |
9110 FloatingPointHelper::LoadFloatOperand(masm, rax, xmm1, | 9110 FloatingPointHelper::LoadFloatOperand(masm, rax, xmm1, |
9111 &non_number_comparison); | 9111 &non_number_comparison); |
9112 | 9112 |
9113 __ comisd(xmm0, xmm1); | 9113 __ ucomisd(xmm0, xmm1); |
9114 | 9114 |
9115 // Don't base result on EFLAGS when a NaN is involved. | 9115 // Don't base result on EFLAGS when a NaN is involved. |
9116 __ j(parity_even, &unordered); | 9116 __ j(parity_even, &unordered); |
9117 // Return a result of -1, 0, or 1, based on EFLAGS. | 9117 // Return a result of -1, 0, or 1, based on EFLAGS. |
9118 __ movq(rax, Immediate(0)); // equal | 9118 __ movq(rax, Immediate(0)); // equal |
9119 __ movq(rcx, Immediate(1)); | 9119 __ movq(rcx, Immediate(1)); |
9120 __ cmovq(above, rax, rcx); | 9120 __ cmovq(above, rax, rcx); |
9121 __ movq(rcx, Immediate(-1)); | 9121 __ movq(rcx, Immediate(-1)); |
9122 __ cmovq(below, rax, rcx); | 9122 __ cmovq(below, rax, rcx); |
9123 __ ret(2 * kPointerSize); // rax, rdx were pushed | 9123 __ ret(2 * kPointerSize); // rax, rdx were pushed |
(...skipping 2820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11944 } | 11944 } |
11945 | 11945 |
11946 #endif | 11946 #endif |
11947 | 11947 |
11948 | 11948 |
11949 #undef __ | 11949 #undef __ |
11950 | 11950 |
11951 } } // namespace v8::internal | 11951 } } // namespace v8::internal |
11952 | 11952 |
11953 #endif // V8_TARGET_ARCH_X64 | 11953 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |