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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 4501 matching lines...) Expand 10 before | Expand all | Expand 10 after
4512 4512
4513 HBasicBlock* join = 4513 HBasicBlock* join =
4514 CreateJoin(materialize_false, materialize_true, expr->id()); 4514 CreateJoin(materialize_false, materialize_true, expr->id());
4515 set_current_block(join); 4515 set_current_block(join);
4516 ast_context()->ReturnValue(Pop()); 4516 ast_context()->ReturnValue(Pop());
4517 } else { 4517 } else {
4518 ASSERT(ast_context()->IsEffect()); 4518 ASSERT(ast_context()->IsEffect());
4519 VisitForEffect(expr->expression()); 4519 VisitForEffect(expr->expression());
4520 } 4520 }
4521 4521
4522 } else if (op == Token::BIT_NOT || op == Token::SUB) { 4522 } else {
4523 VISIT_FOR_VALUE(expr->expression()); 4523 VISIT_FOR_VALUE(expr->expression());
4524 HValue* value = Pop(); 4524 HValue* value = Pop();
4525 HInstruction* instr = NULL; 4525 HInstruction* instr = NULL;
4526 switch (op) { 4526 switch (op) {
4527 case Token::BIT_NOT: 4527 case Token::BIT_NOT:
4528 instr = new HBitNot(value); 4528 instr = new HBitNot(value);
4529 break; 4529 break;
4530 case Token::SUB: 4530 case Token::SUB:
4531 instr = new HMul(graph_->GetConstantMinus1(), value); 4531 instr = new HMul(value, graph_->GetConstantMinus1());
4532 break;
4533 case Token::ADD:
4534 instr = new HMul(value, graph_->GetConstant1());
4535 break;
4536 case Token::TYPEOF:
4537 instr = new HTypeof(value);
4532 break; 4538 break;
4533 default: 4539 default:
4534 UNREACHABLE(); 4540 BAILOUT("Value: unsupported unary operation");
4535 break; 4541 break;
4536 } 4542 }
4537 ast_context()->ReturnInstruction(instr, expr->id()); 4543 ast_context()->ReturnInstruction(instr, expr->id());
4538 } else if (op == Token::TYPEOF) {
4539 VISIT_FOR_VALUE(expr->expression());
4540 HValue* value = Pop();
4541 ast_context()->ReturnInstruction(new HTypeof(value), expr->id());
4542 } else {
4543 BAILOUT("Value: unsupported unary operation");
4544 } 4544 }
4545 } 4545 }
4546 4546
4547 4547
4548 void HGraphBuilder::VisitIncrementOperation(IncrementOperation* expr) { 4548 void HGraphBuilder::VisitIncrementOperation(IncrementOperation* expr) {
4549 // IncrementOperation is never visited by the visitor. It only 4549 // IncrementOperation is never visited by the visitor. It only
4550 // occurs as a subexpression of CountOperation. 4550 // occurs as a subexpression of CountOperation.
4551 UNREACHABLE(); 4551 UNREACHABLE();
4552 } 4552 }
4553 4553
(...skipping 1352 matching lines...) Expand 10 before | Expand all | Expand 10 after
5906 } 5906 }
5907 } 5907 }
5908 5908
5909 #ifdef DEBUG 5909 #ifdef DEBUG
5910 if (graph_ != NULL) graph_->Verify(); 5910 if (graph_ != NULL) graph_->Verify();
5911 if (allocator_ != NULL) allocator_->Verify(); 5911 if (allocator_ != NULL) allocator_->Verify();
5912 #endif 5912 #endif
5913 } 5913 }
5914 5914
5915 } } // namespace v8::internal 5915 } } // namespace v8::internal
OLDNEW
« 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