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

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: Addressed review comments. 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();
3593 }
3591 if (FLAG_array_index_dehoisting) DehoistSimpleArrayIndexComputations(); 3594 if (FLAG_array_index_dehoisting) DehoistSimpleArrayIndexComputations();
3592 if (FLAG_dead_code_elimination) DeadCodeElimination(); 3595 if (FLAG_dead_code_elimination) DeadCodeElimination();
3593 3596
3594 RestoreActualValues(); 3597 RestoreActualValues();
3595 3598
3596 return true; 3599 return true;
3597 } 3600 }
3598 3601
3599 3602
3603 void HGraph::SetupInformativeDefinitionsInBlock(HBasicBlock* block) {
3604 for (int phi_index = 0; phi_index < block->phis()->length(); phi_index++) {
3605 HPhi* phi = block->phis()->at(phi_index);
3606 phi->AddInformativeDefinitions();
3607 // We do not support phis that "redefine just one operand".
3608 ASSERT(!phi->IsInformativeDefinition());
3609 }
3610
3611 for (HInstruction* i = block->first(); i != NULL; i = i->next()) {
3612 i->AddInformativeDefinitions();
3613 i->UpdateRedefinedUsesWhileSettingUpInformativeDefinitions();
3614 }
3615 }
3616
3617
3618 // This method is recursive, so if its stack frame is large it could
3619 // cause a stack overflow.
3620 // To keep the individual stack frames small we do the actual work inside
3621 // SetupInformativeDefinitionsInBlock();
3622 void HGraph::SetupInformativeDefinitionsRecursively(HBasicBlock* block) {
3623 SetupInformativeDefinitionsInBlock(block);
3624 for (int i = 0; i < block->dominated_blocks()->length(); ++i) {
3625 SetupInformativeDefinitionsRecursively(block->dominated_blocks()->at(i));
3626 }
3627 }
3628
3629
3630 void HGraph::SetupInformativeDefinitions() {
3631 HPhase phase("H_Setup informative definitions", this);
3632 SetupInformativeDefinitionsRecursively(entry_block());
3633 }
3634
3635
3600 // We try to "factor up" HBoundsCheck instructions towards the root of the 3636 // We try to "factor up" HBoundsCheck instructions towards the root of the
3601 // dominator tree. 3637 // dominator tree.
3602 // For now we handle checks where the index is like "exp + int32value". 3638 // 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) 3639 // 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 3640 // "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. 3641 // 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 3642 // To do so we keep a dictionary of all checks where the key if the pair
3607 // "exp, length". 3643 // "exp, length".
3608 // The class BoundsCheckKey represents this key. 3644 // The class BoundsCheckKey represents this key.
3609 class BoundsCheckKey : public ZoneObject { 3645 class BoundsCheckKey : public ZoneObject {
(...skipping 6738 matching lines...) Expand 10 before | Expand all | Expand 10 after
10348 } 10384 }
10349 } 10385 }
10350 10386
10351 #ifdef DEBUG 10387 #ifdef DEBUG
10352 if (graph_ != NULL) graph_->Verify(false); // No full verify. 10388 if (graph_ != NULL) graph_->Verify(false); // No full verify.
10353 if (allocator_ != NULL) allocator_->Verify(); 10389 if (allocator_ != NULL) allocator_->Verify();
10354 #endif 10390 #endif
10355 } 10391 }
10356 10392
10357 } } // namespace v8::internal 10393 } } // 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