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 1680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1691 kind)); | 1691 kind)); |
1692 } | 1692 } |
1693 } | 1693 } |
1694 | 1694 |
1695 return object; | 1695 return object; |
1696 } | 1696 } |
1697 | 1697 |
1698 | 1698 |
1699 void HGraphBuilder::BuildCompareNil( | 1699 void HGraphBuilder::BuildCompareNil( |
1700 HValue* value, | 1700 HValue* value, |
1701 EqualityKind kind, | |
1702 CompareNilICStub::Types types, | 1701 CompareNilICStub::Types types, |
1703 Handle<Map> map, | 1702 Handle<Map> map, |
1704 int position, | 1703 int position, |
1705 HIfContinuation* continuation) { | 1704 HIfContinuation* continuation) { |
1706 IfBuilder if_nil(this, position); | 1705 IfBuilder if_nil(this, position); |
1707 bool needs_or = false; | 1706 bool needs_or = false; |
1708 if (types.Contains(CompareNilICStub::NULL_TYPE)) { | 1707 if (types.Contains(CompareNilICStub::NULL_TYPE)) { |
1709 if (needs_or) if_nil.Or(); | 1708 if (needs_or) if_nil.Or(); |
1710 if_nil.If<HCompareObjectEqAndBranch>(value, graph()->GetConstantNull()); | 1709 if_nil.If<HCompareObjectEqAndBranch>(value, graph()->GetConstantNull()); |
1711 needs_or = true; | 1710 needs_or = true; |
(...skipping 14 matching lines...) Expand all Loading... |
1726 if_nil.Then(); | 1725 if_nil.Then(); |
1727 if_nil.Else(); | 1726 if_nil.Else(); |
1728 if (!map.is_null() && types.Contains(CompareNilICStub::MONOMORPHIC_MAP)) { | 1727 if (!map.is_null() && types.Contains(CompareNilICStub::MONOMORPHIC_MAP)) { |
1729 BuildCheckNonSmi(value); | 1728 BuildCheckNonSmi(value); |
1730 // For ICs, the map checked below is a sentinel map that gets replaced by | 1729 // For ICs, the map checked below is a sentinel map that gets replaced by |
1731 // the monomorphic map when the code is used as a template to generate a | 1730 // the monomorphic map when the code is used as a template to generate a |
1732 // new IC. For optimized functions, there is no sentinel map, the map | 1731 // new IC. For optimized functions, there is no sentinel map, the map |
1733 // emitted below is the actual monomorphic map. | 1732 // emitted below is the actual monomorphic map. |
1734 BuildCheckMap(value, map); | 1733 BuildCheckMap(value, map); |
1735 } else { | 1734 } else { |
1736 if (kind == kNonStrictEquality) { | 1735 if_nil.Deopt(); |
1737 if_nil.Deopt(); | |
1738 } | |
1739 } | 1736 } |
1740 } | 1737 } |
1741 | 1738 |
1742 if_nil.CaptureContinuation(continuation); | 1739 if_nil.CaptureContinuation(continuation); |
1743 } | 1740 } |
1744 | 1741 |
1745 | 1742 |
1746 HValue* HGraphBuilder::BuildCreateAllocationSiteInfo(HValue* previous_object, | 1743 HValue* HGraphBuilder::BuildCreateAllocationSiteInfo(HValue* previous_object, |
1747 int previous_object_size, | 1744 int previous_object_size, |
1748 HValue* payload) { | 1745 HValue* payload) { |
(...skipping 8165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9914 } | 9911 } |
9915 } | 9912 } |
9916 | 9913 |
9917 | 9914 |
9918 void HOptimizedGraphBuilder::HandleLiteralCompareNil(CompareOperation* expr, | 9915 void HOptimizedGraphBuilder::HandleLiteralCompareNil(CompareOperation* expr, |
9919 HValue* value, | 9916 HValue* value, |
9920 NilValue nil) { | 9917 NilValue nil) { |
9921 ASSERT(!HasStackOverflow()); | 9918 ASSERT(!HasStackOverflow()); |
9922 ASSERT(current_block() != NULL); | 9919 ASSERT(current_block() != NULL); |
9923 ASSERT(current_block()->HasPredecessor()); | 9920 ASSERT(current_block()->HasPredecessor()); |
9924 EqualityKind kind = | |
9925 expr->op() == Token::EQ_STRICT ? kStrictEquality : kNonStrictEquality; | |
9926 HIfContinuation continuation; | 9921 HIfContinuation continuation; |
9927 CompareNilICStub::Types types; | 9922 CompareNilICStub::Types types; |
9928 if (kind == kStrictEquality) { | 9923 if (expr->op() == Token::EQ_STRICT) { |
9929 types.Add((nil == kNullValue) ? CompareNilICStub::NULL_TYPE : | 9924 IfBuilder if_nil(this); |
9930 CompareNilICStub::UNDEFINED); | 9925 if_nil.If<HCompareObjectEqAndBranch>( |
9931 } else { | 9926 value, (nil == kNullValue) ? graph()->GetConstantNull() |
9932 types = CompareNilICStub::Types(expr->compare_nil_types()); | 9927 : graph()->GetConstantUndefined()); |
9933 if (types.IsEmpty()) types = CompareNilICStub::Types::FullCompare(); | 9928 if_nil.Then(); |
| 9929 if_nil.Else(); |
| 9930 if_nil.CaptureContinuation(&continuation); |
| 9931 return ast_context()->ReturnContinuation(&continuation, expr->id()); |
9934 } | 9932 } |
| 9933 types = CompareNilICStub::Types(expr->compare_nil_types()); |
| 9934 if (types.IsEmpty()) types = CompareNilICStub::Types::FullCompare(); |
9935 Handle<Map> map_handle = expr->map(); | 9935 Handle<Map> map_handle = expr->map(); |
9936 BuildCompareNil(value, kind, types, map_handle, | 9936 BuildCompareNil(value, types, map_handle, |
9937 expr->position(), &continuation); | 9937 expr->position(), &continuation); |
9938 return ast_context()->ReturnContinuation(&continuation, expr->id()); | 9938 return ast_context()->ReturnContinuation(&continuation, expr->id()); |
9939 } | 9939 } |
9940 | 9940 |
9941 | 9941 |
9942 HInstruction* HOptimizedGraphBuilder::BuildThisFunction() { | 9942 HInstruction* HOptimizedGraphBuilder::BuildThisFunction() { |
9943 // If we share optimized code between different closures, the | 9943 // If we share optimized code between different closures, the |
9944 // this-function is not a constant, except inside an inlined body. | 9944 // this-function is not a constant, except inside an inlined body. |
9945 if (function_state()->outer() != NULL) { | 9945 if (function_state()->outer() != NULL) { |
9946 return new(zone()) HConstant( | 9946 return new(zone()) HConstant( |
(...skipping 1653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11600 } | 11600 } |
11601 } | 11601 } |
11602 | 11602 |
11603 #ifdef DEBUG | 11603 #ifdef DEBUG |
11604 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 11604 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
11605 if (allocator_ != NULL) allocator_->Verify(); | 11605 if (allocator_ != NULL) allocator_->Verify(); |
11606 #endif | 11606 #endif |
11607 } | 11607 } |
11608 | 11608 |
11609 } } // namespace v8::internal | 11609 } } // namespace v8::internal |
OLD | NEW |