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 #ifndef V8_IC_H_ | 5 #ifndef V8_IC_H_ |
6 #define V8_IC_H_ | 6 #define V8_IC_H_ |
7 | 7 |
8 #include "src/ic/ic-state.h" | 8 #include "src/ic/ic-state.h" |
9 #include "src/macro-assembler.h" | 9 #include "src/macro-assembler.h" |
10 | 10 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 static void RegisterWeakMapDependency(Handle<Code> stub); | 79 static void RegisterWeakMapDependency(Handle<Code> stub); |
80 | 80 |
81 // This function is called when a weak map in the stub is dying, | 81 // This function is called when a weak map in the stub is dying, |
82 // invalidates the stub by setting maps in it to undefined. | 82 // invalidates the stub by setting maps in it to undefined. |
83 static void InvalidateMaps(Code* stub); | 83 static void InvalidateMaps(Code* stub); |
84 | 84 |
85 // Clear the inline cache to initial state. | 85 // Clear the inline cache to initial state. |
86 static void Clear(Isolate* isolate, Address address, | 86 static void Clear(Isolate* isolate, Address address, |
87 ConstantPoolArray* constant_pool); | 87 ConstantPoolArray* constant_pool); |
88 | 88 |
| 89 // Clear the vector-based inline cache to initial state. |
| 90 static void Clear(Isolate* isolate, Code::Kind kind, Code* host, |
| 91 TypeFeedbackVector* vector, FeedbackVectorICSlot slot); |
| 92 |
89 #ifdef DEBUG | 93 #ifdef DEBUG |
90 bool IsLoadStub() const { | 94 bool IsLoadStub() const { |
91 return target()->is_load_stub() || target()->is_keyed_load_stub(); | 95 return target()->is_load_stub() || target()->is_keyed_load_stub(); |
92 } | 96 } |
93 | 97 |
94 bool IsStoreStub() const { | 98 bool IsStoreStub() const { |
95 return target()->is_store_stub() || target()->is_keyed_store_stub(); | 99 return target()->is_store_stub() || target()->is_keyed_store_stub(); |
96 } | 100 } |
97 | 101 |
98 bool IsCallStub() const { return target()->is_call_stub(); } | 102 bool IsCallStub() const { return target()->is_call_stub(); } |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 Address address_; | 291 Address address_; |
288 IC::UtilityId id_; | 292 IC::UtilityId id_; |
289 }; | 293 }; |
290 | 294 |
291 | 295 |
292 class CallIC : public IC { | 296 class CallIC : public IC { |
293 public: | 297 public: |
294 explicit CallIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) {} | 298 explicit CallIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) {} |
295 | 299 |
296 void PatchMegamorphic(Handle<Object> function, | 300 void PatchMegamorphic(Handle<Object> function, |
297 Handle<TypeFeedbackVector> vector, Handle<Smi> slot); | 301 Handle<TypeFeedbackVector> vector, |
| 302 FeedbackVectorICSlot slot); |
298 | 303 |
299 void HandleMiss(Handle<Object> receiver, Handle<Object> function, | 304 void HandleMiss(Handle<Object> receiver, Handle<Object> function, |
300 Handle<TypeFeedbackVector> vector, Handle<Smi> slot); | 305 Handle<TypeFeedbackVector> vector, FeedbackVectorICSlot slot); |
301 | 306 |
302 // Returns true if a custom handler was installed. | 307 // Returns true if a custom handler was installed. |
303 bool DoCustomHandler(Handle<Object> receiver, Handle<Object> function, | 308 bool DoCustomHandler(Handle<Object> receiver, Handle<Object> function, |
304 Handle<TypeFeedbackVector> vector, Handle<Smi> slot, | 309 Handle<TypeFeedbackVector> vector, |
305 const CallICState& state); | 310 FeedbackVectorICSlot slot, const CallICState& state); |
306 | 311 |
307 // Code generator routines. | 312 // Code generator routines. |
308 static Handle<Code> initialize_stub(Isolate* isolate, int argc, | 313 static Handle<Code> initialize_stub(Isolate* isolate, int argc, |
309 CallICState::CallType call_type); | 314 CallICState::CallType call_type); |
310 | 315 |
311 static void Clear(Isolate* isolate, Address address, Code* target, | 316 static void Clear(Isolate* isolate, Code* host, TypeFeedbackVector* vector, |
312 ConstantPoolArray* constant_pool); | 317 FeedbackVectorICSlot slot); |
313 | 318 |
314 private: | 319 private: |
315 inline IC::State FeedbackToState(Handle<TypeFeedbackVector> vector, | 320 static inline IC::State FeedbackToState(Isolate* isolate, |
316 Handle<Smi> slot) const; | 321 TypeFeedbackVector* vector, |
| 322 FeedbackVectorICSlot slot); |
| 323 |
| 324 inline Code* get_host(); |
| 325 |
| 326 // As a vector-based IC, type feedback must be updated differently. |
| 327 static void OnTypeFeedbackChanged(Isolate* isolate, Code* host, |
| 328 TypeFeedbackVector* vector, State old_state, |
| 329 State new_state); |
317 }; | 330 }; |
318 | 331 |
319 | 332 |
320 class LoadIC : public IC { | 333 class LoadIC : public IC { |
321 public: | 334 public: |
322 static ExtraICState ComputeExtraICState(ContextualMode contextual_mode) { | 335 static ExtraICState ComputeExtraICState(ContextualMode contextual_mode) { |
323 return LoadICState(contextual_mode).GetExtraICState(); | 336 return LoadICState(contextual_mode).GetExtraICState(); |
324 } | 337 } |
325 | 338 |
326 ContextualMode contextual_mode() const { | 339 ContextualMode contextual_mode() const { |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 | 715 |
703 // Support functions for interceptor handlers. | 716 // Support functions for interceptor handlers. |
704 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptorOnly); | 717 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptorOnly); |
705 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptor); | 718 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptor); |
706 DECLARE_RUNTIME_FUNCTION(LoadElementWithInterceptor); | 719 DECLARE_RUNTIME_FUNCTION(LoadElementWithInterceptor); |
707 DECLARE_RUNTIME_FUNCTION(StorePropertyWithInterceptor); | 720 DECLARE_RUNTIME_FUNCTION(StorePropertyWithInterceptor); |
708 } | 721 } |
709 } // namespace v8::internal | 722 } // namespace v8::internal |
710 | 723 |
711 #endif // V8_IC_H_ | 724 #endif // V8_IC_H_ |
OLD | NEW |