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 // Returns the object having the expected type in the |
1033 // prototype chain between the two arguments. | 1019 // prototype chain between the two arguments, null otherwise |
1034 int GetPrototypeDepthOfExpectedType(Handle<JSObject> object, | 1020 Handle<JSObject> GetPrototypeOfExpectedType( |
1035 Handle<JSObject> holder) const; | 1021 Handle<JSObject> object, Handle<JSObject> holder) const; |
1036 | 1022 |
1037 bool IsCompatibleReceiver(Object* receiver) { | 1023 bool IsCompatibleReceiver(Object* receiver) { |
1038 ASSERT(is_simple_api_call()); | 1024 ASSERT(is_simple_api_call()); |
1039 if (expected_receiver_type_.is_null()) return true; | 1025 if (expected_receiver_type_.is_null()) return true; |
1040 return expected_receiver_type_->IsTemplateFor(receiver); | 1026 return expected_receiver_type_->IsTemplateFor(receiver); |
1041 } | 1027 } |
1042 | 1028 |
1043 private: | 1029 private: |
1044 void Initialize(Handle<JSFunction> function); | 1030 void Initialize(Handle<JSFunction> function); |
1045 | 1031 |
1046 // Determines whether the given function can be called using the | 1032 // Determines whether the given function can be called using the |
1047 // fast api call builtin. | 1033 // fast api call builtin. |
1048 void AnalyzePossibleApiFunction(Handle<JSFunction> function); | 1034 void AnalyzePossibleApiFunction(Handle<JSFunction> function); |
1049 | 1035 |
1050 Handle<JSFunction> constant_function_; | 1036 Handle<JSFunction> constant_function_; |
1051 bool is_simple_api_call_; | 1037 bool is_simple_api_call_; |
1052 Handle<FunctionTemplateInfo> expected_receiver_type_; | 1038 Handle<FunctionTemplateInfo> expected_receiver_type_; |
1053 Handle<CallHandlerInfo> api_call_info_; | 1039 Handle<CallHandlerInfo> api_call_info_; |
1054 }; | 1040 }; |
1055 | 1041 |
1056 | 1042 |
1057 } } // namespace v8::internal | 1043 } } // namespace v8::internal |
1058 | 1044 |
1059 #endif // V8_STUB_CACHE_H_ | 1045 #endif // V8_STUB_CACHE_H_ |
OLD | NEW |