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

Side by Side Diff: src/hydrogen.cc

Issue 11678007: SSI implementation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 11 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 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 if (!pointer->is_set()) { 590 if (!pointer->is_set()) {
591 HConstant* constant = 591 HConstant* constant =
592 new(zone()) HConstant(value, Representation::Integer32()); 592 new(zone()) HConstant(value, Representation::Integer32());
593 constant->InsertAfter(GetConstantUndefined()); 593 constant->InsertAfter(GetConstantUndefined());
594 pointer->set(constant); 594 pointer->set(constant);
595 } 595 }
596 return pointer->get(); 596 return pointer->get();
597 } 597 }
598 598
599 599
600 HConstant* HGraph::GetConstant0() {
601 return GetConstantInt32(&constant_0_, 0);
602 }
603
604
600 HConstant* HGraph::GetConstant1() { 605 HConstant* HGraph::GetConstant1() {
601 return GetConstantInt32(&constant_1_, 1); 606 return GetConstantInt32(&constant_1_, 1);
602 } 607 }
603 608
604 609
605 HConstant* HGraph::GetConstantMinus1() { 610 HConstant* HGraph::GetConstantMinus1() {
606 return GetConstantInt32(&constant_minus1_, -1); 611 return GetConstantInt32(&constant_minus1_, -1);
607 } 612 }
608 613
609 614
(...skipping 2882 matching lines...) Expand 10 before | Expand all | Expand 10 after
3492 if (FLAG_use_range) { 3497 if (FLAG_use_range) {
3493 HRangeAnalysis rangeAnalysis(this); 3498 HRangeAnalysis rangeAnalysis(this);
3494 rangeAnalysis.Analyze(); 3499 rangeAnalysis.Analyze();
3495 } 3500 }
3496 ComputeMinusZeroChecks(); 3501 ComputeMinusZeroChecks();
3497 3502
3498 // Eliminate redundant stack checks on backwards branches. 3503 // Eliminate redundant stack checks on backwards branches.
3499 HStackCheckEliminator sce(this); 3504 HStackCheckEliminator sce(this);
3500 sce.Process(); 3505 sce.Process();
3501 3506
3507 if (FLAG_use_ssi) {
3508 BuildSsi();
3509 CleanupSsi();
3510 }
3511
3502 EliminateRedundantBoundsChecks(); 3512 EliminateRedundantBoundsChecks();
3503 DehoistSimpleArrayIndexComputations(); 3513 DehoistSimpleArrayIndexComputations();
3504 if (FLAG_dead_code_elimination) DeadCodeElimination(); 3514 if (FLAG_dead_code_elimination) DeadCodeElimination();
3505 3515
3506 return true; 3516 return true;
3507 } 3517 }
3508 3518
3509 3519
3510 // We try to "factor up" HBoundsCheck instructions towards the root of the 3520 // We try to "factor up" HBoundsCheck instructions towards the root of the
3511 // dominator tree. 3521 // dominator tree.
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
3932 array_instruction = static_cast<ArrayInstructionInterface*>(op); 3942 array_instruction = static_cast<ArrayInstructionInterface*>(op);
3933 } else { 3943 } else {
3934 continue; 3944 continue;
3935 } 3945 }
3936 DehoistArrayIndex(array_instruction); 3946 DehoistArrayIndex(array_instruction);
3937 } 3947 }
3938 } 3948 }
3939 } 3949 }
3940 3950
3941 3951
3952 void HGraph::BuildSsi() {
3953 HPhase phase("H_Build SSI", this);
3954 entry_block()->BuildSsiRecursively();
3955 }
3956
3957
3958 void HGraph::CleanupSsi() {
3959 HPhase phase("H_Cleanup SSI", this);
3960 for (int b_index = 0; b_index < blocks()->length(); b_index++) {
3961 HBasicBlock* block = blocks()->at(b_index);
3962 HInstruction* current = block->first();
3963 while (current != NULL) {
3964 HInstruction* next = current->next();
3965 if (current->IsSsiDefinition()) {
3966 current->DeleteAndReplaceWith(current->ValueBeforeSsi());
3967 }
3968 current = next;
3969 }
3970 }
3971 }
3972
3973
3942 void HGraph::DeadCodeElimination() { 3974 void HGraph::DeadCodeElimination() {
3943 HPhase phase("H_Dead code elimination", this); 3975 HPhase phase("H_Dead code elimination", this);
3944 ZoneList<HInstruction*> worklist(blocks_.length(), zone()); 3976 ZoneList<HInstruction*> worklist(blocks_.length(), zone());
3945 for (int i = 0; i < blocks()->length(); ++i) { 3977 for (int i = 0; i < blocks()->length(); ++i) {
3946 for (HInstruction* instr = blocks()->at(i)->first(); 3978 for (HInstruction* instr = blocks()->at(i)->first();
3947 instr != NULL; 3979 instr != NULL;
3948 instr = instr->next()) { 3980 instr = instr->next()) {
3949 if (instr->IsDead()) worklist.Add(instr, zone()); 3981 if (instr->IsDead()) worklist.Add(instr, zone());
3950 } 3982 }
3951 } 3983 }
(...skipping 6242 matching lines...) Expand 10 before | Expand all | Expand 10 after
10194 } 10226 }
10195 } 10227 }
10196 10228
10197 #ifdef DEBUG 10229 #ifdef DEBUG
10198 if (graph_ != NULL) graph_->Verify(false); // No full verify. 10230 if (graph_ != NULL) graph_->Verify(false); // No full verify.
10199 if (allocator_ != NULL) allocator_->Verify(); 10231 if (allocator_ != NULL) allocator_->Verify();
10200 #endif 10232 #endif
10201 } 10233 }
10202 10234
10203 } } // namespace v8::internal 10235 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | src/hydrogen-instructions.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698