| 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 2421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2478 phi_list_ = new(zone()) ZoneList<HPhi*>(block_count, zone()); | 2479 phi_list_ = new(zone()) ZoneList<HPhi*>(block_count, zone()); |
| 2479 for (int i = 0; i < block_count; ++i) { | 2480 for (int i = 0; i < block_count; ++i) { |
| 2480 for (int j = 0; j < blocks_[i]->phis()->length(); ++j) { | 2481 for (int j = 0; j < blocks_[i]->phis()->length(); ++j) { |
| 2481 HPhi* phi = blocks_[i]->phis()->at(j); | 2482 HPhi* phi = blocks_[i]->phis()->at(j); |
| 2482 phi_list_->Add(phi, zone()); | 2483 phi_list_->Add(phi, zone()); |
| 2483 } | 2484 } |
| 2484 } | 2485 } |
| 2485 } | 2486 } |
| 2486 | 2487 |
| 2487 | 2488 |
| 2488 void HGraph::RecursivelyMarkPhiDeoptimizeOnUndefined(HPhi* phi) { | |
| 2489 if (!phi->CheckFlag(HValue::kAllowUndefinedAsNaN)) return; | |
| 2490 phi->ClearFlag(HValue::kAllowUndefinedAsNaN); | |
| 2491 for (int i = 0; i < phi->OperandCount(); ++i) { | |
| 2492 HValue* input = phi->OperandAt(i); | |
| 2493 if (input->IsPhi()) { | |
| 2494 RecursivelyMarkPhiDeoptimizeOnUndefined(HPhi::cast(input)); | |
| 2495 } | |
| 2496 } | |
| 2497 } | |
| 2498 | |
| 2499 | |
| 2500 void HGraph::MarkDeoptimizeOnUndefined() { | |
| 2501 HPhase phase("H_MarkDeoptimizeOnUndefined", this); | |
| 2502 // Compute DeoptimizeOnUndefined flag for phis. Any phi that can reach a use | |
| 2503 // with DeoptimizeOnUndefined set must have DeoptimizeOnUndefined set. | |
| 2504 // Currently only HCompareNumericAndBranch, with double input representation, | |
| 2505 // has this flag set. The flag is used by HChange tagged->double, which must | |
| 2506 // deoptimize if one of its uses has this flag set. | |
| 2507 for (int i = 0; i < phi_list()->length(); i++) { | |
| 2508 HPhi* phi = phi_list()->at(i); | |
| 2509 for (HUseIterator it(phi->uses()); !it.Done(); it.Advance()) { | |
| 2510 HValue* use_value = it.value(); | |
| 2511 if (!use_value->CheckFlag(HValue::kAllowUndefinedAsNaN)) { | |
| 2512 RecursivelyMarkPhiDeoptimizeOnUndefined(phi); | |
| 2513 break; | |
| 2514 } | |
| 2515 } | |
| 2516 } | |
| 2517 } | |
| 2518 | |
| 2519 | |
| 2520 // Implementation of utility class to encapsulate the translation state for | 2489 // Implementation of utility class to encapsulate the translation state for |
| 2521 // a (possibly inlined) function. | 2490 // a (possibly inlined) function. |
| 2522 FunctionState::FunctionState(HOptimizedGraphBuilder* owner, | 2491 FunctionState::FunctionState(HOptimizedGraphBuilder* owner, |
| 2523 CompilationInfo* info, | 2492 CompilationInfo* info, |
| 2524 InliningKind inlining_kind) | 2493 InliningKind inlining_kind) |
| 2525 : owner_(owner), | 2494 : owner_(owner), |
| 2526 compilation_info_(info), | 2495 compilation_info_(info), |
| 2527 call_context_(NULL), | 2496 call_context_(NULL), |
| 2528 inlining_kind_(inlining_kind), | 2497 inlining_kind_(inlining_kind), |
| 2529 function_return_(NULL), | 2498 function_return_(NULL), |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2982 | 2951 |
| 2983 if (has_osr()) osr()->FinishOsrValues(); | 2952 if (has_osr()) osr()->FinishOsrValues(); |
| 2984 | 2953 |
| 2985 Run<HInferRepresentationPhase>(); | 2954 Run<HInferRepresentationPhase>(); |
| 2986 | 2955 |
| 2987 // Remove HSimulate instructions that have turned out not to be needed | 2956 // Remove HSimulate instructions that have turned out not to be needed |
| 2988 // after all by folding them into the following HSimulate. | 2957 // after all by folding them into the following HSimulate. |
| 2989 // This must happen after inferring representations. | 2958 // This must happen after inferring representations. |
| 2990 Run<HMergeRemovableSimulatesPhase>(); | 2959 Run<HMergeRemovableSimulatesPhase>(); |
| 2991 | 2960 |
| 2992 MarkDeoptimizeOnUndefined(); | 2961 Run<HMarkDeoptimizeOnUndefinedPhase>(); |
| 2993 Run<HRepresentationChangesPhase>(); | 2962 Run<HRepresentationChangesPhase>(); |
| 2994 | 2963 |
| 2995 Run<HInferTypesPhase>(); | 2964 Run<HInferTypesPhase>(); |
| 2996 | 2965 |
| 2997 // Must be performed before canonicalization to ensure that Canonicalize | 2966 // Must be performed before canonicalization to ensure that Canonicalize |
| 2998 // will not remove semantically meaningful ToInt32 operations e.g. BIT_OR with | 2967 // will not remove semantically meaningful ToInt32 operations e.g. BIT_OR with |
| 2999 // zero. | 2968 // zero. |
| 3000 if (FLAG_opt_safe_uint32_operations) Run<HUint32AnalysisPhase>(); | 2969 if (FLAG_opt_safe_uint32_operations) Run<HUint32AnalysisPhase>(); |
| 3001 | 2970 |
| 3002 if (FLAG_use_canonicalizing) Run<HCanonicalizePhase>(); | 2971 if (FLAG_use_canonicalizing) Run<HCanonicalizePhase>(); |
| (...skipping 6909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9912 if (ShouldProduceTraceOutput()) { | 9881 if (ShouldProduceTraceOutput()) { |
| 9913 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 9882 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 9914 } | 9883 } |
| 9915 | 9884 |
| 9916 #ifdef DEBUG | 9885 #ifdef DEBUG |
| 9917 graph_->Verify(false); // No full verify. | 9886 graph_->Verify(false); // No full verify. |
| 9918 #endif | 9887 #endif |
| 9919 } | 9888 } |
| 9920 | 9889 |
| 9921 } } // namespace v8::internal | 9890 } } // namespace v8::internal |
| OLD | NEW |