Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/stub-cache.h

Issue 7036016: Reland 7917: (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixes to make re-land work Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/spaces.cc ('k') | src/stub-cache.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 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
11 // with the distribution. 11 // with the distribution.
(...skipping 12 matching lines...) Expand all
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #ifndef V8_STUB_CACHE_H_ 28 #ifndef V8_STUB_CACHE_H_
29 #define V8_STUB_CACHE_H_ 29 #define V8_STUB_CACHE_H_
30 30
31 #include "allocation.h" 31 #include "allocation.h"
32 #include "arguments.h" 32 #include "arguments.h"
33 #include "macro-assembler.h" 33 #include "macro-assembler.h"
34 #include "objects.h"
34 #include "zone-inl.h" 35 #include "zone-inl.h"
35 36
36 namespace v8 { 37 namespace v8 {
37 namespace internal { 38 namespace internal {
38 39
39 40
40 // The stub cache is used for megamorphic calls and property accesses. 41 // The stub cache is used for megamorphic calls and property accesses.
41 // It maps (map, name, type)->Code* 42 // It maps (map, name, type)->Code*
42 43
43 // The design of the table uses the inline cache stubs used for 44 // The design of the table uses the inline cache stubs used for
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 JSArray* receiver); 138 JSArray* receiver);
138 139
139 MUST_USE_RESULT MaybeObject* ComputeKeyedLoadStringLength( 140 MUST_USE_RESULT MaybeObject* ComputeKeyedLoadStringLength(
140 String* name, 141 String* name,
141 String* receiver); 142 String* receiver);
142 143
143 MUST_USE_RESULT MaybeObject* ComputeKeyedLoadFunctionPrototype( 144 MUST_USE_RESULT MaybeObject* ComputeKeyedLoadFunctionPrototype(
144 String* name, 145 String* name,
145 JSFunction* receiver); 146 JSFunction* receiver);
146 147
147 MUST_USE_RESULT MaybeObject* ComputeKeyedLoadSpecialized(
148 JSObject* receiver);
149
150 // --- 148 // ---
151 149
152 MUST_USE_RESULT MaybeObject* ComputeStoreField( 150 MUST_USE_RESULT MaybeObject* ComputeStoreField(
153 String* name, 151 String* name,
154 JSObject* receiver, 152 JSObject* receiver,
155 int field_index, 153 int field_index,
156 Map* transition, 154 Map* transition,
157 StrictModeFlag strict_mode); 155 StrictModeFlag strict_mode);
158 156
159 MUST_USE_RESULT MaybeObject* ComputeStoreNormal( 157 MUST_USE_RESULT MaybeObject* ComputeStoreNormal(
(...skipping 18 matching lines...) Expand all
178 176
179 // --- 177 // ---
180 178
181 MUST_USE_RESULT MaybeObject* ComputeKeyedStoreField( 179 MUST_USE_RESULT MaybeObject* ComputeKeyedStoreField(
182 String* name, 180 String* name,
183 JSObject* receiver, 181 JSObject* receiver,
184 int field_index, 182 int field_index,
185 Map* transition, 183 Map* transition,
186 StrictModeFlag strict_mode); 184 StrictModeFlag strict_mode);
187 185
188 MUST_USE_RESULT MaybeObject* ComputeKeyedStoreSpecialized(
189 JSObject* receiver,
190 StrictModeFlag strict_mode);
191
192
193 MUST_USE_RESULT MaybeObject* ComputeKeyedLoadOrStoreExternalArray( 186 MUST_USE_RESULT MaybeObject* ComputeKeyedLoadOrStoreExternalArray(
194 JSObject* receiver, 187 JSObject* receiver,
195 bool is_store, 188 bool is_store,
196 StrictModeFlag strict_mode); 189 StrictModeFlag strict_mode);
197 190
191 MUST_USE_RESULT MaybeObject* ComputeKeyedLoadOrStoreFastElement(
192 JSObject* receiver,
193 bool is_store,
194 StrictModeFlag strict_mode);
198 // --- 195 // ---
199 196
200 MUST_USE_RESULT MaybeObject* ComputeCallField(int argc, 197 MUST_USE_RESULT MaybeObject* ComputeCallField(int argc,
201 InLoopFlag in_loop, 198 InLoopFlag in_loop,
202 Code::Kind, 199 Code::Kind,
203 String* name, 200 String* name,
204 Object* object, 201 Object* object,
205 JSObject* holder, 202 JSObject* holder,
206 int index); 203 int index);
207 204
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 459
463 static void GenerateStoreField(MacroAssembler* masm, 460 static void GenerateStoreField(MacroAssembler* masm,
464 JSObject* object, 461 JSObject* object,
465 int index, 462 int index,
466 Map* transition, 463 Map* transition,
467 Register receiver_reg, 464 Register receiver_reg,
468 Register name_reg, 465 Register name_reg,
469 Register scratch, 466 Register scratch,
470 Label* miss_label); 467 Label* miss_label);
471 468
472 static void GenerateLoadMiss(MacroAssembler* masm, Code::Kind kind); 469 static void GenerateLoadMiss(MacroAssembler* masm,
470 Code::Kind kind);
471
472 static void GenerateKeyedLoadMissForceGeneric(MacroAssembler* masm);
473 473
474 // Generates code that verifies that the property holder has not changed 474 // Generates code that verifies that the property holder has not changed
475 // (checking maps of objects in the prototype chain for fast and global 475 // (checking maps of objects in the prototype chain for fast and global
476 // objects or doing negative lookup for slow objects, ensures that the 476 // objects or doing negative lookup for slow objects, ensures that the
477 // property cells for global objects are still empty) and checks that the map 477 // property cells for global objects are still empty) and checks that the map
478 // of the holder has not changed. If necessary the function also generates 478 // of the holder has not changed. If necessary the function also generates
479 // code for security check in case of global object holders. Helps to make 479 // code for security check in case of global object holders. Helps to make
480 // sure that the current IC is still valid. 480 // sure that the current IC is still valid.
481 // 481 //
482 // The scratch and holder registers are always clobbered, but the object 482 // The scratch and holder registers are always clobbered, but the object
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 Object* value); 627 Object* value);
628 628
629 MUST_USE_RESULT MaybeObject* CompileLoadInterceptor(JSObject* object, 629 MUST_USE_RESULT MaybeObject* CompileLoadInterceptor(JSObject* object,
630 JSObject* holder, 630 JSObject* holder,
631 String* name); 631 String* name);
632 632
633 MUST_USE_RESULT MaybeObject* CompileLoadArrayLength(String* name); 633 MUST_USE_RESULT MaybeObject* CompileLoadArrayLength(String* name);
634 MUST_USE_RESULT MaybeObject* CompileLoadStringLength(String* name); 634 MUST_USE_RESULT MaybeObject* CompileLoadStringLength(String* name);
635 MUST_USE_RESULT MaybeObject* CompileLoadFunctionPrototype(String* name); 635 MUST_USE_RESULT MaybeObject* CompileLoadFunctionPrototype(String* name);
636 636
637 MUST_USE_RESULT MaybeObject* CompileLoadSpecialized(JSObject* receiver); 637 MUST_USE_RESULT MaybeObject* CompileLoadFastElement(Map* receiver_map);
638
639 MUST_USE_RESULT MaybeObject* CompileLoadMegamorphic(
640 MapList* receiver_maps,
641 CodeList* handler_ics);
642
643 static void GenerateLoadExternalArray(MacroAssembler* masm,
644 ExternalArrayType array_type);
645
646 static void GenerateLoadFastElement(MacroAssembler* masm);
638 647
639 private: 648 private:
640 MaybeObject* GetCode(PropertyType type, String* name); 649 MaybeObject* GetCode(PropertyType type,
650 String* name,
651 InlineCacheState state = MONOMORPHIC);
641 }; 652 };
642 653
643 654
644 class StoreStubCompiler: public StubCompiler { 655 class StoreStubCompiler: public StubCompiler {
645 public: 656 public:
646 explicit StoreStubCompiler(StrictModeFlag strict_mode) 657 explicit StoreStubCompiler(StrictModeFlag strict_mode)
647 : strict_mode_(strict_mode) { } 658 : strict_mode_(strict_mode) { }
648 659
649 MUST_USE_RESULT MaybeObject* CompileStoreField(JSObject* object, 660 MUST_USE_RESULT MaybeObject* CompileStoreField(JSObject* object,
650 int index, 661 int index,
(...skipping 20 matching lines...) Expand all
671 class KeyedStoreStubCompiler: public StubCompiler { 682 class KeyedStoreStubCompiler: public StubCompiler {
672 public: 683 public:
673 explicit KeyedStoreStubCompiler(StrictModeFlag strict_mode) 684 explicit KeyedStoreStubCompiler(StrictModeFlag strict_mode)
674 : strict_mode_(strict_mode) { } 685 : strict_mode_(strict_mode) { }
675 686
676 MUST_USE_RESULT MaybeObject* CompileStoreField(JSObject* object, 687 MUST_USE_RESULT MaybeObject* CompileStoreField(JSObject* object,
677 int index, 688 int index,
678 Map* transition, 689 Map* transition,
679 String* name); 690 String* name);
680 691
681 MUST_USE_RESULT MaybeObject* CompileStoreSpecialized(JSObject* receiver); 692 MUST_USE_RESULT MaybeObject* CompileStoreFastElement(Map* receiver_map);
693
694 MUST_USE_RESULT MaybeObject* CompileStoreMegamorphic(
695 MapList* receiver_maps,
696 CodeList* handler_ics);
697
698 static void GenerateStoreFastElement(MacroAssembler* masm,
699 bool is_js_array);
700
701 static void GenerateStoreExternalArray(MacroAssembler* masm,
702 ExternalArrayType array_type);
682 703
683 private: 704 private:
684 MaybeObject* GetCode(PropertyType type, String* name); 705 MaybeObject* GetCode(PropertyType type,
706 String* name,
707 InlineCacheState state = MONOMORPHIC);
685 708
686 StrictModeFlag strict_mode_; 709 StrictModeFlag strict_mode_;
687 }; 710 };
688 711
689 712
690 // Subset of FUNCTIONS_WITH_ID_LIST with custom constant/global call 713 // Subset of FUNCTIONS_WITH_ID_LIST with custom constant/global call
691 // IC stubs. 714 // IC stubs.
692 #define CUSTOM_CALL_IC_GENERATORS(V) \ 715 #define CUSTOM_CALL_IC_GENERATORS(V) \
693 V(ArrayPush) \ 716 V(ArrayPush) \
694 V(ArrayPop) \ 717 V(ArrayPop) \
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 // Determines whether the given function can be called using the 864 // Determines whether the given function can be called using the
842 // fast api call builtin. 865 // fast api call builtin.
843 void AnalyzePossibleApiFunction(JSFunction* function); 866 void AnalyzePossibleApiFunction(JSFunction* function);
844 867
845 JSFunction* constant_function_; 868 JSFunction* constant_function_;
846 bool is_simple_api_call_; 869 bool is_simple_api_call_;
847 FunctionTemplateInfo* expected_receiver_type_; 870 FunctionTemplateInfo* expected_receiver_type_;
848 CallHandlerInfo* api_call_info_; 871 CallHandlerInfo* api_call_info_;
849 }; 872 };
850 873
851 class ExternalArrayStubCompiler: public StubCompiler { 874 class ExternalArrayLoadStubCompiler: public StubCompiler {
852 public: 875 public:
853 explicit ExternalArrayStubCompiler() {} 876 explicit ExternalArrayLoadStubCompiler(StrictModeFlag strict_mode)
877 : strict_mode_(strict_mode) { }
854 878
855 MUST_USE_RESULT MaybeObject* CompileKeyedLoadStub( 879 MUST_USE_RESULT MaybeObject* CompileLoad(
856 JSObject* receiver, ExternalArrayType array_type, Code::Flags flags); 880 JSObject* receiver, ExternalArrayType array_type);
857
858 MUST_USE_RESULT MaybeObject* CompileKeyedStoreStub(
859 JSObject* receiver, ExternalArrayType array_type, Code::Flags flags);
860 881
861 private: 882 private:
862 MaybeObject* GetCode(Code::Flags flags); 883 MaybeObject* GetCode();
884
885 StrictModeFlag strict_mode_;
863 }; 886 };
864 887
888
889 class ExternalArrayStoreStubCompiler: public StubCompiler {
890 public:
891 explicit ExternalArrayStoreStubCompiler(StrictModeFlag strict_mode)
892 : strict_mode_(strict_mode) {}
893
894 MUST_USE_RESULT MaybeObject* CompileStore(
895 JSObject* receiver, ExternalArrayType array_type);
896
897 private:
898 MaybeObject* GetCode();
899
900 StrictModeFlag strict_mode_;
901 };
902
903
865 } } // namespace v8::internal 904 } } // namespace v8::internal
866 905
867 #endif // V8_STUB_CACHE_H_ 906 #endif // V8_STUB_CACHE_H_
OLDNEW
« no previous file with comments | « src/spaces.cc ('k') | src/stub-cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698