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 26 matching lines...) Expand all Loading... |
37 #include "hydrogen-bch.h" | 37 #include "hydrogen-bch.h" |
38 #include "hydrogen-canonicalize.h" | 38 #include "hydrogen-canonicalize.h" |
39 #include "hydrogen-dce.h" | 39 #include "hydrogen-dce.h" |
40 #include "hydrogen-dehoist.h" | 40 #include "hydrogen-dehoist.h" |
41 #include "hydrogen-deoptimizing-mark.h" | 41 #include "hydrogen-deoptimizing-mark.h" |
42 #include "hydrogen-environment-liveness.h" | 42 #include "hydrogen-environment-liveness.h" |
43 #include "hydrogen-escape-analysis.h" | 43 #include "hydrogen-escape-analysis.h" |
44 #include "hydrogen-infer-representation.h" | 44 #include "hydrogen-infer-representation.h" |
45 #include "hydrogen-infer-types.h" | 45 #include "hydrogen-infer-types.h" |
46 #include "hydrogen-gvn.h" | 46 #include "hydrogen-gvn.h" |
| 47 #include "hydrogen-mark-deoptimize.h" |
47 #include "hydrogen-minus-zero.h" | 48 #include "hydrogen-minus-zero.h" |
48 #include "hydrogen-osr.h" | 49 #include "hydrogen-osr.h" |
49 #include "hydrogen-range-analysis.h" | 50 #include "hydrogen-range-analysis.h" |
50 #include "hydrogen-redundant-phi.h" | 51 #include "hydrogen-redundant-phi.h" |
51 #include "hydrogen-removable-simulates.h" | 52 #include "hydrogen-removable-simulates.h" |
52 #include "hydrogen-representation-changes.h" | 53 #include "hydrogen-representation-changes.h" |
53 #include "hydrogen-sce.h" | 54 #include "hydrogen-sce.h" |
54 #include "hydrogen-uint32-analysis.h" | 55 #include "hydrogen-uint32-analysis.h" |
55 #include "lithium-allocator.h" | 56 #include "lithium-allocator.h" |
56 #include "parser.h" | 57 #include "parser.h" |
(...skipping 2450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2507 phi_list_ = new(zone()) ZoneList<HPhi*>(block_count, zone()); | 2508 phi_list_ = new(zone()) ZoneList<HPhi*>(block_count, zone()); |
2508 for (int i = 0; i < block_count; ++i) { | 2509 for (int i = 0; i < block_count; ++i) { |
2509 for (int j = 0; j < blocks_[i]->phis()->length(); ++j) { | 2510 for (int j = 0; j < blocks_[i]->phis()->length(); ++j) { |
2510 HPhi* phi = blocks_[i]->phis()->at(j); | 2511 HPhi* phi = blocks_[i]->phis()->at(j); |
2511 phi_list_->Add(phi, zone()); | 2512 phi_list_->Add(phi, zone()); |
2512 } | 2513 } |
2513 } | 2514 } |
2514 } | 2515 } |
2515 | 2516 |
2516 | 2517 |
2517 void HGraph::RecursivelyMarkPhiDeoptimizeOnUndefined(HPhi* phi) { | |
2518 if (!phi->CheckFlag(HValue::kAllowUndefinedAsNaN)) return; | |
2519 phi->ClearFlag(HValue::kAllowUndefinedAsNaN); | |
2520 for (int i = 0; i < phi->OperandCount(); ++i) { | |
2521 HValue* input = phi->OperandAt(i); | |
2522 if (input->IsPhi()) { | |
2523 RecursivelyMarkPhiDeoptimizeOnUndefined(HPhi::cast(input)); | |
2524 } | |
2525 } | |
2526 } | |
2527 | |
2528 | |
2529 void HGraph::MarkDeoptimizeOnUndefined() { | |
2530 HPhase phase("H_MarkDeoptimizeOnUndefined", this); | |
2531 // Compute DeoptimizeOnUndefined flag for phis. Any phi that can reach a use | |
2532 // with DeoptimizeOnUndefined set must have DeoptimizeOnUndefined set. | |
2533 // Currently only HCompareNumericAndBranch, with double input representation, | |
2534 // has this flag set. The flag is used by HChange tagged->double, which must | |
2535 // deoptimize if one of its uses has this flag set. | |
2536 for (int i = 0; i < phi_list()->length(); i++) { | |
2537 HPhi* phi = phi_list()->at(i); | |
2538 for (HUseIterator it(phi->uses()); !it.Done(); it.Advance()) { | |
2539 HValue* use_value = it.value(); | |
2540 if (!use_value->CheckFlag(HValue::kAllowUndefinedAsNaN)) { | |
2541 RecursivelyMarkPhiDeoptimizeOnUndefined(phi); | |
2542 break; | |
2543 } | |
2544 } | |
2545 } | |
2546 } | |
2547 | |
2548 | |
2549 // Implementation of utility class to encapsulate the translation state for | 2518 // Implementation of utility class to encapsulate the translation state for |
2550 // a (possibly inlined) function. | 2519 // a (possibly inlined) function. |
2551 FunctionState::FunctionState(HOptimizedGraphBuilder* owner, | 2520 FunctionState::FunctionState(HOptimizedGraphBuilder* owner, |
2552 CompilationInfo* info, | 2521 CompilationInfo* info, |
2553 InliningKind inlining_kind) | 2522 InliningKind inlining_kind) |
2554 : owner_(owner), | 2523 : owner_(owner), |
2555 compilation_info_(info), | 2524 compilation_info_(info), |
2556 call_context_(NULL), | 2525 call_context_(NULL), |
2557 inlining_kind_(inlining_kind), | 2526 inlining_kind_(inlining_kind), |
2558 function_return_(NULL), | 2527 function_return_(NULL), |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3011 | 2980 |
3012 if (has_osr()) osr()->FinishOsrValues(); | 2981 if (has_osr()) osr()->FinishOsrValues(); |
3013 | 2982 |
3014 Run<HInferRepresentationPhase>(); | 2983 Run<HInferRepresentationPhase>(); |
3015 | 2984 |
3016 // Remove HSimulate instructions that have turned out not to be needed | 2985 // Remove HSimulate instructions that have turned out not to be needed |
3017 // after all by folding them into the following HSimulate. | 2986 // after all by folding them into the following HSimulate. |
3018 // This must happen after inferring representations. | 2987 // This must happen after inferring representations. |
3019 Run<HMergeRemovableSimulatesPhase>(); | 2988 Run<HMergeRemovableSimulatesPhase>(); |
3020 | 2989 |
3021 MarkDeoptimizeOnUndefined(); | 2990 Run<HMarkDeoptimizeOnUndefinedPhase>(); |
3022 Run<HRepresentationChangesPhase>(); | 2991 Run<HRepresentationChangesPhase>(); |
3023 | 2992 |
3024 Run<HInferTypesPhase>(); | 2993 Run<HInferTypesPhase>(); |
3025 | 2994 |
3026 // Must be performed before canonicalization to ensure that Canonicalize | 2995 // Must be performed before canonicalization to ensure that Canonicalize |
3027 // will not remove semantically meaningful ToInt32 operations e.g. BIT_OR with | 2996 // will not remove semantically meaningful ToInt32 operations e.g. BIT_OR with |
3028 // zero. | 2997 // zero. |
3029 if (FLAG_opt_safe_uint32_operations) Run<HUint32AnalysisPhase>(); | 2998 if (FLAG_opt_safe_uint32_operations) Run<HUint32AnalysisPhase>(); |
3030 | 2999 |
3031 if (FLAG_use_canonicalizing) Run<HCanonicalizePhase>(); | 3000 if (FLAG_use_canonicalizing) Run<HCanonicalizePhase>(); |
(...skipping 6909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9941 if (ShouldProduceTraceOutput()) { | 9910 if (ShouldProduceTraceOutput()) { |
9942 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 9911 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
9943 } | 9912 } |
9944 | 9913 |
9945 #ifdef DEBUG | 9914 #ifdef DEBUG |
9946 graph_->Verify(false); // No full verify. | 9915 graph_->Verify(false); // No full verify. |
9947 #endif | 9916 #endif |
9948 } | 9917 } |
9949 | 9918 |
9950 } } // namespace v8::internal | 9919 } } // namespace v8::internal |
OLD | NEW |