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

Unified Diff: src/arm/fast-codegen-arm.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
« no previous file with comments | « no previous file | src/ast.h » ('j') | src/compiler.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm/fast-codegen-arm.cc
===================================================================
--- src/arm/fast-codegen-arm.cc (revision 3642)
+++ src/arm/fast-codegen-arm.cc (working copy)
@@ -662,13 +662,13 @@
__ mov(r0, Operand(boilerplate));
__ stm(db_w, sp, cp.bit() | r0.bit());
__ CallRuntime(Runtime::kNewClosure, 2);
- Apply(expr->context(), r0);
+ Apply(context_, r0);
}
void FastCodeGenerator::VisitVariableProxy(VariableProxy* expr) {
Comment cmnt(masm_, "[ VariableProxy");
- EmitVariableLoad(expr->var(), expr->context());
+ EmitVariableLoad(expr->var(), context_);
}
@@ -768,7 +768,7 @@
__ stm(db_w, sp, r4.bit() | r3.bit() | r2.bit() | r1.bit());
__ CallRuntime(Runtime::kMaterializeRegExpLiteral, 4);
__ bind(&done);
- Apply(expr->context(), r0);
+ Apply(context_, r0);
}
@@ -840,9 +840,9 @@
}
if (result_saved) {
- ApplyTOS(expr->context());
+ ApplyTOS(context_);
} else {
- Apply(expr->context(), r0);
+ Apply(context_, r0);
}
}
@@ -893,9 +893,9 @@
}
if (result_saved) {
- ApplyTOS(expr->context());
+ ApplyTOS(context_);
} else {
- Apply(expr->context(), r0);
+ Apply(context_, r0);
}
}
@@ -1007,7 +1007,7 @@
__ pop(r0);
}
- DropAndApply(1, expr->context(), r0);
+ DropAndApply(1, context_, r0);
}
@@ -1042,7 +1042,7 @@
}
// Receiver and key are still on stack.
- DropAndApply(2, expr->context(), r0);
+ DropAndApply(2, context_, r0);
}
@@ -1056,12 +1056,12 @@
if (key->IsPropertyName()) {
EmitNamedPropertyLoad(expr);
// Drop receiver left on the stack by IC.
- DropAndApply(1, expr->context(), r0);
+ DropAndApply(1, context_, r0);
} else {
VisitForValue(expr->key(), kStack);
EmitKeyedPropertyLoad(expr);
// Drop key and receiver left on the stack by IC.
- DropAndApply(2, expr->context(), r0);
+ DropAndApply(2, context_, r0);
}
}
@@ -1083,7 +1083,7 @@
// Restore context register.
__ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
// Discard the function left on TOS.
- DropAndApply(1, expr->context(), r0);
+ DropAndApply(1, context_, r0);
}
@@ -1101,7 +1101,7 @@
// Restore context register.
__ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
// Discard the function left on TOS.
- DropAndApply(1, expr->context(), r0);
+ DropAndApply(1, context_, r0);
}
@@ -1207,7 +1207,7 @@
__ Call(construct_builtin, RelocInfo::CONSTRUCT_CALL);
// Replace function on TOS with result in r0, or pop it.
- DropAndApply(1, expr->context(), r0);
+ DropAndApply(1, context_, r0);
}
@@ -1237,11 +1237,11 @@
// Restore context register.
__ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
// Discard the function left on TOS.
- DropAndApply(1, expr->context(), r0);
+ DropAndApply(1, context_, r0);
} else {
// Call the C runtime function.
__ CallRuntime(expr->function(), arg_count);
- Apply(expr->context(), r0);
+ Apply(context_, r0);
}
}
@@ -1250,9 +1250,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;
@@ -1289,14 +1288,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;
@@ -1318,14 +1315,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() &&
@@ -1352,7 +1347,7 @@
}
__ CallRuntime(Runtime::kTypeof, 1);
- Apply(expr->context(), r0);
+ Apply(context_, r0);
break;
}
@@ -1373,9 +1368,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.
@@ -1388,8 +1382,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) {
__ mov(ip, Operand(Smi::FromInt(0)));
__ push(ip);
}
@@ -1408,7 +1401,7 @@
// Save result for postfix expressions.
if (expr->is_postfix()) {
- switch (expr->context()) {
+ switch (context_) {
case Expression::kUninitialized:
UNREACHABLE();
case Expression::kEffect:
@@ -1451,12 +1444,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: {
@@ -1465,11 +1458,11 @@
__ Call(ic, RelocInfo::CODE_TARGET);
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(), r0);
+ DropAndApply(1, context_, r0);
}
break;
}
@@ -1478,11 +1471,11 @@
__ Call(ic, RelocInfo::CODE_TARGET);
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(), r0);
+ DropAndApply(2, context_, r0);
}
break;
}
@@ -1494,9 +1487,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;
@@ -1518,7 +1509,7 @@
case Token::SAR:
VisitForValue(expr->left(), kStack);
VisitForValue(expr->right(), kAccumulator);
- EmitBinaryOp(expr->op(), expr->context());
+ EmitBinaryOp(expr->op(), context_);
break;
default:
@@ -1536,7 +1527,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;
@@ -1638,13 +1629,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) {
__ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
- Apply(expr->context(), r0);
+ Apply(context_, r0);
}
« no previous file with comments | « no previous file | src/ast.h » ('j') | src/compiler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698