| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 | 421 |
| 422 void LStoreKeyedFastElement::PrintDataTo(StringStream* stream) { | 422 void LStoreKeyedFastElement::PrintDataTo(StringStream* stream) { |
| 423 object()->PrintTo(stream); | 423 object()->PrintTo(stream); |
| 424 stream->Add("["); | 424 stream->Add("["); |
| 425 key()->PrintTo(stream); | 425 key()->PrintTo(stream); |
| 426 stream->Add("] <- "); | 426 stream->Add("] <- "); |
| 427 value()->PrintTo(stream); | 427 value()->PrintTo(stream); |
| 428 } | 428 } |
| 429 | 429 |
| 430 | 430 |
| 431 void LStoreKeyedFastDoubleElement::PrintDataTo(StringStream* stream) { |
| 432 elements()->PrintTo(stream); |
| 433 stream->Add("["); |
| 434 key()->PrintTo(stream); |
| 435 stream->Add("] <- "); |
| 436 value()->PrintTo(stream); |
| 437 } |
| 438 |
| 439 |
| 431 void LStoreKeyedGeneric::PrintDataTo(StringStream* stream) { | 440 void LStoreKeyedGeneric::PrintDataTo(StringStream* stream) { |
| 432 object()->PrintTo(stream); | 441 object()->PrintTo(stream); |
| 433 stream->Add("["); | 442 stream->Add("["); |
| 434 key()->PrintTo(stream); | 443 key()->PrintTo(stream); |
| 435 stream->Add("] <- "); | 444 stream->Add("] <- "); |
| 436 value()->PrintTo(stream); | 445 value()->PrintTo(stream); |
| 437 } | 446 } |
| 438 | 447 |
| 439 | 448 |
| 440 void LChunk::AddInstruction(LInstruction* instr, HBasicBlock* block) { | 449 void LChunk::AddInstruction(LInstruction* instr, HBasicBlock* block) { |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1020 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { | 1029 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { |
| 1021 HValue* v = instr->value(); | 1030 HValue* v = instr->value(); |
| 1022 if (v->EmitAtUses()) { | 1031 if (v->EmitAtUses()) { |
| 1023 ASSERT(v->IsConstant()); | 1032 ASSERT(v->IsConstant()); |
| 1024 ASSERT(!v->representation().IsDouble()); | 1033 ASSERT(!v->representation().IsDouble()); |
| 1025 HBasicBlock* successor = HConstant::cast(v)->ToBoolean() | 1034 HBasicBlock* successor = HConstant::cast(v)->ToBoolean() |
| 1026 ? instr->FirstSuccessor() | 1035 ? instr->FirstSuccessor() |
| 1027 : instr->SecondSuccessor(); | 1036 : instr->SecondSuccessor(); |
| 1028 return new LGoto(successor->block_id()); | 1037 return new LGoto(successor->block_id()); |
| 1029 } | 1038 } |
| 1030 return new LBranch(UseRegisterAtStart(v)); | 1039 LInstruction* branch = new LBranch(UseRegister(v)); |
| 1040 // When we handle all cases, we never deopt, so we don't need to assign the |
| 1041 // environment then. |
| 1042 bool all_cases_handled = instr->expected_input_types().IsAll(); |
| 1043 return all_cases_handled ? branch : AssignEnvironment(branch); |
| 1031 } | 1044 } |
| 1032 | 1045 |
| 1033 | 1046 |
| 1034 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) { | 1047 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) { |
| 1035 ASSERT(instr->value()->representation().IsTagged()); | 1048 ASSERT(instr->value()->representation().IsTagged()); |
| 1036 LOperand* value = UseRegisterAtStart(instr->value()); | 1049 LOperand* value = UseRegisterAtStart(instr->value()); |
| 1037 return new LCmpMapAndBranch(value); | 1050 return new LCmpMapAndBranch(value); |
| 1038 } | 1051 } |
| 1039 | 1052 |
| 1040 | 1053 |
| (...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1817 HLoadKeyedFastElement* instr) { | 1830 HLoadKeyedFastElement* instr) { |
| 1818 ASSERT(instr->representation().IsTagged()); | 1831 ASSERT(instr->representation().IsTagged()); |
| 1819 ASSERT(instr->key()->representation().IsInteger32()); | 1832 ASSERT(instr->key()->representation().IsInteger32()); |
| 1820 LOperand* obj = UseRegisterAtStart(instr->object()); | 1833 LOperand* obj = UseRegisterAtStart(instr->object()); |
| 1821 LOperand* key = UseRegisterAtStart(instr->key()); | 1834 LOperand* key = UseRegisterAtStart(instr->key()); |
| 1822 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); | 1835 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); |
| 1823 return AssignEnvironment(DefineSameAsFirst(result)); | 1836 return AssignEnvironment(DefineSameAsFirst(result)); |
| 1824 } | 1837 } |
| 1825 | 1838 |
| 1826 | 1839 |
| 1840 LInstruction* LChunkBuilder::DoLoadKeyedFastDoubleElement( |
| 1841 HLoadKeyedFastDoubleElement* instr) { |
| 1842 ASSERT(instr->representation().IsDouble()); |
| 1843 ASSERT(instr->key()->representation().IsInteger32()); |
| 1844 LOperand* elements = UseRegisterAtStart(instr->elements()); |
| 1845 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
| 1846 LLoadKeyedFastDoubleElement* result = |
| 1847 new LLoadKeyedFastDoubleElement(elements, key); |
| 1848 return AssignEnvironment(DefineAsRegister(result)); |
| 1849 } |
| 1850 |
| 1851 |
| 1827 LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement( | 1852 LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement( |
| 1828 HLoadKeyedSpecializedArrayElement* instr) { | 1853 HLoadKeyedSpecializedArrayElement* instr) { |
| 1829 JSObject::ElementsKind elements_kind = instr->elements_kind(); | 1854 JSObject::ElementsKind elements_kind = instr->elements_kind(); |
| 1830 Representation representation(instr->representation()); | 1855 Representation representation(instr->representation()); |
| 1831 ASSERT( | 1856 ASSERT( |
| 1832 (representation.IsInteger32() && | 1857 (representation.IsInteger32() && |
| 1833 (elements_kind != JSObject::EXTERNAL_FLOAT_ELEMENTS) && | 1858 (elements_kind != JSObject::EXTERNAL_FLOAT_ELEMENTS) && |
| 1834 (elements_kind != JSObject::EXTERNAL_DOUBLE_ELEMENTS)) || | 1859 (elements_kind != JSObject::EXTERNAL_DOUBLE_ELEMENTS)) || |
| 1835 (representation.IsDouble() && | 1860 (representation.IsDouble() && |
| 1836 ((elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) || | 1861 ((elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) || |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1869 ? UseTempRegister(instr->value()) | 1894 ? UseTempRegister(instr->value()) |
| 1870 : UseRegisterAtStart(instr->value()); | 1895 : UseRegisterAtStart(instr->value()); |
| 1871 LOperand* key = needs_write_barrier | 1896 LOperand* key = needs_write_barrier |
| 1872 ? UseTempRegister(instr->key()) | 1897 ? UseTempRegister(instr->key()) |
| 1873 : UseRegisterOrConstantAtStart(instr->key()); | 1898 : UseRegisterOrConstantAtStart(instr->key()); |
| 1874 | 1899 |
| 1875 return AssignEnvironment(new LStoreKeyedFastElement(obj, key, val)); | 1900 return AssignEnvironment(new LStoreKeyedFastElement(obj, key, val)); |
| 1876 } | 1901 } |
| 1877 | 1902 |
| 1878 | 1903 |
| 1904 LInstruction* LChunkBuilder::DoStoreKeyedFastDoubleElement( |
| 1905 HStoreKeyedFastDoubleElement* instr) { |
| 1906 ASSERT(instr->value()->representation().IsDouble()); |
| 1907 ASSERT(instr->elements()->representation().IsTagged()); |
| 1908 ASSERT(instr->key()->representation().IsInteger32()); |
| 1909 |
| 1910 LOperand* elements = UseRegisterAtStart(instr->elements()); |
| 1911 LOperand* val = UseTempRegister(instr->value()); |
| 1912 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
| 1913 |
| 1914 return new LStoreKeyedFastDoubleElement(elements, key, val); |
| 1915 } |
| 1916 |
| 1917 |
| 1879 LInstruction* LChunkBuilder::DoStoreKeyedSpecializedArrayElement( | 1918 LInstruction* LChunkBuilder::DoStoreKeyedSpecializedArrayElement( |
| 1880 HStoreKeyedSpecializedArrayElement* instr) { | 1919 HStoreKeyedSpecializedArrayElement* instr) { |
| 1881 Representation representation(instr->value()->representation()); | 1920 Representation representation(instr->value()->representation()); |
| 1882 JSObject::ElementsKind elements_kind = instr->elements_kind(); | 1921 JSObject::ElementsKind elements_kind = instr->elements_kind(); |
| 1883 ASSERT( | 1922 ASSERT( |
| 1884 (representation.IsInteger32() && | 1923 (representation.IsInteger32() && |
| 1885 (elements_kind != JSObject::EXTERNAL_FLOAT_ELEMENTS) && | 1924 (elements_kind != JSObject::EXTERNAL_FLOAT_ELEMENTS) && |
| 1886 (elements_kind != JSObject::EXTERNAL_DOUBLE_ELEMENTS)) || | 1925 (elements_kind != JSObject::EXTERNAL_DOUBLE_ELEMENTS)) || |
| 1887 (representation.IsDouble() && | 1926 (representation.IsDouble() && |
| 1888 ((elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) || | 1927 ((elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) || |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2140 LOperand* key = UseOrConstantAtStart(instr->key()); | 2179 LOperand* key = UseOrConstantAtStart(instr->key()); |
| 2141 LOperand* object = UseOrConstantAtStart(instr->object()); | 2180 LOperand* object = UseOrConstantAtStart(instr->object()); |
| 2142 LIn* result = new LIn(key, object); | 2181 LIn* result = new LIn(key, object); |
| 2143 return MarkAsCall(DefineFixed(result, rax), instr); | 2182 return MarkAsCall(DefineFixed(result, rax), instr); |
| 2144 } | 2183 } |
| 2145 | 2184 |
| 2146 | 2185 |
| 2147 } } // namespace v8::internal | 2186 } } // namespace v8::internal |
| 2148 | 2187 |
| 2149 #endif // V8_TARGET_ARCH_X64 | 2188 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |