| 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/factory.h" | 8 #include "src/factory.h" |
| 9 #include "src/feedback-vector.h" | 9 #include "src/feedback-vector.h" |
| 10 #include "src/ic/ic-state.h" | 10 #include "src/ic/ic-state.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 // Set the call-site target. | 89 // Set the call-site target. |
| 90 inline void set_target(Code* code); | 90 inline void set_target(Code* code); |
| 91 bool is_vector_set() { return vector_set_; } | 91 bool is_vector_set() { return vector_set_; } |
| 92 | 92 |
| 93 // Configure for most states. | 93 // Configure for most states. |
| 94 void ConfigureVectorState(IC::State new_state, Handle<Object> key); | 94 void ConfigureVectorState(IC::State new_state, Handle<Object> key); |
| 95 // Configure the vector for MONOMORPHIC. | 95 // Configure the vector for MONOMORPHIC. |
| 96 void ConfigureVectorState(Handle<Name> name, Handle<Map> map, | 96 void ConfigureVectorState(Handle<Name> name, Handle<Map> map, |
| 97 Handle<Object> handler); | 97 Handle<Object> handler); |
| 98 // Configure the vector for POLYMORPHIC. | 98 // Configure the vector for POLYMORPHIC. |
| 99 void ConfigureVectorState(Handle<Name> name, MapHandleList* maps, | 99 void ConfigureVectorState(Handle<Name> name, MapHandles const& maps, |
| 100 List<Handle<Object>>* handlers); | 100 List<Handle<Object>>* handlers); |
| 101 | 101 |
| 102 char TransitionMarkFromState(IC::State state); | 102 char TransitionMarkFromState(IC::State state); |
| 103 void TraceIC(const char* type, Handle<Object> name); | 103 void TraceIC(const char* type, Handle<Object> name); |
| 104 void TraceIC(const char* type, Handle<Object> name, State old_state, | 104 void TraceIC(const char* type, Handle<Object> name, State old_state, |
| 105 State new_state); | 105 State new_state); |
| 106 | 106 |
| 107 MaybeHandle<Object> TypeError(MessageTemplate::Template, | 107 MaybeHandle<Object> TypeError(MessageTemplate::Template, |
| 108 Handle<Object> object, Handle<Object> key); | 108 Handle<Object> object, Handle<Object> key); |
| 109 MaybeHandle<Object> ReferenceError(Handle<Name> name); | 109 MaybeHandle<Object> ReferenceError(Handle<Name> name); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 | 157 |
| 158 Handle<Map> receiver_map() { return receiver_map_; } | 158 Handle<Map> receiver_map() { return receiver_map_; } |
| 159 void update_receiver_map(Handle<Object> receiver) { | 159 void update_receiver_map(Handle<Object> receiver) { |
| 160 if (receiver->IsSmi()) { | 160 if (receiver->IsSmi()) { |
| 161 receiver_map_ = isolate_->factory()->heap_number_map(); | 161 receiver_map_ = isolate_->factory()->heap_number_map(); |
| 162 } else { | 162 } else { |
| 163 receiver_map_ = handle(HeapObject::cast(*receiver)->map()); | 163 receiver_map_ = handle(HeapObject::cast(*receiver)->map()); |
| 164 } | 164 } |
| 165 } | 165 } |
| 166 | 166 |
| 167 void TargetMaps(MapHandleList* list) { | 167 void TargetMaps(MapHandles* list) { |
| 168 FindTargetMaps(); | 168 FindTargetMaps(); |
| 169 for (int i = 0; i < target_maps_.length(); i++) { | 169 for (Handle<Map> map : target_maps_) { |
| 170 list->Add(target_maps_.at(i)); | 170 list->push_back(map); |
| 171 } | 171 } |
| 172 } | 172 } |
| 173 | 173 |
| 174 Map* FirstTargetMap() { | 174 Map* FirstTargetMap() { |
| 175 FindTargetMaps(); | 175 FindTargetMaps(); |
| 176 return target_maps_.length() > 0 ? *target_maps_.at(0) : NULL; | 176 return !target_maps_.empty() ? *target_maps_[0] : NULL; |
| 177 } | 177 } |
| 178 | 178 |
| 179 Handle<FeedbackVector> vector() const { return nexus()->vector_handle(); } | 179 Handle<FeedbackVector> vector() const { return nexus()->vector_handle(); } |
| 180 FeedbackSlot slot() const { return nexus()->slot(); } | 180 FeedbackSlot slot() const { return nexus()->slot(); } |
| 181 State saved_state() const { | 181 State saved_state() const { |
| 182 return state() == RECOMPUTE_HANDLER ? old_state_ : state(); | 182 return state() == RECOMPUTE_HANDLER ? old_state_ : state(); |
| 183 } | 183 } |
| 184 | 184 |
| 185 template <class NexusClass> | 185 template <class NexusClass> |
| 186 NexusClass* casted_nexus() { | 186 NexusClass* casted_nexus() { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 216 Isolate* isolate_; | 216 Isolate* isolate_; |
| 217 | 217 |
| 218 bool vector_set_; | 218 bool vector_set_; |
| 219 State old_state_; // For saving if we marked as prototype failure. | 219 State old_state_; // For saving if we marked as prototype failure. |
| 220 State state_; | 220 State state_; |
| 221 FeedbackSlotKind kind_; | 221 FeedbackSlotKind kind_; |
| 222 Handle<Map> receiver_map_; | 222 Handle<Map> receiver_map_; |
| 223 MaybeHandle<Object> maybe_handler_; | 223 MaybeHandle<Object> maybe_handler_; |
| 224 | 224 |
| 225 ExtraICState extra_ic_state_; | 225 ExtraICState extra_ic_state_; |
| 226 MapHandleList target_maps_; | 226 MapHandles target_maps_; |
| 227 bool target_maps_set_; | 227 bool target_maps_set_; |
| 228 | 228 |
| 229 const char* slow_stub_reason_; | 229 const char* slow_stub_reason_; |
| 230 | 230 |
| 231 FeedbackNexus* nexus_; | 231 FeedbackNexus* nexus_; |
| 232 | 232 |
| 233 DISALLOW_IMPLICIT_CONSTRUCTORS(IC); | 233 DISALLOW_IMPLICIT_CONSTRUCTORS(IC); |
| 234 }; | 234 }; |
| 235 | 235 |
| 236 | 236 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 | 321 |
| 322 protected: | 322 protected: |
| 323 // receiver is HeapObject because it could be a String or a JSObject | 323 // receiver is HeapObject because it could be a String or a JSObject |
| 324 void UpdateLoadElement(Handle<HeapObject> receiver); | 324 void UpdateLoadElement(Handle<HeapObject> receiver); |
| 325 | 325 |
| 326 private: | 326 private: |
| 327 friend class IC; | 327 friend class IC; |
| 328 | 328 |
| 329 Handle<Object> LoadElementHandler(Handle<Map> receiver_map); | 329 Handle<Object> LoadElementHandler(Handle<Map> receiver_map); |
| 330 | 330 |
| 331 void LoadElementPolymorphicHandlers(MapHandleList* receiver_maps, | 331 void LoadElementPolymorphicHandlers(MapHandles* receiver_maps, |
| 332 List<Handle<Object>>* handlers); | 332 List<Handle<Object>>* handlers); |
| 333 }; | 333 }; |
| 334 | 334 |
| 335 | 335 |
| 336 class StoreIC : public IC { | 336 class StoreIC : public IC { |
| 337 public: | 337 public: |
| 338 StoreIC(Isolate* isolate, FeedbackNexus* nexus) | 338 StoreIC(Isolate* isolate, FeedbackNexus* nexus) |
| 339 : IC(NO_EXTRA_FRAME, isolate, nexus) { | 339 : IC(NO_EXTRA_FRAME, isolate, nexus) { |
| 340 DCHECK(IsAnyStore()); | 340 DCHECK(IsAnyStore()); |
| 341 } | 341 } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 void UpdateStoreElement(Handle<Map> receiver_map, | 407 void UpdateStoreElement(Handle<Map> receiver_map, |
| 408 KeyedAccessStoreMode store_mode); | 408 KeyedAccessStoreMode store_mode); |
| 409 | 409 |
| 410 private: | 410 private: |
| 411 Handle<Map> ComputeTransitionedMap(Handle<Map> map, | 411 Handle<Map> ComputeTransitionedMap(Handle<Map> map, |
| 412 KeyedAccessStoreMode store_mode); | 412 KeyedAccessStoreMode store_mode); |
| 413 | 413 |
| 414 Handle<Object> StoreElementHandler(Handle<Map> receiver_map, | 414 Handle<Object> StoreElementHandler(Handle<Map> receiver_map, |
| 415 KeyedAccessStoreMode store_mode); | 415 KeyedAccessStoreMode store_mode); |
| 416 | 416 |
| 417 void StoreElementPolymorphicHandlers(MapHandleList* receiver_maps, | 417 void StoreElementPolymorphicHandlers(MapHandles* receiver_maps, |
| 418 List<Handle<Object>>* handlers, | 418 List<Handle<Object>>* handlers, |
| 419 KeyedAccessStoreMode store_mode); | 419 KeyedAccessStoreMode store_mode); |
| 420 | 420 |
| 421 friend class IC; | 421 friend class IC; |
| 422 }; | 422 }; |
| 423 | 423 |
| 424 | 424 |
| 425 // Type Recording BinaryOpIC, that records the types of the inputs and outputs. | 425 // Type Recording BinaryOpIC, that records the types of the inputs and outputs. |
| 426 class BinaryOpIC : public IC { | 426 class BinaryOpIC : public IC { |
| 427 public: | 427 public: |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 | 471 |
| 472 // Helper for BinaryOpIC and CompareIC. | 472 // Helper for BinaryOpIC and CompareIC. |
| 473 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK }; | 473 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK }; |
| 474 void PatchInlinedSmiCode(Isolate* isolate, Address address, | 474 void PatchInlinedSmiCode(Isolate* isolate, Address address, |
| 475 InlinedSmiCheck check); | 475 InlinedSmiCheck check); |
| 476 | 476 |
| 477 } // namespace internal | 477 } // namespace internal |
| 478 } // namespace v8 | 478 } // namespace v8 |
| 479 | 479 |
| 480 #endif // V8_IC_H_ | 480 #endif // V8_IC_H_ |
| OLD | NEW |