OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 1608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1619 | 1619 |
1620 LoopBuilder builder(this, context(), LoopBuilder::kPostIncrement); | 1620 LoopBuilder builder(this, context(), LoopBuilder::kPostIncrement); |
1621 | 1621 |
1622 HValue* key = builder.BeginBody(graph()->GetConstant0(), length, Token::LT); | 1622 HValue* key = builder.BeginBody(graph()->GetConstant0(), length, Token::LT); |
1623 | 1623 |
1624 HValue* element = Add<HLoadKeyed>(from_elements, key, | 1624 HValue* element = Add<HLoadKeyed>(from_elements, key, |
1625 static_cast<HValue*>(NULL), | 1625 static_cast<HValue*>(NULL), |
1626 from_elements_kind, | 1626 from_elements_kind, |
1627 ALLOW_RETURN_HOLE); | 1627 ALLOW_RETURN_HOLE); |
1628 | 1628 |
1629 ElementsKind holey_kind = IsFastSmiElementsKind(to_elements_kind) | 1629 ElementsKind kind = (IsHoleyElementsKind(from_elements_kind) && |
| 1630 IsFastSmiElementsKind(to_elements_kind)) |
1630 ? FAST_HOLEY_ELEMENTS : to_elements_kind; | 1631 ? FAST_HOLEY_ELEMENTS : to_elements_kind; |
1631 HInstruction* holey_store = Add<HStoreKeyed>(to_elements, key, | 1632 |
1632 element, holey_kind); | 1633 if (IsHoleyElementsKind(from_elements_kind) && |
1633 // Allow NaN hole values to converted to their tagged counterparts. | 1634 from_elements_kind != to_elements_kind) { |
1634 if (IsFastHoleyElementsKind(to_elements_kind)) { | 1635 IfBuilder if_hole(this); |
1635 holey_store->SetFlag(HValue::kAllowUndefinedAsNaN); | 1636 if_hole.If<HCompareHoleAndBranch>(element); |
| 1637 if_hole.Then(); |
| 1638 HConstant* hole_constant = IsFastDoubleElementsKind(to_elements_kind) |
| 1639 ? Add<HConstant>(FixedDoubleArray::hole_nan_as_double()) |
| 1640 : graph()->GetConstantHole(); |
| 1641 Add<HStoreKeyed>(to_elements, key, hole_constant, kind); |
| 1642 if_hole.Else(); |
| 1643 HStoreKeyed* store = Add<HStoreKeyed>(to_elements, key, element, kind); |
| 1644 store->SetFlag(HValue::kAllowUndefinedAsNaN); |
| 1645 if_hole.End(); |
| 1646 } else { |
| 1647 HStoreKeyed* store = Add<HStoreKeyed>(to_elements, key, element, kind); |
| 1648 store->SetFlag(HValue::kAllowUndefinedAsNaN); |
1636 } | 1649 } |
1637 | 1650 |
1638 builder.EndBody(); | 1651 builder.EndBody(); |
1639 | 1652 |
1640 if (!pre_fill_with_holes && length != capacity) { | 1653 if (!pre_fill_with_holes && length != capacity) { |
1641 // Fill unused capacity with the hole. | 1654 // Fill unused capacity with the hole. |
1642 BuildFillElementsWithHole(to_elements, to_elements_kind, | 1655 BuildFillElementsWithHole(to_elements, to_elements_kind, |
1643 key, capacity); | 1656 key, capacity); |
1644 } | 1657 } |
1645 } | 1658 } |
(...skipping 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2939 // will not remove semantically meaningful ToInt32 operations e.g. BIT_OR with | 2952 // will not remove semantically meaningful ToInt32 operations e.g. BIT_OR with |
2940 // zero. | 2953 // zero. |
2941 if (FLAG_opt_safe_uint32_operations) Run<HUint32AnalysisPhase>(); | 2954 if (FLAG_opt_safe_uint32_operations) Run<HUint32AnalysisPhase>(); |
2942 | 2955 |
2943 if (FLAG_use_canonicalizing) Run<HCanonicalizePhase>(); | 2956 if (FLAG_use_canonicalizing) Run<HCanonicalizePhase>(); |
2944 | 2957 |
2945 if (FLAG_use_gvn) Run<HGlobalValueNumberingPhase>(); | 2958 if (FLAG_use_gvn) Run<HGlobalValueNumberingPhase>(); |
2946 | 2959 |
2947 if (FLAG_use_range) Run<HRangeAnalysisPhase>(); | 2960 if (FLAG_use_range) Run<HRangeAnalysisPhase>(); |
2948 | 2961 |
| 2962 Run<HComputeChangeUndefinedToNaN>(); |
2949 Run<HComputeMinusZeroChecksPhase>(); | 2963 Run<HComputeMinusZeroChecksPhase>(); |
2950 | 2964 |
2951 // Eliminate redundant stack checks on backwards branches. | 2965 // Eliminate redundant stack checks on backwards branches. |
2952 Run<HStackCheckEliminationPhase>(); | 2966 Run<HStackCheckEliminationPhase>(); |
2953 | 2967 |
2954 if (FLAG_array_bounds_checks_elimination) { | 2968 if (FLAG_array_bounds_checks_elimination) { |
2955 Run<HBoundsCheckEliminationPhase>(); | 2969 Run<HBoundsCheckEliminationPhase>(); |
2956 } | 2970 } |
2957 if (FLAG_array_bounds_checks_hoisting) { | 2971 if (FLAG_array_bounds_checks_hoisting) { |
2958 Run<HBoundsCheckHoistingPhase>(); | 2972 Run<HBoundsCheckHoistingPhase>(); |
(...skipping 6748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9707 if (ShouldProduceTraceOutput()) { | 9721 if (ShouldProduceTraceOutput()) { |
9708 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 9722 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
9709 } | 9723 } |
9710 | 9724 |
9711 #ifdef DEBUG | 9725 #ifdef DEBUG |
9712 graph_->Verify(false); // No full verify. | 9726 graph_->Verify(false); // No full verify. |
9713 #endif | 9727 #endif |
9714 } | 9728 } |
9715 | 9729 |
9716 } } // namespace v8::internal | 9730 } } // namespace v8::internal |
OLD | NEW |