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

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

Issue 2622003004: [ic] Port {Load,Store}IC_Normal to TF (Closed)
Patch Set: fix nit Created 3 years, 11 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 | « src/arm/code-stubs-arm.h ('k') | src/arm64/code-stubs-arm64.h » ('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/code-stubs.h" 7 #include "src/code-stubs.h"
8 #include "src/api-arguments.h" 8 #include "src/api-arguments.h"
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 2624 matching lines...) Expand 10 before | Expand all | Expand 10 after
2635 __ mov(r1, Operand(Handle<Name>(name))); 2635 __ mov(r1, Operand(Handle<Name>(name)));
2636 NameDictionaryLookupStub stub(masm->isolate(), NEGATIVE_LOOKUP); 2636 NameDictionaryLookupStub stub(masm->isolate(), NEGATIVE_LOOKUP);
2637 __ CallStub(&stub); 2637 __ CallStub(&stub);
2638 __ cmp(r0, Operand::Zero()); 2638 __ cmp(r0, Operand::Zero());
2639 __ ldm(ia_w, sp, spill_mask); 2639 __ ldm(ia_w, sp, spill_mask);
2640 2640
2641 __ b(eq, done); 2641 __ b(eq, done);
2642 __ b(ne, miss); 2642 __ b(ne, miss);
2643 } 2643 }
2644 2644
2645
2646 // Probe the name dictionary in the |elements| register. Jump to the
2647 // |done| label if a property with the given name is found. Jump to
2648 // the |miss| label otherwise.
2649 // If lookup was successful |scratch2| will be equal to elements + 4 * index.
2650 void NameDictionaryLookupStub::GeneratePositiveLookup(MacroAssembler* masm,
2651 Label* miss,
2652 Label* done,
2653 Register elements,
2654 Register name,
2655 Register scratch1,
2656 Register scratch2) {
2657 DCHECK(!elements.is(scratch1));
2658 DCHECK(!elements.is(scratch2));
2659 DCHECK(!name.is(scratch1));
2660 DCHECK(!name.is(scratch2));
2661
2662 __ AssertName(name);
2663
2664 // Compute the capacity mask.
2665 __ ldr(scratch1, FieldMemOperand(elements, kCapacityOffset));
2666 __ SmiUntag(scratch1);
2667 __ sub(scratch1, scratch1, Operand(1));
2668
2669 // Generate an unrolled loop that performs a few probes before
2670 // giving up. Measurements done on Gmail indicate that 2 probes
2671 // cover ~93% of loads from dictionaries.
2672 for (int i = 0; i < kInlinedProbes; i++) {
2673 // Compute the masked index: (hash + i + i * i) & mask.
2674 __ ldr(scratch2, FieldMemOperand(name, Name::kHashFieldOffset));
2675 if (i > 0) {
2676 // Add the probe offset (i + i * i) left shifted to avoid right shifting
2677 // the hash in a separate instruction. The value hash + i + i * i is right
2678 // shifted in the following and instruction.
2679 DCHECK(NameDictionary::GetProbeOffset(i) <
2680 1 << (32 - Name::kHashFieldOffset));
2681 __ add(scratch2, scratch2, Operand(
2682 NameDictionary::GetProbeOffset(i) << Name::kHashShift));
2683 }
2684 __ and_(scratch2, scratch1, Operand(scratch2, LSR, Name::kHashShift));
2685
2686 // Scale the index by multiplying by the entry size.
2687 STATIC_ASSERT(NameDictionary::kEntrySize == 3);
2688 // scratch2 = scratch2 * 3.
2689 __ add(scratch2, scratch2, Operand(scratch2, LSL, 1));
2690
2691 // Check if the key is identical to the name.
2692 __ add(scratch2, elements, Operand(scratch2, LSL, 2));
2693 __ ldr(ip, FieldMemOperand(scratch2, kElementsStartOffset));
2694 __ cmp(name, Operand(ip));
2695 __ b(eq, done);
2696 }
2697
2698 const int spill_mask =
2699 (lr.bit() | r6.bit() | r5.bit() | r4.bit() |
2700 r3.bit() | r2.bit() | r1.bit() | r0.bit()) &
2701 ~(scratch1.bit() | scratch2.bit());
2702
2703 __ stm(db_w, sp, spill_mask);
2704 if (name.is(r0)) {
2705 DCHECK(!elements.is(r1));
2706 __ Move(r1, name);
2707 __ Move(r0, elements);
2708 } else {
2709 __ Move(r0, elements);
2710 __ Move(r1, name);
2711 }
2712 NameDictionaryLookupStub stub(masm->isolate(), POSITIVE_LOOKUP);
2713 __ CallStub(&stub);
2714 __ cmp(r0, Operand::Zero());
2715 __ mov(scratch2, Operand(r2));
2716 __ ldm(ia_w, sp, spill_mask);
2717
2718 __ b(ne, done);
2719 __ b(eq, miss);
2720 }
2721
2722
2723 void NameDictionaryLookupStub::Generate(MacroAssembler* masm) { 2645 void NameDictionaryLookupStub::Generate(MacroAssembler* masm) {
2724 // This stub overrides SometimesSetsUpAFrame() to return false. That means 2646 // This stub overrides SometimesSetsUpAFrame() to return false. That means
2725 // we cannot call anything that could cause a GC from this stub. 2647 // we cannot call anything that could cause a GC from this stub.
2726 // Registers: 2648 // Registers:
2727 // result: NameDictionary to probe 2649 // result: NameDictionary to probe
2728 // r1: key 2650 // r1: key
2729 // dictionary: NameDictionary to probe. 2651 // dictionary: NameDictionary to probe.
2730 // index: will hold an index of entry if lookup is successful. 2652 // index: will hold an index of entry if lookup is successful.
2731 // might alias with result_. 2653 // might alias with result_.
2732 // Returns: 2654 // Returns:
(...skipping 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after
4164 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, 4086 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref,
4165 kStackUnwindSpace, NULL, return_value_operand, NULL); 4087 kStackUnwindSpace, NULL, return_value_operand, NULL);
4166 } 4088 }
4167 4089
4168 #undef __ 4090 #undef __
4169 4091
4170 } // namespace internal 4092 } // namespace internal
4171 } // namespace v8 4093 } // namespace v8
4172 4094
4173 #endif // V8_TARGET_ARCH_ARM 4095 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/code-stubs-arm.h ('k') | src/arm64/code-stubs-arm64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698