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