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

Side by Side Diff: src/codegen.h

Issue 5002: Port of fast-case switch to ARM (Closed)
Patch Set: Updates based on review comments Created 12 years, 2 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
« no previous file with comments | « no previous file | src/codegen.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 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 // Support for accessing the value field of an object (used by Date). 159 // Support for accessing the value field of an object (used by Date).
160 virtual void GenerateValueOf(ZoneList<Expression*>* args) = 0; 160 virtual void GenerateValueOf(ZoneList<Expression*>* args) = 0;
161 virtual void GenerateSetValueOf(ZoneList<Expression*>* args) = 0; 161 virtual void GenerateSetValueOf(ZoneList<Expression*>* args) = 0;
162 162
163 // Fast support for charCodeAt(n). 163 // Fast support for charCodeAt(n).
164 virtual void GenerateFastCharCodeAt(ZoneList<Expression*>* args) = 0; 164 virtual void GenerateFastCharCodeAt(ZoneList<Expression*>* args) = 0;
165 165
166 // Fast support for object equality testing. 166 // Fast support for object equality testing.
167 virtual void GenerateObjectEquals(ZoneList<Expression*>* args) = 0; 167 virtual void GenerateObjectEquals(ZoneList<Expression*>* args) = 0;
168 168
169
170 // Multiple methods for fast case switch statement support.
171
172 // The limit of the range of a fast-case switch, as a factor of the number
173 // of cases of the switch. Each platform should return a value that
174 // is optimal compared to the default code generated for a switch statement
175 // on that platform.
176 virtual int FastCaseSwitchMaxOverheadFactor() = 0;
177
178 // The minimal number of cases in a switch before the fast-case switch
179 // optimization is enabled. Each platform should return a value that
180 // is optimal compared to the default code generated for a switch statement
181 // on that platform.
182 virtual int FastCaseSwitchMinCaseCount() = 0;
183
184 // Allocate a jump table and create code to jump through it.
185 // Should call GenerateFastCaseSwitchCases to generate the code for
186 // all the cases at the appropriate point.
187 virtual void GenerateFastCaseSwitchJumpTable(
188 SwitchStatement* node, int min_index, int range, Label *fail_label,
189 SmartPointer<Label*> &case_targets, SmartPointer<Label>& case_labels) = 0;
190
191 // Generate the code for cases for the fast case switch.
192 // Called by GenerateFastCaseSwitchJumpTable.
193 virtual void GenerateFastCaseSwitchCases(
194 SwitchStatement* node, SmartPointer<Label> &case_labels);
195
196 // Fast support for constant-Smi switches.
197 virtual void GenerateFastCaseSwitchStatement(
198 SwitchStatement *node, int min_index, int range, int default_index);
199
200 // Fast support for constant-Smi switches. Tests whether switch statement
201 // permits optimization and calls GenerateFastCaseSwitch if it does.
202 // Returns true if the fast-case switch was generated, and false if not.
203 virtual bool TryGenerateFastCaseSwitchStatement(SwitchStatement *node);
204
205
169 private: 206 private:
170 bool is_eval_; // Tells whether code is generated for eval. 207 bool is_eval_; // Tells whether code is generated for eval.
171 Handle<Script> script_; 208 Handle<Script> script_;
172 List<DeferredCode*> deferred_; 209 List<DeferredCode*> deferred_;
173 }; 210 };
174 211
175 212
176 // RuntimeStub models code stubs calling entrypoints in the Runtime class. 213 // RuntimeStub models code stubs calling entry points in the Runtime class.
177 class RuntimeStub : public CodeStub { 214 class RuntimeStub : public CodeStub {
178 public: 215 public:
179 explicit RuntimeStub(Runtime::FunctionId id, int num_arguments) 216 explicit RuntimeStub(Runtime::FunctionId id, int num_arguments)
180 : id_(id), num_arguments_(num_arguments) { } 217 : id_(id), num_arguments_(num_arguments) { }
181 218
182 void Generate(MacroAssembler* masm); 219 void Generate(MacroAssembler* masm);
183 220
184 // Disassembler support. It is useful to be able to print the name 221 // Disassembler support. It is useful to be able to print the name
185 // of the runtime function called through this stub. 222 // of the runtime function called through this stub.
186 static const char* GetNameFromMinorKey(int minor_key) { 223 static const char* GetNameFromMinorKey(int minor_key) {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 int MinorKey() { return 1; } 339 int MinorKey() { return 1; }
303 340
304 const char* GetName() { return "JSConstructEntryStub"; } 341 const char* GetName() { return "JSConstructEntryStub"; }
305 }; 342 };
306 343
307 344
308 } // namespace internal 345 } // namespace internal
309 } // namespace v8 346 } // namespace v8
310 347
311 #endif // V8_CODEGEN_H_ 348 #endif // V8_CODEGEN_H_
OLDNEW
« no previous file with comments | « no previous file | src/codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698