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

Side by Side Diff: src/code-stubs.h

Issue 8510013: Get rid of CodeStub::TryGetCode. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 1 month 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 | « no previous file | src/code-stubs.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 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 #define DEF_ENUM(name) name, 111 #define DEF_ENUM(name) name,
112 CODE_STUB_LIST(DEF_ENUM) 112 CODE_STUB_LIST(DEF_ENUM)
113 #undef DEF_ENUM 113 #undef DEF_ENUM
114 NoCache, // marker for stubs that do custom caching 114 NoCache, // marker for stubs that do custom caching
115 NUMBER_OF_IDS 115 NUMBER_OF_IDS
116 }; 116 };
117 117
118 // Retrieve the code for the stub. Generate the code if needed. 118 // Retrieve the code for the stub. Generate the code if needed.
119 Handle<Code> GetCode(); 119 Handle<Code> GetCode();
120 120
121 // Retrieve the code for the stub if already generated. Do not
122 // generate the code if not already generated and instead return a
123 // retry after GC Failure object.
124 MUST_USE_RESULT MaybeObject* TryGetCode();
125
126 static Major MajorKeyFromKey(uint32_t key) { 121 static Major MajorKeyFromKey(uint32_t key) {
127 return static_cast<Major>(MajorKeyBits::decode(key)); 122 return static_cast<Major>(MajorKeyBits::decode(key));
128 } 123 }
129 static int MinorKeyFromKey(uint32_t key) { 124 static int MinorKeyFromKey(uint32_t key) {
130 return MinorKeyBits::decode(key); 125 return MinorKeyBits::decode(key);
131 } 126 }
132 127
133 // Gets the major key from a code object that is a code stub or binary op IC. 128 // Gets the major key from a code object that is a code stub or binary op IC.
134 static Major GetMajorKey(Code* code_stub) { 129 static Major GetMajorKey(Code* code_stub) {
135 return static_cast<Major>(code_stub->major_key()); 130 return static_cast<Major>(code_stub->major_key());
(...skipping 17 matching lines...) Expand all
153 static void GenerateFPStubs(); 148 static void GenerateFPStubs();
154 149
155 // Some stubs put untagged junk on the stack that cannot be scanned by the 150 // Some stubs put untagged junk on the stack that cannot be scanned by the
156 // GC. This means that we must be statically sure that no GC can occur while 151 // GC. This means that we must be statically sure that no GC can occur while
157 // they are running. If that is the case they should override this to return 152 // they are running. If that is the case they should override this to return
158 // true, which will cause an assertion if we try to call something that can 153 // true, which will cause an assertion if we try to call something that can
159 // GC or if we try to put a stack frame on top of the junk, which would not 154 // GC or if we try to put a stack frame on top of the junk, which would not
160 // result in a traversable stack. 155 // result in a traversable stack.
161 virtual bool SometimesSetsUpAFrame() { return true; } 156 virtual bool SometimesSetsUpAFrame() { return true; }
162 157
158 // Lookup the code in the (possibly custom) cache.
159 bool FindCodeInCache(Code** code_out);
160
163 protected: 161 protected:
164 static const int kMajorBits = 6; 162 static const int kMajorBits = 6;
165 static const int kMinorBits = kBitsPerInt - kSmiTagSize - kMajorBits; 163 static const int kMinorBits = kBitsPerInt - kSmiTagSize - kMajorBits;
166 164
167 private: 165 private:
168 // Lookup the code in the (possibly custom) cache.
169 bool FindCodeInCache(Code** code_out);
170
171 // Nonvirtual wrapper around the stub-specific Generate function. Call 166 // Nonvirtual wrapper around the stub-specific Generate function. Call
172 // this function to set up the macro assembler and generate the code. 167 // this function to set up the macro assembler and generate the code.
173 void GenerateCode(MacroAssembler* masm); 168 void GenerateCode(MacroAssembler* masm);
174 169
175 // Generates the assembler code for the stub. 170 // Generates the assembler code for the stub.
176 virtual void Generate(MacroAssembler* masm) = 0; 171 virtual void Generate(MacroAssembler* masm) = 0;
177 172
178 // Perform bookkeeping required after code generation when stub code is 173 // Perform bookkeeping required after code generation when stub code is
179 // initially generated. 174 // initially generated.
180 void RecordCodeGeneration(Code* code, MacroAssembler* masm); 175 void RecordCodeGeneration(Code* code, MacroAssembler* masm);
181 176
182 // Finish the code object after it has been generated. 177 // Finish the code object after it has been generated.
183 virtual void FinishCode(Code* code) { } 178 virtual void FinishCode(Code* code) { }
184 179
185 // Returns true if TryGetCode should fail if it failed
186 // to register newly generated stub in the stub cache.
187 virtual bool MustBeInStubCache() { return false; }
188
189 // Activate newly generated stub. Is called after 180 // Activate newly generated stub. Is called after
190 // registering stub in the stub cache. 181 // registering stub in the stub cache.
191 virtual void Activate(Code* code) { } 182 virtual void Activate(Code* code) { }
192 183
193 // Returns information for computing the number key. 184 // Returns information for computing the number key.
194 virtual Major MajorKey() = 0; 185 virtual Major MajorKey() = 0;
195 virtual int MinorKey() = 0; 186 virtual int MinorKey() = 0;
196 187
197 // BinaryOpStub needs to override this. 188 // BinaryOpStub needs to override this.
198 virtual int GetCodeKind(); 189 virtual int GetCodeKind();
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after
1065 int MinorKey() { return 0; } 1056 int MinorKey() { return 0; }
1066 1057
1067 void Generate(MacroAssembler* masm); 1058 void Generate(MacroAssembler* masm);
1068 1059
1069 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); 1060 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub);
1070 }; 1061 };
1071 1062
1072 } } // namespace v8::internal 1063 } } // namespace v8::internal
1073 1064
1074 #endif // V8_CODE_STUBS_H_ 1065 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « no previous file | src/code-stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698