OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "ic-inl.h" | 31 #include "ic-inl.h" |
32 #include "runtime.h" | 32 #include "runtime.h" |
33 #include "stub-cache.h" | 33 #include "stub-cache.h" |
34 | 34 |
35 namespace v8 { namespace internal { | 35 namespace v8 { namespace internal { |
36 | 36 |
37 // ---------------------------------------------------------------------------- | 37 // ---------------------------------------------------------------------------- |
38 // Static IC stub generators. | 38 // Static IC stub generators. |
39 // | 39 // |
40 | 40 |
41 #define __ masm-> | 41 #define __ DEFINE_MASM(masm) |
42 | 42 |
43 | 43 |
44 // Helper function used to load a property from a dictionary backing storage. | 44 // Helper function used to load a property from a dictionary backing storage. |
45 static void GenerateDictionaryLoad(MacroAssembler* masm, Label* miss_label, | 45 static void GenerateDictionaryLoad(MacroAssembler* masm, Label* miss_label, |
46 Register r0, Register r1, Register r2, | 46 Register r0, Register r1, Register r2, |
47 Register name) { | 47 Register name) { |
48 // Register use: | 48 // Register use: |
49 // | 49 // |
50 // r0 - used to hold the property dictionary. | 50 // r0 - used to hold the property dictionary. |
51 // | 51 // |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // Generate an unrolled loop that performs a few probes before | 84 // Generate an unrolled loop that performs a few probes before |
85 // giving up. Measurements done on Gmail indicate that 2 probes | 85 // giving up. Measurements done on Gmail indicate that 2 probes |
86 // cover ~93% of loads from dictionaries. | 86 // cover ~93% of loads from dictionaries. |
87 static const int kProbes = 4; | 87 static const int kProbes = 4; |
88 const int kElementsStartOffset = | 88 const int kElementsStartOffset = |
89 Array::kHeaderSize + Dictionary::kElementsStartIndex * kPointerSize; | 89 Array::kHeaderSize + Dictionary::kElementsStartIndex * kPointerSize; |
90 for (int i = 0; i < kProbes; i++) { | 90 for (int i = 0; i < kProbes; i++) { |
91 // Compute the masked index: (hash + i + i * i) & mask. | 91 // Compute the masked index: (hash + i + i * i) & mask. |
92 __ mov(r1, FieldOperand(name, String::kLengthOffset)); | 92 __ mov(r1, FieldOperand(name, String::kLengthOffset)); |
93 __ shr(r1, String::kHashShift); | 93 __ shr(r1, String::kHashShift); |
94 if (i > 0) __ add(Operand(r1), Immediate(Dictionary::GetProbeOffset(i))); | 94 if (i > 0) { |
| 95 __ add(Operand(r1), Immediate(Dictionary::GetProbeOffset(i))); |
| 96 } |
95 __ and_(r1, Operand(r2)); | 97 __ and_(r1, Operand(r2)); |
96 | 98 |
97 // Scale the index by multiplying by the element size. | 99 // Scale the index by multiplying by the element size. |
98 ASSERT(Dictionary::kElementSize == 3); | 100 ASSERT(Dictionary::kElementSize == 3); |
99 __ lea(r1, Operand(r1, r1, times_2, 0)); // r1 = r1 * 3 | 101 __ lea(r1, Operand(r1, r1, times_2, 0)); // r1 = r1 * 3 |
100 | 102 |
101 // Check if the key is identical to the name. | 103 // Check if the key is identical to the name. |
102 __ cmp(name, | 104 __ cmp(name, |
103 Operand(r0, r1, times_4, kElementsStartOffset - kHeapObjectTag)); | 105 Operand(r0, r1, times_4, kElementsStartOffset - kHeapObjectTag)); |
104 if (i != kProbes - 1) { | 106 if (i != kProbes - 1) { |
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
883 | 885 |
884 // Do tail-call to runtime routine. | 886 // Do tail-call to runtime routine. |
885 __ TailCallRuntime( | 887 __ TailCallRuntime( |
886 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3); | 888 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3); |
887 } | 889 } |
888 | 890 |
889 #undef __ | 891 #undef __ |
890 | 892 |
891 | 893 |
892 } } // namespace v8::internal | 894 } } // namespace v8::internal |
OLD | NEW |