OLD | NEW |
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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
6 | 6 |
7 #include "src/codegen.h" | 7 #include "src/codegen.h" |
8 #include "src/ic/ic.h" | 8 #include "src/ic/ic.h" |
9 #include "src/ic/stub-cache.h" | 9 #include "src/ic/stub-cache.h" |
10 #include "src/interface-descriptors.h" | 10 #include "src/interface-descriptors.h" |
11 | 11 |
12 namespace v8 { | 12 namespace v8 { |
13 namespace internal { | 13 namespace internal { |
14 | 14 |
15 #define __ ACCESS_MASM(masm) | 15 #define __ ACCESS_MASM(masm) |
16 | 16 |
17 | 17 |
18 static void ProbeTable(Isolate* isolate, MacroAssembler* masm, | 18 static void ProbeTable(Isolate* isolate, MacroAssembler* masm, |
19 Code::Kind ic_kind, Code::Flags flags, | 19 Code::Kind ic_kind, Code::Flags flags, |
20 StubCache::Table table, Register name, Register receiver, | 20 StubCache::Table table, Register name, Register receiver, |
21 // Number of the cache entry pointer-size scaled. | 21 // Number of the cache entry pointer-size scaled. |
22 Register offset, Register extra) { | 22 Register offset, Register extra) { |
23 ExternalReference key_offset(isolate->stub_cache()->key_reference(table)); | 23 ExternalReference key_offset(isolate->stub_cache()->key_reference(table)); |
24 ExternalReference value_offset(isolate->stub_cache()->value_reference(table)); | 24 ExternalReference value_offset(isolate->stub_cache()->value_reference(table)); |
25 ExternalReference map_offset(isolate->stub_cache()->map_reference(table)); | 25 ExternalReference map_offset(isolate->stub_cache()->map_reference(table)); |
| 26 ExternalReference virtual_register = |
| 27 ExternalReference::vector_store_virtual_register(masm->isolate()); |
26 | 28 |
27 Label miss; | 29 Label miss; |
28 bool is_vector_store = | 30 bool is_vector_store = |
29 IC::ICUseVector(ic_kind) && | 31 IC::ICUseVector(ic_kind) && |
30 (ic_kind == Code::STORE_IC || ic_kind == Code::KEYED_STORE_IC); | 32 (ic_kind == Code::STORE_IC || ic_kind == Code::KEYED_STORE_IC); |
31 | 33 |
32 // Multiply by 3 because there are 3 fields per entry (name, code, map). | 34 // Multiply by 3 because there are 3 fields per entry (name, code, map). |
33 __ lea(offset, Operand(offset, offset, times_2, 0)); | 35 __ lea(offset, Operand(offset, offset, times_2, 0)); |
34 | 36 |
35 if (extra.is_valid()) { | 37 if (extra.is_valid()) { |
(...skipping 24 matching lines...) Expand all Loading... |
60 #endif | 62 #endif |
61 | 63 |
62 // The vector and slot were pushed onto the stack before starting the | 64 // The vector and slot were pushed onto the stack before starting the |
63 // probe, and need to be dropped before calling the handler. | 65 // probe, and need to be dropped before calling the handler. |
64 if (is_vector_store) { | 66 if (is_vector_store) { |
65 // The overlap here is rather embarrassing. One does what one must. | 67 // The overlap here is rather embarrassing. One does what one must. |
66 Register vector = VectorStoreICDescriptor::VectorRegister(); | 68 Register vector = VectorStoreICDescriptor::VectorRegister(); |
67 DCHECK(extra.is(VectorStoreICDescriptor::SlotRegister())); | 69 DCHECK(extra.is(VectorStoreICDescriptor::SlotRegister())); |
68 __ add(extra, Immediate(Code::kHeaderSize - kHeapObjectTag)); | 70 __ add(extra, Immediate(Code::kHeaderSize - kHeapObjectTag)); |
69 __ pop(vector); | 71 __ pop(vector); |
70 __ xchg(extra, Operand(esp, 0)); | 72 __ mov(Operand::StaticVariable(virtual_register), extra); |
| 73 __ pop(extra); // Pop "slot". |
71 // Jump to the first instruction in the code stub. | 74 // Jump to the first instruction in the code stub. |
72 __ ret(0); | 75 __ jmp(Operand::StaticVariable(virtual_register)); |
73 } else { | 76 } else { |
74 __ pop(LoadWithVectorDescriptor::VectorRegister()); | 77 __ pop(LoadWithVectorDescriptor::VectorRegister()); |
75 __ pop(LoadDescriptor::SlotRegister()); | 78 __ pop(LoadDescriptor::SlotRegister()); |
76 __ add(extra, Immediate(Code::kHeaderSize - kHeapObjectTag)); | 79 __ add(extra, Immediate(Code::kHeaderSize - kHeapObjectTag)); |
77 __ jmp(extra); | 80 __ jmp(extra); |
78 } | 81 } |
79 | 82 |
80 __ bind(&miss); | 83 __ bind(&miss); |
81 } else { | 84 } else { |
82 DCHECK(ic_kind == Code::STORE_IC || ic_kind == Code::KEYED_STORE_IC); | 85 DCHECK(ic_kind == Code::STORE_IC || ic_kind == Code::KEYED_STORE_IC); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 __ pop(offset); | 120 __ pop(offset); |
118 __ mov(offset, Operand::StaticArray(offset, times_1, value_offset)); | 121 __ mov(offset, Operand::StaticArray(offset, times_1, value_offset)); |
119 | 122 |
120 // Jump to the first instruction in the code stub. | 123 // Jump to the first instruction in the code stub. |
121 if (is_vector_store) { | 124 if (is_vector_store) { |
122 // The vector and slot were pushed onto the stack before starting the | 125 // The vector and slot were pushed onto the stack before starting the |
123 // probe, and need to be dropped before calling the handler. | 126 // probe, and need to be dropped before calling the handler. |
124 Register vector = VectorStoreICDescriptor::VectorRegister(); | 127 Register vector = VectorStoreICDescriptor::VectorRegister(); |
125 DCHECK(offset.is(VectorStoreICDescriptor::SlotRegister())); | 128 DCHECK(offset.is(VectorStoreICDescriptor::SlotRegister())); |
126 __ add(offset, Immediate(Code::kHeaderSize - kHeapObjectTag)); | 129 __ add(offset, Immediate(Code::kHeaderSize - kHeapObjectTag)); |
| 130 __ mov(Operand::StaticVariable(virtual_register), offset); |
127 __ pop(vector); | 131 __ pop(vector); |
128 __ xchg(offset, Operand(esp, 0)); | 132 __ pop(offset); // Pop "slot". |
129 __ ret(0); | 133 __ jmp(Operand::StaticVariable(virtual_register)); |
130 } else { | 134 } else { |
131 __ add(offset, Immediate(Code::kHeaderSize - kHeapObjectTag)); | 135 __ add(offset, Immediate(Code::kHeaderSize - kHeapObjectTag)); |
132 __ jmp(offset); | 136 __ jmp(offset); |
133 } | 137 } |
134 | 138 |
135 // Pop at miss. | 139 // Pop at miss. |
136 __ bind(&miss); | 140 __ bind(&miss); |
137 __ pop(offset); | 141 __ pop(offset); |
138 } | 142 } |
139 } | 143 } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 __ bind(&miss); | 210 __ bind(&miss); |
207 __ IncrementCounter(counters->megamorphic_stub_cache_misses(), 1); | 211 __ IncrementCounter(counters->megamorphic_stub_cache_misses(), 1); |
208 } | 212 } |
209 | 213 |
210 | 214 |
211 #undef __ | 215 #undef __ |
212 } // namespace internal | 216 } // namespace internal |
213 } // namespace v8 | 217 } // namespace v8 |
214 | 218 |
215 #endif // V8_TARGET_ARCH_IA32 | 219 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |