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 "src/crankshaft/arm/lithium-codegen-arm.h" | 5 #include "src/crankshaft/arm/lithium-codegen-arm.h" |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/builtins/builtins-constructor.h" | 8 #include "src/builtins/builtins-constructor.h" |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 2549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2560 | 2560 |
2561 __ Jump(lr); | 2561 __ Jump(lr); |
2562 } | 2562 } |
2563 } | 2563 } |
2564 | 2564 |
2565 | 2565 |
2566 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 2566 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
2567 Register context = ToRegister(instr->context()); | 2567 Register context = ToRegister(instr->context()); |
2568 Register result = ToRegister(instr->result()); | 2568 Register result = ToRegister(instr->result()); |
2569 __ ldr(result, ContextMemOperand(context, instr->slot_index())); | 2569 __ ldr(result, ContextMemOperand(context, instr->slot_index())); |
| 2570 if (instr->hydrogen()->RequiresHoleCheck()) { |
| 2571 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
| 2572 __ cmp(result, ip); |
| 2573 if (instr->hydrogen()->DeoptimizesOnHole()) { |
| 2574 DeoptimizeIf(eq, instr, DeoptimizeReason::kHole); |
| 2575 } else { |
| 2576 __ mov(result, Operand(factory()->undefined_value()), LeaveCC, eq); |
| 2577 } |
| 2578 } |
2570 } | 2579 } |
2571 | 2580 |
2572 | 2581 |
2573 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { | 2582 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { |
2574 Register context = ToRegister(instr->context()); | 2583 Register context = ToRegister(instr->context()); |
2575 Register value = ToRegister(instr->value()); | 2584 Register value = ToRegister(instr->value()); |
2576 Register scratch = scratch0(); | 2585 Register scratch = scratch0(); |
2577 MemOperand target = ContextMemOperand(context, instr->slot_index()); | 2586 MemOperand target = ContextMemOperand(context, instr->slot_index()); |
2578 | 2587 |
| 2588 Label skip_assignment; |
| 2589 |
| 2590 if (instr->hydrogen()->RequiresHoleCheck()) { |
| 2591 __ ldr(scratch, target); |
| 2592 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
| 2593 __ cmp(scratch, ip); |
| 2594 if (instr->hydrogen()->DeoptimizesOnHole()) { |
| 2595 DeoptimizeIf(eq, instr, DeoptimizeReason::kHole); |
| 2596 } else { |
| 2597 __ b(ne, &skip_assignment); |
| 2598 } |
| 2599 } |
| 2600 |
2579 __ str(value, target); | 2601 __ str(value, target); |
2580 if (instr->hydrogen()->NeedsWriteBarrier()) { | 2602 if (instr->hydrogen()->NeedsWriteBarrier()) { |
2581 SmiCheck check_needed = | 2603 SmiCheck check_needed = |
2582 instr->hydrogen()->value()->type().IsHeapObject() | 2604 instr->hydrogen()->value()->type().IsHeapObject() |
2583 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; | 2605 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; |
2584 __ RecordWriteContextSlot(context, | 2606 __ RecordWriteContextSlot(context, |
2585 target.offset(), | 2607 target.offset(), |
2586 value, | 2608 value, |
2587 scratch, | 2609 scratch, |
2588 GetLinkRegisterState(), | 2610 GetLinkRegisterState(), |
2589 kSaveFPRegs, | 2611 kSaveFPRegs, |
2590 EMIT_REMEMBERED_SET, | 2612 EMIT_REMEMBERED_SET, |
2591 check_needed); | 2613 check_needed); |
2592 } | 2614 } |
| 2615 |
| 2616 __ bind(&skip_assignment); |
2593 } | 2617 } |
2594 | 2618 |
2595 | 2619 |
2596 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { | 2620 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |
2597 HObjectAccess access = instr->hydrogen()->access(); | 2621 HObjectAccess access = instr->hydrogen()->access(); |
2598 int offset = access.offset(); | 2622 int offset = access.offset(); |
2599 Register object = ToRegister(instr->object()); | 2623 Register object = ToRegister(instr->object()); |
2600 | 2624 |
2601 if (access.IsExternalMemory()) { | 2625 if (access.IsExternalMemory()) { |
2602 Register result = ToRegister(instr->result()); | 2626 Register result = ToRegister(instr->result()); |
(...skipping 2759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5362 __ ldr(result, FieldMemOperand(scratch, | 5386 __ ldr(result, FieldMemOperand(scratch, |
5363 FixedArray::kHeaderSize - kPointerSize)); | 5387 FixedArray::kHeaderSize - kPointerSize)); |
5364 __ bind(deferred->exit()); | 5388 __ bind(deferred->exit()); |
5365 __ bind(&done); | 5389 __ bind(&done); |
5366 } | 5390 } |
5367 | 5391 |
5368 #undef __ | 5392 #undef __ |
5369 | 5393 |
5370 } // namespace internal | 5394 } // namespace internal |
5371 } // namespace v8 | 5395 } // namespace v8 |
OLD | NEW |