| 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 1794 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1805   // All HForceRepresentation instructions should be eliminated in the |  1805   // All HForceRepresentation instructions should be eliminated in the | 
|  1806   // representation change phase of Hydrogen. |  1806   // representation change phase of Hydrogen. | 
|  1807   UNREACHABLE(); |  1807   UNREACHABLE(); | 
|  1808   return NULL; |  1808   return NULL; | 
|  1809 } |  1809 } | 
|  1810  |  1810  | 
|  1811  |  1811  | 
|  1812 LInstruction* LChunkBuilder::DoChange(HChange* instr) { |  1812 LInstruction* LChunkBuilder::DoChange(HChange* instr) { | 
|  1813   Representation from = instr->from(); |  1813   Representation from = instr->from(); | 
|  1814   Representation to = instr->to(); |  1814   Representation to = instr->to(); | 
 |  1815   if (from.IsSmi()) { | 
 |  1816     if (to.IsTagged()) { | 
 |  1817       LOperand* value = UseRegister(instr->value()); | 
 |  1818       return DefineSameAsFirst(new(zone()) LDummyUse(value)); | 
 |  1819     } | 
 |  1820     from = Representation::Tagged(); | 
 |  1821   } | 
|  1815   // Only mark conversions that might need to allocate as calling rather than |  1822   // Only mark conversions that might need to allocate as calling rather than | 
|  1816   // all changes. This makes simple, non-allocating conversion not have to force |  1823   // all changes. This makes simple, non-allocating conversion not have to force | 
|  1817   // building a stack frame. |  1824   // building a stack frame. | 
|  1818   if (from.IsTagged()) { |  1825   if (from.IsTagged()) { | 
|  1819     if (to.IsDouble()) { |  1826     if (to.IsDouble()) { | 
|  1820       info()->MarkAsDeferredCalling(); |  1827       info()->MarkAsDeferredCalling(); | 
|  1821       LOperand* value = UseRegister(instr->value()); |  1828       LOperand* value = UseRegister(instr->value()); | 
|  1822       LNumberUntagD* res = new(zone()) LNumberUntagD(value); |  1829       LNumberUntagD* res = new(zone()) LNumberUntagD(value); | 
|  1823       return AssignEnvironment(DefineAsRegister(res)); |  1830       return AssignEnvironment(DefineAsRegister(res)); | 
 |  1831     } else if (to.IsSmi()) { | 
 |  1832       HValue* val = instr->value(); | 
 |  1833       LOperand* value = UseRegisterAtStart(val); | 
 |  1834       return AssignEnvironment( | 
 |  1835           DefineSameAsFirst(new(zone()) LCheckSmi(value))); | 
|  1824     } else { |  1836     } else { | 
|  1825       ASSERT(to.IsInteger32()); |  1837       ASSERT(to.IsInteger32()); | 
|  1826       LOperand* value = UseRegister(instr->value()); |  1838       LOperand* value = UseRegister(instr->value()); | 
|  1827       if (instr->value()->type().IsSmi()) { |  1839       if (instr->value()->type().IsSmi()) { | 
|  1828         return DefineSameAsFirst(new(zone()) LSmiUntag(value, false)); |  1840         return DefineSameAsFirst(new(zone()) LSmiUntag(value, false)); | 
|  1829       } else { |  1841       } else { | 
|  1830         bool truncating = instr->CanTruncateToInt32(); |  1842         bool truncating = instr->CanTruncateToInt32(); | 
|  1831         LOperand* xmm_temp = truncating ? NULL : FixedTemp(xmm1); |  1843         LOperand* xmm_temp = truncating ? NULL : FixedTemp(xmm1); | 
|  1832         LTaggedToI* res = new(zone()) LTaggedToI(value, xmm_temp); |  1844         LTaggedToI* res = new(zone()) LTaggedToI(value, xmm_temp); | 
|  1833         return AssignEnvironment(DefineSameAsFirst(res)); |  1845         return AssignEnvironment(DefineSameAsFirst(res)); | 
|  1834       } |  1846       } | 
|  1835     } |  1847     } | 
|  1836   } else if (from.IsDouble()) { |  1848   } else if (from.IsDouble()) { | 
|  1837     if (to.IsTagged()) { |  1849     if (to.IsTagged()) { | 
|  1838       info()->MarkAsDeferredCalling(); |  1850       info()->MarkAsDeferredCalling(); | 
|  1839       LOperand* value = UseRegister(instr->value()); |  1851       LOperand* value = UseRegister(instr->value()); | 
|  1840       LOperand* temp = TempRegister(); |  1852       LOperand* temp = TempRegister(); | 
|  1841  |  1853  | 
|  1842       // Make sure that temp and result_temp are different registers. |  1854       // Make sure that temp and result_temp are different registers. | 
|  1843       LUnallocated* result_temp = TempRegister(); |  1855       LUnallocated* result_temp = TempRegister(); | 
|  1844       LNumberTagD* result = new(zone()) LNumberTagD(value, temp); |  1856       LNumberTagD* result = new(zone()) LNumberTagD(value, temp); | 
|  1845       return AssignPointerMap(Define(result, result_temp)); |  1857       return AssignPointerMap(Define(result, result_temp)); | 
 |  1858     } else if (to.IsSmi()) { | 
 |  1859       LOperand* value = UseRegister(instr->value()); | 
 |  1860       return AssignEnvironment( | 
 |  1861           DefineAsRegister(new(zone()) LDoubleToSmi(value))); | 
|  1846     } else { |  1862     } else { | 
|  1847       ASSERT(to.IsInteger32()); |  1863       ASSERT(to.IsInteger32()); | 
|  1848       LOperand* value = UseRegister(instr->value()); |  1864       LOperand* value = UseRegister(instr->value()); | 
|  1849       return AssignEnvironment(DefineAsRegister(new(zone()) LDoubleToI(value))); |  1865       return AssignEnvironment( | 
 |  1866           DefineAsRegister(new(zone()) LDoubleToI(value))); | 
|  1850     } |  1867     } | 
|  1851   } else if (from.IsInteger32()) { |  1868   } else if (from.IsInteger32()) { | 
|  1852     info()->MarkAsDeferredCalling(); |  1869     info()->MarkAsDeferredCalling(); | 
|  1853     if (to.IsTagged()) { |  1870     if (to.IsTagged()) { | 
|  1854       HValue* val = instr->value(); |  1871       HValue* val = instr->value(); | 
|  1855       LOperand* value = UseRegister(val); |  1872       LOperand* value = UseRegister(val); | 
|  1856       if (val->CheckFlag(HInstruction::kUint32)) { |  1873       if (val->CheckFlag(HInstruction::kUint32)) { | 
|  1857         LOperand* temp = FixedTemp(xmm1); |  1874         LOperand* temp = FixedTemp(xmm1); | 
|  1858         LNumberTagU* result = new(zone()) LNumberTagU(value, temp); |  1875         LNumberTagU* result = new(zone()) LNumberTagU(value, temp); | 
|  1859         return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); |  1876         return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); | 
|  1860       } else if (val->HasRange() && val->range()->IsInSmiRange()) { |  1877       } else if (val->HasRange() && val->range()->IsInSmiRange()) { | 
|  1861         return DefineSameAsFirst(new(zone()) LSmiTag(value)); |  1878         return DefineSameAsFirst(new(zone()) LSmiTag(value)); | 
|  1862       } else { |  1879       } else { | 
|  1863         LNumberTagI* result = new(zone()) LNumberTagI(value); |  1880         LNumberTagI* result = new(zone()) LNumberTagI(value); | 
|  1864         return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); |  1881         return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); | 
|  1865       } |  1882       } | 
 |  1883     } else if (to.IsSmi()) { | 
 |  1884       HValue* val = instr->value(); | 
 |  1885       LOperand* value = UseRegister(val); | 
 |  1886       LInstruction* result = | 
 |  1887           DefineAsRegister(new(zone()) LInteger32ToSmi(value)); | 
 |  1888       if (val->HasRange() && val->range()->IsInSmiRange()) { | 
 |  1889         return result; | 
 |  1890       } | 
 |  1891       return AssignEnvironment(result); | 
|  1866     } else { |  1892     } else { | 
|  1867       if (instr->value()->CheckFlag(HInstruction::kUint32)) { |  1893       if (instr->value()->CheckFlag(HInstruction::kUint32)) { | 
|  1868         LOperand* temp = FixedTemp(xmm1); |  1894         LOperand* temp = FixedTemp(xmm1); | 
|  1869         return DefineAsRegister( |  1895         return DefineAsRegister( | 
|  1870             new(zone()) LUint32ToDouble(UseRegister(instr->value()), temp)); |  1896             new(zone()) LUint32ToDouble(UseRegister(instr->value()), temp)); | 
|  1871       } else { |  1897       } else { | 
|  1872         ASSERT(to.IsDouble()); |  1898         ASSERT(to.IsDouble()); | 
|  1873         LOperand* value = Use(instr->value()); |  1899         LOperand* value = Use(instr->value()); | 
|  1874         return DefineAsRegister(new(zone()) LInteger32ToDouble(value)); |  1900         return DefineAsRegister(new(zone()) LInteger32ToDouble(value)); | 
|  1875       } |  1901       } | 
| (...skipping 19 matching lines...) Expand all  Loading... | 
|  1895  |  1921  | 
|  1896 LInstruction* LChunkBuilder::DoCheckPrototypeMaps(HCheckPrototypeMaps* instr) { |  1922 LInstruction* LChunkBuilder::DoCheckPrototypeMaps(HCheckPrototypeMaps* instr) { | 
|  1897   LUnallocated* temp = TempRegister(); |  1923   LUnallocated* temp = TempRegister(); | 
|  1898   LCheckPrototypeMaps* result = new(zone()) LCheckPrototypeMaps(temp); |  1924   LCheckPrototypeMaps* result = new(zone()) LCheckPrototypeMaps(temp); | 
|  1899   return AssignEnvironment(result); |  1925   return AssignEnvironment(result); | 
|  1900 } |  1926 } | 
|  1901  |  1927  | 
|  1902  |  1928  | 
|  1903 LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) { |  1929 LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) { | 
|  1904   LOperand* value = UseRegisterAtStart(instr->value()); |  1930   LOperand* value = UseRegisterAtStart(instr->value()); | 
|  1905   return AssignEnvironment(new(zone()) LCheckSmi(value)); |  1931   return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value))); | 
|  1906 } |  1932 } | 
|  1907  |  1933  | 
|  1908  |  1934  | 
|  1909 LInstruction* LChunkBuilder::DoCheckSmiOrInt32(HCheckSmiOrInt32* instr) { |  1935 LInstruction* LChunkBuilder::DoCheckSmiOrInt32(HCheckSmiOrInt32* instr) { | 
|  1910   LOperand* value = UseRegisterAtStart(instr->value()); |  1936   LOperand* value = UseRegisterAtStart(instr->value()); | 
|  1911   return AssignEnvironment(new(zone()) LCheckSmi(value)); |  1937   return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value))); | 
|  1912 } |  1938 } | 
|  1913  |  1939  | 
|  1914  |  1940  | 
|  1915 LInstruction* LChunkBuilder::DoCheckFunction(HCheckFunction* instr) { |  1941 LInstruction* LChunkBuilder::DoCheckFunction(HCheckFunction* instr) { | 
|  1916   LOperand* value = UseRegisterAtStart(instr->value()); |  1942   LOperand* value = UseRegisterAtStart(instr->value()); | 
|  1917   return AssignEnvironment(new(zone()) LCheckFunction(value)); |  1943   return AssignEnvironment(new(zone()) LCheckFunction(value)); | 
|  1918 } |  1944 } | 
|  1919  |  1945  | 
|  1920  |  1946  | 
|  1921 LInstruction* LChunkBuilder::DoCheckMaps(HCheckMaps* instr) { |  1947 LInstruction* LChunkBuilder::DoCheckMaps(HCheckMaps* instr) { | 
| (...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2549 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |  2575 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 
|  2550   LOperand* object = UseRegister(instr->object()); |  2576   LOperand* object = UseRegister(instr->object()); | 
|  2551   LOperand* index = UseTempRegister(instr->index()); |  2577   LOperand* index = UseTempRegister(instr->index()); | 
|  2552   return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |  2578   return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 
|  2553 } |  2579 } | 
|  2554  |  2580  | 
|  2555  |  2581  | 
|  2556 } }  // namespace v8::internal |  2582 } }  // namespace v8::internal | 
|  2557  |  2583  | 
|  2558 #endif  // V8_TARGET_ARCH_X64 |  2584 #endif  // V8_TARGET_ARCH_X64 | 
| OLD | NEW |