| 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 1738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1749 LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch( | 1749 LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch( |
| 1750 HCompareObjectEqAndBranch* instr) { | 1750 HCompareObjectEqAndBranch* instr) { |
| 1751 LOperand* left = UseRegisterAtStart(instr->left()); | 1751 LOperand* left = UseRegisterAtStart(instr->left()); |
| 1752 LOperand* right = UseRegisterAtStart(instr->right()); | 1752 LOperand* right = UseRegisterAtStart(instr->right()); |
| 1753 return new(zone()) LCmpObjectEqAndBranch(left, right); | 1753 return new(zone()) LCmpObjectEqAndBranch(left, right); |
| 1754 } | 1754 } |
| 1755 | 1755 |
| 1756 | 1756 |
| 1757 LInstruction* LChunkBuilder::DoCompareHoleAndBranch( | 1757 LInstruction* LChunkBuilder::DoCompareHoleAndBranch( |
| 1758 HCompareHoleAndBranch* instr) { | 1758 HCompareHoleAndBranch* instr) { |
| 1759 LOperand* object = UseRegisterAtStart(instr->object()); | 1759 LOperand* value = UseRegisterAtStart(instr->value()); |
| 1760 return new(zone()) LCmpHoleAndBranch(object); | 1760 return new(zone()) LCmpHoleAndBranch(value); |
| 1761 } | 1761 } |
| 1762 | 1762 |
| 1763 | 1763 |
| 1764 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) { | 1764 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) { |
| 1765 ASSERT(instr->value()->representation().IsTagged()); | 1765 ASSERT(instr->value()->representation().IsTagged()); |
| 1766 LOperand* value = UseRegisterAtStart(instr->value()); | 1766 LOperand* value = UseRegisterAtStart(instr->value()); |
| 1767 LOperand* temp = TempRegister(); | 1767 LOperand* temp = TempRegister(); |
| 1768 return new(zone()) LIsObjectAndBranch(value, temp); | 1768 return new(zone()) LIsObjectAndBranch(value, temp); |
| 1769 } | 1769 } |
| 1770 | 1770 |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2013 return AssignEnvironment(new(zone()) LCheckNonSmi(value)); | 2013 return AssignEnvironment(new(zone()) LCheckNonSmi(value)); |
| 2014 } | 2014 } |
| 2015 | 2015 |
| 2016 | 2016 |
| 2017 LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) { | 2017 LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) { |
| 2018 LOperand* value = UseRegisterAtStart(instr->value()); | 2018 LOperand* value = UseRegisterAtStart(instr->value()); |
| 2019 return AssignEnvironment(new(zone()) LCheckSmi(value)); | 2019 return AssignEnvironment(new(zone()) LCheckSmi(value)); |
| 2020 } | 2020 } |
| 2021 | 2021 |
| 2022 | 2022 |
| 2023 LInstruction* LChunkBuilder::DoIsNumberAndBranch(HIsNumberAndBranch* instr) { | |
| 2024 return new(zone()) | |
| 2025 LIsNumberAndBranch(UseRegisterOrConstantAtStart(instr->value())); | |
| 2026 } | |
| 2027 | |
| 2028 | |
| 2029 LInstruction* LChunkBuilder::DoCheckInstanceType(HCheckInstanceType* instr) { | 2023 LInstruction* LChunkBuilder::DoCheckInstanceType(HCheckInstanceType* instr) { |
| 2030 LOperand* value = UseRegisterAtStart(instr->value()); | 2024 LOperand* value = UseRegisterAtStart(instr->value()); |
| 2031 LInstruction* result = new(zone()) LCheckInstanceType(value); | 2025 LInstruction* result = new(zone()) LCheckInstanceType(value); |
| 2032 return AssignEnvironment(result); | 2026 return AssignEnvironment(result); |
| 2033 } | 2027 } |
| 2034 | 2028 |
| 2035 | 2029 |
| 2036 LInstruction* LChunkBuilder::DoCheckValue(HCheckValue* instr) { | 2030 LInstruction* LChunkBuilder::DoCheckValue(HCheckValue* instr) { |
| 2037 LOperand* value = UseRegisterAtStart(instr->value()); | 2031 LOperand* value = UseRegisterAtStart(instr->value()); |
| 2038 return AssignEnvironment(new(zone()) LCheckValue(value)); | 2032 return AssignEnvironment(new(zone()) LCheckValue(value)); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2168 } | 2162 } |
| 2169 | 2163 |
| 2170 | 2164 |
| 2171 LInstruction* LChunkBuilder::DoLoadFunctionPrototype( | 2165 LInstruction* LChunkBuilder::DoLoadFunctionPrototype( |
| 2172 HLoadFunctionPrototype* instr) { | 2166 HLoadFunctionPrototype* instr) { |
| 2173 return AssignEnvironment(DefineAsRegister( | 2167 return AssignEnvironment(DefineAsRegister( |
| 2174 new(zone()) LLoadFunctionPrototype(UseRegister(instr->function())))); | 2168 new(zone()) LLoadFunctionPrototype(UseRegister(instr->function())))); |
| 2175 } | 2169 } |
| 2176 | 2170 |
| 2177 | 2171 |
| 2172 LInstruction* LChunkBuilder::DoLoadRoot(HLoadRoot* instr) { |
| 2173 return DefineAsRegister(new(zone()) LLoadRoot); |
| 2174 } |
| 2175 |
| 2176 |
| 2178 LInstruction* LChunkBuilder::DoLoadExternalArrayPointer( | 2177 LInstruction* LChunkBuilder::DoLoadExternalArrayPointer( |
| 2179 HLoadExternalArrayPointer* instr) { | 2178 HLoadExternalArrayPointer* instr) { |
| 2180 LOperand* input = UseRegisterAtStart(instr->value()); | 2179 LOperand* input = UseRegisterAtStart(instr->value()); |
| 2181 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input)); | 2180 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input)); |
| 2182 } | 2181 } |
| 2183 | 2182 |
| 2184 | 2183 |
| 2185 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { | 2184 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { |
| 2186 ASSERT(instr->key()->representation().IsSmiOrInteger32()); | 2185 ASSERT(instr->key()->representation().IsSmiOrInteger32()); |
| 2187 ElementsKind elements_kind = instr->elements_kind(); | 2186 ElementsKind elements_kind = instr->elements_kind(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2222 LOperand* object = UseFixed(instr->object(), r1); | 2221 LOperand* object = UseFixed(instr->object(), r1); |
| 2223 LOperand* key = UseFixed(instr->key(), r0); | 2222 LOperand* key = UseFixed(instr->key(), r0); |
| 2224 | 2223 |
| 2225 LInstruction* result = | 2224 LInstruction* result = |
| 2226 DefineFixed(new(zone()) LLoadKeyedGeneric(object, key), r0); | 2225 DefineFixed(new(zone()) LLoadKeyedGeneric(object, key), r0); |
| 2227 return MarkAsCall(result, instr); | 2226 return MarkAsCall(result, instr); |
| 2228 } | 2227 } |
| 2229 | 2228 |
| 2230 | 2229 |
| 2231 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { | 2230 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { |
| 2232 ElementsKind elements_kind = instr->elements_kind(); | |
| 2233 | |
| 2234 if (!instr->is_external()) { | 2231 if (!instr->is_external()) { |
| 2235 ASSERT(instr->elements()->representation().IsTagged()); | 2232 ASSERT(instr->elements()->representation().IsTagged()); |
| 2236 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 2233 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
| 2237 LOperand* object = NULL; | 2234 LOperand* object = NULL; |
| 2238 LOperand* key = NULL; | 2235 LOperand* key = NULL; |
| 2239 LOperand* val = NULL; | 2236 LOperand* val = NULL; |
| 2240 | 2237 |
| 2241 if (instr->value()->representation().IsDouble()) { | 2238 if (instr->value()->representation().IsDouble()) { |
| 2242 object = UseRegisterAtStart(instr->elements()); | 2239 object = UseRegisterAtStart(instr->elements()); |
| 2243 val = UseTempRegister(instr->value()); | 2240 val = UseRegister(instr->value()); |
| 2244 key = UseRegisterOrConstantAtStart(instr->key()); | 2241 key = UseRegisterOrConstantAtStart(instr->key()); |
| 2245 } else { | 2242 } else { |
| 2246 ASSERT(instr->value()->representation().IsSmiOrTagged()); | 2243 ASSERT(instr->value()->representation().IsSmiOrTagged()); |
| 2247 object = UseTempRegister(instr->elements()); | 2244 if (needs_write_barrier) { |
| 2248 val = needs_write_barrier ? UseTempRegister(instr->value()) | 2245 object = UseTempRegister(instr->elements()); |
| 2249 : UseRegisterAtStart(instr->value()); | 2246 val = UseTempRegister(instr->value()); |
| 2250 key = needs_write_barrier ? UseTempRegister(instr->key()) | 2247 key = UseTempRegister(instr->key()); |
| 2251 : UseRegisterOrConstantAtStart(instr->key()); | 2248 } else { |
| 2249 object = UseRegisterAtStart(instr->elements()); |
| 2250 val = UseRegisterAtStart(instr->value()); |
| 2251 key = UseRegisterOrConstantAtStart(instr->key()); |
| 2252 } |
| 2252 } | 2253 } |
| 2253 | 2254 |
| 2254 return new(zone()) LStoreKeyed(object, key, val); | 2255 return new(zone()) LStoreKeyed(object, key, val); |
| 2255 } | 2256 } |
| 2256 | 2257 |
| 2257 ASSERT( | 2258 ASSERT( |
| 2258 (instr->value()->representation().IsInteger32() && | 2259 (instr->value()->representation().IsInteger32() && |
| 2259 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && | 2260 (instr->elements_kind() != EXTERNAL_FLOAT_ELEMENTS) && |
| 2260 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || | 2261 (instr->elements_kind() != EXTERNAL_DOUBLE_ELEMENTS)) || |
| 2261 (instr->value()->representation().IsDouble() && | 2262 (instr->value()->representation().IsDouble() && |
| 2262 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || | 2263 ((instr->elements_kind() == EXTERNAL_FLOAT_ELEMENTS) || |
| 2263 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); | 2264 (instr->elements_kind() == EXTERNAL_DOUBLE_ELEMENTS)))); |
| 2264 ASSERT(instr->elements()->representation().IsExternal()); | 2265 ASSERT(instr->elements()->representation().IsExternal()); |
| 2265 bool val_is_temp_register = | 2266 LOperand* val = UseRegister(instr->value()); |
| 2266 elements_kind == EXTERNAL_PIXEL_ELEMENTS || | |
| 2267 elements_kind == EXTERNAL_FLOAT_ELEMENTS; | |
| 2268 LOperand* val = val_is_temp_register ? UseTempRegister(instr->value()) | |
| 2269 : UseRegister(instr->value()); | |
| 2270 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 2267 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
| 2271 LOperand* external_pointer = UseRegister(instr->elements()); | 2268 LOperand* external_pointer = UseRegister(instr->elements()); |
| 2272 return new(zone()) LStoreKeyed(external_pointer, key, val); | 2269 return new(zone()) LStoreKeyed(external_pointer, key, val); |
| 2273 } | 2270 } |
| 2274 | 2271 |
| 2275 | 2272 |
| 2276 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { | 2273 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { |
| 2277 LOperand* obj = UseFixed(instr->object(), r2); | 2274 LOperand* obj = UseFixed(instr->object(), r2); |
| 2278 LOperand* key = UseFixed(instr->key(), r1); | 2275 LOperand* key = UseFixed(instr->key(), r1); |
| 2279 LOperand* val = UseFixed(instr->value(), r0); | 2276 LOperand* val = UseFixed(instr->value(), r0); |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2604 | 2601 |
| 2605 | 2602 |
| 2606 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2603 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2607 LOperand* object = UseRegister(instr->object()); | 2604 LOperand* object = UseRegister(instr->object()); |
| 2608 LOperand* index = UseRegister(instr->index()); | 2605 LOperand* index = UseRegister(instr->index()); |
| 2609 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2606 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
| 2610 } | 2607 } |
| 2611 | 2608 |
| 2612 | 2609 |
| 2613 } } // namespace v8::internal | 2610 } } // namespace v8::internal |
| OLD | NEW |