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 2640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2651 } | 2651 } |
2652 | 2652 |
2653 __ blr(); | 2653 __ blr(); |
2654 } | 2654 } |
2655 | 2655 |
2656 | 2656 |
2657 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 2657 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
2658 Register context = ToRegister(instr->context()); | 2658 Register context = ToRegister(instr->context()); |
2659 Register result = ToRegister(instr->result()); | 2659 Register result = ToRegister(instr->result()); |
2660 __ LoadP(result, ContextMemOperand(context, instr->slot_index())); | 2660 __ LoadP(result, ContextMemOperand(context, instr->slot_index())); |
2661 if (instr->hydrogen()->RequiresHoleCheck()) { | |
2662 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | |
2663 if (instr->hydrogen()->DeoptimizesOnHole()) { | |
2664 __ cmp(result, ip); | |
2665 DeoptimizeIf(eq, instr, DeoptimizeReason::kHole); | |
2666 } else { | |
2667 if (CpuFeatures::IsSupported(ISELECT)) { | |
2668 Register scratch = scratch0(); | |
2669 __ mov(scratch, Operand(factory()->undefined_value())); | |
2670 __ cmp(result, ip); | |
2671 __ isel(eq, result, scratch, result); | |
2672 } else { | |
2673 Label skip; | |
2674 __ cmp(result, ip); | |
2675 __ bne(&skip); | |
2676 __ mov(result, Operand(factory()->undefined_value())); | |
2677 __ bind(&skip); | |
2678 } | |
2679 } | |
2680 } | |
2681 } | 2661 } |
2682 | 2662 |
2683 | 2663 |
2684 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { | 2664 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { |
2685 Register context = ToRegister(instr->context()); | 2665 Register context = ToRegister(instr->context()); |
2686 Register value = ToRegister(instr->value()); | 2666 Register value = ToRegister(instr->value()); |
2687 Register scratch = scratch0(); | 2667 Register scratch = scratch0(); |
2688 MemOperand target = ContextMemOperand(context, instr->slot_index()); | 2668 MemOperand target = ContextMemOperand(context, instr->slot_index()); |
2689 | 2669 |
2690 Label skip_assignment; | |
2691 | |
2692 if (instr->hydrogen()->RequiresHoleCheck()) { | |
2693 __ LoadP(scratch, target); | |
2694 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | |
2695 __ cmp(scratch, ip); | |
2696 if (instr->hydrogen()->DeoptimizesOnHole()) { | |
2697 DeoptimizeIf(eq, instr, DeoptimizeReason::kHole); | |
2698 } else { | |
2699 __ bne(&skip_assignment); | |
2700 } | |
2701 } | |
2702 | |
2703 __ StoreP(value, target, r0); | 2670 __ StoreP(value, target, r0); |
2704 if (instr->hydrogen()->NeedsWriteBarrier()) { | 2671 if (instr->hydrogen()->NeedsWriteBarrier()) { |
2705 SmiCheck check_needed = instr->hydrogen()->value()->type().IsHeapObject() | 2672 SmiCheck check_needed = instr->hydrogen()->value()->type().IsHeapObject() |
2706 ? OMIT_SMI_CHECK | 2673 ? OMIT_SMI_CHECK |
2707 : INLINE_SMI_CHECK; | 2674 : INLINE_SMI_CHECK; |
2708 __ RecordWriteContextSlot(context, target.offset(), value, scratch, | 2675 __ RecordWriteContextSlot(context, target.offset(), value, scratch, |
2709 GetLinkRegisterState(), kSaveFPRegs, | 2676 GetLinkRegisterState(), kSaveFPRegs, |
2710 EMIT_REMEMBERED_SET, check_needed); | 2677 EMIT_REMEMBERED_SET, check_needed); |
2711 } | 2678 } |
2712 | |
2713 __ bind(&skip_assignment); | |
2714 } | 2679 } |
2715 | 2680 |
2716 | 2681 |
2717 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { | 2682 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |
2718 HObjectAccess access = instr->hydrogen()->access(); | 2683 HObjectAccess access = instr->hydrogen()->access(); |
2719 int offset = access.offset(); | 2684 int offset = access.offset(); |
2720 Register object = ToRegister(instr->object()); | 2685 Register object = ToRegister(instr->object()); |
2721 | 2686 |
2722 if (access.IsExternalMemory()) { | 2687 if (access.IsExternalMemory()) { |
2723 Register result = ToRegister(instr->result()); | 2688 Register result = ToRegister(instr->result()); |
(...skipping 2932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5656 __ LoadP(result, | 5621 __ LoadP(result, |
5657 FieldMemOperand(scratch, FixedArray::kHeaderSize - kPointerSize)); | 5622 FieldMemOperand(scratch, FixedArray::kHeaderSize - kPointerSize)); |
5658 __ bind(deferred->exit()); | 5623 __ bind(deferred->exit()); |
5659 __ bind(&done); | 5624 __ bind(&done); |
5660 } | 5625 } |
5661 | 5626 |
5662 #undef __ | 5627 #undef __ |
5663 | 5628 |
5664 } // namespace internal | 5629 } // namespace internal |
5665 } // namespace v8 | 5630 } // namespace v8 |
OLD | NEW |