| 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 4877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4888 // The input is a tagged HeapObject. | 4888 // The input is a tagged HeapObject. |
| 4889 // Heap number map check. | 4889 // Heap number map check. |
| 4890 __ lw(scratch1, FieldMemOperand(input_reg, HeapObject::kMapOffset)); | 4890 __ lw(scratch1, FieldMemOperand(input_reg, HeapObject::kMapOffset)); |
| 4891 __ LoadRoot(at, Heap::kHeapNumberMapRootIndex); | 4891 __ LoadRoot(at, Heap::kHeapNumberMapRootIndex); |
| 4892 // This 'at' value and scratch1 map value are used for tests in both clauses | 4892 // This 'at' value and scratch1 map value are used for tests in both clauses |
| 4893 // of the if. | 4893 // of the if. |
| 4894 | 4894 |
| 4895 if (instr->truncating()) { | 4895 if (instr->truncating()) { |
| 4896 // Performs a truncating conversion of a floating point number as used by | 4896 // Performs a truncating conversion of a floating point number as used by |
| 4897 // the JS bitwise operations. | 4897 // the JS bitwise operations. |
| 4898 Label heap_number; | 4898 Label no_heap_number, check_bools, check_false; |
| 4899 __ Branch(&heap_number, eq, scratch1, Operand(at)); // HeapNumber map? | 4899 __ Branch(&no_heap_number, ne, scratch1, Operand(at)); // HeapNumber map? |
| 4900 // Check for undefined. Undefined is converted to zero for truncating | 4900 __ mov(scratch2, input_reg); |
| 4901 // conversions. | 4901 __ TruncateHeapNumberToI(input_reg, scratch2); |
| 4902 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); | |
| 4903 DeoptimizeIf(ne, instr->environment(), input_reg, Operand(at)); | |
| 4904 ASSERT(ToRegister(instr->result()).is(input_reg)); | |
| 4905 __ mov(input_reg, zero_reg); | |
| 4906 __ Branch(&done); | 4902 __ Branch(&done); |
| 4907 | 4903 |
| 4908 __ bind(&heap_number); | 4904 // Check for Oddballs. Undefined/False is converted to zero and True to one |
| 4909 __ mov(scratch2, input_reg); | 4905 // for truncating conversions. |
| 4910 __ TruncateHeapNumberToI(input_reg, scratch2); | 4906 __ bind(&no_heap_number); |
| 4907 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); |
| 4908 __ Branch(&check_bools, ne, input_reg, Operand(at)); |
| 4909 ASSERT(ToRegister(instr->result()).is(input_reg)); |
| 4910 __ Branch(USE_DELAY_SLOT, &done); |
| 4911 __ mov(input_reg, zero_reg); // In delay slot. |
| 4912 |
| 4913 __ bind(&check_bools); |
| 4914 __ LoadRoot(at, Heap::kTrueValueRootIndex); |
| 4915 __ Branch(&check_false, ne, scratch2, Operand(at)); |
| 4916 __ Branch(USE_DELAY_SLOT, &done); |
| 4917 __ li(input_reg, Operand(1)); // In delay slot. |
| 4918 |
| 4919 __ bind(&check_false); |
| 4920 __ LoadRoot(at, Heap::kFalseValueRootIndex); |
| 4921 DeoptimizeIf(ne, instr->environment(), scratch2, Operand(at)); |
| 4922 __ Branch(USE_DELAY_SLOT, &done); |
| 4923 __ mov(input_reg, zero_reg); // In delay slot. |
| 4911 } else { | 4924 } else { |
| 4912 // Deoptimize if we don't have a heap number. | 4925 // Deoptimize if we don't have a heap number. |
| 4913 DeoptimizeIf(ne, instr->environment(), scratch1, Operand(at)); | 4926 DeoptimizeIf(ne, instr->environment(), scratch1, Operand(at)); |
| 4914 | 4927 |
| 4915 // Load the double value. | 4928 // Load the double value. |
| 4916 __ ldc1(double_scratch, | 4929 __ ldc1(double_scratch, |
| 4917 FieldMemOperand(input_reg, HeapNumber::kValueOffset)); | 4930 FieldMemOperand(input_reg, HeapNumber::kValueOffset)); |
| 4918 | 4931 |
| 4919 Register except_flag = scratch2; | 4932 Register except_flag = scratch2; |
| 4920 __ EmitFPUTruncate(kRoundToZero, | 4933 __ EmitFPUTruncate(kRoundToZero, |
| (...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5812 __ Subu(scratch, result, scratch); | 5825 __ Subu(scratch, result, scratch); |
| 5813 __ lw(result, FieldMemOperand(scratch, | 5826 __ lw(result, FieldMemOperand(scratch, |
| 5814 FixedArray::kHeaderSize - kPointerSize)); | 5827 FixedArray::kHeaderSize - kPointerSize)); |
| 5815 __ bind(&done); | 5828 __ bind(&done); |
| 5816 } | 5829 } |
| 5817 | 5830 |
| 5818 | 5831 |
| 5819 #undef __ | 5832 #undef __ |
| 5820 | 5833 |
| 5821 } } // namespace v8::internal | 5834 } } // namespace v8::internal |
| OLD | NEW |