Revision: 3186
Author: [email protected]
Date: Fri Oct 30 04:32:42 2009
Log: Add void operator to fast compiler.
Review URL: http://codereview.chromium.org/342055
http://code.google.com/p/v8/source/detail?r=3186
Modified:
/branches/bleeding_edge/src/arm/fast-codegen-arm.cc
/branches/bleeding_edge/src/compiler.cc
/branches/bleeding_edge/src/fast-codegen.cc
/branches/bleeding_edge/src/ia32/fast-codegen-ia32.cc
/branches/bleeding_edge/src/x64/fast-codegen-x64.cc
=======================================
--- /branches/bleeding_edge/src/arm/fast-codegen-arm.cc Fri Oct 30 03:22:31
2009
+++ /branches/bleeding_edge/src/arm/fast-codegen-arm.cc Fri Oct 30 04:32:42
2009
@@ -721,6 +721,32 @@
__ CallRuntime(function, arg_count);
Move(expr->context(), r0);
}
+
+
+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) {
=======================================
--- /branches/bleeding_edge/src/compiler.cc Fri Oct 30 03:22:31 2009
+++ /branches/bleeding_edge/src/compiler.cc Fri Oct 30 04:32:42 2009
@@ -825,7 +825,13 @@
void CodeGenSelector::VisitUnaryOperation(UnaryOperation* expr) {
- BAILOUT("UnaryOperation");
+ switch (expr->op()) {
+ case Token::VOID:
+ ProcessExpression(expr->expression(), Expression::kEffect);
+ break;
+ default:
+ BAILOUT("UnaryOperation");
+ }
}
=======================================
--- /branches/bleeding_edge/src/fast-codegen.cc Fri Oct 30 01:36:46 2009
+++ /branches/bleeding_edge/src/fast-codegen.cc Fri Oct 30 04:32:42 2009
@@ -322,11 +322,6 @@
void FastCodeGenerator::VisitThrow(Throw* expr) {
UNREACHABLE();
}
-
-
-void FastCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {
- UNREACHABLE();
-}
void FastCodeGenerator::VisitCountOperation(CountOperation* expr) {
=======================================
--- /branches/bleeding_edge/src/ia32/fast-codegen-ia32.cc Fri Oct 30
03:22:31 2009
+++ /branches/bleeding_edge/src/ia32/fast-codegen-ia32.cc Fri Oct 30
04:32:42 2009
@@ -727,6 +727,31 @@
__ CallRuntime(function, arg_count);
Move(expr->context(), eax);
}
+
+
+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) {
=======================================
--- /branches/bleeding_edge/src/x64/fast-codegen-x64.cc Fri Oct 30 03:22:31
2009
+++ /branches/bleeding_edge/src/x64/fast-codegen-x64.cc Fri Oct 30 04:32:42
2009
@@ -739,6 +739,31 @@
__ CallRuntime(function, arg_count);
Move(expr->context(), rax);
}
+
+
+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) {
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---