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 2245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2256 HTrapAllocationMemento* instr) { | 2256 HTrapAllocationMemento* instr) { |
2257 LOperand* object = UseRegister(instr->object()); | 2257 LOperand* object = UseRegister(instr->object()); |
2258 LOperand* temp = TempRegister(); | 2258 LOperand* temp = TempRegister(); |
2259 LTrapAllocationMemento* result = | 2259 LTrapAllocationMemento* result = |
2260 new(zone()) LTrapAllocationMemento(object, temp); | 2260 new(zone()) LTrapAllocationMemento(object, temp); |
2261 return AssignEnvironment(result); | 2261 return AssignEnvironment(result); |
2262 } | 2262 } |
2263 | 2263 |
2264 | 2264 |
2265 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { | 2265 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { |
| 2266 bool is_in_object = instr->access().IsInobject(); |
2266 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 2267 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
2267 bool needs_write_barrier_for_map = !instr->transition().is_null() && | 2268 bool needs_write_barrier_for_map = !instr->transition().is_null() && |
2268 instr->NeedsWriteBarrierForMap(); | 2269 instr->NeedsWriteBarrierForMap(); |
2269 | 2270 |
2270 LOperand* obj; | 2271 LOperand* obj; |
2271 if (needs_write_barrier) { | 2272 if (needs_write_barrier) { |
2272 obj = instr->is_in_object() | 2273 obj = is_in_object |
2273 ? UseRegister(instr->object()) | 2274 ? UseRegister(instr->object()) |
2274 : UseTempRegister(instr->object()); | 2275 : UseTempRegister(instr->object()); |
2275 } else { | 2276 } else { |
2276 obj = needs_write_barrier_for_map | 2277 obj = needs_write_barrier_for_map |
2277 ? UseRegister(instr->object()) | 2278 ? UseRegister(instr->object()) |
2278 : UseRegisterAtStart(instr->object()); | 2279 : UseRegisterAtStart(instr->object()); |
2279 } | 2280 } |
2280 | 2281 |
2281 bool can_be_constant = instr->value()->IsConstant() && | 2282 bool can_be_constant = instr->value()->IsConstant() && |
2282 HConstant::cast(instr->value())->NotInNewSpace() && | 2283 HConstant::cast(instr->value())->NotInNewSpace() && |
2283 !(FLAG_track_double_fields && instr->field_representation().IsDouble()); | 2284 !(FLAG_track_double_fields && instr->field_representation().IsDouble()); |
2284 | 2285 |
2285 LOperand* val; | 2286 LOperand* val; |
2286 if (needs_write_barrier) { | 2287 if (needs_write_barrier) { |
2287 val = UseTempRegister(instr->value()); | 2288 val = UseTempRegister(instr->value()); |
2288 } else if (can_be_constant) { | 2289 } else if (can_be_constant) { |
2289 val = UseRegisterOrConstant(instr->value()); | 2290 val = UseRegisterOrConstant(instr->value()); |
2290 } else if (FLAG_track_fields && instr->field_representation().IsSmi()) { | 2291 } else if (FLAG_track_fields && instr->field_representation().IsSmi()) { |
2291 val = UseTempRegister(instr->value()); | 2292 val = UseTempRegister(instr->value()); |
2292 } else if (FLAG_track_double_fields && | 2293 } else if (FLAG_track_double_fields && |
2293 instr->field_representation().IsDouble()) { | 2294 instr->field_representation().IsDouble()) { |
2294 val = UseRegisterAtStart(instr->value()); | 2295 val = UseRegisterAtStart(instr->value()); |
2295 } else { | 2296 } else { |
2296 val = UseRegister(instr->value()); | 2297 val = UseRegister(instr->value()); |
2297 } | 2298 } |
2298 | 2299 |
2299 // We only need a scratch register if we have a write barrier or we | 2300 // We only need a scratch register if we have a write barrier or we |
2300 // have a store into the properties array (not in-object-property). | 2301 // have a store into the properties array (not in-object-property). |
2301 LOperand* temp = (!instr->is_in_object() || needs_write_barrier || | 2302 LOperand* temp = (!is_in_object || needs_write_barrier || |
2302 needs_write_barrier_for_map) ? TempRegister() : NULL; | 2303 needs_write_barrier_for_map) ? TempRegister() : NULL; |
2303 | 2304 |
2304 LStoreNamedField* result = new(zone()) LStoreNamedField(obj, val, temp); | 2305 LStoreNamedField* result = new(zone()) LStoreNamedField(obj, val, temp); |
2305 if ((FLAG_track_fields && instr->field_representation().IsSmi()) || | 2306 if ((FLAG_track_fields && instr->field_representation().IsSmi()) || |
2306 (FLAG_track_heap_object_fields && | 2307 (FLAG_track_heap_object_fields && |
2307 instr->field_representation().IsHeapObject())) { | 2308 instr->field_representation().IsHeapObject())) { |
2308 return AssignEnvironment(result); | 2309 return AssignEnvironment(result); |
2309 } | 2310 } |
2310 return result; | 2311 return result; |
2311 } | 2312 } |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2589 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2590 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2590 LOperand* object = UseRegister(instr->object()); | 2591 LOperand* object = UseRegister(instr->object()); |
2591 LOperand* index = UseTempRegister(instr->index()); | 2592 LOperand* index = UseTempRegister(instr->index()); |
2592 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2593 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
2593 } | 2594 } |
2594 | 2595 |
2595 | 2596 |
2596 } } // namespace v8::internal | 2597 } } // namespace v8::internal |
2597 | 2598 |
2598 #endif // V8_TARGET_ARCH_X64 | 2599 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |