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