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

Unified Diff: src/codegen.cc

Issue 269049: Split the AST LoopStatement type into separate types for do/while,... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/codegen.h ('k') | src/ia32/codegen-ia32.h » ('j') | src/parser.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codegen.cc
===================================================================
--- src/codegen.cc (revision 3045)
+++ src/codegen.cc (working copy)
@@ -469,6 +469,25 @@
}
+// Simple condition analysis. ALWAYS_TRUE and ALWAYS_FALSE represent a
+// known result for the test expression, with no side effects.
+CodeGenerator::ConditionAnalysis CodeGenerator::AnalyzeCondition(
+ Expression* cond) {
+ if (cond == NULL) return ALWAYS_TRUE;
+
+ Literal* lit = cond->AsLiteral();
+ if (lit == NULL) return DONT_KNOW;
+
+ if (lit->IsTrue()) {
+ return ALWAYS_TRUE;
+ } else if (lit->IsFalse()) {
+ return ALWAYS_FALSE;
+ }
+
+ return DONT_KNOW;
+}
+
+
static inline void RecordPositions(CodeGenerator* cgen, int pos) {
if (pos != RelocInfo::kNoPosition) {
cgen->masm()->RecordStatementPosition(pos);
« no previous file with comments | « src/codegen.h ('k') | src/ia32/codegen-ia32.h » ('j') | src/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698