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 3229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3240 // Compute DeoptimizeOnUndefined flag for phis. | 3240 // Compute DeoptimizeOnUndefined flag for phis. |
3241 // Any phi that can reach a use with DeoptimizeOnUndefined set must | 3241 // Any phi that can reach a use with DeoptimizeOnUndefined set must |
3242 // have DeoptimizeOnUndefined set. Currently only HCompareIDAndBranch, with | 3242 // have DeoptimizeOnUndefined set. Currently only HCompareIDAndBranch, with |
3243 // double input representation, has this flag set. | 3243 // double input representation, has this flag set. |
3244 // The flag is used by HChange tagged->double, which must deoptimize | 3244 // The flag is used by HChange tagged->double, which must deoptimize |
3245 // if one of its uses has this flag set. | 3245 // if one of its uses has this flag set. |
3246 for (int i = 0; i < phi_list()->length(); i++) { | 3246 for (int i = 0; i < phi_list()->length(); i++) { |
3247 HPhi* phi = phi_list()->at(i); | 3247 HPhi* phi = phi_list()->at(i); |
3248 if (phi->representation().IsDouble()) { | 3248 if (phi->representation().IsDouble()) { |
3249 for (HUseIterator it(phi->uses()); !it.Done(); it.Advance()) { | 3249 for (HUseIterator it(phi->uses()); !it.Done(); it.Advance()) { |
3250 if (it.value()->CheckFlag(HValue::kDeoptimizeOnUndefined)) { | 3250 int use_index = it.index(); |
| 3251 HValue* use_value = it.value(); |
| 3252 Representation req = use_value->RequiredInputRepresentation(use_index); |
| 3253 if (!req.IsDouble() || |
| 3254 use_value->CheckFlag(HValue::kDeoptimizeOnUndefined)) { |
3251 RecursivelyMarkPhiDeoptimizeOnUndefined(phi); | 3255 RecursivelyMarkPhiDeoptimizeOnUndefined(phi); |
3252 break; | 3256 break; |
3253 } | 3257 } |
3254 } | 3258 } |
3255 } | 3259 } |
3256 } | 3260 } |
3257 } | 3261 } |
3258 | 3262 |
3259 | 3263 |
3260 // Discover instructions that can be marked with kUint32 flag allowing | 3264 // Discover instructions that can be marked with kUint32 flag allowing |
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3981 } | 3985 } |
3982 | 3986 |
3983 HInferRepresentation rep(this); | 3987 HInferRepresentation rep(this); |
3984 rep.Analyze(); | 3988 rep.Analyze(); |
3985 | 3989 |
3986 // Remove HSimulate instructions that have turned out not to be needed | 3990 // Remove HSimulate instructions that have turned out not to be needed |
3987 // after all by folding them into the following HSimulate. | 3991 // after all by folding them into the following HSimulate. |
3988 // This must happen after inferring representations. | 3992 // This must happen after inferring representations. |
3989 MergeRemovableSimulates(); | 3993 MergeRemovableSimulates(); |
3990 | 3994 |
| 3995 MarkDeoptimizeOnUndefined(); |
3991 InsertRepresentationChanges(); | 3996 InsertRepresentationChanges(); |
3992 MarkDeoptimizeOnUndefined(); | |
3993 | 3997 |
3994 InitializeInferredTypes(); | 3998 InitializeInferredTypes(); |
3995 | 3999 |
3996 // Must be performed before canonicalization to ensure that Canonicalize | 4000 // Must be performed before canonicalization to ensure that Canonicalize |
3997 // will not remove semantically meaningful ToInt32 operations e.g. BIT_OR with | 4001 // will not remove semantically meaningful ToInt32 operations e.g. BIT_OR with |
3998 // zero. | 4002 // zero. |
3999 if (FLAG_opt_safe_uint32_operations) ComputeSafeUint32Operations(); | 4003 if (FLAG_opt_safe_uint32_operations) ComputeSafeUint32Operations(); |
4000 | 4004 |
4001 if (FLAG_use_canonicalizing) Canonicalize(); | 4005 if (FLAG_use_canonicalizing) Canonicalize(); |
4002 | 4006 |
(...skipping 7464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11467 } | 11471 } |
11468 } | 11472 } |
11469 | 11473 |
11470 #ifdef DEBUG | 11474 #ifdef DEBUG |
11471 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 11475 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
11472 if (allocator_ != NULL) allocator_->Verify(); | 11476 if (allocator_ != NULL) allocator_->Verify(); |
11473 #endif | 11477 #endif |
11474 } | 11478 } |
11475 | 11479 |
11476 } } // namespace v8::internal | 11480 } } // namespace v8::internal |
OLD | NEW |