Chromium Code Reviews| 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 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 636 Map* transition, | 636 Map* transition, | 
| 637 String* name); | 637 String* name); | 
| 638 | 638 | 
| 639 MUST_USE_RESULT MaybeObject* CompileStoreSpecialized(JSObject* receiver); | 639 MUST_USE_RESULT MaybeObject* CompileStoreSpecialized(JSObject* receiver); | 
| 640 | 640 | 
| 641 private: | 641 private: | 
| 642 MaybeObject* GetCode(PropertyType type, String* name); | 642 MaybeObject* GetCode(PropertyType type, String* name); | 
| 643 }; | 643 }; | 
| 644 | 644 | 
| 645 | 645 | 
| 646 // List of functions with custom constant call IC stubs. | 646 // Subset of FUNCTIONS_WITH_ID_LIST with custom constant/global call | 
| 647 // | 647 // IC stubs. | 
| 648 // Installation of custom call generators for the selected builtins is | 648 #define CUSTOM_CALL_IC_GENERATORS(V) \ | 
| 649 // handled by the bootstrapper. | 649 V(ArrayPush) \ | 
| 650 // | 650 V(ArrayPop) \ | 
| 651 // Each entry has a name of a global object property holding an object | 651 V(StringCharCodeAt) \ | 
| 652 // optionally followed by ".prototype" (this controls whether the | 652 V(StringCharAt) \ | 
| 653 // generator is set on the object itself or, in case it's a function, | 653 V(StringFromCharCode) \ | 
| 654 // on the its instance prototype), a name of a builtin function on the | 654 V(MathFloor) \ | 
| 655 // object (the one the generator is set for), and a name of the | 655 V(MathAbs) | 
| 656 // generator (used to build ids and generator function names). | |
| 657 #define CUSTOM_CALL_IC_GENERATORS(V) \ | |
| 658 V(Array.prototype, push, ArrayPush) \ | |
| 659 V(Array.prototype, pop, ArrayPop) \ | |
| 660 V(String.prototype, charCodeAt, StringCharCodeAt) \ | |
| 661 V(String.prototype, charAt, StringCharAt) \ | |
| 662 V(String, fromCharCode, StringFromCharCode) \ | |
| 663 V(Math, floor, MathFloor) \ | |
| 664 V(Math, abs, MathAbs) | |
| 665 | 656 | 
| 666 | 657 | 
| 667 class CallStubCompiler: public StubCompiler { | 658 class CallStubCompiler: public StubCompiler { | 
| 668 public: | 659 public: | 
| 669 enum { | |
| 670 #define DECLARE_CALL_GENERATOR_ID(ignored1, ignore2, name) \ | |
| 671 k##name##CallGenerator, | |
| 672 CUSTOM_CALL_IC_GENERATORS(DECLARE_CALL_GENERATOR_ID) | |
| 673 #undef DECLARE_CALL_GENERATOR_ID | |
| 674 kNumCallGenerators | |
| 675 }; | |
| 676 | |
| 677 CallStubCompiler(int argc, | 660 CallStubCompiler(int argc, | 
| 678 InLoopFlag in_loop, | 661 InLoopFlag in_loop, | 
| 679 Code::Kind kind, | 662 Code::Kind kind, | 
| 680 InlineCacheHolderFlag cache_holder); | 663 InlineCacheHolderFlag cache_holder); | 
| 681 | 664 | 
| 682 MUST_USE_RESULT MaybeObject* CompileCallField(JSObject* object, | 665 MUST_USE_RESULT MaybeObject* CompileCallField(JSObject* object, | 
| 683 JSObject* holder, | 666 JSObject* holder, | 
| 684 int index, | 667 int index, | 
| 685 String* name); | 668 String* name); | 
| 686 MUST_USE_RESULT MaybeObject* CompileCallConstant(Object* object, | 669 MUST_USE_RESULT MaybeObject* CompileCallConstant(Object* object, | 
| 687 JSObject* holder, | 670 JSObject* holder, | 
| 688 JSFunction* function, | 671 JSFunction* function, | 
| 689 String* name, | 672 String* name, | 
| 690 CheckType check); | 673 CheckType check); | 
| 691 MUST_USE_RESULT MaybeObject* CompileCallInterceptor(JSObject* object, | 674 MUST_USE_RESULT MaybeObject* CompileCallInterceptor(JSObject* object, | 
| 692 JSObject* holder, | 675 JSObject* holder, | 
| 693 String* name); | 676 String* name); | 
| 694 MUST_USE_RESULT MaybeObject* CompileCallGlobal(JSObject* object, | 677 MUST_USE_RESULT MaybeObject* CompileCallGlobal(JSObject* object, | 
| 695 GlobalObject* holder, | 678 GlobalObject* holder, | 
| 696 JSGlobalPropertyCell* cell, | 679 JSGlobalPropertyCell* cell, | 
| 697 JSFunction* function, | 680 JSFunction* function, | 
| 698 String* name); | 681 String* name); | 
| 699 | 682 | 
| 700 // Compiles a custom call constant/global IC using the generator | 683 static bool HasCustomCallGenerator(BuiltinFunctionId id); | 
| 701 // with given id. For constant calls cell is NULL. | 684 | 
| 702 MUST_USE_RESULT MaybeObject* CompileCustomCall(int generator_id, | 685 private: | 
| 686 // Compiles a custom call constant/global IC. For constant calls cell is NULL. | |
| 687 // Returns undefined if there is no custom call code for the given function. | |
| 
 
antonm
2010/12/13 13:44:15
as you're fixing the wording anyway: undefined can
 
Erik Corry
2010/12/13 14:08:17
Done.
 
Vitaly Repeshko
2010/12/14 18:55:33
Done.
 
 | |
| 688 MUST_USE_RESULT MaybeObject* CompileCustomCall(BuiltinFunctionId id, | |
| 703 Object* object, | 689 Object* object, | 
| 704 JSObject* holder, | 690 JSObject* holder, | 
| 705 JSGlobalPropertyCell* cell, | 691 JSGlobalPropertyCell* cell, | 
| 706 JSFunction* function, | 692 JSFunction* function, | 
| 707 String* name); | 693 String* name); | 
| 708 | 694 | 
| 709 #define DECLARE_CALL_GENERATOR(ignored1, ignored2, name) \ | 695 #define DECLARE_CALL_GENERATOR(name) \ | 
| 710 MUST_USE_RESULT MaybeObject* Compile##name##Call(Object* object, \ | 696 MUST_USE_RESULT MaybeObject* Compile##name##Call(Object* object, \ | 
| 711 JSObject* holder, \ | 697 JSObject* holder, \ | 
| 712 JSGlobalPropertyCell* cell, \ | 698 JSGlobalPropertyCell* cell, \ | 
| 713 JSFunction* function, \ | 699 JSFunction* function, \ | 
| 714 String* fname); | 700 String* fname); | 
| 715 CUSTOM_CALL_IC_GENERATORS(DECLARE_CALL_GENERATOR) | 701 CUSTOM_CALL_IC_GENERATORS(DECLARE_CALL_GENERATOR) | 
| 716 #undef DECLARE_CALL_GENERATOR | 702 #undef DECLARE_CALL_GENERATOR | 
| 717 | 703 | 
| 718 private: | |
| 719 const ParameterCount arguments_; | 704 const ParameterCount arguments_; | 
| 720 const InLoopFlag in_loop_; | 705 const InLoopFlag in_loop_; | 
| 721 const Code::Kind kind_; | 706 const Code::Kind kind_; | 
| 722 const InlineCacheHolderFlag cache_holder_; | 707 const InlineCacheHolderFlag cache_holder_; | 
| 723 | 708 | 
| 724 const ParameterCount& arguments() { return arguments_; } | 709 const ParameterCount& arguments() { return arguments_; } | 
| 725 | 710 | 
| 726 MUST_USE_RESULT MaybeObject* GetCode(PropertyType type, String* name); | 711 MUST_USE_RESULT MaybeObject* GetCode(PropertyType type, String* name); | 
| 727 | 712 | 
| 728 // Convenience function. Calls GetCode above passing | 713 // Convenience function. Calls GetCode above passing | 
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 803 | 788 | 
| 804 JSFunction* constant_function_; | 789 JSFunction* constant_function_; | 
| 805 bool is_simple_api_call_; | 790 bool is_simple_api_call_; | 
| 806 FunctionTemplateInfo* expected_receiver_type_; | 791 FunctionTemplateInfo* expected_receiver_type_; | 
| 807 CallHandlerInfo* api_call_info_; | 792 CallHandlerInfo* api_call_info_; | 
| 808 }; | 793 }; | 
| 809 | 794 | 
| 810 } } // namespace v8::internal | 795 } } // namespace v8::internal | 
| 811 | 796 | 
| 812 #endif // V8_STUB_CACHE_H_ | 797 #endif // V8_STUB_CACHE_H_ | 
| OLD | NEW |