OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 #define CUSTOM_CALL_IC_GENERATORS(V) \ | 673 #define CUSTOM_CALL_IC_GENERATORS(V) \ |
674 V(ArrayPush) \ | 674 V(ArrayPush) \ |
675 V(ArrayPop) \ | 675 V(ArrayPop) \ |
676 V(StringCharCodeAt) \ | 676 V(StringCharCodeAt) \ |
677 V(StringCharAt) \ | 677 V(StringCharAt) \ |
678 V(StringFromCharCode) \ | 678 V(StringFromCharCode) \ |
679 V(MathFloor) \ | 679 V(MathFloor) \ |
680 V(MathAbs) | 680 V(MathAbs) |
681 | 681 |
682 | 682 |
| 683 class CallOptimization; |
| 684 |
683 class CallStubCompiler: public StubCompiler { | 685 class CallStubCompiler: public StubCompiler { |
684 public: | 686 public: |
685 CallStubCompiler(int argc, | 687 CallStubCompiler(int argc, |
686 InLoopFlag in_loop, | 688 InLoopFlag in_loop, |
687 Code::Kind kind, | 689 Code::Kind kind, |
688 Code::ExtraICState extra_ic_state, | 690 Code::ExtraICState extra_ic_state, |
689 InlineCacheHolderFlag cache_holder); | 691 InlineCacheHolderFlag cache_holder); |
690 | 692 |
691 MUST_USE_RESULT MaybeObject* CompileCallField(JSObject* object, | 693 MUST_USE_RESULT MaybeObject* CompileCallField(JSObject* object, |
692 JSObject* holder, | 694 JSObject* holder, |
693 int index, | 695 int index, |
694 String* name); | 696 String* name); |
695 MUST_USE_RESULT MaybeObject* CompileCallConstant(Object* object, | 697 MUST_USE_RESULT MaybeObject* CompileCallConstant(Object* object, |
696 JSObject* holder, | 698 JSObject* holder, |
697 JSFunction* function, | 699 JSFunction* function, |
698 String* name, | 700 String* name, |
699 CheckType check); | 701 CheckType check); |
700 MUST_USE_RESULT MaybeObject* CompileCallInterceptor(JSObject* object, | 702 MUST_USE_RESULT MaybeObject* CompileCallInterceptor(JSObject* object, |
701 JSObject* holder, | 703 JSObject* holder, |
702 String* name); | 704 String* name); |
703 MUST_USE_RESULT MaybeObject* CompileCallGlobal(JSObject* object, | 705 MUST_USE_RESULT MaybeObject* CompileCallGlobal(JSObject* object, |
704 GlobalObject* holder, | 706 GlobalObject* holder, |
705 JSGlobalPropertyCell* cell, | 707 JSGlobalPropertyCell* cell, |
706 JSFunction* function, | 708 JSFunction* function, |
707 String* name); | 709 String* name); |
708 | 710 |
709 static bool HasCustomCallGenerator(BuiltinFunctionId id); | 711 static bool HasCustomCallGenerator(JSFunction* function); |
710 | 712 |
711 private: | 713 private: |
712 // Compiles a custom call constant/global IC. For constant calls | 714 // Compiles a custom call constant/global IC. For constant calls |
713 // cell is NULL. Returns undefined if there is no custom call code | 715 // cell is NULL. Returns undefined if there is no custom call code |
714 // for the given function or it can't be generated. | 716 // for the given function or it can't be generated. |
715 MUST_USE_RESULT MaybeObject* CompileCustomCall(BuiltinFunctionId id, | 717 MUST_USE_RESULT MaybeObject* CompileCustomCall(Object* object, |
716 Object* object, | |
717 JSObject* holder, | 718 JSObject* holder, |
718 JSGlobalPropertyCell* cell, | 719 JSGlobalPropertyCell* cell, |
719 JSFunction* function, | 720 JSFunction* function, |
720 String* name); | 721 String* name); |
721 | 722 |
722 #define DECLARE_CALL_GENERATOR(name) \ | 723 #define DECLARE_CALL_GENERATOR(name) \ |
723 MUST_USE_RESULT MaybeObject* Compile##name##Call(Object* object, \ | 724 MUST_USE_RESULT MaybeObject* Compile##name##Call(Object* object, \ |
724 JSObject* holder, \ | 725 JSObject* holder, \ |
725 JSGlobalPropertyCell* cell, \ | 726 JSGlobalPropertyCell* cell, \ |
726 JSFunction* function, \ | 727 JSFunction* function, \ |
727 String* fname); | 728 String* fname); |
728 CUSTOM_CALL_IC_GENERATORS(DECLARE_CALL_GENERATOR) | 729 CUSTOM_CALL_IC_GENERATORS(DECLARE_CALL_GENERATOR) |
729 #undef DECLARE_CALL_GENERATOR | 730 #undef DECLARE_CALL_GENERATOR |
730 | 731 |
| 732 MUST_USE_RESULT MaybeObject* CompileFastApiCall( |
| 733 const CallOptimization& optimization, |
| 734 Object* object, |
| 735 JSObject* holder, |
| 736 JSGlobalPropertyCell* cell, |
| 737 JSFunction* function, |
| 738 String* name); |
| 739 |
731 const ParameterCount arguments_; | 740 const ParameterCount arguments_; |
732 const InLoopFlag in_loop_; | 741 const InLoopFlag in_loop_; |
733 const Code::Kind kind_; | 742 const Code::Kind kind_; |
734 const Code::ExtraICState extra_ic_state_; | 743 const Code::ExtraICState extra_ic_state_; |
735 const InlineCacheHolderFlag cache_holder_; | 744 const InlineCacheHolderFlag cache_holder_; |
736 | 745 |
737 const ParameterCount& arguments() { return arguments_; } | 746 const ParameterCount& arguments() { return arguments_; } |
738 | 747 |
739 MUST_USE_RESULT MaybeObject* GetCode(PropertyType type, String* name); | 748 MUST_USE_RESULT MaybeObject* GetCode(PropertyType type, String* name); |
740 | 749 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
830 MUST_USE_RESULT MaybeObject* CompileKeyedStoreStub( | 839 MUST_USE_RESULT MaybeObject* CompileKeyedStoreStub( |
831 JSObject* receiver, ExternalArrayType array_type, Code::Flags flags); | 840 JSObject* receiver, ExternalArrayType array_type, Code::Flags flags); |
832 | 841 |
833 private: | 842 private: |
834 MaybeObject* GetCode(Code::Flags flags); | 843 MaybeObject* GetCode(Code::Flags flags); |
835 }; | 844 }; |
836 | 845 |
837 } } // namespace v8::internal | 846 } } // namespace v8::internal |
838 | 847 |
839 #endif // V8_STUB_CACHE_H_ | 848 #endif // V8_STUB_CACHE_H_ |
OLD | NEW |