OLD | NEW |
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 5703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5714 if (expr->IsLiteralCompareTypeof(&sub_expr, &check)) { | 5714 if (expr->IsLiteralCompareTypeof(&sub_expr, &check)) { |
5715 HandleLiteralCompareTypeof(expr, sub_expr, check); | 5715 HandleLiteralCompareTypeof(expr, sub_expr, check); |
5716 return; | 5716 return; |
5717 } | 5717 } |
5718 | 5718 |
5719 if (expr->IsLiteralCompareUndefined(&sub_expr)) { | 5719 if (expr->IsLiteralCompareUndefined(&sub_expr)) { |
5720 HandleLiteralCompareUndefined(expr, sub_expr); | 5720 HandleLiteralCompareUndefined(expr, sub_expr); |
5721 return; | 5721 return; |
5722 } | 5722 } |
5723 | 5723 |
| 5724 if (expr->IsLiteralCompareNull(&sub_expr)) { |
| 5725 HandleLiteralCompareNull(expr, sub_expr); |
| 5726 return; |
| 5727 } |
| 5728 |
5724 TypeInfo type_info = oracle()->CompareType(expr); | 5729 TypeInfo type_info = oracle()->CompareType(expr); |
5725 // Check if this expression was ever executed according to type feedback. | 5730 // Check if this expression was ever executed according to type feedback. |
5726 if (type_info.IsUninitialized()) { | 5731 if (type_info.IsUninitialized()) { |
5727 AddInstruction(new(zone()) HSoftDeoptimize); | 5732 AddInstruction(new(zone()) HSoftDeoptimize); |
5728 current_block()->MarkAsDeoptimizing(); | 5733 current_block()->MarkAsDeoptimizing(); |
5729 type_info = TypeInfo::Unknown(); | 5734 type_info = TypeInfo::Unknown(); |
5730 } | 5735 } |
5731 | 5736 |
5732 CHECK_ALIVE(VisitForValue(expr->left())); | 5737 CHECK_ALIVE(VisitForValue(expr->left())); |
5733 CHECK_ALIVE(VisitForValue(expr->right())); | 5738 CHECK_ALIVE(VisitForValue(expr->right())); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5817 HCompareIDAndBranch* result = | 5822 HCompareIDAndBranch* result = |
5818 new(zone()) HCompareIDAndBranch(left, right, op); | 5823 new(zone()) HCompareIDAndBranch(left, right, op); |
5819 result->set_position(expr->position()); | 5824 result->set_position(expr->position()); |
5820 result->SetInputRepresentation(r); | 5825 result->SetInputRepresentation(r); |
5821 return ast_context()->ReturnControl(result, expr->id()); | 5826 return ast_context()->ReturnControl(result, expr->id()); |
5822 } | 5827 } |
5823 } | 5828 } |
5824 } | 5829 } |
5825 | 5830 |
5826 | 5831 |
5827 void HGraphBuilder::VisitCompareToNull(CompareToNull* expr) { | 5832 void HGraphBuilder::HandleLiteralCompareNull(CompareOperation* compare_expr, |
| 5833 Expression* expr) { |
5828 ASSERT(!HasStackOverflow()); | 5834 ASSERT(!HasStackOverflow()); |
5829 ASSERT(current_block() != NULL); | 5835 ASSERT(current_block() != NULL); |
5830 ASSERT(current_block()->HasPredecessor()); | 5836 ASSERT(current_block()->HasPredecessor()); |
5831 CHECK_ALIVE(VisitForValue(expr->expression())); | 5837 CHECK_ALIVE(VisitForValue(expr)); |
5832 HValue* value = Pop(); | 5838 HValue* value = Pop(); |
5833 HIsNullAndBranch* instr = | 5839 bool is_strict = compare_expr->op() == Token::EQ_STRICT; |
5834 new(zone()) HIsNullAndBranch(value, expr->is_strict()); | 5840 HIsNullAndBranch* instr = new(zone()) HIsNullAndBranch(value, is_strict); |
5835 return ast_context()->ReturnControl(instr, expr->id()); | 5841 return ast_context()->ReturnControl(instr, compare_expr->id()); |
5836 } | 5842 } |
5837 | 5843 |
5838 | 5844 |
5839 void HGraphBuilder::VisitThisFunction(ThisFunction* expr) { | 5845 void HGraphBuilder::VisitThisFunction(ThisFunction* expr) { |
5840 ASSERT(!HasStackOverflow()); | 5846 ASSERT(!HasStackOverflow()); |
5841 ASSERT(current_block() != NULL); | 5847 ASSERT(current_block() != NULL); |
5842 ASSERT(current_block()->HasPredecessor()); | 5848 ASSERT(current_block()->HasPredecessor()); |
5843 HThisFunction* self = new(zone()) HThisFunction; | 5849 HThisFunction* self = new(zone()) HThisFunction; |
5844 return ast_context()->ReturnInstruction(self, expr->id()); | 5850 return ast_context()->ReturnInstruction(self, expr->id()); |
5845 } | 5851 } |
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6815 } | 6821 } |
6816 } | 6822 } |
6817 | 6823 |
6818 #ifdef DEBUG | 6824 #ifdef DEBUG |
6819 if (graph_ != NULL) graph_->Verify(); | 6825 if (graph_ != NULL) graph_->Verify(); |
6820 if (allocator_ != NULL) allocator_->Verify(); | 6826 if (allocator_ != NULL) allocator_->Verify(); |
6821 #endif | 6827 #endif |
6822 } | 6828 } |
6823 | 6829 |
6824 } } // namespace v8::internal | 6830 } } // namespace v8::internal |
OLD | NEW |