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

Unified Diff: src/ia32/fast-codegen-ia32.cc

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
Index: src/ia32/fast-codegen-ia32.cc
===================================================================
--- src/ia32/fast-codegen-ia32.cc (revision 3642)
+++ src/ia32/fast-codegen-ia32.cc (working copy)
@@ -775,13 +775,13 @@
__ push(esi);
__ push(Immediate(boilerplate));
__ CallRuntime(Runtime::kNewClosure, 2);
- Apply(expr->context(), eax);
+ Apply(context_, eax);
}
void FastCodeGenerator::VisitVariableProxy(VariableProxy* expr) {
Comment cmnt(masm_, "[ VariableProxy");
- EmitVariableLoad(expr->var(), expr->context());
+ EmitVariableLoad(expr->var(), context_);
}
@@ -885,7 +885,7 @@
__ CallRuntime(Runtime::kMaterializeRegExpLiteral, 4);
// Label done:
__ bind(&done);
- Apply(expr->context(), eax);
+ Apply(context_, eax);
}
@@ -951,9 +951,9 @@
}
if (result_saved) {
- ApplyTOS(expr->context());
+ ApplyTOS(context_);
} else {
- Apply(expr->context(), eax);
+ Apply(context_, eax);
}
}
@@ -1001,9 +1001,9 @@
}
if (result_saved) {
- ApplyTOS(expr->context());
+ ApplyTOS(context_);
} else {
- Apply(expr->context(), eax);
+ Apply(context_, eax);
}
}
@@ -1117,7 +1117,7 @@
__ pop(eax);
}
- DropAndApply(1, expr->context(), eax);
+ DropAndApply(1, context_, eax);
}
@@ -1153,7 +1153,7 @@
}
// Receiver and key are still on stack.
- DropAndApply(2, expr->context(), eax);
+ DropAndApply(2, context_, eax);
}
@@ -1167,12 +1167,12 @@
if (key->IsPropertyName()) {
EmitNamedPropertyLoad(expr);
// Drop receiver left on the stack by IC.
- DropAndApply(1, expr->context(), eax);
+ DropAndApply(1, context_, eax);
} else {
VisitForValue(expr->key(), kStack);
EmitKeyedPropertyLoad(expr);
// Drop key and receiver left on the stack by IC.
- DropAndApply(2, expr->context(), eax);
+ DropAndApply(2, context_, eax);
}
}
@@ -1194,7 +1194,7 @@
__ call(ic, mode);
// Restore context register.
__ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
- Apply(expr->context(), eax);
+ Apply(context_, eax);
}
@@ -1211,7 +1211,7 @@
__ CallStub(&stub);
// Restore context register.
__ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
- DropAndApply(1, expr->context(), eax);
+ DropAndApply(1, context_, eax);
}
@@ -1317,7 +1317,7 @@
__ call(construct_builtin, RelocInfo::CONSTRUCT_CALL);
// Replace function on TOS with result in eax, or pop it.
- DropAndApply(1, expr->context(), eax);
+ DropAndApply(1, context_, eax);
}
@@ -1349,7 +1349,7 @@
// Call the C runtime function.
__ CallRuntime(expr->function(), arg_count);
}
- Apply(expr->context(), eax);
+ Apply(context_, eax);
}
@@ -1357,9 +1357,8 @@
switch (expr->op()) {
case Token::VOID: {
Comment cmnt(masm_, "[ UnaryOperation (VOID)");
- ASSERT_EQ(Expression::kEffect, expr->expression()->context());
- Visit(expr->expression());
- switch (expr->context()) {
+ VisitForEffect(expr->expression());
+ switch (context_) {
case Expression::kUninitialized:
UNREACHABLE();
break;
@@ -1396,14 +1395,12 @@
case Token::NOT: {
Comment cmnt(masm_, "[ UnaryOperation (NOT)");
- ASSERT_EQ(Expression::kTest, expr->expression()->context());
-
Label materialize_true, materialize_false, done;
// Initially assume a pure test context. Notice that the labels are
// swapped.
Label* if_true = false_label_;
Label* if_false = true_label_;
- switch (expr->context()) {
+ switch (context_) {
case Expression::kUninitialized:
UNREACHABLE();
break;
@@ -1425,14 +1422,12 @@
break;
}
VisitForControl(expr->expression(), if_true, if_false);
- Apply(expr->context(), if_false, if_true); // Labels swapped.
+ Apply(context_, if_false, if_true); // Labels swapped.
break;
}
case Token::TYPEOF: {
Comment cmnt(masm_, "[ UnaryOperation (TYPEOF)");
- ASSERT_EQ(Expression::kValue, expr->expression()->context());
-
VariableProxy* proxy = expr->expression()->AsVariableProxy();
if (proxy != NULL &&
!proxy->var()->is_this() &&
@@ -1458,7 +1453,7 @@
}
__ CallRuntime(Runtime::kTypeof, 1);
- Apply(expr->context(), eax);
+ Apply(context_, eax);
break;
}
@@ -1479,9 +1474,8 @@
// In case of a property we use the uninitialized expression context
// of the key to detect a named property.
if (prop != NULL) {
- assign_type = (prop->key()->context() == Expression::kUninitialized)
- ? NAMED_PROPERTY
- : KEYED_PROPERTY;
+ assign_type =
+ (prop->key()->IsPropertyName()) ? NAMED_PROPERTY : KEYED_PROPERTY;
}
// Evaluate expression and get value.
@@ -1494,8 +1488,7 @@
location_ = saved_location;
} else {
// Reserve space for result of postfix operation.
- if (expr->is_postfix() && expr->context() != Expression::kEffect) {
- ASSERT(expr->context() != Expression::kUninitialized);
+ if (expr->is_postfix() && context_ != Expression::kEffect) {
__ push(Immediate(Smi::FromInt(0)));
}
VisitForValue(prop->obj(), kStack);
@@ -1513,7 +1506,7 @@
// Save result for postfix expressions.
if (expr->is_postfix()) {
- switch (expr->context()) {
+ switch (context_) {
case Expression::kUninitialized:
UNREACHABLE();
case Expression::kEffect:
@@ -1557,12 +1550,12 @@
Expression::kEffect);
// For all contexts except kEffect: We have the result on
// top of the stack.
- if (expr->context() != Expression::kEffect) {
- ApplyTOS(expr->context());
+ if (context_ != Expression::kEffect) {
+ ApplyTOS(context_);
}
} else {
EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(),
- expr->context());
+ context_);
}
break;
case NAMED_PROPERTY: {
@@ -1574,11 +1567,11 @@
__ nop();
if (expr->is_postfix()) {
__ Drop(1); // Result is on the stack under the receiver.
- if (expr->context() != Expression::kEffect) {
- ApplyTOS(expr->context());
+ if (context_ != Expression::kEffect) {
+ ApplyTOS(context_);
}
} else {
- DropAndApply(1, expr->context(), eax);
+ DropAndApply(1, context_, eax);
}
break;
}
@@ -1590,11 +1583,11 @@
__ nop();
if (expr->is_postfix()) {
__ Drop(2); // Result is on the stack under the key and the receiver.
- if (expr->context() != Expression::kEffect) {
- ApplyTOS(expr->context());
+ if (context_ != Expression::kEffect) {
+ ApplyTOS(context_);
}
} else {
- DropAndApply(2, expr->context(), eax);
+ DropAndApply(2, context_, eax);
}
break;
}
@@ -1606,9 +1599,7 @@
Comment cmnt(masm_, "[ BinaryOperation");
switch (expr->op()) {
case Token::COMMA:
- ASSERT_EQ(Expression::kEffect, expr->left()->context());
- ASSERT_EQ(expr->context(), expr->right()->context());
- Visit(expr->left());
+ VisitForEffect(expr->left());
Visit(expr->right());
break;
@@ -1630,7 +1621,7 @@
case Token::SAR:
VisitForValue(expr->left(), kStack);
VisitForValue(expr->right(), kAccumulator);
- EmitBinaryOp(expr->op(), expr->context());
+ EmitBinaryOp(expr->op(), context_);
break;
default:
@@ -1648,7 +1639,7 @@
// Initially assume we are in a test context.
Label* if_true = true_label_;
Label* if_false = false_label_;
- switch (expr->context()) {
+ switch (context_) {
case Expression::kUninitialized:
UNREACHABLE();
break;
@@ -1750,13 +1741,13 @@
// Convert the result of the comparison into one expected for this
// expression's context.
- Apply(expr->context(), if_true, if_false);
+ Apply(context_, if_true, if_false);
}
void FastCodeGenerator::VisitThisFunction(ThisFunction* expr) {
__ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
- Apply(expr->context(), eax);
+ Apply(context_, eax);
}
« src/compiler.cc ('K') | « src/fast-codegen.cc ('k') | src/x64/fast-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698