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

Unified Diff: src/fast-codegen.h

Issue 546075: First step of refactoring expression contexts in the toplevel code... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 11 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
« src/compiler.cc ('K') | « src/compiler.cc ('k') | src/fast-codegen.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/fast-codegen.h
===================================================================
--- src/fast-codegen.h (revision 3642)
+++ src/fast-codegen.h (working copy)
@@ -250,27 +250,74 @@
// register.
MemOperand EmitSlotSearch(Slot* slot, Register scratch);
+ void VisitForEffect(Expression* expr) {
+ Expression::Context saved_context = context_;
+ context_ = Expression::kEffect;
+ Visit(expr);
+ context_ = saved_context;
+ }
+
void VisitForValue(Expression* expr, Location where) {
- ASSERT(expr->context() == Expression::kValue);
+ Expression::Context saved_context = context_;
Location saved_location = location_;
+ context_ = Expression::kValue;
location_ = where;
Visit(expr);
+ context_ = saved_context;
location_ = saved_location;
}
void VisitForControl(Expression* expr, Label* if_true, Label* if_false) {
- ASSERT(expr->context() == Expression::kTest ||
- expr->context() == Expression::kValueTest ||
- expr->context() == Expression::kTestValue);
+ Expression::Context saved_context = context_;
Label* saved_true = true_label_;
Label* saved_false = false_label_;
+ context_ = Expression::kTest;
true_label_ = if_true;
false_label_ = if_false;
Visit(expr);
+ context_ = saved_context;
true_label_ = saved_true;
false_label_ = saved_false;
}
+ void VisitForValueControl(Expression* expr,
+ Location where,
+ Label* if_true,
+ Label* if_false) {
+ Expression::Context saved_context = context_;
+ Location saved_location = location_;
+ Label* saved_true = true_label_;
+ Label* saved_false = false_label_;
+ context_ = Expression::kValueTest;
+ location_ = where;
+ true_label_ = if_true;
+ false_label_ = if_false;
+ Visit(expr);
+ context_ = saved_context;
+ location_ = saved_location;
+ true_label_ = saved_true;
+ false_label_ = saved_false;
+ }
+
+ void VisitForControlValue(Expression* expr,
+ Location where,
+ Label* if_true,
+ Label* if_false) {
+ Expression::Context saved_context = context_;
+ Location saved_location = location_;
+ Label* saved_true = true_label_;
+ Label* saved_false = false_label_;
+ context_ = Expression::kTestValue;
+ location_ = where;
+ true_label_ = if_true;
+ false_label_ = if_false;
+ Visit(expr);
+ context_ = saved_context;
+ location_ = saved_location;
+ true_label_ = saved_true;
+ false_label_ = saved_false;
+ }
+
void VisitDeclarations(ZoneList<Declaration*>* declarations);
void DeclareGlobals(Handle<FixedArray> pairs);
@@ -356,6 +403,7 @@
NestedStatement* nesting_stack_;
int loop_depth_;
+ Expression::Context context_;
Location location_;
Label* true_label_;
Label* false_label_;
« src/compiler.cc ('K') | « src/compiler.cc ('k') | src/fast-codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698