| 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 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 997 | 997 |
| 998 enum HolderLookup { | 998 enum HolderLookup { |
| 999 kHolderNotFound, | 999 kHolderNotFound, |
| 1000 kHolderIsReceiver, | 1000 kHolderIsReceiver, |
| 1001 kHolderIsPrototypeOfMap | 1001 kHolderIsPrototypeOfMap |
| 1002 }; | 1002 }; |
| 1003 // Returns a map whose prototype has the expected type in the | 1003 // Returns a map whose prototype has the expected type in the |
| 1004 // prototype chain between the two arguments | 1004 // prototype chain between the two arguments |
| 1005 // null will be returned if the first argument has that property | 1005 // null will be returned if the first argument has that property |
| 1006 // lookup will be set accordingly | 1006 // lookup will be set accordingly |
| 1007 Handle<Map> LookupHolderOfExpectedType(Handle<Map> receiver_map, |
| 1008 Handle<Map> object_map, |
| 1009 Handle<Map> holder_map, |
| 1010 HolderLookup* holder_lookup) const; |
| 1007 Handle<Map> LookupHolderOfExpectedType(Handle<JSObject> receiver, | 1011 Handle<Map> LookupHolderOfExpectedType(Handle<JSObject> receiver, |
| 1008 Handle<JSObject> object, | 1012 Handle<JSObject> object, |
| 1009 Handle<JSObject> holder, | 1013 Handle<JSObject> holder, |
| 1010 HolderLookup* holder_lookup) const; | 1014 HolderLookup* holder_lookup) const { |
| 1015 Handle<Map> receiver_map(receiver->map()); |
| 1016 Handle<Map> object_map(object->map()); |
| 1017 Handle<Map> holder_map(holder->map()); |
| 1018 return LookupHolderOfExpectedType( |
| 1019 receiver_map, object_map, holder_map, holder_lookup); |
| 1020 } |
| 1011 | 1021 |
| 1012 bool IsCompatibleReceiver(Object* receiver) { | 1022 bool IsCompatibleReceiver(Object* receiver) { |
| 1013 ASSERT(is_simple_api_call()); | 1023 ASSERT(is_simple_api_call()); |
| 1014 if (expected_receiver_type_.is_null()) return true; | 1024 if (expected_receiver_type_.is_null()) return true; |
| 1015 return expected_receiver_type_->IsTemplateFor(receiver); | 1025 return expected_receiver_type_->IsTemplateFor(receiver); |
| 1016 } | 1026 } |
| 1017 | 1027 |
| 1018 private: | 1028 private: |
| 1019 void Initialize(Handle<JSFunction> function); | 1029 void Initialize(Handle<JSFunction> function); |
| 1020 | 1030 |
| 1021 // Determines whether the given function can be called using the | 1031 // Determines whether the given function can be called using the |
| 1022 // fast api call builtin. | 1032 // fast api call builtin. |
| 1023 void AnalyzePossibleApiFunction(Handle<JSFunction> function); | 1033 void AnalyzePossibleApiFunction(Handle<JSFunction> function); |
| 1024 | 1034 |
| 1025 Handle<JSFunction> constant_function_; | 1035 Handle<JSFunction> constant_function_; |
| 1026 bool is_simple_api_call_; | 1036 bool is_simple_api_call_; |
| 1027 Handle<FunctionTemplateInfo> expected_receiver_type_; | 1037 Handle<FunctionTemplateInfo> expected_receiver_type_; |
| 1028 Handle<CallHandlerInfo> api_call_info_; | 1038 Handle<CallHandlerInfo> api_call_info_; |
| 1029 }; | 1039 }; |
| 1030 | 1040 |
| 1031 | 1041 |
| 1032 } } // namespace v8::internal | 1042 } } // namespace v8::internal |
| 1033 | 1043 |
| 1034 #endif // V8_STUB_CACHE_H_ | 1044 #endif // V8_STUB_CACHE_H_ |
| OLD | NEW |