Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Side by Side Diff: src/arm/code-stubs-arm.cc

Issue 1319123004: Reland Vector ICs: platform support for vector-based stores. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix for arm[64] release build failure. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/arm64/code-stubs-arm64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #if V8_TARGET_ARCH_ARM 5 #if V8_TARGET_ARCH_ARM
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.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 4427 matching lines...) Expand 10 before | Expand all | Expand 10 after
4438 __ b(ne, &miss); 4438 __ b(ne, &miss);
4439 Code::Flags code_flags = Code::RemoveTypeAndHolderFromFlags( 4439 Code::Flags code_flags = Code::RemoveTypeAndHolderFromFlags(
4440 Code::ComputeHandlerFlags(Code::LOAD_IC)); 4440 Code::ComputeHandlerFlags(Code::LOAD_IC));
4441 masm->isolate()->stub_cache()->GenerateProbe(masm, Code::LOAD_IC, code_flags, 4441 masm->isolate()->stub_cache()->GenerateProbe(masm, Code::LOAD_IC, code_flags,
4442 receiver, name, feedback, 4442 receiver, name, feedback,
4443 receiver_map, scratch1, r9); 4443 receiver_map, scratch1, r9);
4444 4444
4445 __ bind(&miss); 4445 __ bind(&miss);
4446 LoadIC::GenerateMiss(masm); 4446 LoadIC::GenerateMiss(masm);
4447 4447
4448
4449 __ bind(&load_smi_map); 4448 __ bind(&load_smi_map);
4450 __ LoadRoot(receiver_map, Heap::kHeapNumberMapRootIndex); 4449 __ LoadRoot(receiver_map, Heap::kHeapNumberMapRootIndex);
4451 __ jmp(&compare_map); 4450 __ jmp(&compare_map);
4452 } 4451 }
4453 4452
4454 4453
4455 void KeyedLoadICStub::Generate(MacroAssembler* masm) { 4454 void KeyedLoadICStub::Generate(MacroAssembler* masm) {
4456 GenerateImpl(masm, false); 4455 GenerateImpl(masm, false);
4457 } 4456 }
4458 4457
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
4539 GenerateImpl(masm, false); 4538 GenerateImpl(masm, false);
4540 } 4539 }
4541 4540
4542 4541
4543 void VectorStoreICStub::GenerateForTrampoline(MacroAssembler* masm) { 4542 void VectorStoreICStub::GenerateForTrampoline(MacroAssembler* masm) {
4544 GenerateImpl(masm, true); 4543 GenerateImpl(masm, true);
4545 } 4544 }
4546 4545
4547 4546
4548 void VectorStoreICStub::GenerateImpl(MacroAssembler* masm, bool in_frame) { 4547 void VectorStoreICStub::GenerateImpl(MacroAssembler* masm, bool in_frame) {
4549 Label miss; 4548 Register receiver = VectorStoreICDescriptor::ReceiverRegister(); // r1
4549 Register key = VectorStoreICDescriptor::NameRegister(); // r2
4550 Register vector = VectorStoreICDescriptor::VectorRegister(); // r3
4551 Register slot = VectorStoreICDescriptor::SlotRegister(); // r4
4552 DCHECK(VectorStoreICDescriptor::ValueRegister().is(r0)); // r0
4553 Register feedback = r5;
4554 Register receiver_map = r6;
4555 Register scratch1 = r9;
4550 4556
4551 // TODO(mvstanton): Implement. 4557 __ add(feedback, vector, Operand::PointerOffsetFromSmiKey(slot));
4558 __ ldr(feedback, FieldMemOperand(feedback, FixedArray::kHeaderSize));
4559
4560 // Try to quickly handle the monomorphic case without knowing for sure
4561 // if we have a weak cell in feedback. We do know it's safe to look
4562 // at WeakCell::kValueOffset.
4563 Label try_array, load_smi_map, compare_map;
4564 Label not_array, miss;
4565 HandleMonomorphicCase(masm, receiver, receiver_map, feedback, vector, slot,
4566 scratch1, &compare_map, &load_smi_map, &try_array);
4567
4568 // Is it a fixed array?
4569 __ bind(&try_array);
4570 __ ldr(scratch1, FieldMemOperand(feedback, HeapObject::kMapOffset));
4571 __ CompareRoot(scratch1, Heap::kFixedArrayMapRootIndex);
4572 __ b(ne, &not_array);
4573
4574 // We are using register r8, which is used for the embedded constant pool
4575 // when FLAG_enable_embedded_constant_pool is true.
4576 DCHECK(!FLAG_enable_embedded_constant_pool);
4577 Register scratch2 = r8;
4578 HandleArrayCases(masm, feedback, receiver_map, scratch1, scratch2, true,
4579 &miss);
4580
4581 __ bind(&not_array);
4582 __ CompareRoot(feedback, Heap::kmegamorphic_symbolRootIndex);
4583 __ b(ne, &miss);
4584 Code::Flags code_flags = Code::RemoveTypeAndHolderFromFlags(
4585 Code::ComputeHandlerFlags(Code::STORE_IC));
4586 masm->isolate()->stub_cache()->GenerateProbe(
4587 masm, Code::STORE_IC, code_flags, receiver, key, feedback, receiver_map,
4588 scratch1, scratch2);
4589
4552 __ bind(&miss); 4590 __ bind(&miss);
4553 StoreIC::GenerateMiss(masm); 4591 StoreIC::GenerateMiss(masm);
4592
4593 __ bind(&load_smi_map);
4594 __ LoadRoot(receiver_map, Heap::kHeapNumberMapRootIndex);
4595 __ jmp(&compare_map);
4554 } 4596 }
4555 4597
4556 4598
4557 void VectorKeyedStoreICStub::Generate(MacroAssembler* masm) { 4599 void VectorKeyedStoreICStub::Generate(MacroAssembler* masm) {
4558 GenerateImpl(masm, false); 4600 GenerateImpl(masm, false);
4559 } 4601 }
4560 4602
4561 4603
4562 void VectorKeyedStoreICStub::GenerateForTrampoline(MacroAssembler* masm) { 4604 void VectorKeyedStoreICStub::GenerateForTrampoline(MacroAssembler* masm) {
4563 GenerateImpl(masm, true); 4605 GenerateImpl(masm, true);
4564 } 4606 }
4565 4607
4566 4608
4609 static void HandlePolymorphicStoreCase(MacroAssembler* masm, Register feedback,
4610 Register receiver_map, Register scratch1,
4611 Register scratch2, Label* miss) {
4612 // feedback initially contains the feedback array
4613 Label next_loop, prepare_next;
4614 Label start_polymorphic;
4615 Label transition_call;
4616
4617 Register cached_map = scratch1;
4618 Register too_far = scratch2;
4619 Register pointer_reg = feedback;
4620 __ ldr(too_far, FieldMemOperand(feedback, FixedArray::kLengthOffset));
4621
4622 // +-----+------+------+-----+-----+-----+ ... ----+
4623 // | map | len | wm0 | wt0 | h0 | wm1 | hN |
4624 // +-----+------+------+-----+-----+ ----+ ... ----+
4625 // 0 1 2 len-1
4626 // ^ ^
4627 // | |
4628 // pointer_reg too_far
4629 // aka feedback scratch2
4630 // also need receiver_map
4631 // use cached_map (scratch1) to look in the weak map values.
4632 __ add(too_far, feedback, Operand::PointerOffsetFromSmiKey(too_far));
4633 __ add(too_far, too_far, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
4634 __ add(pointer_reg, feedback,
4635 Operand(FixedArray::OffsetOfElementAt(0) - kHeapObjectTag));
4636
4637 __ bind(&next_loop);
4638 __ ldr(cached_map, MemOperand(pointer_reg));
4639 __ ldr(cached_map, FieldMemOperand(cached_map, WeakCell::kValueOffset));
4640 __ cmp(receiver_map, cached_map);
4641 __ b(ne, &prepare_next);
4642 // Is it a transitioning store?
4643 __ ldr(too_far, MemOperand(pointer_reg, kPointerSize));
4644 __ CompareRoot(too_far, Heap::kUndefinedValueRootIndex);
4645 __ b(ne, &transition_call);
4646 __ ldr(pointer_reg, MemOperand(pointer_reg, kPointerSize * 2));
4647 __ add(pc, pointer_reg, Operand(Code::kHeaderSize - kHeapObjectTag));
4648
4649 __ bind(&transition_call);
4650 __ ldr(too_far, FieldMemOperand(too_far, WeakCell::kValueOffset));
4651 __ JumpIfSmi(too_far, miss);
4652
4653 __ ldr(receiver_map, MemOperand(pointer_reg, kPointerSize * 2));
4654
4655 // Load the map into the correct register.
4656 DCHECK(feedback.is(VectorStoreTransitionDescriptor::MapRegister()));
4657 __ mov(feedback, too_far);
4658
4659 __ add(pc, receiver_map, Operand(Code::kHeaderSize - kHeapObjectTag));
4660
4661 __ bind(&prepare_next);
4662 __ add(pointer_reg, pointer_reg, Operand(kPointerSize * 3));
4663 __ cmp(pointer_reg, too_far);
4664 __ b(lt, &next_loop);
4665
4666 // We exhausted our array of map handler pairs.
4667 __ jmp(miss);
4668 }
4669
4670
4567 void VectorKeyedStoreICStub::GenerateImpl(MacroAssembler* masm, bool in_frame) { 4671 void VectorKeyedStoreICStub::GenerateImpl(MacroAssembler* masm, bool in_frame) {
4568 Label miss; 4672 Register receiver = VectorStoreICDescriptor::ReceiverRegister(); // r1
4673 Register key = VectorStoreICDescriptor::NameRegister(); // r2
4674 Register vector = VectorStoreICDescriptor::VectorRegister(); // r3
4675 Register slot = VectorStoreICDescriptor::SlotRegister(); // r4
4676 DCHECK(VectorStoreICDescriptor::ValueRegister().is(r0)); // r0
4677 Register feedback = r5;
4678 Register receiver_map = r6;
4679 Register scratch1 = r9;
4569 4680
4570 // TODO(mvstanton): Implement. 4681 __ add(feedback, vector, Operand::PointerOffsetFromSmiKey(slot));
4682 __ ldr(feedback, FieldMemOperand(feedback, FixedArray::kHeaderSize));
4683
4684 // Try to quickly handle the monomorphic case without knowing for sure
4685 // if we have a weak cell in feedback. We do know it's safe to look
4686 // at WeakCell::kValueOffset.
4687 Label try_array, load_smi_map, compare_map;
4688 Label not_array, miss;
4689 HandleMonomorphicCase(masm, receiver, receiver_map, feedback, vector, slot,
4690 scratch1, &compare_map, &load_smi_map, &try_array);
4691
4692 __ bind(&try_array);
4693 // Is it a fixed array?
4694 __ ldr(scratch1, FieldMemOperand(feedback, HeapObject::kMapOffset));
4695 __ CompareRoot(scratch1, Heap::kFixedArrayMapRootIndex);
4696 __ b(ne, &not_array);
4697
4698 // We have a polymorphic element handler.
4699 Label polymorphic, try_poly_name;
4700 __ bind(&polymorphic);
4701
4702 // We are using register r8, which is used for the embedded constant pool
4703 // when FLAG_enable_embedded_constant_pool is true.
4704 DCHECK(!FLAG_enable_embedded_constant_pool);
4705 Register scratch2 = r8;
4706
4707 HandlePolymorphicStoreCase(masm, feedback, receiver_map, scratch1, scratch2,
4708 &miss);
4709
4710 __ bind(&not_array);
4711 // Is it generic?
4712 __ CompareRoot(feedback, Heap::kmegamorphic_symbolRootIndex);
4713 __ b(ne, &try_poly_name);
4714 Handle<Code> megamorphic_stub =
4715 KeyedStoreIC::ChooseMegamorphicStub(masm->isolate(), GetExtraICState());
4716 __ Jump(megamorphic_stub, RelocInfo::CODE_TARGET);
4717
4718 __ bind(&try_poly_name);
4719 // We might have a name in feedback, and a fixed array in the next slot.
4720 __ cmp(key, feedback);
4721 __ b(ne, &miss);
4722 // If the name comparison succeeded, we know we have a fixed array with
4723 // at least one map/handler pair.
4724 __ add(feedback, vector, Operand::PointerOffsetFromSmiKey(slot));
4725 __ ldr(feedback,
4726 FieldMemOperand(feedback, FixedArray::kHeaderSize + kPointerSize));
4727 HandleArrayCases(masm, feedback, receiver_map, scratch1, scratch2, false,
4728 &miss);
4729
4571 __ bind(&miss); 4730 __ bind(&miss);
4572 KeyedStoreIC::GenerateMiss(masm); 4731 KeyedStoreIC::GenerateMiss(masm);
4732
4733 __ bind(&load_smi_map);
4734 __ LoadRoot(receiver_map, Heap::kHeapNumberMapRootIndex);
4735 __ jmp(&compare_map);
4573 } 4736 }
4574 4737
4575 4738
4576 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { 4739 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) {
4577 if (masm->isolate()->function_entry_hook() != NULL) { 4740 if (masm->isolate()->function_entry_hook() != NULL) {
4578 ProfileEntryHookStub stub(masm->isolate()); 4741 ProfileEntryHookStub stub(masm->isolate());
4579 PredictableCodeSizeScope predictable(masm); 4742 PredictableCodeSizeScope predictable(masm);
4580 predictable.ExpectSize(masm->CallStubSize(&stub) + 4743 predictable.ExpectSize(masm->CallStubSize(&stub) +
4581 2 * Assembler::kInstrSize); 4744 2 * Assembler::kInstrSize);
4582 __ push(lr); 4745 __ push(lr);
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
5428 MemOperand(fp, 6 * kPointerSize), NULL); 5591 MemOperand(fp, 6 * kPointerSize), NULL);
5429 } 5592 }
5430 5593
5431 5594
5432 #undef __ 5595 #undef __
5433 5596
5434 } // namespace internal 5597 } // namespace internal
5435 } // namespace v8 5598 } // namespace v8
5436 5599
5437 #endif // V8_TARGET_ARCH_ARM 5600 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm64/code-stubs-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698