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 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 StrictModeFlag strict_mode, | 552 StrictModeFlag strict_mode, |
554 Handle<JSObject> receiver, | 553 Handle<JSObject> receiver, |
555 Handle<String> name, | 554 Handle<String> name, |
556 Handle<Object> value); | 555 Handle<Object> value); |
557 // Compute the code stub for this store; used for rewriting to | 556 // Compute the code stub for this store; used for rewriting to |
558 // monomorphic state and making sure that the code stub is in the | 557 // monomorphic state and making sure that the code stub is in the |
559 // stub cache. | 558 // stub cache. |
560 virtual Handle<Code> ComputeStoreMonomorphic(LookupResult* lookup, | 559 virtual Handle<Code> ComputeStoreMonomorphic(LookupResult* lookup, |
561 StrictModeFlag strict_mode, | 560 StrictModeFlag strict_mode, |
562 Handle<JSObject> receiver, | 561 Handle<JSObject> receiver, |
563 Handle<String> name); | 562 Handle<String> name, |
| 563 Handle<Object> value); |
564 | 564 |
565 private: | 565 private: |
566 void set_target(Code* code) { | 566 void set_target(Code* code) { |
567 // Strict mode must be preserved across IC patching. | 567 // Strict mode must be preserved across IC patching. |
568 ASSERT(Code::GetStrictMode(code->extra_ic_state()) == | 568 ASSERT(Code::GetStrictMode(code->extra_ic_state()) == |
569 Code::GetStrictMode(target()->extra_ic_state())); | 569 Code::GetStrictMode(target()->extra_ic_state())); |
570 IC::set_target(code); | 570 IC::set_target(code); |
571 } | 571 } |
572 | 572 |
573 static Handle<Code> initialize_stub() { | 573 static Handle<Code> initialize_stub() { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 static void GenerateNonStrictArguments(MacroAssembler* masm); | 620 static void GenerateNonStrictArguments(MacroAssembler* masm); |
621 static void GenerateTransitionElementsSmiToDouble(MacroAssembler* masm); | 621 static void GenerateTransitionElementsSmiToDouble(MacroAssembler* masm); |
622 static void GenerateTransitionElementsDoubleToObject(MacroAssembler* masm); | 622 static void GenerateTransitionElementsDoubleToObject(MacroAssembler* masm); |
623 | 623 |
624 protected: | 624 protected: |
625 virtual Code::Kind kind() const { return Code::KEYED_STORE_IC; } | 625 virtual Code::Kind kind() const { return Code::KEYED_STORE_IC; } |
626 | 626 |
627 virtual Handle<Code> ComputeStoreMonomorphic(LookupResult* lookup, | 627 virtual Handle<Code> ComputeStoreMonomorphic(LookupResult* lookup, |
628 StrictModeFlag strict_mode, | 628 StrictModeFlag strict_mode, |
629 Handle<JSObject> receiver, | 629 Handle<JSObject> receiver, |
630 Handle<String> name); | 630 Handle<String> name, |
| 631 Handle<Object> value); |
631 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code) { } | 632 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code) { } |
632 | 633 |
633 virtual Handle<Code> megamorphic_stub() { | 634 virtual Handle<Code> megamorphic_stub() { |
634 return isolate()->builtins()->KeyedStoreIC_Generic(); | 635 return isolate()->builtins()->KeyedStoreIC_Generic(); |
635 } | 636 } |
636 virtual Handle<Code> megamorphic_stub_strict() { | 637 virtual Handle<Code> megamorphic_stub_strict() { |
637 return isolate()->builtins()->KeyedStoreIC_Generic_Strict(); | 638 return isolate()->builtins()->KeyedStoreIC_Generic_Strict(); |
638 } | 639 } |
639 | 640 |
640 Handle<Code> StoreElementStub(Handle<JSObject> receiver, | 641 Handle<Code> StoreElementStub(Handle<JSObject> receiver, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 | 675 |
675 Handle<Map> ComputeTransitionedMap(Handle<JSObject> receiver, | 676 Handle<Map> ComputeTransitionedMap(Handle<JSObject> receiver, |
676 KeyedAccessStoreMode store_mode); | 677 KeyedAccessStoreMode store_mode); |
677 | 678 |
678 friend class IC; | 679 friend class IC; |
679 }; | 680 }; |
680 | 681 |
681 | 682 |
682 class UnaryOpIC: public IC { | 683 class UnaryOpIC: public IC { |
683 public: | 684 public: |
684 // sorted: increasingly more unspecific (ignoring UNINITIALIZED) | 685 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 | 686 |
693 static Handle<Type> TypeInfoToType(TypeInfo info, Isolate* isolate); | 687 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 }; | 688 }; |
707 | 689 |
708 | 690 |
709 // Type Recording BinaryOpIC, that records the types of the inputs and outputs. | 691 // Type Recording BinaryOpIC, that records the types of the inputs and outputs. |
710 class BinaryOpIC: public IC { | 692 class BinaryOpIC: public IC { |
711 public: | 693 public: |
712 enum TypeInfo { | 694 enum TypeInfo { |
713 UNINITIALIZED, | 695 UNINITIALIZED, |
714 SMI, | 696 SMI, |
715 INT32, | 697 INT32, |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 MaybeObject* ToBoolean(Handle<Object> object, Code::ExtraICState state); | 813 MaybeObject* ToBoolean(Handle<Object> object, Code::ExtraICState state); |
832 }; | 814 }; |
833 | 815 |
834 | 816 |
835 // Helper for BinaryOpIC and CompareIC. | 817 // Helper for BinaryOpIC and CompareIC. |
836 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK }; | 818 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK }; |
837 void PatchInlinedSmiCode(Address address, InlinedSmiCheck check); | 819 void PatchInlinedSmiCode(Address address, InlinedSmiCheck check); |
838 | 820 |
839 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_MissFromStubFailure); | 821 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_MissFromStubFailure); |
840 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedStoreIC_MissFromStubFailure); | 822 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedStoreIC_MissFromStubFailure); |
| 823 DECLARE_RUNTIME_FUNCTION(MaybeObject*, UnaryOpIC_Miss); |
| 824 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure); |
841 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); | 825 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); |
842 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); | 826 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); |
843 | 827 |
844 | 828 |
845 } } // namespace v8::internal | 829 } } // namespace v8::internal |
846 | 830 |
847 #endif // V8_IC_H_ | 831 #endif // V8_IC_H_ |
OLD | NEW |