OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 ICU(KeyedStoreIC_Miss) \ | 50 ICU(KeyedStoreIC_Miss) \ |
51 ICU(KeyedStoreIC_MissForceGeneric) \ | 51 ICU(KeyedStoreIC_MissForceGeneric) \ |
52 ICU(KeyedStoreIC_Slow) \ | 52 ICU(KeyedStoreIC_Slow) \ |
53 /* Utilities for IC stubs. */ \ | 53 /* Utilities for IC stubs. */ \ |
54 ICU(StoreCallbackProperty) \ | 54 ICU(StoreCallbackProperty) \ |
55 ICU(LoadPropertyWithInterceptorOnly) \ | 55 ICU(LoadPropertyWithInterceptorOnly) \ |
56 ICU(LoadPropertyWithInterceptorForLoad) \ | 56 ICU(LoadPropertyWithInterceptorForLoad) \ |
57 ICU(LoadPropertyWithInterceptorForCall) \ | 57 ICU(LoadPropertyWithInterceptorForCall) \ |
58 ICU(KeyedLoadPropertyWithInterceptor) \ | 58 ICU(KeyedLoadPropertyWithInterceptor) \ |
59 ICU(StoreInterceptorProperty) \ | 59 ICU(StoreInterceptorProperty) \ |
60 ICU(UnaryOp_Patch) \ | |
61 ICU(BinaryOp_Patch) \ | 60 ICU(BinaryOp_Patch) \ |
62 ICU(CompareIC_Miss) \ | 61 ICU(CompareIC_Miss) \ |
63 ICU(CompareNilIC_Miss) \ | 62 ICU(CompareNilIC_Miss) \ |
64 ICU(Unreachable) \ | 63 ICU(Unreachable) \ |
65 ICU(ToBooleanIC_Miss) | 64 ICU(ToBooleanIC_Miss) |
66 // | 65 // |
67 // IC is the base class for LoadIC, StoreIC, CallIC, KeyedLoadIC, | 66 // IC is the base class for LoadIC, StoreIC, CallIC, KeyedLoadIC, |
68 // and KeyedStoreIC. | 67 // and KeyedStoreIC. |
69 // | 68 // |
70 class IC { | 69 class IC { |
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 | 673 |
675 Handle<Map> ComputeTransitionedMap(Handle<JSObject> receiver, | 674 Handle<Map> ComputeTransitionedMap(Handle<JSObject> receiver, |
676 KeyedAccessStoreMode store_mode); | 675 KeyedAccessStoreMode store_mode); |
677 | 676 |
678 friend class IC; | 677 friend class IC; |
679 }; | 678 }; |
680 | 679 |
681 | 680 |
682 class UnaryOpIC: public IC { | 681 class UnaryOpIC: public IC { |
683 public: | 682 public: |
684 // sorted: increasingly more unspecific (ignoring UNINITIALIZED) | 683 explicit UnaryOpIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) { } |
685 // TODO(svenpanne) Using enums+switch is an antipattern, use a class instead. | |
686 enum TypeInfo { | |
687 UNINITIALIZED, | |
688 SMI, | |
689 NUMBER, | |
690 GENERIC | |
691 }; | |
692 | 684 |
693 static Handle<Type> TypeInfoToType(TypeInfo info, Isolate* isolate); | 685 MUST_USE_RESULT MaybeObject* Transition(Handle<Object> object); |
694 | |
695 explicit UnaryOpIC(Isolate* isolate) : IC(NO_EXTRA_FRAME, isolate) { } | |
696 | |
697 void patch(Code* code); | |
698 | |
699 static const char* GetName(TypeInfo type_info); | |
700 | |
701 static State ToState(TypeInfo type_info); | |
702 | |
703 static TypeInfo GetTypeInfo(Handle<Object> operand); | |
704 | |
705 static TypeInfo ComputeNewType(TypeInfo type, TypeInfo previous); | |
706 }; | 686 }; |
707 | 687 |
708 | 688 |
709 // Type Recording BinaryOpIC, that records the types of the inputs and outputs. | 689 // Type Recording BinaryOpIC, that records the types of the inputs and outputs. |
710 class BinaryOpIC: public IC { | 690 class BinaryOpIC: public IC { |
711 public: | 691 public: |
712 enum TypeInfo { | 692 enum TypeInfo { |
713 UNINITIALIZED, | 693 UNINITIALIZED, |
714 SMI, | 694 SMI, |
715 INT32, | 695 INT32, |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 MaybeObject* ToBoolean(Handle<Object> object, Code::ExtraICState state); | 811 MaybeObject* ToBoolean(Handle<Object> object, Code::ExtraICState state); |
832 }; | 812 }; |
833 | 813 |
834 | 814 |
835 // Helper for BinaryOpIC and CompareIC. | 815 // Helper for BinaryOpIC and CompareIC. |
836 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK }; | 816 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK }; |
837 void PatchInlinedSmiCode(Address address, InlinedSmiCheck check); | 817 void PatchInlinedSmiCode(Address address, InlinedSmiCheck check); |
838 | 818 |
839 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_MissFromStubFailure); | 819 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_MissFromStubFailure); |
840 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedStoreIC_MissFromStubFailure); | 820 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedStoreIC_MissFromStubFailure); |
| 821 DECLARE_RUNTIME_FUNCTION(MaybeObject*, UnaryOpIC_Miss); |
841 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); | 822 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); |
842 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); | 823 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); |
843 | 824 |
844 | 825 |
845 } } // namespace v8::internal | 826 } } // namespace v8::internal |
846 | 827 |
847 #endif // V8_IC_H_ | 828 #endif // V8_IC_H_ |
OLD | NEW |