| 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 #include "src/messages.h" | 10 #include "src/messages.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 bool is_vector_set() { return vector_set_; } | 105 bool is_vector_set() { return vector_set_; } |
| 106 | 106 |
| 107 bool UseVector() const { | 107 bool UseVector() const { |
| 108 bool use = ICUseVector(kind()); | 108 bool use = ICUseVector(kind()); |
| 109 // If we are supposed to use the nexus, verify the nexus is non-null. | 109 // If we are supposed to use the nexus, verify the nexus is non-null. |
| 110 DCHECK(!use || nexus_ != NULL); | 110 DCHECK(!use || nexus_ != NULL); |
| 111 return use; | 111 return use; |
| 112 } | 112 } |
| 113 | 113 |
| 114 // Configure for most states. | 114 // Configure for most states. |
| 115 void ConfigureVectorState(IC::State new_state); | 115 void ConfigureVectorState(IC::State new_state, Handle<Object> key); |
| 116 // Configure the vector for MONOMORPHIC. | 116 // Configure the vector for MONOMORPHIC. |
| 117 void ConfigureVectorState(Handle<Name> name, Handle<Map> map, | 117 void ConfigureVectorState(Handle<Name> name, Handle<Map> map, |
| 118 Handle<Code> handler); | 118 Handle<Code> handler); |
| 119 // Configure the vector for POLYMORPHIC. | 119 // Configure the vector for POLYMORPHIC. |
| 120 void ConfigureVectorState(Handle<Name> name, MapHandleList* maps, | 120 void ConfigureVectorState(Handle<Name> name, MapHandleList* maps, |
| 121 CodeHandleList* handlers); | 121 CodeHandleList* handlers); |
| 122 // Configure the vector for POLYMORPHIC with transitions (only for element | 122 // Configure the vector for POLYMORPHIC with transitions (only for element |
| 123 // keyed stores). | 123 // keyed stores). |
| 124 void ConfigureVectorState(MapHandleList* maps, | 124 void ConfigureVectorState(MapHandleList* maps, |
| 125 MapHandleList* transitioned_maps, | 125 MapHandleList* transitioned_maps, |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 static Handle<Code> initialize_stub_in_optimized_code( | 289 static Handle<Code> initialize_stub_in_optimized_code( |
| 290 Isolate* isolate, int argc, ConvertReceiverMode mode, | 290 Isolate* isolate, int argc, ConvertReceiverMode mode, |
| 291 TailCallMode tail_call_mode); | 291 TailCallMode tail_call_mode); |
| 292 | 292 |
| 293 static void Clear(Isolate* isolate, Code* host, CallICNexus* nexus); | 293 static void Clear(Isolate* isolate, Code* host, CallICNexus* nexus); |
| 294 }; | 294 }; |
| 295 | 295 |
| 296 | 296 |
| 297 class LoadIC : public IC { | 297 class LoadIC : public IC { |
| 298 public: | 298 public: |
| 299 static ExtraICState ComputeExtraICState(TypeofMode typeof_mode) { | |
| 300 return LoadICState(typeof_mode).GetExtraICState(); | |
| 301 } | |
| 302 | |
| 303 TypeofMode typeof_mode() const { | 299 TypeofMode typeof_mode() const { |
| 304 return LoadICState::GetTypeofMode(extra_ic_state()); | 300 return LoadICState::GetTypeofMode(extra_ic_state()); |
| 305 } | 301 } |
| 306 | 302 |
| 307 LoadIC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus = NULL) | 303 LoadIC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus = NULL) |
| 308 : IC(depth, isolate, nexus) { | 304 : IC(depth, isolate, nexus) { |
| 309 DCHECK(nexus != NULL); | 305 DCHECK(nexus != NULL); |
| 310 DCHECK(IsLoadStub()); | 306 DCHECK(IsLoadStub()); |
| 311 } | 307 } |
| 312 | 308 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 | 353 |
| 358 static void Clear(Isolate* isolate, Address address, Code* target, | 354 static void Clear(Isolate* isolate, Address address, Code* target, |
| 359 Address constant_pool); | 355 Address constant_pool); |
| 360 | 356 |
| 361 friend class IC; | 357 friend class IC; |
| 362 }; | 358 }; |
| 363 | 359 |
| 364 | 360 |
| 365 class KeyedLoadIC : public LoadIC { | 361 class KeyedLoadIC : public LoadIC { |
| 366 public: | 362 public: |
| 367 // ExtraICState bits (building on IC) | |
| 368 class IcCheckTypeField | |
| 369 : public BitField<IcCheckType, LoadICState::kNextBitFieldOffset, 1> {}; | |
| 370 | |
| 371 static ExtraICState ComputeExtraICState(TypeofMode typeof_mode, | |
| 372 IcCheckType key_type) { | |
| 373 return LoadICState(typeof_mode).GetExtraICState() | | |
| 374 IcCheckTypeField::encode(key_type); | |
| 375 } | |
| 376 | |
| 377 static IcCheckType GetKeyType(ExtraICState extra_state) { | |
| 378 return IcCheckTypeField::decode(extra_state); | |
| 379 } | |
| 380 | |
| 381 KeyedLoadIC(FrameDepth depth, Isolate* isolate, | 363 KeyedLoadIC(FrameDepth depth, Isolate* isolate, |
| 382 KeyedLoadICNexus* nexus = NULL) | 364 KeyedLoadICNexus* nexus = NULL) |
| 383 : LoadIC(depth, isolate, nexus) { | 365 : LoadIC(depth, isolate, nexus) { |
| 384 DCHECK(nexus != NULL); | 366 DCHECK(nexus != NULL); |
| 385 DCHECK(target()->is_keyed_load_stub()); | 367 DCHECK(target()->is_keyed_load_stub()); |
| 386 } | 368 } |
| 387 | 369 |
| 388 MUST_USE_RESULT MaybeHandle<Object> Load(Handle<Object> object, | 370 MUST_USE_RESULT MaybeHandle<Object> Load(Handle<Object> object, |
| 389 Handle<Object> key); | 371 Handle<Object> key); |
| 390 | 372 |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 | 616 |
| 635 // Helper for BinaryOpIC and CompareIC. | 617 // Helper for BinaryOpIC and CompareIC. |
| 636 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK }; | 618 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK }; |
| 637 void PatchInlinedSmiCode(Isolate* isolate, Address address, | 619 void PatchInlinedSmiCode(Isolate* isolate, Address address, |
| 638 InlinedSmiCheck check); | 620 InlinedSmiCheck check); |
| 639 | 621 |
| 640 } // namespace internal | 622 } // namespace internal |
| 641 } // namespace v8 | 623 } // namespace v8 |
| 642 | 624 |
| 643 #endif // V8_IC_H_ | 625 #endif // V8_IC_H_ |
| OLD | NEW |