Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(679)

Side by Side Diff: src/hydrogen.cc

Issue 12079042: Base iDef update code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 3569 matching lines...) Expand 10 before | Expand all | Expand 10 after
3580 if (FLAG_use_range) { 3580 if (FLAG_use_range) {
3581 HRangeAnalysis rangeAnalysis(this); 3581 HRangeAnalysis rangeAnalysis(this);
3582 rangeAnalysis.Analyze(); 3582 rangeAnalysis.Analyze();
3583 } 3583 }
3584 ComputeMinusZeroChecks(); 3584 ComputeMinusZeroChecks();
3585 3585
3586 // Eliminate redundant stack checks on backwards branches. 3586 // Eliminate redundant stack checks on backwards branches.
3587 HStackCheckEliminator sce(this); 3587 HStackCheckEliminator sce(this);
3588 sce.Process(); 3588 sce.Process();
3589 3589
3590 if (FLAG_array_bounds_checks_elimination) EliminateRedundantBoundsChecks(); 3590 if (FLAG_idefs) SetupInformativeDefinitions();
3591 if (FLAG_array_bounds_checks_elimination && !FLAG_idefs)
3592 EliminateRedundantBoundsChecks();
Jakob Kummerow 2013/01/31 14:06:43 nit: {} please
Massi 2013/01/31 17:16:19 Done.
3591 if (FLAG_array_index_dehoisting) DehoistSimpleArrayIndexComputations(); 3593 if (FLAG_array_index_dehoisting) DehoistSimpleArrayIndexComputations();
3592 if (FLAG_dead_code_elimination) DeadCodeElimination(); 3594 if (FLAG_dead_code_elimination) DeadCodeElimination();
3593 3595
3594 RestoreActualValues(); 3596 RestoreActualValues();
3595 3597
3596 return true; 3598 return true;
3597 } 3599 }
3598 3600
3599 3601
3602 void HGraph::SetupInformativeDefinitionsInBlock(HBasicBlock* block) {
3603 for (int phi_index = 0; phi_index < block->phis()->length(); phi_index++) {
3604 HPhi* phi = block->phis()->at(phi_index);
3605 phi->AddInformativeDefinitions();
3606 // We do not support phis that "redefine just one operand".
3607 ASSERT(!phi->IsInformativeDefinition());
3608 }
3609
3610 for (HInstruction* i = block->first(); i != NULL; i = i->next()) {
3611 i->AddInformativeDefinitions();
3612 i->UpdateRedefinedUsesWhileSettingUpInformativeDefinitions();
3613 }
3614 }
3615
3616
3617 // This method is recursive, so if its stack frame is large it could
3618 // cause a stack overflow.
3619 // To keep the individual stack frames small we do the actual work inside
3620 // SetupInformativeDefinitionsInBlock();
3621 void HGraph::SetupInformativeDefinitionsRecursively(HBasicBlock* block) {
3622 SetupInformativeDefinitionsInBlock(block);
3623 for (int i = 0; i < block->dominated_blocks()->length(); ++i) {
3624 SetupInformativeDefinitionsRecursively(block->dominated_blocks()->at(i));
3625 }
3626 }
3627
3628
3629 void HGraph::SetupInformativeDefinitions() {
3630 HPhase phase("H_Setup informative definitions", this);
3631 SetupInformativeDefinitionsRecursively(entry_block());
3632 }
3633
3634
3600 // We try to "factor up" HBoundsCheck instructions towards the root of the 3635 // We try to "factor up" HBoundsCheck instructions towards the root of the
3601 // dominator tree. 3636 // dominator tree.
3602 // For now we handle checks where the index is like "exp + int32value". 3637 // For now we handle checks where the index is like "exp + int32value".
3603 // If in the dominator tree we check "exp + v1" and later (dominated) 3638 // If in the dominator tree we check "exp + v1" and later (dominated)
3604 // "exp + v2", if v2 <= v1 we can safely remove the second check, and if 3639 // "exp + v2", if v2 <= v1 we can safely remove the second check, and if
3605 // v2 > v1 we can use v2 in the 1st check and again remove the second. 3640 // v2 > v1 we can use v2 in the 1st check and again remove the second.
3606 // To do so we keep a dictionary of all checks where the key if the pair 3641 // To do so we keep a dictionary of all checks where the key if the pair
3607 // "exp, length". 3642 // "exp, length".
3608 // The class BoundsCheckKey represents this key. 3643 // The class BoundsCheckKey represents this key.
3609 class BoundsCheckKey : public ZoneObject { 3644 class BoundsCheckKey : public ZoneObject {
(...skipping 6738 matching lines...) Expand 10 before | Expand all | Expand 10 after
10348 } 10383 }
10349 } 10384 }
10350 10385
10351 #ifdef DEBUG 10386 #ifdef DEBUG
10352 if (graph_ != NULL) graph_->Verify(false); // No full verify. 10387 if (graph_ != NULL) graph_->Verify(false); // No full verify.
10353 if (allocator_ != NULL) allocator_->Verify(); 10388 if (allocator_ != NULL) allocator_->Verify();
10354 #endif 10389 #endif
10355 } 10390 }
10356 10391
10357 } } // namespace v8::internal 10392 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | src/hydrogen-instructions.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698