OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/arm64/lithium-codegen-arm64.h" | 5 #include "src/crankshaft/arm64/lithium-codegen-arm64.h" |
6 | 6 |
7 #include "src/arm64/frames-arm64.h" | 7 #include "src/arm64/frames-arm64.h" |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/builtins/builtins-constructor.h" | 9 #include "src/builtins/builtins-constructor.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 2951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2962 __ Bind(label->label()); | 2962 __ Bind(label->label()); |
2963 current_block_ = label->block_id(); | 2963 current_block_ = label->block_id(); |
2964 DoGap(label); | 2964 DoGap(label); |
2965 } | 2965 } |
2966 | 2966 |
2967 | 2967 |
2968 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 2968 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
2969 Register context = ToRegister(instr->context()); | 2969 Register context = ToRegister(instr->context()); |
2970 Register result = ToRegister(instr->result()); | 2970 Register result = ToRegister(instr->result()); |
2971 __ Ldr(result, ContextMemOperand(context, instr->slot_index())); | 2971 __ Ldr(result, ContextMemOperand(context, instr->slot_index())); |
| 2972 if (instr->hydrogen()->RequiresHoleCheck()) { |
| 2973 if (instr->hydrogen()->DeoptimizesOnHole()) { |
| 2974 DeoptimizeIfRoot(result, Heap::kTheHoleValueRootIndex, instr, |
| 2975 DeoptimizeReason::kHole); |
| 2976 } else { |
| 2977 Label not_the_hole; |
| 2978 __ JumpIfNotRoot(result, Heap::kTheHoleValueRootIndex, ¬_the_hole); |
| 2979 __ LoadRoot(result, Heap::kUndefinedValueRootIndex); |
| 2980 __ Bind(¬_the_hole); |
| 2981 } |
| 2982 } |
2972 } | 2983 } |
2973 | 2984 |
2974 | 2985 |
2975 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { | 2986 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { |
2976 Register function = ToRegister(instr->function()); | 2987 Register function = ToRegister(instr->function()); |
2977 Register result = ToRegister(instr->result()); | 2988 Register result = ToRegister(instr->result()); |
2978 Register temp = ToRegister(instr->temp()); | 2989 Register temp = ToRegister(instr->temp()); |
2979 | 2990 |
2980 // Get the prototype or initial map from the function. | 2991 // Get the prototype or initial map from the function. |
2981 __ Ldr(result, FieldMemOperand(function, | 2992 __ Ldr(result, FieldMemOperand(function, |
(...skipping 1683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4665 __ Str(temp, FieldMemOperand(function, JSFunction::kCodeEntryOffset)); | 4676 __ Str(temp, FieldMemOperand(function, JSFunction::kCodeEntryOffset)); |
4666 } | 4677 } |
4667 | 4678 |
4668 | 4679 |
4669 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { | 4680 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { |
4670 Register context = ToRegister(instr->context()); | 4681 Register context = ToRegister(instr->context()); |
4671 Register value = ToRegister(instr->value()); | 4682 Register value = ToRegister(instr->value()); |
4672 Register scratch = ToRegister(instr->temp()); | 4683 Register scratch = ToRegister(instr->temp()); |
4673 MemOperand target = ContextMemOperand(context, instr->slot_index()); | 4684 MemOperand target = ContextMemOperand(context, instr->slot_index()); |
4674 | 4685 |
| 4686 Label skip_assignment; |
| 4687 |
| 4688 if (instr->hydrogen()->RequiresHoleCheck()) { |
| 4689 __ Ldr(scratch, target); |
| 4690 if (instr->hydrogen()->DeoptimizesOnHole()) { |
| 4691 DeoptimizeIfRoot(scratch, Heap::kTheHoleValueRootIndex, instr, |
| 4692 DeoptimizeReason::kHole); |
| 4693 } else { |
| 4694 __ JumpIfNotRoot(scratch, Heap::kTheHoleValueRootIndex, &skip_assignment); |
| 4695 } |
| 4696 } |
| 4697 |
4675 __ Str(value, target); | 4698 __ Str(value, target); |
4676 if (instr->hydrogen()->NeedsWriteBarrier()) { | 4699 if (instr->hydrogen()->NeedsWriteBarrier()) { |
4677 SmiCheck check_needed = | 4700 SmiCheck check_needed = |
4678 instr->hydrogen()->value()->type().IsHeapObject() | 4701 instr->hydrogen()->value()->type().IsHeapObject() |
4679 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; | 4702 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; |
4680 __ RecordWriteContextSlot(context, static_cast<int>(target.offset()), value, | 4703 __ RecordWriteContextSlot(context, static_cast<int>(target.offset()), value, |
4681 scratch, GetLinkRegisterState(), kSaveFPRegs, | 4704 scratch, GetLinkRegisterState(), kSaveFPRegs, |
4682 EMIT_REMEMBERED_SET, check_needed); | 4705 EMIT_REMEMBERED_SET, check_needed); |
4683 } | 4706 } |
| 4707 __ Bind(&skip_assignment); |
4684 } | 4708 } |
4685 | 4709 |
4686 | 4710 |
4687 void LCodeGen::DoStoreKeyedExternal(LStoreKeyedExternal* instr) { | 4711 void LCodeGen::DoStoreKeyedExternal(LStoreKeyedExternal* instr) { |
4688 Register ext_ptr = ToRegister(instr->elements()); | 4712 Register ext_ptr = ToRegister(instr->elements()); |
4689 Register key = no_reg; | 4713 Register key = no_reg; |
4690 Register scratch; | 4714 Register scratch; |
4691 ElementsKind elements_kind = instr->elements_kind(); | 4715 ElementsKind elements_kind = instr->elements_kind(); |
4692 | 4716 |
4693 bool key_is_smi = instr->hydrogen()->key()->representation().IsSmi(); | 4717 bool key_is_smi = instr->hydrogen()->key()->representation().IsSmi(); |
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5567 // Index is equal to negated out of object property index plus 1. | 5591 // Index is equal to negated out of object property index plus 1. |
5568 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); | 5592 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); |
5569 __ Ldr(result, FieldMemOperand(result, | 5593 __ Ldr(result, FieldMemOperand(result, |
5570 FixedArray::kHeaderSize - kPointerSize)); | 5594 FixedArray::kHeaderSize - kPointerSize)); |
5571 __ Bind(deferred->exit()); | 5595 __ Bind(deferred->exit()); |
5572 __ Bind(&done); | 5596 __ Bind(&done); |
5573 } | 5597 } |
5574 | 5598 |
5575 } // namespace internal | 5599 } // namespace internal |
5576 } // namespace v8 | 5600 } // namespace v8 |
OLD | NEW |