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

Unified Diff: src/fast-codegen.h

Issue 597021: Simple type tracking in the fast code generator. (Closed)
Patch Set: Created 10 years, 10 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
Index: src/fast-codegen.h
diff --git a/src/fast-codegen.h b/src/fast-codegen.h
index 5bc03374e09224d2264bbd68b2ae97429068431a..a784381a90522de68182bc188c0f7d148546c847 100644
--- a/src/fast-codegen.h
+++ b/src/fast-codegen.h
@@ -97,6 +97,12 @@ class FastCodeGenerator: public AstVisitor {
return (reg.is(accumulator0())) ? accumulator1() : accumulator0();
}
+ // Flags are true if the respective register is statically known to hold a
+ // smi. We do not track every register, only the accumulator registers.
+ bool is_smi(Register reg) { return (smi_bits_ & reg.bit()) != 0; }
fschneider 2010/02/10 15:14:33 What happens if reg == no_reg? Maybe we should AS
Kevin Millikin (Chromium) 2010/02/11 08:30:09 Done.
+ void set_as_smi(Register reg) { smi_bits_ = smi_bits_ | reg.bit(); }
+ void clear_as_smi(Register reg) { smi_bits_ = smi_bits_ & ~reg.bit(); }
+
// AST node visit functions.
#define DECLARE_VISIT(type) virtual void Visit##type(type* node);
AST_NODE_LIST(DECLARE_VISIT)
@@ -129,6 +135,7 @@ class FastCodeGenerator: public AstVisitor {
CompilationInfo* info_;
Label bailout_;
Register destination_;
+ uint32_t smi_bits_;
fschneider 2010/02/10 15:14:33 smi_bits_ should be initialized to 0?
Kevin Millikin (Chromium) 2010/02/11 08:30:09 Done.
DISALLOW_COPY_AND_ASSIGN(FastCodeGenerator);
};

Powered by Google App Engine
This is Rietveld 408576698