| 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 1639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1650 LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch( | 1650 LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch( |
| 1651 HCompareObjectEqAndBranch* instr) { | 1651 HCompareObjectEqAndBranch* instr) { |
| 1652 LOperand* left = UseRegisterAtStart(instr->left()); | 1652 LOperand* left = UseRegisterAtStart(instr->left()); |
| 1653 LOperand* right = UseRegisterAtStart(instr->right()); | 1653 LOperand* right = UseRegisterAtStart(instr->right()); |
| 1654 return new(zone()) LCmpObjectEqAndBranch(left, right); | 1654 return new(zone()) LCmpObjectEqAndBranch(left, right); |
| 1655 } | 1655 } |
| 1656 | 1656 |
| 1657 | 1657 |
| 1658 LInstruction* LChunkBuilder::DoCompareHoleAndBranch( | 1658 LInstruction* LChunkBuilder::DoCompareHoleAndBranch( |
| 1659 HCompareHoleAndBranch* instr) { | 1659 HCompareHoleAndBranch* instr) { |
| 1660 LOperand* object = UseRegisterAtStart(instr->object()); | 1660 LOperand* value = UseRegisterAtStart(instr->value()); |
| 1661 return new(zone()) LCmpHoleAndBranch(object); | 1661 return new(zone()) LCmpHoleAndBranch(value); |
| 1662 } | 1662 } |
| 1663 | 1663 |
| 1664 | 1664 |
| 1665 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) { | 1665 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) { |
| 1666 ASSERT(instr->value()->representation().IsTagged()); | 1666 ASSERT(instr->value()->representation().IsTagged()); |
| 1667 LOperand* temp = TempRegister(); | 1667 LOperand* temp = TempRegister(); |
| 1668 return new(zone()) LIsObjectAndBranch(UseRegisterAtStart(instr->value()), | 1668 return new(zone()) LIsObjectAndBranch(UseRegisterAtStart(instr->value()), |
| 1669 temp); | 1669 temp); |
| 1670 } | 1670 } |
| 1671 | 1671 |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1914 return AssignEnvironment(new(zone()) LCheckNonSmi(value)); | 1914 return AssignEnvironment(new(zone()) LCheckNonSmi(value)); |
| 1915 } | 1915 } |
| 1916 | 1916 |
| 1917 | 1917 |
| 1918 LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) { | 1918 LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) { |
| 1919 LOperand* value = UseRegisterAtStart(instr->value()); | 1919 LOperand* value = UseRegisterAtStart(instr->value()); |
| 1920 return AssignEnvironment(new(zone()) LCheckSmi(value)); | 1920 return AssignEnvironment(new(zone()) LCheckSmi(value)); |
| 1921 } | 1921 } |
| 1922 | 1922 |
| 1923 | 1923 |
| 1924 LInstruction* LChunkBuilder::DoIsNumberAndBranch(HIsNumberAndBranch* instr) { | |
| 1925 return new(zone()) | |
| 1926 LIsNumberAndBranch(UseRegisterOrConstantAtStart(instr->value())); | |
| 1927 } | |
| 1928 | |
| 1929 | |
| 1930 LInstruction* LChunkBuilder::DoCheckInstanceType(HCheckInstanceType* instr) { | 1924 LInstruction* LChunkBuilder::DoCheckInstanceType(HCheckInstanceType* instr) { |
| 1931 LOperand* value = UseRegisterAtStart(instr->value()); | 1925 LOperand* value = UseRegisterAtStart(instr->value()); |
| 1932 LInstruction* result = new(zone()) LCheckInstanceType(value); | 1926 LInstruction* result = new(zone()) LCheckInstanceType(value); |
| 1933 return AssignEnvironment(result); | 1927 return AssignEnvironment(result); |
| 1934 } | 1928 } |
| 1935 | 1929 |
| 1936 | 1930 |
| 1937 LInstruction* LChunkBuilder::DoCheckValue(HCheckValue* instr) { | 1931 LInstruction* LChunkBuilder::DoCheckValue(HCheckValue* instr) { |
| 1938 LOperand* value = UseRegisterAtStart(instr->value()); | 1932 LOperand* value = UseRegisterAtStart(instr->value()); |
| 1939 return AssignEnvironment(new(zone()) LCheckValue(value)); | 1933 return AssignEnvironment(new(zone()) LCheckValue(value)); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2070 } | 2064 } |
| 2071 | 2065 |
| 2072 | 2066 |
| 2073 LInstruction* LChunkBuilder::DoLoadFunctionPrototype( | 2067 LInstruction* LChunkBuilder::DoLoadFunctionPrototype( |
| 2074 HLoadFunctionPrototype* instr) { | 2068 HLoadFunctionPrototype* instr) { |
| 2075 return AssignEnvironment(DefineAsRegister( | 2069 return AssignEnvironment(DefineAsRegister( |
| 2076 new(zone()) LLoadFunctionPrototype(UseRegister(instr->function())))); | 2070 new(zone()) LLoadFunctionPrototype(UseRegister(instr->function())))); |
| 2077 } | 2071 } |
| 2078 | 2072 |
| 2079 | 2073 |
| 2074 LInstruction* LChunkBuilder::DoLoadRoot(HLoadRoot* instr) { |
| 2075 return DefineAsRegister(new(zone()) LLoadRoot); |
| 2076 } |
| 2077 |
| 2078 |
| 2080 LInstruction* LChunkBuilder::DoLoadExternalArrayPointer( | 2079 LInstruction* LChunkBuilder::DoLoadExternalArrayPointer( |
| 2081 HLoadExternalArrayPointer* instr) { | 2080 HLoadExternalArrayPointer* instr) { |
| 2082 LOperand* input = UseRegisterAtStart(instr->value()); | 2081 LOperand* input = UseRegisterAtStart(instr->value()); |
| 2083 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input)); | 2082 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input)); |
| 2084 } | 2083 } |
| 2085 | 2084 |
| 2086 | 2085 |
| 2087 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { | 2086 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { |
| 2088 ASSERT(instr->key()->representation().IsSmiOrInteger32()); | 2087 ASSERT(instr->key()->representation().IsSmiOrInteger32()); |
| 2089 ElementsKind elements_kind = instr->elements_kind(); | 2088 ElementsKind elements_kind = instr->elements_kind(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2124 LOperand* object = UseFixed(instr->object(), a1); | 2123 LOperand* object = UseFixed(instr->object(), a1); |
| 2125 LOperand* key = UseFixed(instr->key(), a0); | 2124 LOperand* key = UseFixed(instr->key(), a0); |
| 2126 | 2125 |
| 2127 LInstruction* result = | 2126 LInstruction* result = |
| 2128 DefineFixed(new(zone()) LLoadKeyedGeneric(object, key), v0); | 2127 DefineFixed(new(zone()) LLoadKeyedGeneric(object, key), v0); |
| 2129 return MarkAsCall(result, instr); | 2128 return MarkAsCall(result, instr); |
| 2130 } | 2129 } |
| 2131 | 2130 |
| 2132 | 2131 |
| 2133 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { | 2132 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { |
| 2134 ElementsKind elements_kind = instr->elements_kind(); | |
| 2135 | |
| 2136 if (!instr->is_external()) { | 2133 if (!instr->is_external()) { |
| 2137 ASSERT(instr->elements()->representation().IsTagged()); | 2134 ASSERT(instr->elements()->representation().IsTagged()); |
| 2138 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 2135 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
| 2139 LOperand* object = NULL; | 2136 LOperand* object = NULL; |
| 2140 LOperand* val = NULL; | 2137 LOperand* val = NULL; |
| 2141 LOperand* key = NULL; | 2138 LOperand* key = NULL; |
| 2142 | 2139 |
| 2143 if (instr->value()->representation().IsDouble()) { | 2140 if (instr->value()->representation().IsDouble()) { |
| 2144 object = UseRegisterAtStart(instr->elements()); | 2141 object = UseRegisterAtStart(instr->elements()); |
| 2145 key = UseRegisterOrConstantAtStart(instr->key()); | 2142 key = UseRegisterOrConstantAtStart(instr->key()); |
| 2146 val = UseTempRegister(instr->value()); | 2143 val = UseRegister(instr->value()); |
| 2147 } else { | 2144 } else { |
| 2148 ASSERT(instr->value()->representation().IsSmiOrTagged()); | 2145 ASSERT(instr->value()->representation().IsSmiOrTagged()); |
| 2149 object = UseTempRegister(instr->elements()); | 2146 if (needs_write_barrier) { |
| 2150 val = needs_write_barrier ? UseTempRegister(instr->value()) | 2147 object = UseTempRegister(instr->elements()); |
| 2151 : UseRegisterAtStart(instr->value()); | 2148 val = UseTempRegister(instr->value()); |
| 2152 key = needs_write_barrier ? UseTempRegister(instr->key()) | 2149 key = UseTempRegister(instr->key()); |
| 2153 : UseRegisterOrConstantAtStart(instr->key()); | 2150 } else { |
| 2151 object = UseRegisterAtStart(instr->elements()); |
| 2152 val = UseRegisterAtStart(instr->value()); |
| 2153 key = UseRegisterOrConstantAtStart(instr->key()); |
| 2154 } |
| 2154 } | 2155 } |
| 2155 | 2156 |
| 2156 return new(zone()) LStoreKeyed(object, key, val); | 2157 return new(zone()) LStoreKeyed(object, key, val); |
| 2157 } | 2158 } |
| 2158 | 2159 |
| 2159 ASSERT( | 2160 ASSERT( |
| 2160 (instr->value()->representation().IsInteger32() && | 2161 (instr->value()->representation().IsInteger32() && |
| 2161 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && | 2162 (instr->elements_kind() != EXTERNAL_FLOAT_ELEMENTS) && |
| 2162 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || | 2163 (instr->elements_kind() != EXTERNAL_DOUBLE_ELEMENTS)) || |
| 2163 (instr->value()->representation().IsDouble() && | 2164 (instr->value()->representation().IsDouble() && |
| 2164 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || | 2165 ((instr->elements_kind() == EXTERNAL_FLOAT_ELEMENTS) || |
| 2165 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); | 2166 (instr->elements_kind() == EXTERNAL_DOUBLE_ELEMENTS)))); |
| 2166 ASSERT(instr->elements()->representation().IsExternal()); | 2167 ASSERT(instr->elements()->representation().IsExternal()); |
| 2167 bool val_is_temp_register = | 2168 LOperand* val = UseRegister(instr->value()); |
| 2168 elements_kind == EXTERNAL_PIXEL_ELEMENTS || | |
| 2169 elements_kind == EXTERNAL_FLOAT_ELEMENTS; | |
| 2170 LOperand* val = val_is_temp_register ? UseTempRegister(instr->value()) | |
| 2171 : UseRegister(instr->value()); | |
| 2172 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 2169 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
| 2173 LOperand* external_pointer = UseRegister(instr->elements()); | 2170 LOperand* external_pointer = UseRegister(instr->elements()); |
| 2174 | 2171 |
| 2175 return new(zone()) LStoreKeyed(external_pointer, key, val); | 2172 return new(zone()) LStoreKeyed(external_pointer, key, val); |
| 2176 } | 2173 } |
| 2177 | 2174 |
| 2178 | 2175 |
| 2179 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { | 2176 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { |
| 2180 LOperand* obj = UseFixed(instr->object(), a2); | 2177 LOperand* obj = UseFixed(instr->object(), a2); |
| 2181 LOperand* key = UseFixed(instr->key(), a1); | 2178 LOperand* key = UseFixed(instr->key(), a1); |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2507 | 2504 |
| 2508 | 2505 |
| 2509 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2506 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2510 LOperand* object = UseRegister(instr->object()); | 2507 LOperand* object = UseRegister(instr->object()); |
| 2511 LOperand* index = UseRegister(instr->index()); | 2508 LOperand* index = UseRegister(instr->index()); |
| 2512 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2509 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
| 2513 } | 2510 } |
| 2514 | 2511 |
| 2515 | 2512 |
| 2516 } } // namespace v8::internal | 2513 } } // namespace v8::internal |
| OLD | NEW |