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 3609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3620 } | 3620 } |
3621 | 3621 |
3622 | 3622 |
3623 void LCodeGen::EmitIntegerMathAbs(LMathAbs* instr) { | 3623 void LCodeGen::EmitIntegerMathAbs(LMathAbs* instr) { |
3624 Register input = ToRegister(instr->value()); | 3624 Register input = ToRegister(instr->value()); |
3625 Register result = ToRegister(instr->result()); | 3625 Register result = ToRegister(instr->result()); |
3626 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_); | 3626 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_); |
3627 Label done; | 3627 Label done; |
3628 __ Branch(USE_DELAY_SLOT, &done, ge, input, Operand(zero_reg)); | 3628 __ Branch(USE_DELAY_SLOT, &done, ge, input, Operand(zero_reg)); |
3629 __ mov(result, input); | 3629 __ mov(result, input); |
| 3630 __ subu(result, zero_reg, input); |
3630 // Overflow if result is still negative, i.e. 0x80000000. | 3631 // Overflow if result is still negative, i.e. 0x80000000. |
3631 DeoptimizeIf(lt, instr->environment(), result, Operand(zero_reg)); | 3632 DeoptimizeIf(lt, instr->environment(), result, Operand(zero_reg)); |
3632 __ bind(&done); | 3633 __ bind(&done); |
3633 } | 3634 } |
3634 | 3635 |
3635 | 3636 |
3636 void LCodeGen::DoMathAbs(LMathAbs* instr) { | 3637 void LCodeGen::DoMathAbs(LMathAbs* instr) { |
3637 // Class for deferred case. | 3638 // Class for deferred case. |
3638 class DeferredMathAbsTaggedHeapNumber: public LDeferredCode { | 3639 class DeferredMathAbsTaggedHeapNumber: public LDeferredCode { |
3639 public: | 3640 public: |
(...skipping 2278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5918 __ Subu(scratch, result, scratch); | 5919 __ Subu(scratch, result, scratch); |
5919 __ lw(result, FieldMemOperand(scratch, | 5920 __ lw(result, FieldMemOperand(scratch, |
5920 FixedArray::kHeaderSize - kPointerSize)); | 5921 FixedArray::kHeaderSize - kPointerSize)); |
5921 __ bind(&done); | 5922 __ bind(&done); |
5922 } | 5923 } |
5923 | 5924 |
5924 | 5925 |
5925 #undef __ | 5926 #undef __ |
5926 | 5927 |
5927 } } // namespace v8::internal | 5928 } } // namespace v8::internal |
OLD | NEW |