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 3363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3374 VFPRoundingMode rounding_mode = instr->truncating() ? kRoundToMinusInf | 3374 VFPRoundingMode rounding_mode = instr->truncating() ? kRoundToMinusInf |
3375 : kRoundToNearest; | 3375 : kRoundToNearest; |
3376 | 3376 |
3377 EmitVFPTruncate(rounding_mode, | 3377 EmitVFPTruncate(rounding_mode, |
3378 single_scratch, | 3378 single_scratch, |
3379 double_input, | 3379 double_input, |
3380 scratch1, | 3380 scratch1, |
3381 scratch2); | 3381 scratch2); |
3382 // Deoptimize if we had a vfp invalid exception. | 3382 // Deoptimize if we had a vfp invalid exception. |
3383 DeoptimizeIf(ne, instr->environment()); | 3383 DeoptimizeIf(ne, instr->environment()); |
| 3384 |
3384 // Retrieve the result. | 3385 // Retrieve the result. |
3385 __ vmov(result_reg, single_scratch); | 3386 __ vmov(result_reg, single_scratch); |
3386 | 3387 |
3387 if (instr->truncating() && | 3388 if (!instr->truncating()) { |
3388 instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { | 3389 // Convert result back to double and compare with input |
3389 Label done; | 3390 // to check if the conversion was exact. |
3390 __ cmp(result_reg, Operand(0)); | 3391 __ vmov(single_scratch, result_reg); |
3391 __ b(ne, &done); | 3392 __ vcvt_f64_s32(double_scratch0(), single_scratch); |
3392 // Check for -0. | 3393 __ VFPCompareAndSetFlags(double_scratch0(), double_input); |
3393 __ vmov(scratch1, double_input.high()); | |
3394 __ tst(scratch1, Operand(HeapNumber::kSignMask)); | |
3395 DeoptimizeIf(ne, instr->environment()); | 3394 DeoptimizeIf(ne, instr->environment()); |
| 3395 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
| 3396 Label done; |
| 3397 __ cmp(result_reg, Operand(0)); |
| 3398 __ b(ne, &done); |
| 3399 // Check for -0. |
| 3400 __ vmov(scratch1, double_input.high()); |
| 3401 __ tst(scratch1, Operand(HeapNumber::kSignMask)); |
| 3402 DeoptimizeIf(ne, instr->environment()); |
3396 | 3403 |
3397 __ bind(&done); | 3404 __ bind(&done); |
| 3405 } |
3398 } | 3406 } |
3399 } | 3407 } |
3400 | 3408 |
3401 | 3409 |
3402 void LCodeGen::DoCheckSmi(LCheckSmi* instr) { | 3410 void LCodeGen::DoCheckSmi(LCheckSmi* instr) { |
3403 LOperand* input = instr->InputAt(0); | 3411 LOperand* input = instr->InputAt(0); |
3404 ASSERT(input->IsRegister()); | 3412 ASSERT(input->IsRegister()); |
3405 __ tst(ToRegister(input), Operand(kSmiTagMask)); | 3413 __ tst(ToRegister(input), Operand(kSmiTagMask)); |
3406 DeoptimizeIf(instr->condition(), instr->environment()); | 3414 DeoptimizeIf(instr->condition(), instr->environment()); |
3407 } | 3415 } |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3843 ASSERT(!environment->HasBeenRegistered()); | 3851 ASSERT(!environment->HasBeenRegistered()); |
3844 RegisterEnvironmentForDeoptimization(environment); | 3852 RegisterEnvironmentForDeoptimization(environment); |
3845 ASSERT(osr_pc_offset_ == -1); | 3853 ASSERT(osr_pc_offset_ == -1); |
3846 osr_pc_offset_ = masm()->pc_offset(); | 3854 osr_pc_offset_ = masm()->pc_offset(); |
3847 } | 3855 } |
3848 | 3856 |
3849 | 3857 |
3850 #undef __ | 3858 #undef __ |
3851 | 3859 |
3852 } } // namespace v8::internal | 3860 } } // namespace v8::internal |
OLD | NEW |