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 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "lithium-allocator-inl.h" | 9 #include "lithium-allocator-inl.h" |
10 #include "x64/lithium-x64.h" | 10 #include "x64/lithium-x64.h" |
(...skipping 2258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2269 new(zone()) LTrapAllocationMemento(object, temp); | 2269 new(zone()) LTrapAllocationMemento(object, temp); |
2270 return AssignEnvironment(result); | 2270 return AssignEnvironment(result); |
2271 } | 2271 } |
2272 | 2272 |
2273 | 2273 |
2274 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { | 2274 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { |
2275 bool is_in_object = instr->access().IsInobject(); | 2275 bool is_in_object = instr->access().IsInobject(); |
2276 bool is_external_location = instr->access().IsExternalMemory() && | 2276 bool is_external_location = instr->access().IsExternalMemory() && |
2277 instr->access().offset() == 0; | 2277 instr->access().offset() == 0; |
2278 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 2278 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
| 2279 bool needs_write_barrier_for_map = instr->has_transition() && |
| 2280 instr->NeedsWriteBarrierForMap(); |
2279 | 2281 |
2280 LOperand* obj; | 2282 LOperand* obj; |
2281 if (needs_write_barrier) { | 2283 if (needs_write_barrier) { |
2282 obj = is_in_object | 2284 obj = is_in_object |
2283 ? UseRegister(instr->object()) | 2285 ? UseRegister(instr->object()) |
2284 : UseTempRegister(instr->object()); | 2286 : UseTempRegister(instr->object()); |
2285 } else if (is_external_location) { | 2287 } else if (is_external_location) { |
2286 ASSERT(!is_in_object); | 2288 ASSERT(!is_in_object); |
2287 ASSERT(!needs_write_barrier); | 2289 ASSERT(!needs_write_barrier); |
| 2290 ASSERT(!needs_write_barrier_for_map); |
2288 obj = UseRegisterOrConstant(instr->object()); | 2291 obj = UseRegisterOrConstant(instr->object()); |
2289 } else { | 2292 } else { |
2290 obj = UseRegisterAtStart(instr->object()); | 2293 obj = needs_write_barrier_for_map |
| 2294 ? UseRegister(instr->object()) |
| 2295 : UseRegisterAtStart(instr->object()); |
2291 } | 2296 } |
2292 | 2297 |
2293 bool can_be_constant = instr->value()->IsConstant() && | 2298 bool can_be_constant = instr->value()->IsConstant() && |
2294 HConstant::cast(instr->value())->NotInNewSpace() && | 2299 HConstant::cast(instr->value())->NotInNewSpace() && |
2295 !instr->field_representation().IsDouble(); | 2300 !instr->field_representation().IsDouble(); |
2296 | 2301 |
2297 LOperand* val; | 2302 LOperand* val; |
2298 if (needs_write_barrier) { | 2303 if (needs_write_barrier) { |
2299 val = UseTempRegister(instr->value()); | 2304 val = UseTempRegister(instr->value()); |
2300 } else if (is_external_location) { | 2305 } else if (is_external_location) { |
2301 val = UseFixed(instr->value(), rax); | 2306 val = UseFixed(instr->value(), rax); |
2302 } else if (can_be_constant) { | 2307 } else if (can_be_constant) { |
2303 val = UseRegisterOrConstant(instr->value()); | 2308 val = UseRegisterOrConstant(instr->value()); |
2304 } else if (instr->field_representation().IsSmi()) { | 2309 } else if (instr->field_representation().IsSmi()) { |
2305 val = UseRegister(instr->value()); | 2310 val = UseRegister(instr->value()); |
2306 } else if (instr->field_representation().IsDouble()) { | 2311 } else if (instr->field_representation().IsDouble()) { |
2307 val = UseRegisterAtStart(instr->value()); | 2312 val = UseRegisterAtStart(instr->value()); |
2308 } else { | 2313 } else { |
2309 val = UseRegister(instr->value()); | 2314 val = UseRegister(instr->value()); |
2310 } | 2315 } |
2311 | 2316 |
2312 // We only need a scratch register if we have a write barrier or we | 2317 // We only need a scratch register if we have a write barrier or we |
2313 // have a store into the properties array (not in-object-property). | 2318 // have a store into the properties array (not in-object-property). |
2314 LOperand* temp = (!is_in_object || needs_write_barrier) | 2319 LOperand* temp = (!is_in_object || needs_write_barrier || |
2315 ? TempRegister() : NULL; | 2320 needs_write_barrier_for_map) ? TempRegister() : NULL; |
2316 | 2321 |
2317 LInstruction* result = new(zone()) LStoreNamedField(obj, val, temp); | 2322 LInstruction* result = new(zone()) LStoreNamedField(obj, val, temp); |
2318 if (!instr->access().IsExternalMemory() && | 2323 if (!instr->access().IsExternalMemory() && |
2319 instr->field_representation().IsHeapObject() && | 2324 instr->field_representation().IsHeapObject() && |
2320 (val->IsConstantOperand() | 2325 (val->IsConstantOperand() |
2321 ? HConstant::cast(instr->value())->HasSmiValue() | 2326 ? HConstant::cast(instr->value())->HasSmiValue() |
2322 : !instr->value()->type().IsHeapObject())) { | 2327 : !instr->value()->type().IsHeapObject())) { |
2323 result = AssignEnvironment(result); | 2328 result = AssignEnvironment(result); |
2324 } | 2329 } |
2325 return result; | 2330 return result; |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2588 LOperand* index = UseTempRegister(instr->index()); | 2593 LOperand* index = UseTempRegister(instr->index()); |
2589 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index); | 2594 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index); |
2590 LInstruction* result = DefineSameAsFirst(load); | 2595 LInstruction* result = DefineSameAsFirst(load); |
2591 return AssignPointerMap(result); | 2596 return AssignPointerMap(result); |
2592 } | 2597 } |
2593 | 2598 |
2594 | 2599 |
2595 } } // namespace v8::internal | 2600 } } // namespace v8::internal |
2596 | 2601 |
2597 #endif // V8_TARGET_ARCH_X64 | 2602 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |