| 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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 | 422 |
| 423 void LStoreKeyedFastElement::PrintDataTo(StringStream* stream) { | 423 void LStoreKeyedFastElement::PrintDataTo(StringStream* stream) { |
| 424 object()->PrintTo(stream); | 424 object()->PrintTo(stream); |
| 425 stream->Add("["); | 425 stream->Add("["); |
| 426 key()->PrintTo(stream); | 426 key()->PrintTo(stream); |
| 427 stream->Add("] <- "); | 427 stream->Add("] <- "); |
| 428 value()->PrintTo(stream); | 428 value()->PrintTo(stream); |
| 429 } | 429 } |
| 430 | 430 |
| 431 | 431 |
| 432 void LStoreKeyedFastDoubleElement::PrintDataTo(StringStream* stream) { |
| 433 elements()->PrintTo(stream); |
| 434 stream->Add("["); |
| 435 key()->PrintTo(stream); |
| 436 stream->Add("] <- "); |
| 437 value()->PrintTo(stream); |
| 438 } |
| 439 |
| 440 |
| 432 void LStoreKeyedGeneric::PrintDataTo(StringStream* stream) { | 441 void LStoreKeyedGeneric::PrintDataTo(StringStream* stream) { |
| 433 object()->PrintTo(stream); | 442 object()->PrintTo(stream); |
| 434 stream->Add("["); | 443 stream->Add("["); |
| 435 key()->PrintTo(stream); | 444 key()->PrintTo(stream); |
| 436 stream->Add("] <- "); | 445 stream->Add("] <- "); |
| 437 value()->PrintTo(stream); | 446 value()->PrintTo(stream); |
| 438 } | 447 } |
| 439 | 448 |
| 440 | 449 |
| 441 void LChunk::AddInstruction(LInstruction* instr, HBasicBlock* block) { | 450 void LChunk::AddInstruction(LInstruction* instr, HBasicBlock* block) { |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1025 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { | 1034 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { |
| 1026 HValue* v = instr->value(); | 1035 HValue* v = instr->value(); |
| 1027 if (v->EmitAtUses()) { | 1036 if (v->EmitAtUses()) { |
| 1028 ASSERT(v->IsConstant()); | 1037 ASSERT(v->IsConstant()); |
| 1029 ASSERT(!v->representation().IsDouble()); | 1038 ASSERT(!v->representation().IsDouble()); |
| 1030 HBasicBlock* successor = HConstant::cast(v)->ToBoolean() | 1039 HBasicBlock* successor = HConstant::cast(v)->ToBoolean() |
| 1031 ? instr->FirstSuccessor() | 1040 ? instr->FirstSuccessor() |
| 1032 : instr->SecondSuccessor(); | 1041 : instr->SecondSuccessor(); |
| 1033 return new LGoto(successor->block_id()); | 1042 return new LGoto(successor->block_id()); |
| 1034 } | 1043 } |
| 1035 return new LBranch(UseRegisterAtStart(v)); | 1044 ToBooleanStub::Types expected = instr->expected_input_types(); |
| 1045 // We need a temporary register when we have to access the map *or* we have |
| 1046 // no type info yet, in which case we handle all cases (including the ones |
| 1047 // involving maps). |
| 1048 bool needs_temp = expected.NeedsMap() || expected.IsEmpty(); |
| 1049 LOperand* temp = needs_temp ? TempRegister() : NULL; |
| 1050 LInstruction* branch = new LBranch(UseRegister(v), temp); |
| 1051 // When we handle all cases, we never deopt, so we don't need to assign the |
| 1052 // environment then. |
| 1053 return expected.IsAll() ? branch : AssignEnvironment(branch); |
| 1036 } | 1054 } |
| 1037 | 1055 |
| 1038 | 1056 |
| 1039 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) { | 1057 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) { |
| 1040 ASSERT(instr->value()->representation().IsTagged()); | 1058 ASSERT(instr->value()->representation().IsTagged()); |
| 1041 LOperand* value = UseRegisterAtStart(instr->value()); | 1059 LOperand* value = UseRegisterAtStart(instr->value()); |
| 1042 return new LCmpMapAndBranch(value); | 1060 return new LCmpMapAndBranch(value); |
| 1043 } | 1061 } |
| 1044 | 1062 |
| 1045 | 1063 |
| (...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1871 HLoadKeyedFastElement* instr) { | 1889 HLoadKeyedFastElement* instr) { |
| 1872 ASSERT(instr->representation().IsTagged()); | 1890 ASSERT(instr->representation().IsTagged()); |
| 1873 ASSERT(instr->key()->representation().IsInteger32()); | 1891 ASSERT(instr->key()->representation().IsInteger32()); |
| 1874 LOperand* obj = UseRegisterAtStart(instr->object()); | 1892 LOperand* obj = UseRegisterAtStart(instr->object()); |
| 1875 LOperand* key = UseRegisterAtStart(instr->key()); | 1893 LOperand* key = UseRegisterAtStart(instr->key()); |
| 1876 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); | 1894 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); |
| 1877 return AssignEnvironment(DefineSameAsFirst(result)); | 1895 return AssignEnvironment(DefineSameAsFirst(result)); |
| 1878 } | 1896 } |
| 1879 | 1897 |
| 1880 | 1898 |
| 1899 LInstruction* LChunkBuilder::DoLoadKeyedFastDoubleElement( |
| 1900 HLoadKeyedFastDoubleElement* instr) { |
| 1901 ASSERT(instr->representation().IsDouble()); |
| 1902 ASSERT(instr->key()->representation().IsInteger32()); |
| 1903 LOperand* elements = UseRegisterAtStart(instr->elements()); |
| 1904 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
| 1905 LLoadKeyedFastDoubleElement* result = |
| 1906 new LLoadKeyedFastDoubleElement(elements, key); |
| 1907 return AssignEnvironment(DefineAsRegister(result)); |
| 1908 } |
| 1909 |
| 1910 |
| 1881 LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement( | 1911 LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement( |
| 1882 HLoadKeyedSpecializedArrayElement* instr) { | 1912 HLoadKeyedSpecializedArrayElement* instr) { |
| 1883 JSObject::ElementsKind elements_kind = instr->elements_kind(); | 1913 JSObject::ElementsKind elements_kind = instr->elements_kind(); |
| 1884 Representation representation(instr->representation()); | 1914 Representation representation(instr->representation()); |
| 1885 ASSERT( | 1915 ASSERT( |
| 1886 (representation.IsInteger32() && | 1916 (representation.IsInteger32() && |
| 1887 (elements_kind != JSObject::EXTERNAL_FLOAT_ELEMENTS) && | 1917 (elements_kind != JSObject::EXTERNAL_FLOAT_ELEMENTS) && |
| 1888 (elements_kind != JSObject::EXTERNAL_DOUBLE_ELEMENTS)) || | 1918 (elements_kind != JSObject::EXTERNAL_DOUBLE_ELEMENTS)) || |
| 1889 (representation.IsDouble() && | 1919 (representation.IsDouble() && |
| 1890 ((elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) || | 1920 ((elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) || |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1926 ? UseTempRegister(instr->value()) | 1956 ? UseTempRegister(instr->value()) |
| 1927 : UseRegisterAtStart(instr->value()); | 1957 : UseRegisterAtStart(instr->value()); |
| 1928 LOperand* key = needs_write_barrier | 1958 LOperand* key = needs_write_barrier |
| 1929 ? UseTempRegister(instr->key()) | 1959 ? UseTempRegister(instr->key()) |
| 1930 : UseRegisterOrConstantAtStart(instr->key()); | 1960 : UseRegisterOrConstantAtStart(instr->key()); |
| 1931 | 1961 |
| 1932 return AssignEnvironment(new LStoreKeyedFastElement(obj, key, val)); | 1962 return AssignEnvironment(new LStoreKeyedFastElement(obj, key, val)); |
| 1933 } | 1963 } |
| 1934 | 1964 |
| 1935 | 1965 |
| 1966 LInstruction* LChunkBuilder::DoStoreKeyedFastDoubleElement( |
| 1967 HStoreKeyedFastDoubleElement* instr) { |
| 1968 ASSERT(instr->value()->representation().IsDouble()); |
| 1969 ASSERT(instr->elements()->representation().IsTagged()); |
| 1970 ASSERT(instr->key()->representation().IsInteger32()); |
| 1971 |
| 1972 LOperand* elements = UseRegisterAtStart(instr->elements()); |
| 1973 LOperand* val = UseTempRegister(instr->value()); |
| 1974 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
| 1975 |
| 1976 return new LStoreKeyedFastDoubleElement(elements, key, val); |
| 1977 } |
| 1978 |
| 1979 |
| 1936 LInstruction* LChunkBuilder::DoStoreKeyedSpecializedArrayElement( | 1980 LInstruction* LChunkBuilder::DoStoreKeyedSpecializedArrayElement( |
| 1937 HStoreKeyedSpecializedArrayElement* instr) { | 1981 HStoreKeyedSpecializedArrayElement* instr) { |
| 1938 Representation representation(instr->value()->representation()); | 1982 Representation representation(instr->value()->representation()); |
| 1939 JSObject::ElementsKind elements_kind = instr->elements_kind(); | 1983 JSObject::ElementsKind elements_kind = instr->elements_kind(); |
| 1940 ASSERT( | 1984 ASSERT( |
| 1941 (representation.IsInteger32() && | 1985 (representation.IsInteger32() && |
| 1942 (elements_kind != JSObject::EXTERNAL_FLOAT_ELEMENTS) && | 1986 (elements_kind != JSObject::EXTERNAL_FLOAT_ELEMENTS) && |
| 1943 (elements_kind != JSObject::EXTERNAL_DOUBLE_ELEMENTS)) || | 1987 (elements_kind != JSObject::EXTERNAL_DOUBLE_ELEMENTS)) || |
| 1944 (representation.IsDouble() && | 1988 (representation.IsDouble() && |
| 1945 ((elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) || | 1989 ((elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) || |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2226 LOperand* key = UseOrConstantAtStart(instr->key()); | 2270 LOperand* key = UseOrConstantAtStart(instr->key()); |
| 2227 LOperand* object = UseOrConstantAtStart(instr->object()); | 2271 LOperand* object = UseOrConstantAtStart(instr->object()); |
| 2228 LIn* result = new LIn(context, key, object); | 2272 LIn* result = new LIn(context, key, object); |
| 2229 return MarkAsCall(DefineFixed(result, eax), instr); | 2273 return MarkAsCall(DefineFixed(result, eax), instr); |
| 2230 } | 2274 } |
| 2231 | 2275 |
| 2232 | 2276 |
| 2233 } } // namespace v8::internal | 2277 } } // namespace v8::internal |
| 2234 | 2278 |
| 2235 #endif // V8_TARGET_ARCH_IA32 | 2279 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |