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 1808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1819 ASSERT(to.IsInteger32()); | 1819 ASSERT(to.IsInteger32()); |
1820 LOperand* value = UseRegister(instr->value()); | 1820 LOperand* value = UseRegister(instr->value()); |
1821 return AssignEnvironment( | 1821 return AssignEnvironment( |
1822 DefineAsRegister(new(zone()) LDoubleToI(value))); | 1822 DefineAsRegister(new(zone()) LDoubleToI(value))); |
1823 } | 1823 } |
1824 } else if (from.IsInteger32()) { | 1824 } else if (from.IsInteger32()) { |
1825 info()->MarkAsDeferredCalling(); | 1825 info()->MarkAsDeferredCalling(); |
1826 if (to.IsTagged()) { | 1826 if (to.IsTagged()) { |
1827 HValue* val = instr->value(); | 1827 HValue* val = instr->value(); |
1828 LOperand* value = UseRegister(val); | 1828 LOperand* value = UseRegister(val); |
1829 if (val->CheckFlag(HInstruction::kUint32)) { | 1829 if (!instr->CheckFlag(HValue::kCanOverflow)) { |
| 1830 return DefineAsRegister(new(zone()) LSmiTag(value)); |
| 1831 } else if (val->CheckFlag(HInstruction::kUint32)) { |
1830 LOperand* temp1 = TempRegister(); | 1832 LOperand* temp1 = TempRegister(); |
1831 LOperand* temp2 = FixedTemp(xmm1); | 1833 LOperand* temp2 = FixedTemp(xmm1); |
1832 LNumberTagU* result = new(zone()) LNumberTagU(value, temp1, temp2); | 1834 LNumberTagU* result = new(zone()) LNumberTagU(value, temp1, temp2); |
1833 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); | 1835 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); |
1834 } else if (val->HasRange() && val->range()->IsInSmiRange()) { | |
1835 return DefineSameAsFirst(new(zone()) LSmiTag(value)); | |
1836 } else { | 1836 } else { |
1837 LNumberTagI* result = new(zone()) LNumberTagI(value); | 1837 LNumberTagI* result = new(zone()) LNumberTagI(value); |
1838 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); | 1838 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); |
1839 } | 1839 } |
1840 } else if (to.IsSmi()) { | 1840 } else if (to.IsSmi()) { |
1841 HValue* val = instr->value(); | 1841 HValue* val = instr->value(); |
1842 LOperand* value = UseRegister(val); | 1842 LOperand* value = UseRegister(val); |
1843 LInstruction* result = NULL; | 1843 LInstruction* result = DefineAsRegister(new(zone()) LSmiTag(value)); |
1844 if (val->CheckFlag(HInstruction::kUint32)) { | 1844 if (instr->CheckFlag(HValue::kCanOverflow)) { |
1845 result = DefineAsRegister(new(zone()) LUint32ToSmi(value)); | 1845 ASSERT(val->CheckFlag(HValue::kUint32)); |
1846 if (val->HasRange() && val->range()->IsInSmiRange() && | 1846 result = AssignEnvironment(result); |
1847 val->range()->upper() != kMaxInt) { | |
1848 return result; | |
1849 } | |
1850 } else { | |
1851 result = DefineAsRegister(new(zone()) LInteger32ToSmi(value)); | |
1852 if (val->HasRange() && val->range()->IsInSmiRange()) { | |
1853 return result; | |
1854 } | |
1855 } | 1847 } |
1856 return AssignEnvironment(result); | 1848 return result; |
1857 } else { | 1849 } else { |
1858 if (instr->value()->CheckFlag(HInstruction::kUint32)) { | 1850 if (instr->value()->CheckFlag(HInstruction::kUint32)) { |
1859 LOperand* temp = FixedTemp(xmm1); | 1851 LOperand* temp = FixedTemp(xmm1); |
1860 return DefineAsRegister( | 1852 return DefineAsRegister( |
1861 new(zone()) LUint32ToDouble(UseRegister(instr->value()), temp)); | 1853 new(zone()) LUint32ToDouble(UseRegister(instr->value()), temp)); |
1862 } else { | 1854 } else { |
1863 ASSERT(to.IsDouble()); | 1855 ASSERT(to.IsDouble()); |
1864 LOperand* value = Use(instr->value()); | 1856 LOperand* value = Use(instr->value()); |
1865 return DefineAsRegister(new(zone()) LInteger32ToDouble(value)); | 1857 return DefineAsRegister(new(zone()) LInteger32ToDouble(value)); |
1866 } | 1858 } |
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2531 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2523 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2532 LOperand* object = UseRegister(instr->object()); | 2524 LOperand* object = UseRegister(instr->object()); |
2533 LOperand* index = UseTempRegister(instr->index()); | 2525 LOperand* index = UseTempRegister(instr->index()); |
2534 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2526 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
2535 } | 2527 } |
2536 | 2528 |
2537 | 2529 |
2538 } } // namespace v8::internal | 2530 } } // namespace v8::internal |
2539 | 2531 |
2540 #endif // V8_TARGET_ARCH_X64 | 2532 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |