| 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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 // kInvalidProtoDepth) save the object at the given depth by moving | 476 // kInvalidProtoDepth) save the object at the given depth by moving |
| 477 // it to [esp + kPointerSize]. | 477 // it to [esp + kPointerSize]. |
| 478 Register CheckPrototypes(Handle<Type> type, | 478 Register CheckPrototypes(Handle<Type> type, |
| 479 Register object_reg, | 479 Register object_reg, |
| 480 Handle<JSObject> holder, | 480 Handle<JSObject> holder, |
| 481 Register holder_reg, | 481 Register holder_reg, |
| 482 Register scratch1, | 482 Register scratch1, |
| 483 Register scratch2, | 483 Register scratch2, |
| 484 Handle<Name> name, | 484 Handle<Name> name, |
| 485 Label* miss, | 485 Label* miss, |
| 486 PrototypeCheckType check = CHECK_ALL_MAPS) { | |
| 487 return CheckPrototypes(type, object_reg, holder, holder_reg, scratch1, | |
| 488 scratch2, name, kInvalidProtoDepth, miss, check); | |
| 489 } | |
| 490 | |
| 491 Register CheckPrototypes(Handle<Type> type, | |
| 492 Register object_reg, | |
| 493 Handle<JSObject> holder, | |
| 494 Register holder_reg, | |
| 495 Register scratch1, | |
| 496 Register scratch2, | |
| 497 Handle<Name> name, | |
| 498 int save_at_depth, | |
| 499 Label* miss, | |
| 500 PrototypeCheckType check = CHECK_ALL_MAPS); | 486 PrototypeCheckType check = CHECK_ALL_MAPS); |
| 501 | 487 |
| 502 void GenerateBooleanCheck(Register object, Label* miss); | 488 void GenerateBooleanCheck(Register object, Label* miss); |
| 503 | 489 |
| 504 protected: | 490 protected: |
| 505 Handle<Code> GetCodeWithFlags(Code::Flags flags, const char* name); | 491 Handle<Code> GetCodeWithFlags(Code::Flags flags, const char* name); |
| 506 Handle<Code> GetCodeWithFlags(Code::Flags flags, Handle<Name> name); | 492 Handle<Code> GetCodeWithFlags(Code::Flags flags, Handle<Name> name); |
| 507 | 493 |
| 508 ExtraICState extra_state() { return extra_ic_state_; } | 494 ExtraICState extra_state() { return extra_ic_state_; } |
| 509 | 495 |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1022 Handle<FunctionTemplateInfo> expected_receiver_type() const { | 1008 Handle<FunctionTemplateInfo> expected_receiver_type() const { |
| 1023 ASSERT(is_simple_api_call()); | 1009 ASSERT(is_simple_api_call()); |
| 1024 return expected_receiver_type_; | 1010 return expected_receiver_type_; |
| 1025 } | 1011 } |
| 1026 | 1012 |
| 1027 Handle<CallHandlerInfo> api_call_info() const { | 1013 Handle<CallHandlerInfo> api_call_info() const { |
| 1028 ASSERT(is_simple_api_call()); | 1014 ASSERT(is_simple_api_call()); |
| 1029 return api_call_info_; | 1015 return api_call_info_; |
| 1030 } | 1016 } |
| 1031 | 1017 |
| 1032 // Returns the depth of the object having the expected type in the | 1018 enum HolderLookup { |
| 1033 // prototype chain between the two arguments. | 1019 kHolderNotFound, |
| 1034 int GetPrototypeDepthOfExpectedType(Handle<JSObject> object, | 1020 kHolderIsReceiver, |
| 1035 Handle<JSObject> holder) const; | 1021 kHolderIsPrototypeOfMap |
| 1022 }; |
| 1023 // Returns a map whose prototype has the expected type in the |
| 1024 // prototype chain between the two arguments |
| 1025 // null will be returned if the first argument has that property |
| 1026 // lookup will be set accordingly |
| 1027 Handle<Map> LookupHolderOfExpectedType(Handle<JSObject> receiver, |
| 1028 Handle<JSObject> object, |
| 1029 Handle<JSObject> holder, |
| 1030 HolderLookup* holder_lookup) const; |
| 1036 | 1031 |
| 1037 bool IsCompatibleReceiver(Object* receiver) { | 1032 bool IsCompatibleReceiver(Object* receiver) { |
| 1038 ASSERT(is_simple_api_call()); | 1033 ASSERT(is_simple_api_call()); |
| 1039 if (expected_receiver_type_.is_null()) return true; | 1034 if (expected_receiver_type_.is_null()) return true; |
| 1040 return expected_receiver_type_->IsTemplateFor(receiver); | 1035 return expected_receiver_type_->IsTemplateFor(receiver); |
| 1041 } | 1036 } |
| 1042 | 1037 |
| 1043 private: | 1038 private: |
| 1044 void Initialize(Handle<JSFunction> function); | 1039 void Initialize(Handle<JSFunction> function); |
| 1045 | 1040 |
| 1046 // Determines whether the given function can be called using the | 1041 // Determines whether the given function can be called using the |
| 1047 // fast api call builtin. | 1042 // fast api call builtin. |
| 1048 void AnalyzePossibleApiFunction(Handle<JSFunction> function); | 1043 void AnalyzePossibleApiFunction(Handle<JSFunction> function); |
| 1049 | 1044 |
| 1050 Handle<JSFunction> constant_function_; | 1045 Handle<JSFunction> constant_function_; |
| 1051 bool is_simple_api_call_; | 1046 bool is_simple_api_call_; |
| 1052 Handle<FunctionTemplateInfo> expected_receiver_type_; | 1047 Handle<FunctionTemplateInfo> expected_receiver_type_; |
| 1053 Handle<CallHandlerInfo> api_call_info_; | 1048 Handle<CallHandlerInfo> api_call_info_; |
| 1054 }; | 1049 }; |
| 1055 | 1050 |
| 1056 | 1051 |
| 1057 } } // namespace v8::internal | 1052 } } // namespace v8::internal |
| 1058 | 1053 |
| 1059 #endif // V8_STUB_CACHE_H_ | 1054 #endif // V8_STUB_CACHE_H_ |
| OLD | NEW |