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 903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 Handle<Code> CompileCallInterceptor(Handle<JSObject> object, | 914 Handle<Code> CompileCallInterceptor(Handle<JSObject> object, |
915 Handle<JSObject> holder, | 915 Handle<JSObject> holder, |
916 Handle<Name> name); | 916 Handle<Name> name); |
917 | 917 |
918 Handle<Code> CompileCallGlobal(Handle<JSObject> object, | 918 Handle<Code> CompileCallGlobal(Handle<JSObject> object, |
919 Handle<GlobalObject> holder, | 919 Handle<GlobalObject> holder, |
920 Handle<PropertyCell> cell, | 920 Handle<PropertyCell> cell, |
921 Handle<JSFunction> function, | 921 Handle<JSFunction> function, |
922 Handle<Name> name); | 922 Handle<Name> name); |
923 | 923 |
924 static bool HasCustomCallGenerator(Handle<JSFunction> function); | |
925 | |
926 private: | 924 private: |
927 // Compiles a custom call constant/global IC. For constant calls cell is | |
928 // NULL. Returns an empty handle if there is no custom call code for the | |
929 // given function. | |
930 Handle<Code> CompileCustomCall(Handle<Object> object, | |
931 Handle<JSObject> holder, | |
932 Handle<Cell> cell, | |
933 Handle<JSFunction> function, | |
934 Handle<String> name, | |
935 Code::StubType type); | |
936 | |
937 Handle<Code> CompileFastApiCall(const CallOptimization& optimization, | |
938 Handle<Object> object, | |
939 Handle<JSObject> holder, | |
940 Handle<Cell> cell, | |
941 Handle<JSFunction> function, | |
942 Handle<String> name); | |
943 | |
944 Handle<Code> GetCode(Code::StubType type, Handle<Name> name); | 925 Handle<Code> GetCode(Code::StubType type, Handle<Name> name); |
945 Handle<Code> GetCode(Handle<JSFunction> function); | 926 Handle<Code> GetCode(Handle<JSFunction> function); |
946 | 927 |
947 const ParameterCount& arguments() { return arguments_; } | 928 const ParameterCount& arguments() { return arguments_; } |
948 | 929 |
949 void GenerateNameCheck(Handle<Name> name, Label* miss); | 930 void GenerateNameCheck(Handle<Name> name, Label* miss); |
950 | 931 |
951 // Generates code to load the function from the cell checking that | 932 // Generates code to load the function from the cell checking that |
952 // it still contains the same function. | 933 // it still contains the same function. |
953 void GenerateLoadFunctionFromCell(Handle<Cell> cell, | 934 void GenerateLoadFunctionFromCell(Handle<Cell> cell, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
991 } | 972 } |
992 | 973 |
993 Handle<CallHandlerInfo> api_call_info() const { | 974 Handle<CallHandlerInfo> api_call_info() const { |
994 ASSERT(is_simple_api_call()); | 975 ASSERT(is_simple_api_call()); |
995 return api_call_info_; | 976 return api_call_info_; |
996 } | 977 } |
997 | 978 |
998 enum HolderLookup { | 979 enum HolderLookup { |
999 kHolderNotFound, | 980 kHolderNotFound, |
1000 kHolderIsReceiver, | 981 kHolderIsReceiver, |
1001 kHolderIsPrototypeOfMap | 982 kHolderFound |
1002 }; | 983 }; |
1003 // Returns a map whose prototype has the expected type in the | 984 Handle<JSObject> LookupHolderOfExpectedType( |
1004 // prototype chain between the two arguments | 985 Handle<Map> receiver_map, |
1005 // null will be returned if the first argument has that property | 986 HolderLookup* holder_lookup) const; |
1006 // lookup will be set accordingly | |
1007 Handle<Map> LookupHolderOfExpectedType(Handle<JSObject> receiver, | |
1008 Handle<JSObject> object, | |
1009 Handle<JSObject> holder, | |
1010 HolderLookup* holder_lookup) const; | |
1011 | 987 |
1012 bool IsCompatibleReceiver(Object* receiver) { | 988 bool IsCompatibleReceiver(Object* receiver) { |
1013 ASSERT(is_simple_api_call()); | 989 ASSERT(is_simple_api_call()); |
1014 if (expected_receiver_type_.is_null()) return true; | 990 if (expected_receiver_type_.is_null()) return true; |
1015 return expected_receiver_type_->IsTemplateFor(receiver); | 991 return expected_receiver_type_->IsTemplateFor(receiver); |
1016 } | 992 } |
1017 | 993 |
1018 private: | 994 private: |
1019 void Initialize(Handle<JSFunction> function); | 995 void Initialize(Handle<JSFunction> function); |
1020 | 996 |
1021 // Determines whether the given function can be called using the | 997 // Determines whether the given function can be called using the |
1022 // fast api call builtin. | 998 // fast api call builtin. |
1023 void AnalyzePossibleApiFunction(Handle<JSFunction> function); | 999 void AnalyzePossibleApiFunction(Handle<JSFunction> function); |
1024 | 1000 |
1025 Handle<JSFunction> constant_function_; | 1001 Handle<JSFunction> constant_function_; |
1026 bool is_simple_api_call_; | 1002 bool is_simple_api_call_; |
1027 Handle<FunctionTemplateInfo> expected_receiver_type_; | 1003 Handle<FunctionTemplateInfo> expected_receiver_type_; |
1028 Handle<CallHandlerInfo> api_call_info_; | 1004 Handle<CallHandlerInfo> api_call_info_; |
1029 }; | 1005 }; |
1030 | 1006 |
1031 | 1007 |
1032 } } // namespace v8::internal | 1008 } } // namespace v8::internal |
1033 | 1009 |
1034 #endif // V8_STUB_CACHE_H_ | 1010 #endif // V8_STUB_CACHE_H_ |
OLD | NEW |