| 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()); | |
| 28 | 26 |
| 29 Label miss; | 27 Label miss; |
| 30 bool is_vector_store = | 28 bool is_vector_store = |
| 31 IC::ICUseVector(ic_kind) && | 29 IC::ICUseVector(ic_kind) && |
| 32 (ic_kind == Code::STORE_IC || ic_kind == Code::KEYED_STORE_IC); | 30 (ic_kind == Code::STORE_IC || ic_kind == Code::KEYED_STORE_IC); |
| 33 | 31 |
| 34 // Multiply by 3 because there are 3 fields per entry (name, code, map). | 32 // Multiply by 3 because there are 3 fields per entry (name, code, map). |
| 35 __ lea(offset, Operand(offset, offset, times_2, 0)); | 33 __ lea(offset, Operand(offset, offset, times_2, 0)); |
| 36 | 34 |
| 37 if (extra.is_valid()) { | 35 if (extra.is_valid()) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 62 #endif | 60 #endif |
| 63 | 61 |
| 64 // The vector and slot were pushed onto the stack before starting the | 62 // The vector and slot were pushed onto the stack before starting the |
| 65 // probe, and need to be dropped before calling the handler. | 63 // probe, and need to be dropped before calling the handler. |
| 66 if (is_vector_store) { | 64 if (is_vector_store) { |
| 67 // The overlap here is rather embarrassing. One does what one must. | 65 // The overlap here is rather embarrassing. One does what one must. |
| 68 Register vector = VectorStoreICDescriptor::VectorRegister(); | 66 Register vector = VectorStoreICDescriptor::VectorRegister(); |
| 69 DCHECK(extra.is(VectorStoreICDescriptor::SlotRegister())); | 67 DCHECK(extra.is(VectorStoreICDescriptor::SlotRegister())); |
| 70 __ add(extra, Immediate(Code::kHeaderSize - kHeapObjectTag)); | 68 __ add(extra, Immediate(Code::kHeaderSize - kHeapObjectTag)); |
| 71 __ pop(vector); | 69 __ pop(vector); |
| 72 __ mov(Operand::StaticVariable(virtual_register), extra); | 70 __ xchg(extra, Operand(esp, 0)); |
| 73 __ pop(extra); // Pop "slot". | |
| 74 // Jump to the first instruction in the code stub. | 71 // Jump to the first instruction in the code stub. |
| 75 __ jmp(Operand::StaticVariable(virtual_register)); | 72 __ ret(0); |
| 76 } else { | 73 } else { |
| 77 __ pop(LoadWithVectorDescriptor::VectorRegister()); | 74 __ pop(LoadWithVectorDescriptor::VectorRegister()); |
| 78 __ pop(LoadDescriptor::SlotRegister()); | 75 __ pop(LoadDescriptor::SlotRegister()); |
| 79 __ add(extra, Immediate(Code::kHeaderSize - kHeapObjectTag)); | 76 __ add(extra, Immediate(Code::kHeaderSize - kHeapObjectTag)); |
| 80 __ jmp(extra); | 77 __ jmp(extra); |
| 81 } | 78 } |
| 82 | 79 |
| 83 __ bind(&miss); | 80 __ bind(&miss); |
| 84 } else { | 81 } else { |
| 85 DCHECK(ic_kind == Code::STORE_IC || ic_kind == Code::KEYED_STORE_IC); | 82 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... |
| 120 __ pop(offset); | 117 __ pop(offset); |
| 121 __ mov(offset, Operand::StaticArray(offset, times_1, value_offset)); | 118 __ mov(offset, Operand::StaticArray(offset, times_1, value_offset)); |
| 122 | 119 |
| 123 // Jump to the first instruction in the code stub. | 120 // Jump to the first instruction in the code stub. |
| 124 if (is_vector_store) { | 121 if (is_vector_store) { |
| 125 // The vector and slot were pushed onto the stack before starting the | 122 // The vector and slot were pushed onto the stack before starting the |
| 126 // probe, and need to be dropped before calling the handler. | 123 // probe, and need to be dropped before calling the handler. |
| 127 Register vector = VectorStoreICDescriptor::VectorRegister(); | 124 Register vector = VectorStoreICDescriptor::VectorRegister(); |
| 128 DCHECK(offset.is(VectorStoreICDescriptor::SlotRegister())); | 125 DCHECK(offset.is(VectorStoreICDescriptor::SlotRegister())); |
| 129 __ add(offset, Immediate(Code::kHeaderSize - kHeapObjectTag)); | 126 __ add(offset, Immediate(Code::kHeaderSize - kHeapObjectTag)); |
| 130 __ mov(Operand::StaticVariable(virtual_register), offset); | |
| 131 __ pop(vector); | 127 __ pop(vector); |
| 132 __ pop(offset); // Pop "slot". | 128 __ xchg(offset, Operand(esp, 0)); |
| 133 __ jmp(Operand::StaticVariable(virtual_register)); | 129 __ ret(0); |
| 134 } else { | 130 } else { |
| 135 __ add(offset, Immediate(Code::kHeaderSize - kHeapObjectTag)); | 131 __ add(offset, Immediate(Code::kHeaderSize - kHeapObjectTag)); |
| 136 __ jmp(offset); | 132 __ jmp(offset); |
| 137 } | 133 } |
| 138 | 134 |
| 139 // Pop at miss. | 135 // Pop at miss. |
| 140 __ bind(&miss); | 136 __ bind(&miss); |
| 141 __ pop(offset); | 137 __ pop(offset); |
| 142 } | 138 } |
| 143 } | 139 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 __ bind(&miss); | 206 __ bind(&miss); |
| 211 __ IncrementCounter(counters->megamorphic_stub_cache_misses(), 1); | 207 __ IncrementCounter(counters->megamorphic_stub_cache_misses(), 1); |
| 212 } | 208 } |
| 213 | 209 |
| 214 | 210 |
| 215 #undef __ | 211 #undef __ |
| 216 } // namespace internal | 212 } // namespace internal |
| 217 } // namespace v8 | 213 } // namespace v8 |
| 218 | 214 |
| 219 #endif // V8_TARGET_ARCH_IA32 | 215 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |