| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 176 |
| 177 // --- | 177 // --- |
| 178 | 178 |
| 179 MUST_USE_RESULT MaybeObject* ComputeKeyedStoreField( | 179 MUST_USE_RESULT MaybeObject* ComputeKeyedStoreField( |
| 180 String* name, | 180 String* name, |
| 181 JSObject* receiver, | 181 JSObject* receiver, |
| 182 int field_index, | 182 int field_index, |
| 183 Map* transition, | 183 Map* transition, |
| 184 StrictModeFlag strict_mode); | 184 StrictModeFlag strict_mode); |
| 185 | 185 |
| 186 MUST_USE_RESULT MaybeObject* ComputeKeyedLoadOrStoreExternalArray( | 186 MUST_USE_RESULT MaybeObject* ComputeKeyedLoadOrStoreElement( |
| 187 JSObject* receiver, | 187 JSObject* receiver, |
| 188 bool is_store, | 188 bool is_store, |
| 189 StrictModeFlag strict_mode); | 189 StrictModeFlag strict_mode); |
| 190 | 190 |
| 191 MUST_USE_RESULT MaybeObject* ComputeKeyedLoadOrStoreFastElement( | |
| 192 JSObject* receiver, | |
| 193 bool is_store, | |
| 194 StrictModeFlag strict_mode); | |
| 195 // --- | 191 // --- |
| 196 | 192 |
| 197 MUST_USE_RESULT MaybeObject* ComputeCallField( | 193 MUST_USE_RESULT MaybeObject* ComputeCallField( |
| 198 int argc, | 194 int argc, |
| 199 InLoopFlag in_loop, | 195 InLoopFlag in_loop, |
| 200 Code::Kind, | 196 Code::Kind, |
| 201 Code::ExtraICState extra_ic_state, | 197 Code::ExtraICState extra_ic_state, |
| 202 String* name, | 198 String* name, |
| 203 Object* object, | 199 Object* object, |
| 204 JSObject* holder, | 200 JSObject* holder, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 int argc, | 254 int argc, |
| 259 InLoopFlag in_loop, | 255 InLoopFlag in_loop, |
| 260 Code::Kind kind, | 256 Code::Kind kind, |
| 261 Code::ExtraICState extra_ic_state); | 257 Code::ExtraICState extra_ic_state); |
| 262 | 258 |
| 263 MUST_USE_RESULT MaybeObject* ComputeCallNormal(int argc, | 259 MUST_USE_RESULT MaybeObject* ComputeCallNormal(int argc, |
| 264 InLoopFlag in_loop, | 260 InLoopFlag in_loop, |
| 265 Code::Kind kind, | 261 Code::Kind kind, |
| 266 Code::ExtraICState state); | 262 Code::ExtraICState state); |
| 267 | 263 |
| 264 MUST_USE_RESULT MaybeObject* ComputeCallArguments(int argc, |
| 265 InLoopFlag in_loop, |
| 266 Code::Kind kind); |
| 267 |
| 268 MUST_USE_RESULT MaybeObject* ComputeCallMegamorphic(int argc, | 268 MUST_USE_RESULT MaybeObject* ComputeCallMegamorphic(int argc, |
| 269 InLoopFlag in_loop, | 269 InLoopFlag in_loop, |
| 270 Code::Kind kind, | 270 Code::Kind kind, |
| 271 Code::ExtraICState state); | 271 Code::ExtraICState state); |
| 272 | 272 |
| 273 MUST_USE_RESULT MaybeObject* ComputeCallMiss(int argc, | 273 MUST_USE_RESULT MaybeObject* ComputeCallMiss(int argc, |
| 274 Code::Kind kind, | 274 Code::Kind kind, |
| 275 Code::ExtraICState state); | 275 Code::ExtraICState state); |
| 276 | 276 |
| 277 // Finds the Code object stored in the Heap::non_monomorphic_cache(). | 277 // Finds the Code object stored in the Heap::non_monomorphic_cache(). |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 // The stub compiler compiles stubs for the stub cache. | 422 // The stub compiler compiles stubs for the stub cache. |
| 423 class StubCompiler BASE_EMBEDDED { | 423 class StubCompiler BASE_EMBEDDED { |
| 424 public: | 424 public: |
| 425 StubCompiler() | 425 StubCompiler() |
| 426 : scope_(), masm_(Isolate::Current(), NULL, 256), failure_(NULL) { } | 426 : scope_(), masm_(Isolate::Current(), NULL, 256), failure_(NULL) { } |
| 427 | 427 |
| 428 MUST_USE_RESULT MaybeObject* CompileCallInitialize(Code::Flags flags); | 428 MUST_USE_RESULT MaybeObject* CompileCallInitialize(Code::Flags flags); |
| 429 MUST_USE_RESULT MaybeObject* CompileCallPreMonomorphic(Code::Flags flags); | 429 MUST_USE_RESULT MaybeObject* CompileCallPreMonomorphic(Code::Flags flags); |
| 430 MUST_USE_RESULT MaybeObject* CompileCallNormal(Code::Flags flags); | 430 MUST_USE_RESULT MaybeObject* CompileCallNormal(Code::Flags flags); |
| 431 MUST_USE_RESULT MaybeObject* CompileCallMegamorphic(Code::Flags flags); | 431 MUST_USE_RESULT MaybeObject* CompileCallMegamorphic(Code::Flags flags); |
| 432 MUST_USE_RESULT MaybeObject* CompileCallArguments(Code::Flags flags); |
| 432 MUST_USE_RESULT MaybeObject* CompileCallMiss(Code::Flags flags); | 433 MUST_USE_RESULT MaybeObject* CompileCallMiss(Code::Flags flags); |
| 433 #ifdef ENABLE_DEBUGGER_SUPPORT | 434 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 434 MUST_USE_RESULT MaybeObject* CompileCallDebugBreak(Code::Flags flags); | 435 MUST_USE_RESULT MaybeObject* CompileCallDebugBreak(Code::Flags flags); |
| 435 MUST_USE_RESULT MaybeObject* CompileCallDebugPrepareStepIn(Code::Flags flags); | 436 MUST_USE_RESULT MaybeObject* CompileCallDebugPrepareStepIn(Code::Flags flags); |
| 436 #endif | 437 #endif |
| 437 | 438 |
| 438 // Static functions for generating parts of stubs. | 439 // Static functions for generating parts of stubs. |
| 439 static void GenerateLoadGlobalFunctionPrototype(MacroAssembler* masm, | 440 static void GenerateLoadGlobalFunctionPrototype(MacroAssembler* masm, |
| 440 int index, | 441 int index, |
| 441 Register prototype); | 442 Register prototype); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 Object* value); | 644 Object* value); |
| 644 | 645 |
| 645 MUST_USE_RESULT MaybeObject* CompileLoadInterceptor(JSObject* object, | 646 MUST_USE_RESULT MaybeObject* CompileLoadInterceptor(JSObject* object, |
| 646 JSObject* holder, | 647 JSObject* holder, |
| 647 String* name); | 648 String* name); |
| 648 | 649 |
| 649 MUST_USE_RESULT MaybeObject* CompileLoadArrayLength(String* name); | 650 MUST_USE_RESULT MaybeObject* CompileLoadArrayLength(String* name); |
| 650 MUST_USE_RESULT MaybeObject* CompileLoadStringLength(String* name); | 651 MUST_USE_RESULT MaybeObject* CompileLoadStringLength(String* name); |
| 651 MUST_USE_RESULT MaybeObject* CompileLoadFunctionPrototype(String* name); | 652 MUST_USE_RESULT MaybeObject* CompileLoadFunctionPrototype(String* name); |
| 652 | 653 |
| 653 MUST_USE_RESULT MaybeObject* CompileLoadFastElement(Map* receiver_map); | 654 MUST_USE_RESULT MaybeObject* CompileLoadElement(Map* receiver_map); |
| 654 | 655 |
| 655 MUST_USE_RESULT MaybeObject* CompileLoadMegamorphic( | 656 MUST_USE_RESULT MaybeObject* CompileLoadMegamorphic( |
| 656 MapList* receiver_maps, | 657 MapList* receiver_maps, |
| 657 CodeList* handler_ics); | 658 CodeList* handler_ics); |
| 658 | 659 |
| 659 static void GenerateLoadExternalArray(MacroAssembler* masm, | 660 static void GenerateLoadExternalArray(MacroAssembler* masm, |
| 660 ExternalArrayType array_type); | 661 JSObject::ElementsKind elements_kind); |
| 661 | 662 |
| 662 static void GenerateLoadFastElement(MacroAssembler* masm); | 663 static void GenerateLoadFastElement(MacroAssembler* masm); |
| 663 | 664 |
| 665 static void GenerateLoadDictionaryElement(MacroAssembler* masm); |
| 666 |
| 664 private: | 667 private: |
| 665 MaybeObject* GetCode(PropertyType type, | 668 MaybeObject* GetCode(PropertyType type, |
| 666 String* name, | 669 String* name, |
| 667 InlineCacheState state = MONOMORPHIC); | 670 InlineCacheState state = MONOMORPHIC); |
| 668 }; | 671 }; |
| 669 | 672 |
| 670 | 673 |
| 671 class StoreStubCompiler: public StubCompiler { | 674 class StoreStubCompiler: public StubCompiler { |
| 672 public: | 675 public: |
| 673 explicit StoreStubCompiler(StrictModeFlag strict_mode) | 676 explicit StoreStubCompiler(StrictModeFlag strict_mode) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 698 class KeyedStoreStubCompiler: public StubCompiler { | 701 class KeyedStoreStubCompiler: public StubCompiler { |
| 699 public: | 702 public: |
| 700 explicit KeyedStoreStubCompiler(StrictModeFlag strict_mode) | 703 explicit KeyedStoreStubCompiler(StrictModeFlag strict_mode) |
| 701 : strict_mode_(strict_mode) { } | 704 : strict_mode_(strict_mode) { } |
| 702 | 705 |
| 703 MUST_USE_RESULT MaybeObject* CompileStoreField(JSObject* object, | 706 MUST_USE_RESULT MaybeObject* CompileStoreField(JSObject* object, |
| 704 int index, | 707 int index, |
| 705 Map* transition, | 708 Map* transition, |
| 706 String* name); | 709 String* name); |
| 707 | 710 |
| 708 MUST_USE_RESULT MaybeObject* CompileStoreFastElement(Map* receiver_map); | 711 MUST_USE_RESULT MaybeObject* CompileStoreElement(Map* receiver_map); |
| 709 | 712 |
| 710 MUST_USE_RESULT MaybeObject* CompileStoreMegamorphic( | 713 MUST_USE_RESULT MaybeObject* CompileStoreMegamorphic( |
| 711 MapList* receiver_maps, | 714 MapList* receiver_maps, |
| 712 CodeList* handler_ics); | 715 CodeList* handler_ics); |
| 713 | 716 |
| 714 static void GenerateStoreFastElement(MacroAssembler* masm, | 717 static void GenerateStoreFastElement(MacroAssembler* masm, |
| 715 bool is_js_array); | 718 bool is_js_array); |
| 716 | 719 |
| 717 static void GenerateStoreExternalArray(MacroAssembler* masm, | 720 static void GenerateStoreExternalArray(MacroAssembler* masm, |
| 718 ExternalArrayType array_type); | 721 JSObject::ElementsKind elements_kind); |
| 722 |
| 723 static void GenerateStoreDictionaryElement(MacroAssembler* masm); |
| 719 | 724 |
| 720 private: | 725 private: |
| 721 MaybeObject* GetCode(PropertyType type, | 726 MaybeObject* GetCode(PropertyType type, |
| 722 String* name, | 727 String* name, |
| 723 InlineCacheState state = MONOMORPHIC); | 728 InlineCacheState state = MONOMORPHIC); |
| 724 | 729 |
| 725 StrictModeFlag strict_mode_; | 730 StrictModeFlag strict_mode_; |
| 726 }; | 731 }; |
| 727 | 732 |
| 728 | 733 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 741 class CallOptimization; | 746 class CallOptimization; |
| 742 | 747 |
| 743 class CallStubCompiler: public StubCompiler { | 748 class CallStubCompiler: public StubCompiler { |
| 744 public: | 749 public: |
| 745 CallStubCompiler(int argc, | 750 CallStubCompiler(int argc, |
| 746 InLoopFlag in_loop, | 751 InLoopFlag in_loop, |
| 747 Code::Kind kind, | 752 Code::Kind kind, |
| 748 Code::ExtraICState extra_ic_state, | 753 Code::ExtraICState extra_ic_state, |
| 749 InlineCacheHolderFlag cache_holder); | 754 InlineCacheHolderFlag cache_holder); |
| 750 | 755 |
| 751 MUST_USE_RESULT MaybeObject* CompileCallField(JSObject* object, | 756 MUST_USE_RESULT MaybeObject* CompileCallField( |
| 752 JSObject* holder, | 757 JSObject* object, |
| 753 int index, | 758 JSObject* holder, |
| 754 String* name); | 759 int index, |
| 755 MUST_USE_RESULT MaybeObject* CompileCallConstant(Object* object, | 760 String* name); |
| 756 JSObject* holder, | 761 |
| 757 JSFunction* function, | 762 MUST_USE_RESULT MaybeObject* CompileCallConstant( |
| 758 String* name, | 763 Object* object, |
| 759 CheckType check); | 764 JSObject* holder, |
| 760 MUST_USE_RESULT MaybeObject* CompileCallInterceptor(JSObject* object, | 765 JSFunction* function, |
| 761 JSObject* holder, | 766 String* name, |
| 762 String* name); | 767 CheckType check); |
| 768 |
| 769 MUST_USE_RESULT MaybeObject* CompileCallInterceptor( |
| 770 JSObject* object, |
| 771 JSObject* holder, |
| 772 String* name); |
| 773 |
| 763 MUST_USE_RESULT MaybeObject* CompileCallGlobal( | 774 MUST_USE_RESULT MaybeObject* CompileCallGlobal( |
| 764 JSObject* object, | 775 JSObject* object, |
| 765 GlobalObject* holder, | 776 GlobalObject* holder, |
| 766 JSGlobalPropertyCell* cell, | 777 JSGlobalPropertyCell* cell, |
| 767 JSFunction* function, | 778 JSFunction* function, |
| 768 String* name, | 779 String* name); |
| 769 Code::ExtraICState extra_ic_state); | |
| 770 | 780 |
| 771 static bool HasCustomCallGenerator(JSFunction* function); | 781 static bool HasCustomCallGenerator(JSFunction* function); |
| 772 | 782 |
| 773 private: | 783 private: |
| 774 // Compiles a custom call constant/global IC. For constant calls | 784 // Compiles a custom call constant/global IC. For constant calls |
| 775 // cell is NULL. Returns undefined if there is no custom call code | 785 // cell is NULL. Returns undefined if there is no custom call code |
| 776 // for the given function or it can't be generated. | 786 // for the given function or it can't be generated. |
| 777 MUST_USE_RESULT MaybeObject* CompileCustomCall(Object* object, | 787 MUST_USE_RESULT MaybeObject* CompileCustomCall(Object* object, |
| 778 JSObject* holder, | 788 JSObject* holder, |
| 779 JSGlobalPropertyCell* cell, | 789 JSGlobalPropertyCell* cell, |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 882 // Determines whether the given function can be called using the | 892 // Determines whether the given function can be called using the |
| 883 // fast api call builtin. | 893 // fast api call builtin. |
| 884 void AnalyzePossibleApiFunction(JSFunction* function); | 894 void AnalyzePossibleApiFunction(JSFunction* function); |
| 885 | 895 |
| 886 JSFunction* constant_function_; | 896 JSFunction* constant_function_; |
| 887 bool is_simple_api_call_; | 897 bool is_simple_api_call_; |
| 888 FunctionTemplateInfo* expected_receiver_type_; | 898 FunctionTemplateInfo* expected_receiver_type_; |
| 889 CallHandlerInfo* api_call_info_; | 899 CallHandlerInfo* api_call_info_; |
| 890 }; | 900 }; |
| 891 | 901 |
| 892 class ExternalArrayLoadStubCompiler: public StubCompiler { | |
| 893 public: | |
| 894 explicit ExternalArrayLoadStubCompiler(StrictModeFlag strict_mode) | |
| 895 : strict_mode_(strict_mode) { } | |
| 896 | |
| 897 MUST_USE_RESULT MaybeObject* CompileLoad( | |
| 898 JSObject* receiver, ExternalArrayType array_type); | |
| 899 | |
| 900 private: | |
| 901 MaybeObject* GetCode(); | |
| 902 | |
| 903 StrictModeFlag strict_mode_; | |
| 904 }; | |
| 905 | |
| 906 | |
| 907 class ExternalArrayStoreStubCompiler: public StubCompiler { | |
| 908 public: | |
| 909 explicit ExternalArrayStoreStubCompiler(StrictModeFlag strict_mode) | |
| 910 : strict_mode_(strict_mode) {} | |
| 911 | |
| 912 MUST_USE_RESULT MaybeObject* CompileStore( | |
| 913 JSObject* receiver, ExternalArrayType array_type); | |
| 914 | |
| 915 private: | |
| 916 MaybeObject* GetCode(); | |
| 917 | |
| 918 StrictModeFlag strict_mode_; | |
| 919 }; | |
| 920 | |
| 921 | 902 |
| 922 } } // namespace v8::internal | 903 } } // namespace v8::internal |
| 923 | 904 |
| 924 #endif // V8_STUB_CACHE_H_ | 905 #endif // V8_STUB_CACHE_H_ |
| OLD | NEW |