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 #include "src/ic/ic.h" | 5 #include "src/ic/ic.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api-arguments-inl.h" | 8 #include "src/api-arguments-inl.h" |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 constant_pool_address_ = constant_pool; | 176 constant_pool_address_ = constant_pool; |
177 } | 177 } |
178 pc_address_ = StackFrame::ResolveReturnAddressLocation(pc_address); | 178 pc_address_ = StackFrame::ResolveReturnAddressLocation(pc_address); |
179 Code* target = this->target(); | 179 Code* target = this->target(); |
180 kind_ = target->kind(); | 180 kind_ = target->kind(); |
181 state_ = UseVector() ? nexus->StateFromFeedback() : StateFromCode(target); | 181 state_ = UseVector() ? nexus->StateFromFeedback() : StateFromCode(target); |
182 old_state_ = state_; | 182 old_state_ = state_; |
183 extra_ic_state_ = target->extra_ic_state(); | 183 extra_ic_state_ = target->extra_ic_state(); |
184 } | 184 } |
185 | 185 |
| 186 // The ICs that don't pass slot and vector through the stack have to |
| 187 // save/restore them in the dispatcher. |
| 188 bool IC::ShouldPushPopSlotAndVector(Code::Kind kind) { |
| 189 if (kind == Code::LOAD_IC || kind == Code::LOAD_GLOBAL_IC || |
| 190 kind == Code::KEYED_LOAD_IC || kind == Code::CALL_IC) { |
| 191 return true; |
| 192 } |
| 193 if (kind == Code::STORE_IC || kind == Code::KEYED_STORE_IC) { |
| 194 return !StoreWithVectorDescriptor::kPassLastArgsOnStack; |
| 195 } |
| 196 return false; |
| 197 } |
| 198 |
186 InlineCacheState IC::StateFromCode(Code* code) { | 199 InlineCacheState IC::StateFromCode(Code* code) { |
187 Isolate* isolate = code->GetIsolate(); | 200 Isolate* isolate = code->GetIsolate(); |
188 switch (code->kind()) { | 201 switch (code->kind()) { |
189 case Code::BINARY_OP_IC: { | 202 case Code::BINARY_OP_IC: { |
190 BinaryOpICState state(isolate, code->extra_ic_state()); | 203 BinaryOpICState state(isolate, code->extra_ic_state()); |
191 return state.GetICState(); | 204 return state.GetICState(); |
192 } | 205 } |
193 case Code::COMPARE_IC: { | 206 case Code::COMPARE_IC: { |
194 CompareICStub stub(isolate, code->extra_ic_state()); | 207 CompareICStub stub(isolate, code->extra_ic_state()); |
195 return stub.GetICState(); | 208 return stub.GetICState(); |
(...skipping 2788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2984 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, | 2997 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, |
2985 vector->GetKind(vector_slot)); | 2998 vector->GetKind(vector_slot)); |
2986 KeyedLoadICNexus nexus(vector, vector_slot); | 2999 KeyedLoadICNexus nexus(vector, vector_slot); |
2987 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); | 3000 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); |
2988 ic.UpdateState(receiver, key); | 3001 ic.UpdateState(receiver, key); |
2989 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key)); | 3002 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key)); |
2990 } | 3003 } |
2991 } | 3004 } |
2992 } // namespace internal | 3005 } // namespace internal |
2993 } // namespace v8 | 3006 } // namespace v8 |
OLD | NEW |