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/builtins/builtins-constructor.h" | 9 #include "src/builtins/builtins-constructor.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1353 case -1: | 1353 case -1: |
1354 if (can_overflow) { | 1354 if (can_overflow) { |
1355 #if V8_TARGET_ARCH_S390X | 1355 #if V8_TARGET_ARCH_S390X |
1356 if (instr->hydrogen()->representation().IsSmi()) { | 1356 if (instr->hydrogen()->representation().IsSmi()) { |
1357 #endif | 1357 #endif |
1358 __ LoadComplementRR(result, left); | 1358 __ LoadComplementRR(result, left); |
1359 DeoptimizeIf(overflow, instr, DeoptimizeReason::kOverflow); | 1359 DeoptimizeIf(overflow, instr, DeoptimizeReason::kOverflow); |
1360 #if V8_TARGET_ARCH_S390X | 1360 #if V8_TARGET_ARCH_S390X |
1361 } else { | 1361 } else { |
1362 __ LoadComplementRR(result, left); | 1362 __ LoadComplementRR(result, left); |
1363 __ TestIfInt32(result, r0); | 1363 __ TestIfInt32(result); |
1364 DeoptimizeIf(ne, instr, DeoptimizeReason::kOverflow); | 1364 DeoptimizeIf(ne, instr, DeoptimizeReason::kOverflow); |
1365 } | 1365 } |
1366 #endif | 1366 #endif |
1367 } else { | 1367 } else { |
1368 __ LoadComplementRR(result, left); | 1368 __ LoadComplementRR(result, left); |
1369 } | 1369 } |
1370 break; | 1370 break; |
1371 case 0: | 1371 case 0: |
1372 if (bailout_on_minus_zero) { | 1372 if (bailout_on_minus_zero) { |
1373 // If left is strictly negative and the constant is null, the | 1373 // If left is strictly negative and the constant is null, the |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1438 #if V8_TARGET_ARCH_S390X | 1438 #if V8_TARGET_ARCH_S390X |
1439 // result = left * right. | 1439 // result = left * right. |
1440 if (instr->hydrogen()->representation().IsSmi()) { | 1440 if (instr->hydrogen()->representation().IsSmi()) { |
1441 __ SmiUntag(result, left); | 1441 __ SmiUntag(result, left); |
1442 __ SmiUntag(scratch, right); | 1442 __ SmiUntag(scratch, right); |
1443 __ msgr(result, scratch); | 1443 __ msgr(result, scratch); |
1444 } else { | 1444 } else { |
1445 __ LoadRR(result, left); | 1445 __ LoadRR(result, left); |
1446 __ msgr(result, right); | 1446 __ msgr(result, right); |
1447 } | 1447 } |
1448 __ TestIfInt32(result, r0); | 1448 __ TestIfInt32(result); |
1449 DeoptimizeIf(ne, instr, DeoptimizeReason::kOverflow); | 1449 DeoptimizeIf(ne, instr, DeoptimizeReason::kOverflow); |
1450 if (instr->hydrogen()->representation().IsSmi()) { | 1450 if (instr->hydrogen()->representation().IsSmi()) { |
1451 __ SmiTag(result); | 1451 __ SmiTag(result); |
1452 } | 1452 } |
1453 #else | 1453 #else |
1454 // r0:scratch = scratch * right | 1454 // r0:scratch = scratch * right |
1455 if (instr->hydrogen()->representation().IsSmi()) { | 1455 if (instr->hydrogen()->representation().IsSmi()) { |
1456 __ SmiUntag(scratch, left); | 1456 __ SmiUntag(result, left); |
1457 __ mr_z(r0, right); | 1457 __ lgfr(result, result); |
1458 __ LoadRR(result, scratch); | 1458 __ msgfr(result, right); |
1459 } else { | 1459 } else { |
1460 // r0:scratch = scratch * right | 1460 // r0:scratch = scratch * right |
1461 __ LoadRR(scratch, left); | 1461 __ lgfr(result, left); |
1462 __ mr_z(r0, right); | 1462 __ msgfr(result, right); |
1463 __ LoadRR(result, scratch); | |
1464 } | 1463 } |
1465 __ TestIfInt32(r0, result, scratch); | 1464 __ TestIfInt32(result); |
1466 DeoptimizeIf(ne, instr, DeoptimizeReason::kOverflow); | 1465 DeoptimizeIf(ne, instr, DeoptimizeReason::kOverflow); |
1467 #endif | 1466 #endif |
1468 } | 1467 } |
1469 } else { | 1468 } else { |
1470 if (instr->hydrogen()->representation().IsSmi()) { | 1469 if (instr->hydrogen()->representation().IsSmi()) { |
1471 __ SmiUntag(result, left); | 1470 __ SmiUntag(result, left); |
1472 __ Mul(result, result, right); | 1471 __ Mul(result, result, right); |
1473 } else { | 1472 } else { |
1474 __ Mul(result, left, right); | 1473 __ Mul(result, left, right); |
1475 } | 1474 } |
(...skipping 2944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4420 } | 4419 } |
4421 | 4420 |
4422 void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) { | 4421 void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) { |
4423 LOperand* input = instr->value(); | 4422 LOperand* input = instr->value(); |
4424 DCHECK(input->IsRegister() || input->IsStackSlot()); | 4423 DCHECK(input->IsRegister() || input->IsStackSlot()); |
4425 LOperand* output = instr->result(); | 4424 LOperand* output = instr->result(); |
4426 DCHECK(output->IsDoubleRegister()); | 4425 DCHECK(output->IsDoubleRegister()); |
4427 if (input->IsStackSlot()) { | 4426 if (input->IsStackSlot()) { |
4428 Register scratch = scratch0(); | 4427 Register scratch = scratch0(); |
4429 __ LoadP(scratch, ToMemOperand(input)); | 4428 __ LoadP(scratch, ToMemOperand(input)); |
4430 __ ConvertIntToDouble(scratch, ToDoubleRegister(output)); | 4429 __ ConvertIntToDouble(ToDoubleRegister(output), scratch); |
4431 } else { | 4430 } else { |
4432 __ ConvertIntToDouble(ToRegister(input), ToDoubleRegister(output)); | 4431 __ ConvertIntToDouble(ToDoubleRegister(output), ToRegister(input)); |
4433 } | 4432 } |
4434 } | 4433 } |
4435 | 4434 |
4436 void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) { | 4435 void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) { |
4437 LOperand* input = instr->value(); | 4436 LOperand* input = instr->value(); |
4438 LOperand* output = instr->result(); | 4437 LOperand* output = instr->result(); |
4439 __ ConvertUnsignedIntToDouble(ToRegister(input), ToDoubleRegister(output)); | 4438 __ ConvertUnsignedIntToDouble(ToDoubleRegister(output), ToRegister(input)); |
4440 } | 4439 } |
4441 | 4440 |
4442 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { | 4441 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { |
4443 class DeferredNumberTagI final : public LDeferredCode { | 4442 class DeferredNumberTagI final : public LDeferredCode { |
4444 public: | 4443 public: |
4445 DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr) | 4444 DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr) |
4446 : LDeferredCode(codegen), instr_(instr) {} | 4445 : LDeferredCode(codegen), instr_(instr) {} |
4447 void Generate() override { | 4446 void Generate() override { |
4448 codegen()->DoDeferredNumberTagIU(instr_, instr_->value(), instr_->temp1(), | 4447 codegen()->DoDeferredNumberTagIU(instr_, instr_->value(), instr_->temp1(), |
4449 instr_->temp2(), SIGNED_INT32); | 4448 instr_->temp2(), SIGNED_INT32); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4505 DoubleRegister dbl_scratch = double_scratch0(); | 4504 DoubleRegister dbl_scratch = double_scratch0(); |
4506 | 4505 |
4507 if (signedness == SIGNED_INT32) { | 4506 if (signedness == SIGNED_INT32) { |
4508 // There was overflow, so bits 30 and 31 of the original integer | 4507 // There was overflow, so bits 30 and 31 of the original integer |
4509 // disagree. Try to allocate a heap number in new space and store | 4508 // disagree. Try to allocate a heap number in new space and store |
4510 // the value in there. If that fails, call the runtime system. | 4509 // the value in there. If that fails, call the runtime system. |
4511 if (dst.is(src)) { | 4510 if (dst.is(src)) { |
4512 __ SmiUntag(src, dst); | 4511 __ SmiUntag(src, dst); |
4513 __ xilf(src, Operand(HeapNumber::kSignMask)); | 4512 __ xilf(src, Operand(HeapNumber::kSignMask)); |
4514 } | 4513 } |
4515 __ ConvertIntToDouble(src, dbl_scratch); | 4514 __ ConvertIntToDouble(dbl_scratch, src); |
4516 } else { | 4515 } else { |
4517 __ ConvertUnsignedIntToDouble(src, dbl_scratch); | 4516 __ ConvertUnsignedIntToDouble(dbl_scratch, src); |
4518 } | 4517 } |
4519 | 4518 |
4520 if (FLAG_inline_new) { | 4519 if (FLAG_inline_new) { |
4521 __ LoadRoot(tmp3, Heap::kHeapNumberMapRootIndex); | 4520 __ LoadRoot(tmp3, Heap::kHeapNumberMapRootIndex); |
4522 __ AllocateHeapNumber(dst, tmp1, tmp2, tmp3, &slow); | 4521 __ AllocateHeapNumber(dst, tmp1, tmp2, tmp3, &slow); |
4523 __ b(&done); | 4522 __ b(&done); |
4524 } | 4523 } |
4525 | 4524 |
4526 // Slow case: Call the runtime system to do the number allocation. | 4525 // Slow case: Call the runtime system to do the number allocation. |
4527 __ bind(&slow); | 4526 __ bind(&slow); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4672 FieldMemOperand(scratch, HeapNumber::kValueOffset)); | 4671 FieldMemOperand(scratch, HeapNumber::kValueOffset)); |
4673 __ b(&done, Label::kNear); | 4672 __ b(&done, Label::kNear); |
4674 } | 4673 } |
4675 } else { | 4674 } else { |
4676 __ SmiUntag(scratch, input_reg); | 4675 __ SmiUntag(scratch, input_reg); |
4677 DCHECK(mode == NUMBER_CANDIDATE_IS_SMI); | 4676 DCHECK(mode == NUMBER_CANDIDATE_IS_SMI); |
4678 } | 4677 } |
4679 // Smi to double register conversion | 4678 // Smi to double register conversion |
4680 __ bind(&load_smi); | 4679 __ bind(&load_smi); |
4681 // scratch: untagged value of input_reg | 4680 // scratch: untagged value of input_reg |
4682 __ ConvertIntToDouble(scratch, result_reg); | 4681 __ ConvertIntToDouble(result_reg, scratch); |
4683 __ bind(&done); | 4682 __ bind(&done); |
4684 } | 4683 } |
4685 | 4684 |
4686 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) { | 4685 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) { |
4687 Register input_reg = ToRegister(instr->value()); | 4686 Register input_reg = ToRegister(instr->value()); |
4688 Register scratch1 = scratch0(); | 4687 Register scratch1 = scratch0(); |
4689 Register scratch2 = ToRegister(instr->temp()); | 4688 Register scratch2 = ToRegister(instr->temp()); |
4690 DoubleRegister double_scratch = double_scratch0(); | 4689 DoubleRegister double_scratch = double_scratch0(); |
4691 DoubleRegister double_scratch2 = ToDoubleRegister(instr->temp2()); | 4690 DoubleRegister double_scratch2 = ToDoubleRegister(instr->temp2()); |
4692 | 4691 |
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5550 __ LoadP(result, | 5549 __ LoadP(result, |
5551 FieldMemOperand(scratch, FixedArray::kHeaderSize - kPointerSize)); | 5550 FieldMemOperand(scratch, FixedArray::kHeaderSize - kPointerSize)); |
5552 __ bind(deferred->exit()); | 5551 __ bind(deferred->exit()); |
5553 __ bind(&done); | 5552 __ bind(&done); |
5554 } | 5553 } |
5555 | 5554 |
5556 #undef __ | 5555 #undef __ |
5557 | 5556 |
5558 } // namespace internal | 5557 } // namespace internal |
5559 } // namespace v8 | 5558 } // namespace v8 |
OLD | NEW |