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

Unified Diff: src/x64/fast-codegen-x64.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
« src/compiler.cc ('K') | « src/ia32/fast-codegen-ia32.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/fast-codegen-x64.cc
===================================================================
--- src/x64/fast-codegen-x64.cc (revision 3642)
+++ src/x64/fast-codegen-x64.cc (working copy)
@@ -778,13 +778,13 @@
__ push(rsi);
__ Push(boilerplate);
__ CallRuntime(Runtime::kNewClosure, 2);
- Apply(expr->context(), rax);
+ Apply(context_, rax);
}
void FastCodeGenerator::VisitVariableProxy(VariableProxy* expr) {
Comment cmnt(masm_, "[ VariableProxy");
- EmitVariableLoad(expr->var(), expr->context());
+ EmitVariableLoad(expr->var(), context_);
}
@@ -886,7 +886,7 @@
__ Push(expr->flags());
__ CallRuntime(Runtime::kMaterializeRegExpLiteral, 4);
__ bind(&done);
- Apply(expr->context(), rax);
+ Apply(context_, rax);
}
@@ -953,9 +953,9 @@
}
if (result_saved) {
- ApplyTOS(expr->context());
+ ApplyTOS(context_);
} else {
- Apply(expr->context(), rax);
+ Apply(context_, rax);
}
}
@@ -1003,9 +1003,9 @@
}
if (result_saved) {
- ApplyTOS(expr->context());
+ ApplyTOS(context_);
} else {
- Apply(expr->context(), rax);
+ Apply(context_, rax);
}
}
@@ -1117,7 +1117,7 @@
__ pop(rax);
}
- DropAndApply(1, expr->context(), rax);
+ DropAndApply(1, context_, rax);
}
@@ -1153,7 +1153,7 @@
}
// Receiver and key are still on stack.
- DropAndApply(2, expr->context(), rax);
+ DropAndApply(2, context_, rax);
}
@@ -1167,12 +1167,12 @@
if (key->IsPropertyName()) {
EmitNamedPropertyLoad(expr);
// Drop receiver left on the stack by IC.
- DropAndApply(1, expr->context(), rax);
+ DropAndApply(1, context_, rax);
} else {
VisitForValue(expr->key(), kStack);
EmitKeyedPropertyLoad(expr);
// Drop key and receiver left on the stack by IC.
- DropAndApply(2, expr->context(), rax);
+ DropAndApply(2, context_, rax);
}
}
@@ -1196,7 +1196,7 @@
// Restore context register.
__ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
// Discard the function left on TOS.
- DropAndApply(1, expr->context(), rax);
+ DropAndApply(1, context_, rax);
}
@@ -1214,7 +1214,7 @@
// Restore context register.
__ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
// Discard the function left on TOS.
- DropAndApply(1, expr->context(), rax);
+ DropAndApply(1, context_, rax);
}
@@ -1323,7 +1323,7 @@
__ Call(construct_builtin, RelocInfo::CONSTRUCT_CALL);
// Replace function on TOS with result in rax, or pop it.
- DropAndApply(1, expr->context(), rax);
+ DropAndApply(1, context_, rax);
}
@@ -1352,10 +1352,10 @@
// Restore context register.
__ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
// Discard the function left on TOS.
- DropAndApply(1, expr->context(), rax);
+ DropAndApply(1, context_, rax);
} else {
__ CallRuntime(expr->function(), arg_count);
- Apply(expr->context(), rax);
+ Apply(context_, rax);
}
}
@@ -1364,9 +1364,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;
@@ -1403,14 +1402,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;
@@ -1432,14 +1429,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() &&
@@ -1465,7 +1460,7 @@
}
__ CallRuntime(Runtime::kTypeof, 1);
- Apply(expr->context(), rax);
+ Apply(context_, rax);
break;
}
@@ -1486,9 +1481,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.
@@ -1501,8 +1495,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(Smi::FromInt(0));
}
VisitForValue(prop->obj(), kStack);
@@ -1520,7 +1513,7 @@
// Save result for postfix expressions.
if (expr->is_postfix()) {
- switch (expr->context()) {
+ switch (context_) {
case Expression::kUninitialized:
UNREACHABLE();
case Expression::kEffect:
@@ -1564,12 +1557,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: {
@@ -1581,11 +1574,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(), rax);
+ DropAndApply(1, context_, rax);
}
break;
}
@@ -1597,11 +1590,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(), rax);
+ DropAndApply(2, context_, rax);
}
break;
}
@@ -1612,9 +1605,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;
@@ -1636,7 +1627,7 @@
case Token::SAR:
VisitForValue(expr->left(), kStack);
VisitForValue(expr->right(), kAccumulator);
- EmitBinaryOp(expr->op(), expr->context());
+ EmitBinaryOp(expr->op(), context_);
break;
default:
@@ -1654,7 +1645,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;
@@ -1753,13 +1744,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) {
__ movq(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
- Apply(expr->context(), rax);
+ Apply(context_, rax);
}
« src/compiler.cc ('K') | « src/ia32/fast-codegen-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698