Add void operator to fast compiler.

Review URL: http://codereview.chromium.org/342055

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3186 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
whesse@chromium.org 2009-10-30 11:32:42 +00:00
parent f57f128aba
commit b7c0b738c7
5 changed files with 83 additions and 6 deletions

View File

@ -723,6 +723,32 @@ void FastCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
}
void FastCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {
Comment cmnt(masm_, "[ UnaryOperation");
switch (expr->op()) {
case Token::VOID:
Visit(expr->expression());
ASSERT_EQ(Expression::kEffect, expr->expression()->context());
switch (expr->context()) {
case Expression::kUninitialized:
UNREACHABLE();
break;
case Expression::kValue:
__ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
__ push(ip);
break;
case Expression::kEffect:
break;
}
break;
default:
UNREACHABLE();
}
}
void FastCodeGenerator::VisitBinaryOperation(BinaryOperation* expr) {
switch (expr->op()) {
case Token::COMMA:

View File

@ -825,7 +825,13 @@ void CodeGenSelector::VisitCallRuntime(CallRuntime* expr) {
void CodeGenSelector::VisitUnaryOperation(UnaryOperation* expr) {
BAILOUT("UnaryOperation");
switch (expr->op()) {
case Token::VOID:
ProcessExpression(expr->expression(), Expression::kEffect);
break;
default:
BAILOUT("UnaryOperation");
}
}

View File

@ -324,11 +324,6 @@ void FastCodeGenerator::VisitThrow(Throw* expr) {
}
void FastCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {
UNREACHABLE();
}
void FastCodeGenerator::VisitCountOperation(CountOperation* expr) {
UNREACHABLE();
}

View File

@ -729,6 +729,31 @@ void FastCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
}
void FastCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {
Comment cmnt(masm_, "[ UnaryOperation");
switch (expr->op()) {
case Token::VOID:
Visit(expr->expression());
ASSERT_EQ(Expression::kEffect, expr->expression()->context());
switch (expr->context()) {
case Expression::kUninitialized:
UNREACHABLE();
break;
case Expression::kValue:
__ push(Immediate(Factory::undefined_value()));
break;
case Expression::kEffect:
break;
}
break;
default:
UNREACHABLE();
}
}
void FastCodeGenerator::VisitBinaryOperation(BinaryOperation* expr) {
switch (expr->op()) {
case Token::COMMA:

View File

@ -741,6 +741,31 @@ void FastCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
}
void FastCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {
Comment cmnt(masm_, "[ UnaryOperation");
switch (expr->op()) {
case Token::VOID:
Visit(expr->expression());
ASSERT_EQ(Expression::kEffect, expr->expression()->context());
switch (expr->context()) {
case Expression::kUninitialized:
UNREACHABLE();
break;
case Expression::kValue:
__ PushRoot(Heap::kUndefinedValueRootIndex);
break;
case Expression::kEffect:
break;
}
break;
default:
UNREACHABLE();
}
}
void FastCodeGenerator::VisitBinaryOperation(BinaryOperation* expr) {
switch (expr->op()) {
case Token::COMMA: