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

Unified Diff: src/hydrogen.cc

Issue 6685045: Add support for unary plus in hydrogen compiler. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Changed sign implementation to use HMul. Created 9 years, 9 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/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 6cb2b240a95b61103609b49d4f2532282985591d..41d54865969a05e7a46f02e7f01bd17d82534084 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -4519,7 +4519,7 @@ void HGraphBuilder::VisitUnaryOperation(UnaryOperation* expr) {
VisitForEffect(expr->expression());
}
- } else if (op == Token::BIT_NOT || op == Token::SUB) {
+ } else {
VISIT_FOR_VALUE(expr->expression());
HValue* value = Pop();
HInstruction* instr = NULL;
@@ -4528,19 +4528,19 @@ void HGraphBuilder::VisitUnaryOperation(UnaryOperation* expr) {
instr = new HBitNot(value);
break;
case Token::SUB:
- instr = new HMul(graph_->GetConstantMinus1(), value);
+ instr = new HMul(value, graph_->GetConstantMinus1());
+ break;
+ case Token::ADD:
+ instr = new HMul(value, graph_->GetConstant1());
+ break;
+ case Token::TYPEOF:
+ instr = new HTypeof(value);
break;
default:
- UNREACHABLE();
+ BAILOUT("Value: unsupported unary operation");
break;
}
ast_context()->ReturnInstruction(instr, expr->id());
- } else if (op == Token::TYPEOF) {
- VISIT_FOR_VALUE(expr->expression());
- HValue* value = Pop();
- ast_context()->ReturnInstruction(new HTypeof(value), expr->id());
- } else {
- BAILOUT("Value: unsupported unary operation");
}
}
« no previous file with comments | « no previous file | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698