OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #include "lithium-allocator-inl.h" | 7 #include "lithium-allocator-inl.h" |
8 #include "arm/lithium-arm.h" | 8 #include "arm/lithium-arm.h" |
9 #include "arm/lithium-codegen-arm.h" | 9 #include "arm/lithium-codegen-arm.h" |
10 #include "hydrogen-osr.h" | 10 #include "hydrogen-osr.h" |
(...skipping 2261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2272 LOperand* temp = TempRegister(); | 2272 LOperand* temp = TempRegister(); |
2273 LTrapAllocationMemento* result = | 2273 LTrapAllocationMemento* result = |
2274 new(zone()) LTrapAllocationMemento(object, temp); | 2274 new(zone()) LTrapAllocationMemento(object, temp); |
2275 return AssignEnvironment(result); | 2275 return AssignEnvironment(result); |
2276 } | 2276 } |
2277 | 2277 |
2278 | 2278 |
2279 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { | 2279 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { |
2280 bool is_in_object = instr->access().IsInobject(); | 2280 bool is_in_object = instr->access().IsInobject(); |
2281 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 2281 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
| 2282 bool needs_write_barrier_for_map = instr->has_transition() && |
| 2283 instr->NeedsWriteBarrierForMap(); |
2282 | 2284 |
2283 LOperand* obj; | 2285 LOperand* obj; |
2284 if (needs_write_barrier) { | 2286 if (needs_write_barrier) { |
2285 obj = is_in_object | 2287 obj = is_in_object |
2286 ? UseRegister(instr->object()) | 2288 ? UseRegister(instr->object()) |
2287 : UseTempRegister(instr->object()); | 2289 : UseTempRegister(instr->object()); |
2288 } else { | 2290 } else { |
2289 obj = UseRegisterAtStart(instr->object()); | 2291 obj = needs_write_barrier_for_map |
| 2292 ? UseRegister(instr->object()) |
| 2293 : UseRegisterAtStart(instr->object()); |
2290 } | 2294 } |
2291 | 2295 |
2292 LOperand* val; | 2296 LOperand* val; |
2293 if (needs_write_barrier || instr->field_representation().IsSmi()) { | 2297 if (needs_write_barrier || instr->field_representation().IsSmi()) { |
2294 val = UseTempRegister(instr->value()); | 2298 val = UseTempRegister(instr->value()); |
2295 } else if (instr->field_representation().IsDouble()) { | 2299 } else if (instr->field_representation().IsDouble()) { |
2296 val = UseRegisterAtStart(instr->value()); | 2300 val = UseRegisterAtStart(instr->value()); |
2297 } else { | 2301 } else { |
2298 val = UseRegister(instr->value()); | 2302 val = UseRegister(instr->value()); |
2299 } | 2303 } |
2300 | 2304 |
2301 LInstruction* result = new(zone()) LStoreNamedField(obj, val); | 2305 // We need a temporary register for write barrier of the map field. |
| 2306 LOperand* temp = needs_write_barrier_for_map ? TempRegister() : NULL; |
| 2307 |
| 2308 LInstruction* result = new(zone()) LStoreNamedField(obj, val, temp); |
2302 if (!instr->access().IsExternalMemory() && | 2309 if (!instr->access().IsExternalMemory() && |
2303 instr->field_representation().IsHeapObject() && | 2310 instr->field_representation().IsHeapObject() && |
2304 !instr->value()->type().IsHeapObject()) { | 2311 !instr->value()->type().IsHeapObject()) { |
2305 result = AssignEnvironment(result); | 2312 result = AssignEnvironment(result); |
2306 } | 2313 } |
2307 return result; | 2314 return result; |
2308 } | 2315 } |
2309 | 2316 |
2310 | 2317 |
2311 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) { | 2318 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) { |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2557 | 2564 |
2558 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2565 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2559 LOperand* object = UseRegister(instr->object()); | 2566 LOperand* object = UseRegister(instr->object()); |
2560 LOperand* index = UseTempRegister(instr->index()); | 2567 LOperand* index = UseTempRegister(instr->index()); |
2561 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index); | 2568 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index); |
2562 LInstruction* result = DefineSameAsFirst(load); | 2569 LInstruction* result = DefineSameAsFirst(load); |
2563 return AssignPointerMap(result); | 2570 return AssignPointerMap(result); |
2564 } | 2571 } |
2565 | 2572 |
2566 } } // namespace v8::internal | 2573 } } // namespace v8::internal |
OLD | NEW |