OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 8595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8606 return ast_context()->ReturnInstruction(instr, expr->id()); | 8606 return ast_context()->ReturnInstruction(instr, expr->id()); |
8607 } | 8607 } |
8608 | 8608 |
8609 | 8609 |
8610 void HOptimizedGraphBuilder::VisitAdd(UnaryOperation* expr) { | 8610 void HOptimizedGraphBuilder::VisitAdd(UnaryOperation* expr) { |
8611 CHECK_ALIVE(VisitForValue(expr->expression())); | 8611 CHECK_ALIVE(VisitForValue(expr->expression())); |
8612 HValue* value = Pop(); | 8612 HValue* value = Pop(); |
8613 HValue* context = environment()->LookupContext(); | 8613 HValue* context = environment()->LookupContext(); |
8614 HInstruction* instr = | 8614 HInstruction* instr = |
8615 HMul::New(zone(), context, value, graph()->GetConstant1()); | 8615 HMul::New(zone(), context, value, graph()->GetConstant1()); |
| 8616 if (instr->IsBinaryOperation()) { |
| 8617 // Since we don't have type feedback, we must be cautious/pessimistic. |
| 8618 HBinaryOperation::cast(instr)->set_observed_input_representation( |
| 8619 Representation::Tagged(), Representation::Tagged()); |
| 8620 } |
8616 return ast_context()->ReturnInstruction(instr, expr->id()); | 8621 return ast_context()->ReturnInstruction(instr, expr->id()); |
8617 } | 8622 } |
8618 | 8623 |
8619 | 8624 |
8620 void HOptimizedGraphBuilder::VisitSub(UnaryOperation* expr) { | 8625 void HOptimizedGraphBuilder::VisitSub(UnaryOperation* expr) { |
8621 CHECK_ALIVE(VisitForValue(expr->expression())); | 8626 CHECK_ALIVE(VisitForValue(expr->expression())); |
8622 HValue* value = Pop(); | 8627 HValue* value = Pop(); |
8623 HValue* context = environment()->LookupContext(); | 8628 HValue* context = environment()->LookupContext(); |
8624 HInstruction* instr = | 8629 HInstruction* instr = |
8625 HMul::New(zone(), context, value, graph()->GetConstantMinus1()); | 8630 HMul::New(zone(), context, value, graph()->GetConstantMinus1()); |
(...skipping 2168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10794 } | 10799 } |
10795 } | 10800 } |
10796 | 10801 |
10797 #ifdef DEBUG | 10802 #ifdef DEBUG |
10798 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 10803 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
10799 if (allocator_ != NULL) allocator_->Verify(); | 10804 if (allocator_ != NULL) allocator_->Verify(); |
10800 #endif | 10805 #endif |
10801 } | 10806 } |
10802 | 10807 |
10803 } } // namespace v8::internal | 10808 } } // namespace v8::internal |
OLD | NEW |