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 2228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2239 LOperand* object = UseFixed(instr->object(), r1); | 2239 LOperand* object = UseFixed(instr->object(), r1); |
2240 LOperand* key = UseFixed(instr->key(), r0); | 2240 LOperand* key = UseFixed(instr->key(), r0); |
2241 | 2241 |
2242 LInstruction* result = | 2242 LInstruction* result = |
2243 DefineFixed(new(zone()) LLoadKeyedGeneric(object, key), r0); | 2243 DefineFixed(new(zone()) LLoadKeyedGeneric(object, key), r0); |
2244 return MarkAsCall(result, instr); | 2244 return MarkAsCall(result, instr); |
2245 } | 2245 } |
2246 | 2246 |
2247 | 2247 |
2248 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { | 2248 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { |
2249 ElementsKind elements_kind = instr->elements_kind(); | |
2250 | |
2251 if (!instr->is_external()) { | 2249 if (!instr->is_external()) { |
2252 ASSERT(instr->elements()->representation().IsTagged()); | 2250 ASSERT(instr->elements()->representation().IsTagged()); |
2253 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 2251 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
2254 LOperand* object = NULL; | 2252 LOperand* object = NULL; |
2255 LOperand* key = NULL; | 2253 LOperand* key = NULL; |
2256 LOperand* val = NULL; | 2254 LOperand* val = NULL; |
2257 | 2255 |
2258 if (instr->value()->representation().IsDouble()) { | 2256 if (instr->value()->representation().IsDouble()) { |
2259 object = UseRegisterAtStart(instr->elements()); | 2257 object = UseRegisterAtStart(instr->elements()); |
2260 val = UseTempRegister(instr->value()); | 2258 val = UseRegister(instr->value()); |
2261 key = UseRegisterOrConstantAtStart(instr->key()); | 2259 key = UseRegisterOrConstantAtStart(instr->key()); |
2262 } else { | 2260 } else { |
2263 ASSERT(instr->value()->representation().IsSmiOrTagged()); | 2261 ASSERT(instr->value()->representation().IsSmiOrTagged()); |
2264 object = UseTempRegister(instr->elements()); | 2262 if (needs_write_barrier) { |
2265 val = needs_write_barrier ? UseTempRegister(instr->value()) | 2263 object = UseTempRegister(instr->elements()); |
2266 : UseRegisterAtStart(instr->value()); | 2264 val = UseTempRegister(instr->value()); |
2267 key = needs_write_barrier ? UseTempRegister(instr->key()) | 2265 key = UseTempRegister(instr->key()); |
2268 : UseRegisterOrConstantAtStart(instr->key()); | 2266 } else { |
| 2267 object = UseRegisterAtStart(instr->elements()); |
| 2268 val = UseRegisterAtStart(instr->value()); |
| 2269 key = UseRegisterOrConstantAtStart(instr->key()); |
| 2270 } |
2269 } | 2271 } |
2270 | 2272 |
2271 return new(zone()) LStoreKeyed(object, key, val); | 2273 return new(zone()) LStoreKeyed(object, key, val); |
2272 } | 2274 } |
2273 | 2275 |
2274 ASSERT( | 2276 ASSERT( |
2275 (instr->value()->representation().IsInteger32() && | 2277 (instr->value()->representation().IsInteger32() && |
2276 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && | 2278 (instr->elements_kind() != EXTERNAL_FLOAT_ELEMENTS) && |
2277 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || | 2279 (instr->elements_kind() != EXTERNAL_DOUBLE_ELEMENTS)) || |
2278 (instr->value()->representation().IsDouble() && | 2280 (instr->value()->representation().IsDouble() && |
2279 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || | 2281 ((instr->elements_kind() == EXTERNAL_FLOAT_ELEMENTS) || |
2280 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); | 2282 (instr->elements_kind() == EXTERNAL_DOUBLE_ELEMENTS)))); |
2281 ASSERT(instr->elements()->representation().IsExternal()); | 2283 ASSERT(instr->elements()->representation().IsExternal()); |
2282 bool val_is_temp_register = | 2284 LOperand* val = UseRegister(instr->value()); |
2283 elements_kind == EXTERNAL_PIXEL_ELEMENTS || | |
2284 elements_kind == EXTERNAL_FLOAT_ELEMENTS; | |
2285 LOperand* val = val_is_temp_register ? UseTempRegister(instr->value()) | |
2286 : UseRegister(instr->value()); | |
2287 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 2285 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
2288 LOperand* external_pointer = UseRegister(instr->elements()); | 2286 LOperand* external_pointer = UseRegister(instr->elements()); |
2289 return new(zone()) LStoreKeyed(external_pointer, key, val); | 2287 return new(zone()) LStoreKeyed(external_pointer, key, val); |
2290 } | 2288 } |
2291 | 2289 |
2292 | 2290 |
2293 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { | 2291 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { |
2294 LOperand* obj = UseFixed(instr->object(), r2); | 2292 LOperand* obj = UseFixed(instr->object(), r2); |
2295 LOperand* key = UseFixed(instr->key(), r1); | 2293 LOperand* key = UseFixed(instr->key(), r1); |
2296 LOperand* val = UseFixed(instr->value(), r0); | 2294 LOperand* val = UseFixed(instr->value(), r0); |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2621 | 2619 |
2622 | 2620 |
2623 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2621 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2624 LOperand* object = UseRegister(instr->object()); | 2622 LOperand* object = UseRegister(instr->object()); |
2625 LOperand* index = UseRegister(instr->index()); | 2623 LOperand* index = UseRegister(instr->index()); |
2626 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2624 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
2627 } | 2625 } |
2628 | 2626 |
2629 | 2627 |
2630 } } // namespace v8::internal | 2628 } } // namespace v8::internal |
OLD | NEW |