OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/ppc/lithium-codegen-ppc.h" | 5 #include "src/crankshaft/ppc/lithium-codegen-ppc.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 2656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2667 } | 2667 } |
2668 | 2668 |
2669 __ blr(); | 2669 __ blr(); |
2670 } | 2670 } |
2671 | 2671 |
2672 | 2672 |
2673 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 2673 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
2674 Register context = ToRegister(instr->context()); | 2674 Register context = ToRegister(instr->context()); |
2675 Register result = ToRegister(instr->result()); | 2675 Register result = ToRegister(instr->result()); |
2676 __ LoadP(result, ContextMemOperand(context, instr->slot_index())); | 2676 __ LoadP(result, ContextMemOperand(context, instr->slot_index())); |
| 2677 if (instr->hydrogen()->RequiresHoleCheck()) { |
| 2678 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
| 2679 if (instr->hydrogen()->DeoptimizesOnHole()) { |
| 2680 __ cmp(result, ip); |
| 2681 DeoptimizeIf(eq, instr, DeoptimizeReason::kHole); |
| 2682 } else { |
| 2683 if (CpuFeatures::IsSupported(ISELECT)) { |
| 2684 Register scratch = scratch0(); |
| 2685 __ mov(scratch, Operand(factory()->undefined_value())); |
| 2686 __ cmp(result, ip); |
| 2687 __ isel(eq, result, scratch, result); |
| 2688 } else { |
| 2689 Label skip; |
| 2690 __ cmp(result, ip); |
| 2691 __ bne(&skip); |
| 2692 __ mov(result, Operand(factory()->undefined_value())); |
| 2693 __ bind(&skip); |
| 2694 } |
| 2695 } |
| 2696 } |
2677 } | 2697 } |
2678 | 2698 |
2679 | 2699 |
2680 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { | 2700 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { |
2681 Register context = ToRegister(instr->context()); | 2701 Register context = ToRegister(instr->context()); |
2682 Register value = ToRegister(instr->value()); | 2702 Register value = ToRegister(instr->value()); |
2683 Register scratch = scratch0(); | 2703 Register scratch = scratch0(); |
2684 MemOperand target = ContextMemOperand(context, instr->slot_index()); | 2704 MemOperand target = ContextMemOperand(context, instr->slot_index()); |
2685 | 2705 |
| 2706 Label skip_assignment; |
| 2707 |
| 2708 if (instr->hydrogen()->RequiresHoleCheck()) { |
| 2709 __ LoadP(scratch, target); |
| 2710 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
| 2711 __ cmp(scratch, ip); |
| 2712 if (instr->hydrogen()->DeoptimizesOnHole()) { |
| 2713 DeoptimizeIf(eq, instr, DeoptimizeReason::kHole); |
| 2714 } else { |
| 2715 __ bne(&skip_assignment); |
| 2716 } |
| 2717 } |
| 2718 |
2686 __ StoreP(value, target, r0); | 2719 __ StoreP(value, target, r0); |
2687 if (instr->hydrogen()->NeedsWriteBarrier()) { | 2720 if (instr->hydrogen()->NeedsWriteBarrier()) { |
2688 SmiCheck check_needed = instr->hydrogen()->value()->type().IsHeapObject() | 2721 SmiCheck check_needed = instr->hydrogen()->value()->type().IsHeapObject() |
2689 ? OMIT_SMI_CHECK | 2722 ? OMIT_SMI_CHECK |
2690 : INLINE_SMI_CHECK; | 2723 : INLINE_SMI_CHECK; |
2691 __ RecordWriteContextSlot(context, target.offset(), value, scratch, | 2724 __ RecordWriteContextSlot(context, target.offset(), value, scratch, |
2692 GetLinkRegisterState(), kSaveFPRegs, | 2725 GetLinkRegisterState(), kSaveFPRegs, |
2693 EMIT_REMEMBERED_SET, check_needed); | 2726 EMIT_REMEMBERED_SET, check_needed); |
2694 } | 2727 } |
| 2728 |
| 2729 __ bind(&skip_assignment); |
2695 } | 2730 } |
2696 | 2731 |
2697 | 2732 |
2698 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { | 2733 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |
2699 HObjectAccess access = instr->hydrogen()->access(); | 2734 HObjectAccess access = instr->hydrogen()->access(); |
2700 int offset = access.offset(); | 2735 int offset = access.offset(); |
2701 Register object = ToRegister(instr->object()); | 2736 Register object = ToRegister(instr->object()); |
2702 | 2737 |
2703 if (access.IsExternalMemory()) { | 2738 if (access.IsExternalMemory()) { |
2704 Register result = ToRegister(instr->result()); | 2739 Register result = ToRegister(instr->result()); |
(...skipping 2932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5637 __ LoadP(result, | 5672 __ LoadP(result, |
5638 FieldMemOperand(scratch, FixedArray::kHeaderSize - kPointerSize)); | 5673 FieldMemOperand(scratch, FixedArray::kHeaderSize - kPointerSize)); |
5639 __ bind(deferred->exit()); | 5674 __ bind(deferred->exit()); |
5640 __ bind(&done); | 5675 __ bind(&done); |
5641 } | 5676 } |
5642 | 5677 |
5643 #undef __ | 5678 #undef __ |
5644 | 5679 |
5645 } // namespace internal | 5680 } // namespace internal |
5646 } // namespace v8 | 5681 } // namespace v8 |
OLD | NEW |