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 5110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5121 result = new(zone()) HMul(context, left, left); | 5121 result = new(zone()) HMul(context, left, left); |
5122 } | 5122 } |
5123 | 5123 |
5124 if (result == NULL) { | 5124 if (result == NULL) { |
5125 result = new(zone()) HPower(left, right); | 5125 result = new(zone()) HPower(left, right); |
5126 } | 5126 } |
5127 ast_context()->ReturnInstruction(result, expr->id()); | 5127 ast_context()->ReturnInstruction(result, expr->id()); |
5128 return true; | 5128 return true; |
5129 } | 5129 } |
5130 break; | 5130 break; |
5131 case kMathMax: | |
5132 case kMathMin: | |
5133 if (argument_count == 3 && check_type == RECEIVER_MAP_CHECK) { | |
5134 AddCheckConstantFunction(expr, receiver, receiver_map, true); | |
5135 HValue* right = Pop(); | |
5136 HValue* left = Pop(); | |
5137 // Do not inline if the return representation is not certain. | |
5138 if (!left->representation().Equals(right->representation())) { | |
5139 Push(left); | |
5140 Push(right); | |
5141 return false; | |
5142 } | |
5143 | |
5144 Pop(); // Pop receiver. | |
5145 Token::Value op = (id == kMathMin) ? Token::LT : Token::GT; | |
5146 HCompareIDAndBranch* compare = NULL; | |
5147 | |
5148 if (left->representation().IsTagged()) { | |
5149 HInstruction* left_cvt = | |
fschneider
2012/01/11 10:29:32
maybe use HChange* instead (it's shorter and a bet
| |
5150 new(zone()) HChange(left, Representation::Double(), false, true); | |
5151 left_cvt->SetFlag(HValue::kBailoutOnMinusZero); | |
5152 AddInstruction(left_cvt); | |
5153 HInstruction* right_cvt = | |
fschneider
2012/01/11 10:29:32
HChange* also here.
| |
5154 new(zone()) HChange(right, Representation::Double(), false, true); | |
5155 right_cvt->SetFlag(HValue::kBailoutOnMinusZero); | |
5156 AddInstruction(right_cvt); | |
5157 compare = new(zone()) HCompareIDAndBranch(left_cvt, right_cvt, op); | |
5158 compare->SetInputRepresentation(Representation::Double()); | |
5159 } else { | |
5160 compare = new(zone()) HCompareIDAndBranch(left, right, op); | |
5161 compare->SetInputRepresentation(left->representation()); | |
5162 } | |
5163 | |
5164 HBasicBlock* return_left = graph()->CreateBasicBlock(); | |
5165 HBasicBlock* return_right = graph()->CreateBasicBlock(); | |
5166 | |
5167 compare->SetSuccessorAt(0, return_left); | |
5168 compare->SetSuccessorAt(1, return_right); | |
5169 current_block()->Finish(compare); | |
5170 | |
5171 set_current_block(return_left); | |
5172 Push(left); | |
5173 set_current_block(return_right); | |
5174 Push(right); | |
5175 | |
5176 HBasicBlock* join = CreateJoin(return_left, return_right, expr->id()); | |
5177 set_current_block(join); | |
5178 ast_context()->ReturnValue(Pop()); | |
5179 return true; | |
5180 } | |
5181 break; | |
5131 default: | 5182 default: |
5132 // Not yet supported for inlining. | 5183 // Not yet supported for inlining. |
5133 break; | 5184 break; |
5134 } | 5185 } |
5135 return false; | 5186 return false; |
5136 } | 5187 } |
5137 | 5188 |
5138 | 5189 |
5139 bool HGraphBuilder::TryCallApply(Call* expr) { | 5190 bool HGraphBuilder::TryCallApply(Call* expr) { |
5140 Expression* callee = expr->expression(); | 5191 Expression* callee = expr->expression(); |
(...skipping 2176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7317 } | 7368 } |
7318 } | 7369 } |
7319 | 7370 |
7320 #ifdef DEBUG | 7371 #ifdef DEBUG |
7321 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 7372 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
7322 if (allocator_ != NULL) allocator_->Verify(); | 7373 if (allocator_ != NULL) allocator_->Verify(); |
7323 #endif | 7374 #endif |
7324 } | 7375 } |
7325 | 7376 |
7326 } } // namespace v8::internal | 7377 } } // namespace v8::internal |
OLD | NEW |