Commit b7c0b738 authored by whesse@chromium.org's avatar whesse@chromium.org

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
parent f57f128a
...@@ -723,6 +723,32 @@ void FastCodeGenerator::VisitCallRuntime(CallRuntime* expr) { ...@@ -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) { void FastCodeGenerator::VisitBinaryOperation(BinaryOperation* expr) {
switch (expr->op()) { switch (expr->op()) {
case Token::COMMA: case Token::COMMA:
......
...@@ -825,7 +825,13 @@ void CodeGenSelector::VisitCallRuntime(CallRuntime* expr) { ...@@ -825,7 +825,13 @@ void CodeGenSelector::VisitCallRuntime(CallRuntime* expr) {
void CodeGenSelector::VisitUnaryOperation(UnaryOperation* expr) { void CodeGenSelector::VisitUnaryOperation(UnaryOperation* expr) {
switch (expr->op()) {
case Token::VOID:
ProcessExpression(expr->expression(), Expression::kEffect);
break;
default:
BAILOUT("UnaryOperation"); BAILOUT("UnaryOperation");
}
} }
......
...@@ -324,11 +324,6 @@ void FastCodeGenerator::VisitThrow(Throw* expr) { ...@@ -324,11 +324,6 @@ void FastCodeGenerator::VisitThrow(Throw* expr) {
} }
void FastCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {
UNREACHABLE();
}
void FastCodeGenerator::VisitCountOperation(CountOperation* expr) { void FastCodeGenerator::VisitCountOperation(CountOperation* expr) {
UNREACHABLE(); UNREACHABLE();
} }
......
...@@ -729,6 +729,31 @@ void FastCodeGenerator::VisitCallRuntime(CallRuntime* expr) { ...@@ -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) { void FastCodeGenerator::VisitBinaryOperation(BinaryOperation* expr) {
switch (expr->op()) { switch (expr->op()) {
case Token::COMMA: case Token::COMMA:
......
...@@ -741,6 +741,31 @@ void FastCodeGenerator::VisitCallRuntime(CallRuntime* expr) { ...@@ -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) { void FastCodeGenerator::VisitBinaryOperation(BinaryOperation* expr) {
switch (expr->op()) { switch (expr->op()) {
case Token::COMMA: case Token::COMMA:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment