| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 } | 275 } |
| 276 | 276 |
| 277 | 277 |
| 278 void MacroAssembler::DoubleToI(Register result_reg, | 278 void MacroAssembler::DoubleToI(Register result_reg, |
| 279 XMMRegister input_reg, | 279 XMMRegister input_reg, |
| 280 XMMRegister scratch, | 280 XMMRegister scratch, |
| 281 MinusZeroMode minus_zero_mode, | 281 MinusZeroMode minus_zero_mode, |
| 282 Label* conversion_failed, | 282 Label* conversion_failed, |
| 283 Label::Distance dst) { | 283 Label::Distance dst) { |
| 284 ASSERT(!input_reg.is(scratch)); | 284 ASSERT(!input_reg.is(scratch)); |
| 285 Label done; | |
| 286 cvttsd2si(result_reg, Operand(input_reg)); | 285 cvttsd2si(result_reg, Operand(input_reg)); |
| 287 cvtsi2sd(scratch, Operand(result_reg)); | 286 cvtsi2sd(scratch, Operand(result_reg)); |
| 288 ucomisd(scratch, input_reg); | 287 ucomisd(scratch, input_reg); |
| 289 j(not_equal, conversion_failed, dst); | 288 j(not_equal, conversion_failed, dst); |
| 290 j(parity_even, conversion_failed, dst); // NaN. | 289 j(parity_even, conversion_failed, dst); // NaN. |
| 291 if (minus_zero_mode == FAIL_ON_MINUS_ZERO) { | 290 if (minus_zero_mode == FAIL_ON_MINUS_ZERO) { |
| 291 Label done; |
| 292 // The integer converted back is equal to the original. We |
| 293 // only have to test if we got -0 as an input. |
| 292 test(result_reg, Operand(result_reg)); | 294 test(result_reg, Operand(result_reg)); |
| 293 j(not_zero, &done, Label::kNear); | 295 j(not_zero, &done, Label::kNear); |
| 294 movmskpd(result_reg, input_reg); | 296 movmskpd(result_reg, input_reg); |
| 297 // Bit 0 contains the sign of the double in input_reg. |
| 298 // If input was positive, we are ok and return 0, otherwise |
| 299 // jump to conversion_failed. |
| 295 and_(result_reg, 1); | 300 and_(result_reg, 1); |
| 296 j(not_zero, conversion_failed, dst); | 301 j(not_zero, conversion_failed, dst); |
| 302 bind(&done); |
| 297 } | 303 } |
| 298 bind(&done); | |
| 299 } | 304 } |
| 300 | 305 |
| 301 | 306 |
| 302 void MacroAssembler::TruncateHeapNumberToI(Register result_reg, | 307 void MacroAssembler::TruncateHeapNumberToI(Register result_reg, |
| 303 Register input_reg) { | 308 Register input_reg) { |
| 304 Label done, slow_case; | 309 Label done, slow_case; |
| 305 | 310 |
| 306 if (CpuFeatures::IsSupported(SSE3)) { | 311 if (CpuFeatures::IsSupported(SSE3)) { |
| 307 CpuFeatureScope scope(this, SSE3); | 312 CpuFeatureScope scope(this, SSE3); |
| 308 Label convert; | 313 Label convert; |
| (...skipping 3108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3417 j(greater, &no_memento_available); | 3422 j(greater, &no_memento_available); |
| 3418 cmp(MemOperand(scratch_reg, -AllocationMemento::kSize), | 3423 cmp(MemOperand(scratch_reg, -AllocationMemento::kSize), |
| 3419 Immediate(Handle<Map>(isolate()->heap()->allocation_memento_map()))); | 3424 Immediate(Handle<Map>(isolate()->heap()->allocation_memento_map()))); |
| 3420 bind(&no_memento_available); | 3425 bind(&no_memento_available); |
| 3421 } | 3426 } |
| 3422 | 3427 |
| 3423 | 3428 |
| 3424 } } // namespace v8::internal | 3429 } } // namespace v8::internal |
| 3425 | 3430 |
| 3426 #endif // V8_TARGET_ARCH_IA32 | 3431 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |