OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 7511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7522 FloatingPointHelper::CheckFloatOperands(masm, &call_runtime); | 7522 FloatingPointHelper::CheckFloatOperands(masm, &call_runtime); |
7523 // TODO(X64): Don't convert a Smi to float and then back to int32 | 7523 // TODO(X64): Don't convert a Smi to float and then back to int32 |
7524 // afterwards. | 7524 // afterwards. |
7525 FloatingPointHelper::LoadFloatOperands(masm); | 7525 FloatingPointHelper::LoadFloatOperands(masm); |
7526 | 7526 |
7527 Label skip_allocation, non_smi_result, operand_conversion_failure; | 7527 Label skip_allocation, non_smi_result, operand_conversion_failure; |
7528 | 7528 |
7529 // Reserve space for converted numbers. | 7529 // Reserve space for converted numbers. |
7530 __ subq(rsp, Immediate(2 * kPointerSize)); | 7530 __ subq(rsp, Immediate(2 * kPointerSize)); |
7531 | 7531 |
7532 bool use_sse3 = CpuFeatures::IsSupported(CpuFeatures::SSE3); | 7532 if (use_sse3_) { |
7533 if (use_sse3) { | |
7534 // Truncate the operands to 32-bit integers and check for | 7533 // Truncate the operands to 32-bit integers and check for |
7535 // exceptions in doing so. | 7534 // exceptions in doing so. |
7536 CpuFeatures::Scope scope(CpuFeatures::SSE3); | 7535 CpuFeatures::Scope scope(CpuFeatures::SSE3); |
7537 __ fisttp_s(Operand(rsp, 0 * kPointerSize)); | 7536 __ fisttp_s(Operand(rsp, 0 * kPointerSize)); |
7538 __ fisttp_s(Operand(rsp, 1 * kPointerSize)); | 7537 __ fisttp_s(Operand(rsp, 1 * kPointerSize)); |
7539 __ fnstsw_ax(); | 7538 __ fnstsw_ax(); |
7540 __ testl(rax, Immediate(1)); | 7539 __ testl(rax, Immediate(1)); |
7541 __ j(not_zero, &operand_conversion_failure); | 7540 __ j(not_zero, &operand_conversion_failure); |
7542 } else { | 7541 } else { |
7543 // Check if right operand is int32. | 7542 // Check if right operand is int32. |
7544 __ fist_s(Operand(rsp, 0 * kPointerSize)); | 7543 __ fist_s(Operand(rsp, 0 * kPointerSize)); |
7545 __ fild_s(Operand(rsp, 0 * kPointerSize)); | 7544 __ fild_s(Operand(rsp, 0 * kPointerSize)); |
7546 __ fucompp(); | 7545 __ fucompp(); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7611 __ movq(Operand(rsp, 1 * kPointerSize), rbx); | 7610 __ movq(Operand(rsp, 1 * kPointerSize), rbx); |
7612 __ fild_s(Operand(rsp, 1 * kPointerSize)); | 7611 __ fild_s(Operand(rsp, 1 * kPointerSize)); |
7613 __ fstp_d(FieldOperand(rax, HeapNumber::kValueOffset)); | 7612 __ fstp_d(FieldOperand(rax, HeapNumber::kValueOffset)); |
7614 __ ret(2 * kPointerSize); | 7613 __ ret(2 * kPointerSize); |
7615 } | 7614 } |
7616 | 7615 |
7617 // Clear the FPU exception flag and reset the stack before calling | 7616 // Clear the FPU exception flag and reset the stack before calling |
7618 // the runtime system. | 7617 // the runtime system. |
7619 __ bind(&operand_conversion_failure); | 7618 __ bind(&operand_conversion_failure); |
7620 __ addq(rsp, Immediate(2 * kPointerSize)); | 7619 __ addq(rsp, Immediate(2 * kPointerSize)); |
7621 if (use_sse3) { | 7620 if (use_sse3_) { |
7622 // If we've used the SSE3 instructions for truncating the | 7621 // If we've used the SSE3 instructions for truncating the |
7623 // floating point values to integers and it failed, we have a | 7622 // floating point values to integers and it failed, we have a |
7624 // pending #IA exception. Clear it. | 7623 // pending #IA exception. Clear it. |
7625 __ fnclex(); | 7624 __ fnclex(); |
7626 } else { | 7625 } else { |
7627 // The non-SSE3 variant does early bailout if the right | 7626 // The non-SSE3 variant does early bailout if the right |
7628 // operand isn't a 32-bit integer, so we may have a single | 7627 // operand isn't a 32-bit integer, so we may have a single |
7629 // value on the FPU stack we need to get rid of. | 7628 // value on the FPU stack we need to get rid of. |
7630 __ ffree(0); | 7629 __ ffree(0); |
7631 } | 7630 } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7687 int CompareStub::MinorKey() { | 7686 int CompareStub::MinorKey() { |
7688 // Encode the two parameters in a unique 16 bit value. | 7687 // Encode the two parameters in a unique 16 bit value. |
7689 ASSERT(static_cast<unsigned>(cc_) < (1 << 15)); | 7688 ASSERT(static_cast<unsigned>(cc_) < (1 << 15)); |
7690 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0); | 7689 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0); |
7691 } | 7690 } |
7692 | 7691 |
7693 | 7692 |
7694 #undef __ | 7693 #undef __ |
7695 | 7694 |
7696 } } // namespace v8::internal | 7695 } } // namespace v8::internal |
OLD | NEW |