| 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 9204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9215 HValue* context = environment()->LookupContext(); | 9215 HValue* context = environment()->LookupContext(); |
| 9216 HInstruction* instr = new(zone()) HTypeof(context, value); | 9216 HInstruction* instr = new(zone()) HTypeof(context, value); |
| 9217 return ast_context()->ReturnInstruction(instr, expr->id()); | 9217 return ast_context()->ReturnInstruction(instr, expr->id()); |
| 9218 } | 9218 } |
| 9219 | 9219 |
| 9220 | 9220 |
| 9221 void HOptimizedGraphBuilder::VisitAdd(UnaryOperation* expr) { | 9221 void HOptimizedGraphBuilder::VisitAdd(UnaryOperation* expr) { |
| 9222 CHECK_ALIVE(VisitForValue(expr->expression())); | 9222 CHECK_ALIVE(VisitForValue(expr->expression())); |
| 9223 HValue* value = Pop(); | 9223 HValue* value = Pop(); |
| 9224 HValue* context = environment()->LookupContext(); | 9224 HValue* context = environment()->LookupContext(); |
| 9225 TypeInfo left_info, right_info, result_info; |
| 9226 oracle()->BinaryType( |
| 9227 expr->UnaryOperationFeedbackId(), &left_info, &right_info, &result_info); |
| 9228 // Left is constant 1. |
| 9229 ASSERT(left_info.IsSmi()); |
| 9230 Representation left_rep = ToRepresentation(left_info); |
| 9231 Representation right_rep = ToRepresentation(right_info); |
| 9225 HInstruction* instr = | 9232 HInstruction* instr = |
| 9226 HMul::New(zone(), context, value, graph()->GetConstant1()); | 9233 HMul::New(zone(), context, graph()->GetConstant1(), value); |
| 9227 if (instr->IsBinaryOperation()) { | 9234 if (instr->IsBinaryOperation()) { |
| 9228 // Since we don't have type feedback, we must be cautious/pessimistic. | |
| 9229 HBinaryOperation::cast(instr)->set_observed_input_representation( | 9235 HBinaryOperation::cast(instr)->set_observed_input_representation( |
| 9230 Representation::Tagged(), Representation::Tagged()); | 9236 left_rep, right_rep); |
| 9231 } | 9237 } |
| 9232 return ast_context()->ReturnInstruction(instr, expr->id()); | 9238 return ast_context()->ReturnInstruction(instr, expr->id()); |
| 9233 } | 9239 } |
| 9234 | 9240 |
| 9235 | 9241 |
| 9236 void HOptimizedGraphBuilder::VisitSub(UnaryOperation* expr) { | 9242 void HOptimizedGraphBuilder::VisitSub(UnaryOperation* expr) { |
| 9237 CHECK_ALIVE(VisitForValue(expr->expression())); | 9243 CHECK_ALIVE(VisitForValue(expr->expression())); |
| 9238 HValue* value = Pop(); | 9244 HValue* value = Pop(); |
| 9239 HValue* context = environment()->LookupContext(); | 9245 HValue* context = environment()->LookupContext(); |
| 9240 HInstruction* instr = | 9246 HInstruction* instr = |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9611 } | 9617 } |
| 9612 return true; | 9618 return true; |
| 9613 } | 9619 } |
| 9614 | 9620 |
| 9615 | 9621 |
| 9616 HInstruction* HOptimizedGraphBuilder::BuildBinaryOperation( | 9622 HInstruction* HOptimizedGraphBuilder::BuildBinaryOperation( |
| 9617 BinaryOperation* expr, | 9623 BinaryOperation* expr, |
| 9618 HValue* left, | 9624 HValue* left, |
| 9619 HValue* right) { | 9625 HValue* right) { |
| 9620 HValue* context = environment()->LookupContext(); | 9626 HValue* context = environment()->LookupContext(); |
| 9621 TypeInfo left_info, right_info, result_info, combined_info; | 9627 TypeInfo left_info, right_info, result_info; |
| 9622 oracle()->BinaryType(expr, &left_info, &right_info, &result_info); | 9628 oracle()->BinaryType( |
| 9629 expr->BinaryOperationFeedbackId(), &left_info, &right_info, &result_info); |
| 9623 Representation left_rep = ToRepresentation(left_info); | 9630 Representation left_rep = ToRepresentation(left_info); |
| 9624 Representation right_rep = ToRepresentation(right_info); | 9631 Representation right_rep = ToRepresentation(right_info); |
| 9625 Representation result_rep = ToRepresentation(result_info); | 9632 Representation result_rep = ToRepresentation(result_info); |
| 9626 if (left_info.IsUninitialized()) { | 9633 if (left_info.IsUninitialized()) { |
| 9627 // Can't have initialized one but not the other. | 9634 // Can't have initialized one but not the other. |
| 9628 ASSERT(right_info.IsUninitialized()); | 9635 ASSERT(right_info.IsUninitialized()); |
| 9629 AddSoftDeoptimize(); | 9636 AddSoftDeoptimize(); |
| 9630 left_info = right_info = TypeInfo::Unknown(); | 9637 left_info = right_info = TypeInfo::Unknown(); |
| 9631 } | 9638 } |
| 9632 HInstruction* instr = NULL; | 9639 HInstruction* instr = NULL; |
| (...skipping 2058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11691 } | 11698 } |
| 11692 } | 11699 } |
| 11693 | 11700 |
| 11694 #ifdef DEBUG | 11701 #ifdef DEBUG |
| 11695 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 11702 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
| 11696 if (allocator_ != NULL) allocator_->Verify(); | 11703 if (allocator_ != NULL) allocator_->Verify(); |
| 11697 #endif | 11704 #endif |
| 11698 } | 11705 } |
| 11699 | 11706 |
| 11700 } } // namespace v8::internal | 11707 } } // namespace v8::internal |
| OLD | NEW |