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

Unified Diff: src/codegen.h

Issue 5002: Port of fast-case switch to ARM (Closed)
Patch Set: Updates based on review comments Created 12 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/codegen.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codegen.h
diff --git a/src/codegen.h b/src/codegen.h
index 7dc6bfb270b16b326a8f87b95391188b90a1274b..5f5d4988abf78e7c678f86d3a34f5f72302488ab 100644
--- a/src/codegen.h
+++ b/src/codegen.h
@@ -166,6 +166,43 @@ class CodeGenerator: public Visitor {
// Fast support for object equality testing.
virtual void GenerateObjectEquals(ZoneList<Expression*>* args) = 0;
+
+ // Multiple methods for fast case switch statement support.
+
+ // The limit of the range of a fast-case switch, as a factor of the number
+ // of cases of the switch. Each platform should return a value that
+ // is optimal compared to the default code generated for a switch statement
+ // on that platform.
+ virtual int FastCaseSwitchMaxOverheadFactor() = 0;
+
+ // The minimal number of cases in a switch before the fast-case switch
+ // optimization is enabled. Each platform should return a value that
+ // is optimal compared to the default code generated for a switch statement
+ // on that platform.
+ virtual int FastCaseSwitchMinCaseCount() = 0;
+
+ // Allocate a jump table and create code to jump through it.
+ // Should call GenerateFastCaseSwitchCases to generate the code for
+ // all the cases at the appropriate point.
+ virtual void GenerateFastCaseSwitchJumpTable(
+ SwitchStatement* node, int min_index, int range, Label *fail_label,
+ SmartPointer<Label*> &case_targets, SmartPointer<Label>& case_labels) = 0;
+
+ // Generate the code for cases for the fast case switch.
+ // Called by GenerateFastCaseSwitchJumpTable.
+ virtual void GenerateFastCaseSwitchCases(
+ SwitchStatement* node, SmartPointer<Label> &case_labels);
+
+ // Fast support for constant-Smi switches.
+ virtual void GenerateFastCaseSwitchStatement(
+ SwitchStatement *node, int min_index, int range, int default_index);
+
+ // Fast support for constant-Smi switches. Tests whether switch statement
+ // permits optimization and calls GenerateFastCaseSwitch if it does.
+ // Returns true if the fast-case switch was generated, and false if not.
+ virtual bool TryGenerateFastCaseSwitchStatement(SwitchStatement *node);
+
+
private:
bool is_eval_; // Tells whether code is generated for eval.
Handle<Script> script_;
@@ -173,7 +210,7 @@ class CodeGenerator: public Visitor {
};
-// RuntimeStub models code stubs calling entrypoints in the Runtime class.
+// RuntimeStub models code stubs calling entry points in the Runtime class.
class RuntimeStub : public CodeStub {
public:
explicit RuntimeStub(Runtime::FunctionId id, int num_arguments)
« 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