| 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 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 MacroAssembler* masm() { return &masm_; } | 510 MacroAssembler* masm() { return &masm_; } |
| 511 void set_failure(Failure* failure) { failure_ = failure; } | 511 void set_failure(Failure* failure) { failure_ = failure; } |
| 512 | 512 |
| 513 static void LookupPostInterceptor(Handle<JSObject> holder, | 513 static void LookupPostInterceptor(Handle<JSObject> holder, |
| 514 Handle<Name> name, | 514 Handle<Name> name, |
| 515 LookupResult* lookup); | 515 LookupResult* lookup); |
| 516 | 516 |
| 517 Isolate* isolate() { return isolate_; } | 517 Isolate* isolate() { return isolate_; } |
| 518 Heap* heap() { return isolate()->heap(); } | 518 Heap* heap() { return isolate()->heap(); } |
| 519 Factory* factory() { return isolate()->factory(); } | 519 Factory* factory() { return isolate()->factory(); } |
| 520 ContextualMode contextual_mode() { | |
| 521 return IC::GetContextualMode(extra_state()); | |
| 522 } | |
| 523 | 520 |
| 524 static void GenerateTailCall(MacroAssembler* masm, Handle<Code> code); | 521 static void GenerateTailCall(MacroAssembler* masm, Handle<Code> code); |
| 525 | 522 |
| 526 private: | 523 private: |
| 527 Isolate* isolate_; | 524 Isolate* isolate_; |
| 528 const ExtraICState extra_ic_state_; | 525 const ExtraICState extra_ic_state_; |
| 529 MacroAssembler masm_; | 526 MacroAssembler masm_; |
| 530 Failure* failure_; | 527 Failure* failure_; |
| 531 }; | 528 }; |
| 532 | 529 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 550 Handle<Code> CompileMonomorphicIC(Handle<Type> type, | 547 Handle<Code> CompileMonomorphicIC(Handle<Type> type, |
| 551 Handle<Code> handler, | 548 Handle<Code> handler, |
| 552 Handle<Name> name); | 549 Handle<Name> name); |
| 553 | 550 |
| 554 Handle<Code> CompilePolymorphicIC(TypeHandleList* types, | 551 Handle<Code> CompilePolymorphicIC(TypeHandleList* types, |
| 555 CodeHandleList* handlers, | 552 CodeHandleList* handlers, |
| 556 Handle<Name> name, | 553 Handle<Name> name, |
| 557 Code::StubType type, | 554 Code::StubType type, |
| 558 IcCheckType check); | 555 IcCheckType check); |
| 559 | 556 |
| 560 virtual void GenerateNameCheck(Handle<Name> name, | |
| 561 Register name_reg, | |
| 562 Label* miss) { } | |
| 563 | |
| 564 static Builtins::Name MissBuiltin(Code::Kind kind) { | 557 static Builtins::Name MissBuiltin(Code::Kind kind) { |
| 565 switch (kind) { | 558 switch (kind) { |
| 566 case Code::LOAD_IC: return Builtins::kLoadIC_Miss; | 559 case Code::LOAD_IC: return Builtins::kLoadIC_Miss; |
| 567 case Code::STORE_IC: return Builtins::kStoreIC_Miss; | 560 case Code::STORE_IC: return Builtins::kStoreIC_Miss; |
| 568 case Code::KEYED_LOAD_IC: return Builtins::kKeyedLoadIC_Miss; | 561 case Code::KEYED_LOAD_IC: return Builtins::kKeyedLoadIC_Miss; |
| 569 case Code::KEYED_STORE_IC: return Builtins::kKeyedStoreIC_Miss; | 562 case Code::KEYED_STORE_IC: return Builtins::kKeyedStoreIC_Miss; |
| 570 default: UNREACHABLE(); | 563 default: UNREACHABLE(); |
| 571 } | 564 } |
| 572 return Builtins::kLoadIC_Miss; | 565 return Builtins::kLoadIC_Miss; |
| 573 } | 566 } |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 | 673 |
| 681 Handle<Code> CompileLoadGlobal(Handle<Type> type, | 674 Handle<Code> CompileLoadGlobal(Handle<Type> type, |
| 682 Handle<GlobalObject> holder, | 675 Handle<GlobalObject> holder, |
| 683 Handle<PropertyCell> cell, | 676 Handle<PropertyCell> cell, |
| 684 Handle<Name> name, | 677 Handle<Name> name, |
| 685 bool is_dont_delete); | 678 bool is_dont_delete); |
| 686 | 679 |
| 687 static Register* registers(); | 680 static Register* registers(); |
| 688 | 681 |
| 689 protected: | 682 protected: |
| 683 ContextualMode contextual_mode() { |
| 684 return LoadIC::GetContextualMode(extra_state()); |
| 685 } |
| 686 |
| 690 virtual Register HandlerFrontendHeader(Handle<Type> type, | 687 virtual Register HandlerFrontendHeader(Handle<Type> type, |
| 691 Register object_reg, | 688 Register object_reg, |
| 692 Handle<JSObject> holder, | 689 Handle<JSObject> holder, |
| 693 Handle<Name> name, | 690 Handle<Name> name, |
| 694 Label* miss); | 691 Label* miss); |
| 695 | 692 |
| 696 virtual void HandlerFrontendFooter(Handle<Name> name, Label* miss); | 693 virtual void HandlerFrontendFooter(Handle<Name> name, Label* miss); |
| 697 | 694 |
| 698 Register CallbackHandlerFrontend(Handle<Type> type, | 695 Register CallbackHandlerFrontend(Handle<Type> type, |
| 699 Register object_reg, | 696 Register object_reg, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 : LoadStubCompiler(isolate, extra_ic_state, cache_holder, | 736 : LoadStubCompiler(isolate, extra_ic_state, cache_holder, |
| 740 Code::KEYED_LOAD_IC) { } | 737 Code::KEYED_LOAD_IC) { } |
| 741 | 738 |
| 742 Handle<Code> CompileLoadElement(Handle<Map> receiver_map); | 739 Handle<Code> CompileLoadElement(Handle<Map> receiver_map); |
| 743 | 740 |
| 744 void CompileElementHandlers(MapHandleList* receiver_maps, | 741 void CompileElementHandlers(MapHandleList* receiver_maps, |
| 745 CodeHandleList* handlers); | 742 CodeHandleList* handlers); |
| 746 | 743 |
| 747 static void GenerateLoadDictionaryElement(MacroAssembler* masm); | 744 static void GenerateLoadDictionaryElement(MacroAssembler* masm); |
| 748 | 745 |
| 749 protected: | 746 private: |
| 750 static Register* registers(); | 747 static Register* registers(); |
| 751 | |
| 752 private: | |
| 753 virtual void GenerateNameCheck(Handle<Name> name, | |
| 754 Register name_reg, | |
| 755 Label* miss); | |
| 756 friend class BaseLoadStoreStubCompiler; | 748 friend class BaseLoadStoreStubCompiler; |
| 757 }; | 749 }; |
| 758 | 750 |
| 759 | 751 |
| 760 class StoreStubCompiler: public BaseLoadStoreStubCompiler { | 752 class StoreStubCompiler: public BaseLoadStoreStubCompiler { |
| 761 public: | 753 public: |
| 762 StoreStubCompiler(Isolate* isolate, | 754 StoreStubCompiler(Isolate* isolate, |
| 763 ExtraICState extra_ic_state, | 755 ExtraICState extra_ic_state, |
| 764 Code::Kind kind = Code::STORE_IC) | 756 Code::Kind kind = Code::STORE_IC) |
| 765 : BaseLoadStoreStubCompiler(isolate, kind, extra_ic_state) {} | 757 : BaseLoadStoreStubCompiler(isolate, kind, extra_ic_state) {} |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 Handle<Code> CompileStoreElement(Handle<Map> receiver_map); | 863 Handle<Code> CompileStoreElement(Handle<Map> receiver_map); |
| 872 | 864 |
| 873 Handle<Code> CompileStorePolymorphic(MapHandleList* receiver_maps, | 865 Handle<Code> CompileStorePolymorphic(MapHandleList* receiver_maps, |
| 874 CodeHandleList* handler_stubs, | 866 CodeHandleList* handler_stubs, |
| 875 MapHandleList* transitioned_maps); | 867 MapHandleList* transitioned_maps); |
| 876 | 868 |
| 877 Handle<Code> CompileStoreElementPolymorphic(MapHandleList* receiver_maps); | 869 Handle<Code> CompileStoreElementPolymorphic(MapHandleList* receiver_maps); |
| 878 | 870 |
| 879 static void GenerateStoreDictionaryElement(MacroAssembler* masm); | 871 static void GenerateStoreDictionaryElement(MacroAssembler* masm); |
| 880 | 872 |
| 881 protected: | 873 private: |
| 882 static Register* registers(); | 874 static Register* registers(); |
| 883 | 875 |
| 884 KeyedAccessStoreMode store_mode() { | 876 KeyedAccessStoreMode store_mode() { |
| 885 return KeyedStoreIC::GetKeyedAccessStoreMode(extra_state()); | 877 return KeyedStoreIC::GetKeyedAccessStoreMode(extra_state()); |
| 886 } | 878 } |
| 887 | 879 |
| 888 private: | |
| 889 Register transition_map() { | 880 Register transition_map() { |
| 890 return registers()[3]; | 881 return registers()[3]; |
| 891 } | 882 } |
| 892 | 883 |
| 893 virtual void GenerateNameCheck(Handle<Name> name, | |
| 894 Register name_reg, | |
| 895 Label* miss); | |
| 896 friend class BaseLoadStoreStubCompiler; | 884 friend class BaseLoadStoreStubCompiler; |
| 897 }; | 885 }; |
| 898 | 886 |
| 899 | 887 |
| 900 // Subset of FUNCTIONS_WITH_ID_LIST with custom constant/global call | 888 // Subset of FUNCTIONS_WITH_ID_LIST with custom constant/global call |
| 901 // IC stubs. | 889 // IC stubs. |
| 902 #define CUSTOM_CALL_IC_GENERATORS(V) \ | 890 #define CUSTOM_CALL_IC_GENERATORS(V) \ |
| 903 V(ArrayPush) \ | 891 V(ArrayPush) \ |
| 904 V(ArrayPop) \ | 892 V(ArrayPop) |
| 905 V(StringCharCodeAt) \ | |
| 906 V(StringCharAt) \ | |
| 907 V(StringFromCharCode) \ | |
| 908 V(MathFloor) \ | |
| 909 V(MathAbs) \ | |
| 910 V(ArrayCode) | |
| 911 | |
| 912 | |
| 913 #define SITE_SPECIFIC_CALL_GENERATORS(V) \ | |
| 914 V(ArrayCode) | |
| 915 | 893 |
| 916 | 894 |
| 917 class CallStubCompiler: public StubCompiler { | 895 class CallStubCompiler: public StubCompiler { |
| 918 public: | 896 public: |
| 919 CallStubCompiler(Isolate* isolate, | 897 CallStubCompiler(Isolate* isolate, |
| 920 int argc, | 898 int argc, |
| 921 Code::Kind kind, | 899 Code::Kind kind, |
| 922 ExtraICState extra_state, | 900 ExtraICState extra_state, |
| 923 InlineCacheHolderFlag cache_holder = OWN_MAP); | 901 InlineCacheHolderFlag cache_holder = OWN_MAP); |
| 924 | 902 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 961 Handle<JSObject> holder, | 939 Handle<JSObject> holder, |
| 962 Handle<Name> name); | 940 Handle<Name> name); |
| 963 | 941 |
| 964 Handle<Code> CompileCallGlobal(Handle<JSObject> object, | 942 Handle<Code> CompileCallGlobal(Handle<JSObject> object, |
| 965 Handle<GlobalObject> holder, | 943 Handle<GlobalObject> holder, |
| 966 Handle<PropertyCell> cell, | 944 Handle<PropertyCell> cell, |
| 967 Handle<JSFunction> function, | 945 Handle<JSFunction> function, |
| 968 Handle<Name> name); | 946 Handle<Name> name); |
| 969 | 947 |
| 970 static bool HasCustomCallGenerator(Handle<JSFunction> function); | 948 static bool HasCustomCallGenerator(Handle<JSFunction> function); |
| 971 static bool CanBeCached(Handle<JSFunction> function); | |
| 972 | 949 |
| 973 private: | 950 private: |
| 974 // Compiles a custom call constant/global IC. For constant calls cell is | 951 // Compiles a custom call constant/global IC. For constant calls cell is |
| 975 // NULL. Returns an empty handle if there is no custom call code for the | 952 // NULL. Returns an empty handle if there is no custom call code for the |
| 976 // given function. | 953 // given function. |
| 977 Handle<Code> CompileCustomCall(Handle<Object> object, | 954 Handle<Code> CompileCustomCall(Handle<Object> object, |
| 978 Handle<JSObject> holder, | 955 Handle<JSObject> holder, |
| 979 Handle<Cell> cell, | 956 Handle<Cell> cell, |
| 980 Handle<JSFunction> function, | 957 Handle<JSFunction> function, |
| 981 Handle<String> name, | 958 Handle<String> name, |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1073 Handle<JSFunction> constant_function_; | 1050 Handle<JSFunction> constant_function_; |
| 1074 bool is_simple_api_call_; | 1051 bool is_simple_api_call_; |
| 1075 Handle<FunctionTemplateInfo> expected_receiver_type_; | 1052 Handle<FunctionTemplateInfo> expected_receiver_type_; |
| 1076 Handle<CallHandlerInfo> api_call_info_; | 1053 Handle<CallHandlerInfo> api_call_info_; |
| 1077 }; | 1054 }; |
| 1078 | 1055 |
| 1079 | 1056 |
| 1080 } } // namespace v8::internal | 1057 } } // namespace v8::internal |
| 1081 | 1058 |
| 1082 #endif // V8_STUB_CACHE_H_ | 1059 #endif // V8_STUB_CACHE_H_ |
| OLD | NEW |