OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 3374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3385 __ CompareRoot(input_reg, Heap::kUndefinedValueRootIndex); | 3385 __ CompareRoot(input_reg, Heap::kUndefinedValueRootIndex); |
3386 DeoptimizeIf(not_equal, instr->environment()); | 3386 DeoptimizeIf(not_equal, instr->environment()); |
3387 __ movl(input_reg, Immediate(0)); | 3387 __ movl(input_reg, Immediate(0)); |
3388 __ jmp(&done); | 3388 __ jmp(&done); |
3389 | 3389 |
3390 __ bind(&heap_number); | 3390 __ bind(&heap_number); |
3391 | 3391 |
3392 __ movsd(xmm0, FieldOperand(input_reg, HeapNumber::kValueOffset)); | 3392 __ movsd(xmm0, FieldOperand(input_reg, HeapNumber::kValueOffset)); |
3393 __ cvttsd2siq(input_reg, xmm0); | 3393 __ cvttsd2siq(input_reg, xmm0); |
3394 __ Set(kScratchRegister, V8_UINT64_C(0x8000000000000000)); | 3394 __ Set(kScratchRegister, V8_UINT64_C(0x8000000000000000)); |
3395 __ cmpl(input_reg, kScratchRegister); | 3395 __ cmpq(input_reg, kScratchRegister); |
3396 DeoptimizeIf(equal, instr->environment()); | 3396 DeoptimizeIf(equal, instr->environment()); |
3397 } else { | 3397 } else { |
3398 // Deoptimize if we don't have a heap number. | 3398 // Deoptimize if we don't have a heap number. |
3399 DeoptimizeIf(not_equal, instr->environment()); | 3399 DeoptimizeIf(not_equal, instr->environment()); |
3400 | 3400 |
3401 XMMRegister xmm_temp = ToDoubleRegister(instr->TempAt(0)); | 3401 XMMRegister xmm_temp = ToDoubleRegister(instr->TempAt(0)); |
3402 __ movsd(xmm0, FieldOperand(input_reg, HeapNumber::kValueOffset)); | 3402 __ movsd(xmm0, FieldOperand(input_reg, HeapNumber::kValueOffset)); |
3403 __ cvttsd2si(input_reg, xmm0); | 3403 __ cvttsd2si(input_reg, xmm0); |
3404 __ cvtlsi2sd(xmm_temp, input_reg); | 3404 __ cvtlsi2sd(xmm_temp, input_reg); |
3405 __ ucomisd(xmm0, xmm_temp); | 3405 __ ucomisd(xmm0, xmm_temp); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3450 ASSERT(result->IsRegister()); | 3450 ASSERT(result->IsRegister()); |
3451 | 3451 |
3452 XMMRegister input_reg = ToDoubleRegister(input); | 3452 XMMRegister input_reg = ToDoubleRegister(input); |
3453 Register result_reg = ToRegister(result); | 3453 Register result_reg = ToRegister(result); |
3454 | 3454 |
3455 if (instr->truncating()) { | 3455 if (instr->truncating()) { |
3456 // Performs a truncating conversion of a floating point number as used by | 3456 // Performs a truncating conversion of a floating point number as used by |
3457 // the JS bitwise operations. | 3457 // the JS bitwise operations. |
3458 __ cvttsd2siq(result_reg, input_reg); | 3458 __ cvttsd2siq(result_reg, input_reg); |
3459 __ movq(kScratchRegister, V8_INT64_C(0x8000000000000000), RelocInfo::NONE); | 3459 __ movq(kScratchRegister, V8_INT64_C(0x8000000000000000), RelocInfo::NONE); |
3460 __ cmpl(result_reg, kScratchRegister); | 3460 __ cmpq(result_reg, kScratchRegister); |
3461 DeoptimizeIf(equal, instr->environment()); | 3461 DeoptimizeIf(equal, instr->environment()); |
3462 } else { | 3462 } else { |
3463 __ cvttsd2si(result_reg, input_reg); | 3463 __ cvttsd2si(result_reg, input_reg); |
3464 __ cvtlsi2sd(xmm0, result_reg); | 3464 __ cvtlsi2sd(xmm0, result_reg); |
3465 __ ucomisd(xmm0, input_reg); | 3465 __ ucomisd(xmm0, input_reg); |
3466 DeoptimizeIf(not_equal, instr->environment()); | 3466 DeoptimizeIf(not_equal, instr->environment()); |
3467 DeoptimizeIf(parity_even, instr->environment()); // NaN. | 3467 DeoptimizeIf(parity_even, instr->environment()); // NaN. |
3468 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { | 3468 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
3469 NearLabel done; | 3469 NearLabel done; |
3470 // The integer converted back is equal to the original. We | 3470 // The integer converted back is equal to the original. We |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3961 RegisterEnvironmentForDeoptimization(environment); | 3961 RegisterEnvironmentForDeoptimization(environment); |
3962 ASSERT(osr_pc_offset_ == -1); | 3962 ASSERT(osr_pc_offset_ == -1); |
3963 osr_pc_offset_ = masm()->pc_offset(); | 3963 osr_pc_offset_ = masm()->pc_offset(); |
3964 } | 3964 } |
3965 | 3965 |
3966 #undef __ | 3966 #undef __ |
3967 | 3967 |
3968 } } // namespace v8::internal | 3968 } } // namespace v8::internal |
3969 | 3969 |
3970 #endif // V8_TARGET_ARCH_X64 | 3970 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |