OLD | NEW |
---|---|
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // | 2 // |
3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
5 | 5 |
6 #include "src/crankshaft/s390/lithium-codegen-s390.h" | 6 #include "src/crankshaft/s390/lithium-codegen-s390.h" |
7 | 7 |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 3369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3380 | 3380 |
3381 __ StoreToSafepointRegisterSlot(tmp1, result); | 3381 __ StoreToSafepointRegisterSlot(tmp1, result); |
3382 } | 3382 } |
3383 | 3383 |
3384 __ bind(&done); | 3384 __ bind(&done); |
3385 } | 3385 } |
3386 | 3386 |
3387 void LCodeGen::EmitMathAbs(LMathAbs* instr) { | 3387 void LCodeGen::EmitMathAbs(LMathAbs* instr) { |
3388 Register input = ToRegister(instr->value()); | 3388 Register input = ToRegister(instr->value()); |
3389 Register result = ToRegister(instr->result()); | 3389 Register result = ToRegister(instr->result()); |
3390 Label done; | 3390 __ LoadPositiveP(result, input); |
3391 __ CmpP(input, Operand::Zero()); | |
3392 __ Move(result, input); | |
3393 __ bge(&done, Label::kNear); | |
3394 __ LoadComplementRR(result, result); | |
3395 // Deoptimize on overflow. | 3391 // Deoptimize on overflow. |
3396 DeoptimizeIf(overflow, instr, DeoptimizeReason::kOverflow, cr0); | 3392 DeoptimizeIf(overflow, instr, DeoptimizeReason::kOverflow, cr0); |
3397 __ bind(&done); | |
3398 } | 3393 } |
3399 | 3394 |
3400 #if V8_TARGET_ARCH_S390X | 3395 #if V8_TARGET_ARCH_S390X |
3401 void LCodeGen::EmitInteger32MathAbs(LMathAbs* instr) { | 3396 void LCodeGen::EmitInteger32MathAbs(LMathAbs* instr) { |
3402 Register input = ToRegister(instr->value()); | 3397 Register input = ToRegister(instr->value()); |
3403 Register result = ToRegister(instr->result()); | 3398 Register result = ToRegister(instr->result()); |
3404 Label done; | 3399 __ LoadPositive32(result, input); |
john.yan
2016/12/21 21:03:52
maybe more lgfr to here instead of putting in Macr
| |
3405 __ Cmp32(input, Operand::Zero()); | 3400 DeoptimizeIf(overflow, instr, DeoptimizeReason::kOverflow); |
3406 __ Move(result, input); | |
3407 __ bge(&done, Label::kNear); | |
3408 | |
3409 // Deoptimize on overflow. | |
3410 __ Cmp32(input, Operand(0x80000000)); | |
3411 DeoptimizeIf(eq, instr, DeoptimizeReason::kOverflow); | |
3412 | |
3413 __ LoadComplementRR(result, result); | |
3414 __ bind(&done); | |
3415 } | 3401 } |
3416 #endif | 3402 #endif |
3417 | 3403 |
3418 void LCodeGen::DoMathAbs(LMathAbs* instr) { | 3404 void LCodeGen::DoMathAbs(LMathAbs* instr) { |
3419 // Class for deferred case. | 3405 // Class for deferred case. |
3420 class DeferredMathAbsTaggedHeapNumber final : public LDeferredCode { | 3406 class DeferredMathAbsTaggedHeapNumber final : public LDeferredCode { |
3421 public: | 3407 public: |
3422 DeferredMathAbsTaggedHeapNumber(LCodeGen* codegen, LMathAbs* instr) | 3408 DeferredMathAbsTaggedHeapNumber(LCodeGen* codegen, LMathAbs* instr) |
3423 : LDeferredCode(codegen), instr_(instr) {} | 3409 : LDeferredCode(codegen), instr_(instr) {} |
3424 void Generate() override { | 3410 void Generate() override { |
(...skipping 2160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5585 __ LoadP(result, | 5571 __ LoadP(result, |
5586 FieldMemOperand(scratch, FixedArray::kHeaderSize - kPointerSize)); | 5572 FieldMemOperand(scratch, FixedArray::kHeaderSize - kPointerSize)); |
5587 __ bind(deferred->exit()); | 5573 __ bind(deferred->exit()); |
5588 __ bind(&done); | 5574 __ bind(&done); |
5589 } | 5575 } |
5590 | 5576 |
5591 #undef __ | 5577 #undef __ |
5592 | 5578 |
5593 } // namespace internal | 5579 } // namespace internal |
5594 } // namespace v8 | 5580 } // namespace v8 |
OLD | NEW |