| 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 #if V8_TARGET_ARCH_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
| 6 | 6 |
| 7 #include "src/arm64/frames-arm64.h" | 7 #include "src/arm64/frames-arm64.h" |
| 8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 4479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4490 | 4490 |
| 4491 | 4491 |
| 4492 void LoadICStub::Generate(MacroAssembler* masm) { GenerateImpl(masm, false); } | 4492 void LoadICStub::Generate(MacroAssembler* masm) { GenerateImpl(masm, false); } |
| 4493 | 4493 |
| 4494 | 4494 |
| 4495 void LoadICStub::GenerateForTrampoline(MacroAssembler* masm) { | 4495 void LoadICStub::GenerateForTrampoline(MacroAssembler* masm) { |
| 4496 GenerateImpl(masm, true); | 4496 GenerateImpl(masm, true); |
| 4497 } | 4497 } |
| 4498 | 4498 |
| 4499 | 4499 |
| 4500 static void HandleArrayCases(MacroAssembler* masm, Register receiver, | 4500 static void HandleArrayCases(MacroAssembler* masm, Register feedback, |
| 4501 Register key, Register vector, Register slot, | 4501 Register receiver_map, Register scratch1, |
| 4502 Register feedback, Register receiver_map, | 4502 Register scratch2, bool is_polymorphic, |
| 4503 Register scratch1, Register scratch2, | 4503 Label* miss) { |
| 4504 bool is_polymorphic, Label* miss) { | |
| 4505 // feedback initially contains the feedback array | 4504 // feedback initially contains the feedback array |
| 4506 Label next_loop, prepare_next; | 4505 Label next_loop, prepare_next; |
| 4507 Label load_smi_map, compare_map; | 4506 Label load_smi_map, compare_map; |
| 4508 Label start_polymorphic; | 4507 Label start_polymorphic; |
| 4509 | 4508 |
| 4510 Register cached_map = scratch1; | 4509 Register cached_map = scratch1; |
| 4511 | 4510 |
| 4512 __ Ldr(cached_map, | 4511 __ Ldr(cached_map, |
| 4513 FieldMemOperand(feedback, FixedArray::OffsetOfElementAt(0))); | 4512 FieldMemOperand(feedback, FixedArray::OffsetOfElementAt(0))); |
| 4514 __ Ldr(cached_map, FieldMemOperand(cached_map, WeakCell::kValueOffset)); | 4513 __ Ldr(cached_map, FieldMemOperand(cached_map, WeakCell::kValueOffset)); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4606 // at WeakCell::kValueOffset. | 4605 // at WeakCell::kValueOffset. |
| 4607 Label try_array, load_smi_map, compare_map; | 4606 Label try_array, load_smi_map, compare_map; |
| 4608 Label not_array, miss; | 4607 Label not_array, miss; |
| 4609 HandleMonomorphicCase(masm, receiver, receiver_map, feedback, vector, slot, | 4608 HandleMonomorphicCase(masm, receiver, receiver_map, feedback, vector, slot, |
| 4610 scratch1, &compare_map, &load_smi_map, &try_array); | 4609 scratch1, &compare_map, &load_smi_map, &try_array); |
| 4611 | 4610 |
| 4612 // Is it a fixed array? | 4611 // Is it a fixed array? |
| 4613 __ Bind(&try_array); | 4612 __ Bind(&try_array); |
| 4614 __ Ldr(scratch1, FieldMemOperand(feedback, HeapObject::kMapOffset)); | 4613 __ Ldr(scratch1, FieldMemOperand(feedback, HeapObject::kMapOffset)); |
| 4615 __ JumpIfNotRoot(scratch1, Heap::kFixedArrayMapRootIndex, ¬_array); | 4614 __ JumpIfNotRoot(scratch1, Heap::kFixedArrayMapRootIndex, ¬_array); |
| 4616 HandleArrayCases(masm, receiver, name, vector, slot, feedback, receiver_map, | 4615 HandleArrayCases(masm, feedback, receiver_map, scratch1, x7, true, &miss); |
| 4617 scratch1, x7, true, &miss); | |
| 4618 | 4616 |
| 4619 __ Bind(¬_array); | 4617 __ Bind(¬_array); |
| 4620 __ JumpIfNotRoot(feedback, Heap::kmegamorphic_symbolRootIndex, &miss); | 4618 __ JumpIfNotRoot(feedback, Heap::kmegamorphic_symbolRootIndex, &miss); |
| 4621 Code::Flags code_flags = Code::RemoveTypeAndHolderFromFlags( | 4619 Code::Flags code_flags = Code::RemoveTypeAndHolderFromFlags( |
| 4622 Code::ComputeHandlerFlags(Code::LOAD_IC)); | 4620 Code::ComputeHandlerFlags(Code::LOAD_IC)); |
| 4623 masm->isolate()->stub_cache()->GenerateProbe(masm, Code::LOAD_IC, code_flags, | 4621 masm->isolate()->stub_cache()->GenerateProbe(masm, Code::LOAD_IC, code_flags, |
| 4624 receiver, name, feedback, | 4622 receiver, name, feedback, |
| 4625 receiver_map, scratch1, x7); | 4623 receiver_map, scratch1, x7); |
| 4626 | 4624 |
| 4627 __ Bind(&miss); | 4625 __ Bind(&miss); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4664 scratch1, &compare_map, &load_smi_map, &try_array); | 4662 scratch1, &compare_map, &load_smi_map, &try_array); |
| 4665 | 4663 |
| 4666 __ Bind(&try_array); | 4664 __ Bind(&try_array); |
| 4667 // Is it a fixed array? | 4665 // Is it a fixed array? |
| 4668 __ Ldr(scratch1, FieldMemOperand(feedback, HeapObject::kMapOffset)); | 4666 __ Ldr(scratch1, FieldMemOperand(feedback, HeapObject::kMapOffset)); |
| 4669 __ JumpIfNotRoot(scratch1, Heap::kFixedArrayMapRootIndex, ¬_array); | 4667 __ JumpIfNotRoot(scratch1, Heap::kFixedArrayMapRootIndex, ¬_array); |
| 4670 | 4668 |
| 4671 // We have a polymorphic element handler. | 4669 // We have a polymorphic element handler. |
| 4672 Label polymorphic, try_poly_name; | 4670 Label polymorphic, try_poly_name; |
| 4673 __ Bind(&polymorphic); | 4671 __ Bind(&polymorphic); |
| 4674 HandleArrayCases(masm, receiver, key, vector, slot, feedback, receiver_map, | 4672 HandleArrayCases(masm, feedback, receiver_map, scratch1, x7, true, &miss); |
| 4675 scratch1, x7, true, &miss); | |
| 4676 | 4673 |
| 4677 __ Bind(¬_array); | 4674 __ Bind(¬_array); |
| 4678 // Is it generic? | 4675 // Is it generic? |
| 4679 __ JumpIfNotRoot(feedback, Heap::kmegamorphic_symbolRootIndex, | 4676 __ JumpIfNotRoot(feedback, Heap::kmegamorphic_symbolRootIndex, |
| 4680 &try_poly_name); | 4677 &try_poly_name); |
| 4681 Handle<Code> megamorphic_stub = | 4678 Handle<Code> megamorphic_stub = |
| 4682 KeyedLoadIC::ChooseMegamorphicStub(masm->isolate(), GetExtraICState()); | 4679 KeyedLoadIC::ChooseMegamorphicStub(masm->isolate(), GetExtraICState()); |
| 4683 __ Jump(megamorphic_stub, RelocInfo::CODE_TARGET); | 4680 __ Jump(megamorphic_stub, RelocInfo::CODE_TARGET); |
| 4684 | 4681 |
| 4685 __ Bind(&try_poly_name); | 4682 __ Bind(&try_poly_name); |
| 4686 // We might have a name in feedback, and a fixed array in the next slot. | 4683 // We might have a name in feedback, and a fixed array in the next slot. |
| 4687 __ Cmp(key, feedback); | 4684 __ Cmp(key, feedback); |
| 4688 __ B(ne, &miss); | 4685 __ B(ne, &miss); |
| 4689 // If the name comparison succeeded, we know we have a fixed array with | 4686 // If the name comparison succeeded, we know we have a fixed array with |
| 4690 // at least one map/handler pair. | 4687 // at least one map/handler pair. |
| 4691 __ Add(feedback, vector, Operand::UntagSmiAndScale(slot, kPointerSizeLog2)); | 4688 __ Add(feedback, vector, Operand::UntagSmiAndScale(slot, kPointerSizeLog2)); |
| 4692 __ Ldr(feedback, | 4689 __ Ldr(feedback, |
| 4693 FieldMemOperand(feedback, FixedArray::kHeaderSize + kPointerSize)); | 4690 FieldMemOperand(feedback, FixedArray::kHeaderSize + kPointerSize)); |
| 4694 HandleArrayCases(masm, receiver, key, vector, slot, feedback, receiver_map, | 4691 HandleArrayCases(masm, feedback, receiver_map, scratch1, x7, false, &miss); |
| 4695 scratch1, x7, false, &miss); | |
| 4696 | 4692 |
| 4697 __ Bind(&miss); | 4693 __ Bind(&miss); |
| 4698 KeyedLoadIC::GenerateMiss(masm); | 4694 KeyedLoadIC::GenerateMiss(masm); |
| 4699 | 4695 |
| 4700 __ Bind(&load_smi_map); | 4696 __ Bind(&load_smi_map); |
| 4701 __ LoadRoot(receiver_map, Heap::kHeapNumberMapRootIndex); | 4697 __ LoadRoot(receiver_map, Heap::kHeapNumberMapRootIndex); |
| 4702 __ jmp(&compare_map); | 4698 __ jmp(&compare_map); |
| 4703 } | 4699 } |
| 4704 | 4700 |
| 4705 | 4701 |
| (...skipping 1237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5943 MemOperand(fp, 6 * kPointerSize), NULL); | 5939 MemOperand(fp, 6 * kPointerSize), NULL); |
| 5944 } | 5940 } |
| 5945 | 5941 |
| 5946 | 5942 |
| 5947 #undef __ | 5943 #undef __ |
| 5948 | 5944 |
| 5949 } // namespace internal | 5945 } // namespace internal |
| 5950 } // namespace v8 | 5946 } // namespace v8 |
| 5951 | 5947 |
| 5952 #endif // V8_TARGET_ARCH_ARM64 | 5948 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |