| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/crankshaft/mips64/lithium-codegen-mips64.h" | 5 #include "src/crankshaft/mips64/lithium-codegen-mips64.h" |
| 6 | 6 |
| 7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/crankshaft/hydrogen-osr.h" | 9 #include "src/crankshaft/hydrogen-osr.h" |
| 10 #include "src/crankshaft/mips64/lithium-gap-resolver-mips64.h" | 10 #include "src/crankshaft/mips64/lithium-gap-resolver-mips64.h" |
| (...skipping 4677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4688 Label done; | 4688 Label done; |
| 4689 | 4689 |
| 4690 // The input is a tagged HeapObject. | 4690 // The input is a tagged HeapObject. |
| 4691 // Heap number map check. | 4691 // Heap number map check. |
| 4692 __ ld(scratch1, FieldMemOperand(input_reg, HeapObject::kMapOffset)); | 4692 __ ld(scratch1, FieldMemOperand(input_reg, HeapObject::kMapOffset)); |
| 4693 __ LoadRoot(at, Heap::kHeapNumberMapRootIndex); | 4693 __ LoadRoot(at, Heap::kHeapNumberMapRootIndex); |
| 4694 // This 'at' value and scratch1 map value are used for tests in both clauses | 4694 // This 'at' value and scratch1 map value are used for tests in both clauses |
| 4695 // of the if. | 4695 // of the if. |
| 4696 | 4696 |
| 4697 if (instr->truncating()) { | 4697 if (instr->truncating()) { |
| 4698 // Performs a truncating conversion of a floating point number as used by | 4698 Label truncate; |
| 4699 // the JS bitwise operations. | 4699 __ Branch(USE_DELAY_SLOT, &truncate, eq, scratch1, Operand(at)); |
| 4700 Label no_heap_number, check_bools, check_false; | |
| 4701 // Check HeapNumber map. | |
| 4702 __ Branch(USE_DELAY_SLOT, &no_heap_number, ne, scratch1, Operand(at)); | |
| 4703 __ mov(scratch2, input_reg); // In delay slot. | 4700 __ mov(scratch2, input_reg); // In delay slot. |
| 4701 __ lbu(scratch1, FieldMemOperand(scratch1, Map::kInstanceTypeOffset)); |
| 4702 DeoptimizeIf(ne, instr, DeoptimizeReason::kNotANumberOrOddball, scratch1, |
| 4703 Operand(ODDBALL_TYPE)); |
| 4704 __ bind(&truncate); |
| 4704 __ TruncateHeapNumberToI(input_reg, scratch2); | 4705 __ TruncateHeapNumberToI(input_reg, scratch2); |
| 4705 __ Branch(&done); | |
| 4706 | |
| 4707 // Check for Oddballs. Undefined/False is converted to zero and True to one | |
| 4708 // for truncating conversions. | |
| 4709 __ bind(&no_heap_number); | |
| 4710 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); | |
| 4711 __ Branch(&check_bools, ne, input_reg, Operand(at)); | |
| 4712 DCHECK(ToRegister(instr->result()).is(input_reg)); | |
| 4713 __ Branch(USE_DELAY_SLOT, &done); | |
| 4714 __ mov(input_reg, zero_reg); // In delay slot. | |
| 4715 | |
| 4716 __ bind(&check_bools); | |
| 4717 __ LoadRoot(at, Heap::kTrueValueRootIndex); | |
| 4718 __ Branch(&check_false, ne, scratch2, Operand(at)); | |
| 4719 __ Branch(USE_DELAY_SLOT, &done); | |
| 4720 __ li(input_reg, Operand(1)); // In delay slot. | |
| 4721 | |
| 4722 __ bind(&check_false); | |
| 4723 __ LoadRoot(at, Heap::kFalseValueRootIndex); | |
| 4724 DeoptimizeIf(ne, instr, DeoptimizeReason::kNotAHeapNumberUndefinedBoolean, | |
| 4725 scratch2, Operand(at)); | |
| 4726 __ Branch(USE_DELAY_SLOT, &done); | |
| 4727 __ mov(input_reg, zero_reg); // In delay slot. | |
| 4728 } else { | 4706 } else { |
| 4729 DeoptimizeIf(ne, instr, DeoptimizeReason::kNotAHeapNumber, scratch1, | 4707 DeoptimizeIf(ne, instr, DeoptimizeReason::kNotAHeapNumber, scratch1, |
| 4730 Operand(at)); | 4708 Operand(at)); |
| 4731 | 4709 |
| 4732 // Load the double value. | 4710 // Load the double value. |
| 4733 __ ldc1(double_scratch, | 4711 __ ldc1(double_scratch, |
| 4734 FieldMemOperand(input_reg, HeapNumber::kValueOffset)); | 4712 FieldMemOperand(input_reg, HeapNumber::kValueOffset)); |
| 4735 | 4713 |
| 4736 Register except_flag = scratch2; | 4714 Register except_flag = scratch2; |
| 4737 __ EmitFPUTruncate(kRoundToZero, | 4715 __ EmitFPUTruncate(kRoundToZero, |
| (...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5626 __ ld(result, FieldMemOperand(scratch, | 5604 __ ld(result, FieldMemOperand(scratch, |
| 5627 FixedArray::kHeaderSize - kPointerSize)); | 5605 FixedArray::kHeaderSize - kPointerSize)); |
| 5628 __ bind(deferred->exit()); | 5606 __ bind(deferred->exit()); |
| 5629 __ bind(&done); | 5607 __ bind(&done); |
| 5630 } | 5608 } |
| 5631 | 5609 |
| 5632 #undef __ | 5610 #undef __ |
| 5633 | 5611 |
| 5634 } // namespace internal | 5612 } // namespace internal |
| 5635 } // namespace v8 | 5613 } // namespace v8 |
| OLD | NEW |