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 7933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7944 // Test for -0.5. | 7944 // Test for -0.5. |
7945 // Load xmm2 with -0.5. | 7945 // Load xmm2 with -0.5. |
7946 __ mov(answer.reg(), Immediate(0xBF000000)); | 7946 __ mov(answer.reg(), Immediate(0xBF000000)); |
7947 __ movd(xmm2, Operand(answer.reg())); | 7947 __ movd(xmm2, Operand(answer.reg())); |
7948 __ cvtss2sd(xmm2, xmm2); | 7948 __ cvtss2sd(xmm2, xmm2); |
7949 // xmm2 now has -0.5. | 7949 // xmm2 now has -0.5. |
7950 __ ucomisd(xmm2, xmm1); | 7950 __ ucomisd(xmm2, xmm1); |
7951 __ j(not_equal, ¬_minus_half); | 7951 __ j(not_equal, ¬_minus_half); |
7952 | 7952 |
7953 // Calculates reciprocal of square root. | 7953 // Calculates reciprocal of square root. |
7954 // Note that 1/sqrt(x) = sqrt(1/x)) | 7954 // sqrtsd returns -0 when input is -0. ECMA spec requires +0. |
7955 __ divsd(xmm3, xmm0); | 7955 __ xorpd(xmm1, xmm1); |
| 7956 __ addsd(xmm1, xmm0); |
| 7957 __ sqrtsd(xmm1, xmm1); |
| 7958 __ divsd(xmm3, xmm1); |
7956 __ movsd(xmm1, xmm3); | 7959 __ movsd(xmm1, xmm3); |
7957 __ sqrtsd(xmm1, xmm1); | |
7958 __ jmp(&allocate_return); | 7960 __ jmp(&allocate_return); |
7959 | 7961 |
7960 // Test for 0.5. | 7962 // Test for 0.5. |
7961 __ bind(¬_minus_half); | 7963 __ bind(¬_minus_half); |
7962 // Load xmm2 with 0.5. | 7964 // Load xmm2 with 0.5. |
7963 // Since xmm3 is 1 and xmm2 is -0.5 this is simply xmm2 + xmm3. | 7965 // Since xmm3 is 1 and xmm2 is -0.5 this is simply xmm2 + xmm3. |
7964 __ addsd(xmm2, xmm3); | 7966 __ addsd(xmm2, xmm3); |
7965 // xmm2 now has 0.5. | 7967 // xmm2 now has 0.5. |
7966 __ ucomisd(xmm2, xmm1); | 7968 __ ucomisd(xmm2, xmm1); |
7967 call_runtime.Branch(not_equal); | 7969 call_runtime.Branch(not_equal); |
7968 // Calculates square root. | 7970 // Calculates square root. |
7969 __ movsd(xmm1, xmm0); | 7971 // sqrtsd returns -0 when input is -0. ECMA spec requires +0. |
| 7972 __ xorpd(xmm1, xmm1); |
| 7973 __ addsd(xmm1, xmm0); |
7970 __ sqrtsd(xmm1, xmm1); | 7974 __ sqrtsd(xmm1, xmm1); |
7971 | 7975 |
7972 JumpTarget done; | 7976 JumpTarget done; |
7973 Label failure, success; | 7977 Label failure, success; |
7974 __ bind(&allocate_return); | 7978 __ bind(&allocate_return); |
7975 // Make a copy of the frame to enable us to handle allocation | 7979 // Make a copy of the frame to enable us to handle allocation |
7976 // failure after the JumpTarget jump. | 7980 // failure after the JumpTarget jump. |
7977 VirtualFrame* clone = new VirtualFrame(frame()); | 7981 VirtualFrame* clone = new VirtualFrame(frame()); |
7978 __ AllocateHeapNumber(answer.reg(), exponent.reg(), | 7982 __ AllocateHeapNumber(answer.reg(), exponent.reg(), |
7979 base.reg(), &failure); | 7983 base.reg(), &failure); |
(...skipping 2330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10310 memcpy(chunk->GetStartAddress(), desc.buffer, desc.instr_size); | 10314 memcpy(chunk->GetStartAddress(), desc.buffer, desc.instr_size); |
10311 CPU::FlushICache(chunk->GetStartAddress(), desc.instr_size); | 10315 CPU::FlushICache(chunk->GetStartAddress(), desc.instr_size); |
10312 return FUNCTION_CAST<MemCopyFunction>(chunk->GetStartAddress()); | 10316 return FUNCTION_CAST<MemCopyFunction>(chunk->GetStartAddress()); |
10313 } | 10317 } |
10314 | 10318 |
10315 #undef __ | 10319 #undef __ |
10316 | 10320 |
10317 } } // namespace v8::internal | 10321 } } // namespace v8::internal |
10318 | 10322 |
10319 #endif // V8_TARGET_ARCH_IA32 | 10323 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |