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 4997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5008 // Generate a compare and branch. | 5008 // Generate a compare and branch. |
5009 CHECK_ALIVE(VisitForValue(clause->label())); | 5009 CHECK_ALIVE(VisitForValue(clause->label())); |
5010 HValue* label_value = Pop(); | 5010 HValue* label_value = Pop(); |
5011 | 5011 |
5012 HBasicBlock* next_test_block = graph()->CreateBasicBlock(); | 5012 HBasicBlock* next_test_block = graph()->CreateBasicBlock(); |
5013 HBasicBlock* body_block = graph()->CreateBasicBlock(); | 5013 HBasicBlock* body_block = graph()->CreateBasicBlock(); |
5014 | 5014 |
5015 HControlInstruction* compare; | 5015 HControlInstruction* compare; |
5016 | 5016 |
5017 if (stmt->switch_type() == SwitchStatement::SMI_SWITCH) { | 5017 if (stmt->switch_type() == SwitchStatement::SMI_SWITCH) { |
5018 if (!clause->compare_type()->Is(Type::Integer31())) { | 5018 if (!clause->compare_type()->Is(Type::Smi())) { |
5019 AddSoftDeoptimize(); | 5019 AddSoftDeoptimize(); |
5020 } | 5020 } |
5021 | 5021 |
5022 HCompareIDAndBranch* compare_ = | 5022 HCompareIDAndBranch* compare_ = |
5023 new(zone()) HCompareIDAndBranch(tag_value, | 5023 new(zone()) HCompareIDAndBranch(tag_value, |
5024 label_value, | 5024 label_value, |
5025 Token::EQ_STRICT); | 5025 Token::EQ_STRICT); |
5026 compare_->set_observed_input_representation( | 5026 compare_->set_observed_input_representation( |
5027 Representation::Smi(), Representation::Smi()); | 5027 Representation::Smi(), Representation::Smi()); |
5028 compare = compare_; | 5028 compare = compare_; |
(...skipping 4421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9450 break; | 9450 break; |
9451 case Token::DIV: | 9451 case Token::DIV: |
9452 instr = HDiv::New(zone(), context, left, right); | 9452 instr = HDiv::New(zone(), context, left, right); |
9453 break; | 9453 break; |
9454 case Token::BIT_XOR: | 9454 case Token::BIT_XOR: |
9455 case Token::BIT_AND: | 9455 case Token::BIT_AND: |
9456 instr = HBitwise::New(zone(), expr->op(), context, left, right); | 9456 instr = HBitwise::New(zone(), expr->op(), context, left, right); |
9457 break; | 9457 break; |
9458 case Token::BIT_OR: { | 9458 case Token::BIT_OR: { |
9459 HValue* operand, *shift_amount; | 9459 HValue* operand, *shift_amount; |
9460 if (left_type->Is(Type::Integer32()) && | 9460 if (left_type->Is(Type::Signed32()) && |
9461 right_type->Is(Type::Integer32()) && | 9461 right_type->Is(Type::Signed32()) && |
9462 MatchRotateRight(left, right, &operand, &shift_amount)) { | 9462 MatchRotateRight(left, right, &operand, &shift_amount)) { |
9463 instr = new(zone()) HRor(context, operand, shift_amount); | 9463 instr = new(zone()) HRor(context, operand, shift_amount); |
9464 } else { | 9464 } else { |
9465 instr = HBitwise::New(zone(), expr->op(), context, left, right); | 9465 instr = HBitwise::New(zone(), expr->op(), context, left, right); |
9466 } | 9466 } |
9467 break; | 9467 break; |
9468 } | 9468 } |
9469 case Token::SAR: | 9469 case Token::SAR: |
9470 instr = HSar::New(zone(), context, left, right); | 9470 instr = HSar::New(zone(), context, left, right); |
9471 break; | 9471 break; |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9651 if (info.IsSmi()) return Representation::Integer32(); | 9651 if (info.IsSmi()) return Representation::Integer32(); |
9652 if (info.IsInteger32()) return Representation::Integer32(); | 9652 if (info.IsInteger32()) return Representation::Integer32(); |
9653 if (info.IsDouble()) return Representation::Double(); | 9653 if (info.IsDouble()) return Representation::Double(); |
9654 if (info.IsNumber()) return Representation::Double(); | 9654 if (info.IsNumber()) return Representation::Double(); |
9655 return Representation::Tagged(); | 9655 return Representation::Tagged(); |
9656 } | 9656 } |
9657 | 9657 |
9658 | 9658 |
9659 Representation HOptimizedGraphBuilder::ToRepresentation(Handle<Type> type) { | 9659 Representation HOptimizedGraphBuilder::ToRepresentation(Handle<Type> type) { |
9660 if (type->Is(Type::None())) return Representation::None(); | 9660 if (type->Is(Type::None())) return Representation::None(); |
9661 if (type->Is(Type::Integer32())) return Representation::Integer32(); | 9661 if (type->Is(Type::Signed32())) return Representation::Integer32(); |
9662 if (type->Is(Type::Number())) return Representation::Double(); | 9662 if (type->Is(Type::Number())) return Representation::Double(); |
9663 return Representation::Tagged(); | 9663 return Representation::Tagged(); |
9664 } | 9664 } |
9665 | 9665 |
9666 | 9666 |
9667 void HOptimizedGraphBuilder::HandleLiteralCompareTypeof(CompareOperation* expr, | 9667 void HOptimizedGraphBuilder::HandleLiteralCompareTypeof(CompareOperation* expr, |
9668 HTypeof* typeof_expr, | 9668 HTypeof* typeof_expr, |
9669 Handle<String> check) { | 9669 Handle<String> check) { |
9670 // Note: The HTypeof itself is removed during canonicalization, if possible. | 9670 // Note: The HTypeof itself is removed during canonicalization, if possible. |
9671 HValue* value = typeof_expr->value(); | 9671 HValue* value = typeof_expr->value(); |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9876 if (combined_rep.IsTagged() || combined_rep.IsNone()) { | 9876 if (combined_rep.IsTagged() || combined_rep.IsNone()) { |
9877 HCompareGeneric* result = | 9877 HCompareGeneric* result = |
9878 new(zone()) HCompareGeneric(context, left, right, op); | 9878 new(zone()) HCompareGeneric(context, left, right, op); |
9879 result->set_observed_input_representation(1, left_rep); | 9879 result->set_observed_input_representation(1, left_rep); |
9880 result->set_observed_input_representation(2, right_rep); | 9880 result->set_observed_input_representation(2, right_rep); |
9881 result->set_position(expr->position()); | 9881 result->set_position(expr->position()); |
9882 return ast_context()->ReturnInstruction(result, expr->id()); | 9882 return ast_context()->ReturnInstruction(result, expr->id()); |
9883 } else { | 9883 } else { |
9884 // TODO(verwaest): Remove once ToRepresentation properly returns Smi when | 9884 // TODO(verwaest): Remove once ToRepresentation properly returns Smi when |
9885 // the IC measures Smi. | 9885 // the IC measures Smi. |
9886 if (left_type->Is(Type::Integer31())) left_rep = Representation::Smi(); | 9886 if (left_type->Is(Type::Smi())) left_rep = Representation::Smi(); |
9887 if (right_type->Is(Type::Integer31())) right_rep = Representation::Smi(); | 9887 if (right_type->Is(Type::Smi())) right_rep = Representation::Smi(); |
9888 HCompareIDAndBranch* result = | 9888 HCompareIDAndBranch* result = |
9889 new(zone()) HCompareIDAndBranch(left, right, op); | 9889 new(zone()) HCompareIDAndBranch(left, right, op); |
9890 result->set_observed_input_representation(left_rep, right_rep); | 9890 result->set_observed_input_representation(left_rep, right_rep); |
9891 result->set_position(expr->position()); | 9891 result->set_position(expr->position()); |
9892 return ast_context()->ReturnControl(result, expr->id()); | 9892 return ast_context()->ReturnControl(result, expr->id()); |
9893 } | 9893 } |
9894 } | 9894 } |
9895 } | 9895 } |
9896 | 9896 |
9897 | 9897 |
(...skipping 1673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11571 } | 11571 } |
11572 } | 11572 } |
11573 | 11573 |
11574 #ifdef DEBUG | 11574 #ifdef DEBUG |
11575 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 11575 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
11576 if (allocator_ != NULL) allocator_->Verify(); | 11576 if (allocator_ != NULL) allocator_->Verify(); |
11577 #endif | 11577 #endif |
11578 } | 11578 } |
11579 | 11579 |
11580 } } // namespace v8::internal | 11580 } } // namespace v8::internal |
OLD | NEW |