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