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

Side by Side Diff: src/hydrogen.cc

Issue 17657004: Refactor Hydrogen GVN into an HPhase and use the phase zone. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 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 3928 matching lines...) Expand 10 before | Expand all | Expand 10 after
3939 int checksum = type_info->own_type_change_checksum(); 3939 int checksum = type_info->own_type_change_checksum();
3940 int composite_checksum = graph()->update_type_change_checksum(checksum); 3940 int composite_checksum = graph()->update_type_change_checksum(checksum);
3941 graph()->set_use_optimistic_licm( 3941 graph()->set_use_optimistic_licm(
3942 !type_info->matches_inlined_type_change_checksum(composite_checksum)); 3942 !type_info->matches_inlined_type_change_checksum(composite_checksum));
3943 type_info->set_inlined_type_change_checksum(composite_checksum); 3943 type_info->set_inlined_type_change_checksum(composite_checksum);
3944 3944
3945 return true; 3945 return true;
3946 } 3946 }
3947 3947
3948 3948
3949 // Perform common subexpression elimination and loop-invariant code motion.
3950 void HGraph::GlobalValueNumbering() {
3951 HPhase phase("H_Global value numbering", this);
3952 HGlobalValueNumberer gvn(this, info());
3953 bool removed_side_effects = gvn.Analyze();
3954 // Trigger a second analysis pass to further eliminate duplicate values that
3955 // could only be discovered by removing side-effect-generating instructions
3956 // during the first pass.
3957 if (FLAG_smi_only_arrays && removed_side_effects) {
3958 removed_side_effects = gvn.Analyze();
3959 ASSERT(!removed_side_effects);
3960 }
3961 }
3962
3963
3964 bool HGraph::Optimize(SmartArrayPointer<char>* bailout_reason) { 3949 bool HGraph::Optimize(SmartArrayPointer<char>* bailout_reason) {
3965 *bailout_reason = SmartArrayPointer<char>(); 3950 *bailout_reason = SmartArrayPointer<char>();
3966 OrderBlocks(); 3951 OrderBlocks();
3967 AssignDominators(); 3952 AssignDominators();
3968 3953
3969 // We need to create a HConstant "zero" now so that GVN will fold every 3954 // We need to create a HConstant "zero" now so that GVN will fold every
3970 // zero-valued constant in the graph together. 3955 // zero-valued constant in the graph together.
3971 // The constant is needed to make idef-based bounds check work: the pass 3956 // The constant is needed to make idef-based bounds check work: the pass
3972 // evaluates relations with "zero" and that zero cannot be created after GVN. 3957 // evaluates relations with "zero" and that zero cannot be created after GVN.
3973 GetConstant0(); 3958 GetConstant0();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
4022 4007
4023 InitializeInferredTypes(); 4008 InitializeInferredTypes();
4024 4009
4025 // Must be performed before canonicalization to ensure that Canonicalize 4010 // Must be performed before canonicalization to ensure that Canonicalize
4026 // will not remove semantically meaningful ToInt32 operations e.g. BIT_OR with 4011 // will not remove semantically meaningful ToInt32 operations e.g. BIT_OR with
4027 // zero. 4012 // zero.
4028 if (FLAG_opt_safe_uint32_operations) ComputeSafeUint32Operations(); 4013 if (FLAG_opt_safe_uint32_operations) ComputeSafeUint32Operations();
4029 4014
4030 if (FLAG_use_canonicalizing) Canonicalize(); 4015 if (FLAG_use_canonicalizing) Canonicalize();
4031 4016
4032 if (FLAG_use_gvn) GlobalValueNumbering(); 4017 if (FLAG_use_gvn) Run<HGlobalValueNumberingPhase>();
4033 4018
4034 if (FLAG_use_range) { 4019 if (FLAG_use_range) {
4035 HRangeAnalysis rangeAnalysis(this); 4020 HRangeAnalysis rangeAnalysis(this);
4036 rangeAnalysis.Analyze(); 4021 rangeAnalysis.Analyze();
4037 } 4022 }
4038 ComputeMinusZeroChecks(); 4023 ComputeMinusZeroChecks();
4039 4024
4040 // Eliminate redundant stack checks on backwards branches. 4025 // Eliminate redundant stack checks on backwards branches.
4041 HStackCheckEliminator sce(this); 4026 HStackCheckEliminator sce(this);
4042 sce.Process(); 4027 sce.Process();
(...skipping 7504 matching lines...) Expand 10 before | Expand all | Expand 10 after
11547 sizes_[i] += size; 11532 sizes_[i] += size;
11548 return; 11533 return;
11549 } 11534 }
11550 } 11535 }
11551 names_.Add(name); 11536 names_.Add(name);
11552 timing_.Add(ticks); 11537 timing_.Add(ticks);
11553 sizes_.Add(size); 11538 sizes_.Add(size);
11554 } 11539 }
11555 11540
11556 11541
11542 HPhase::HPhase(const char* name, HGraph* graph, Zone* zone)
11543 : CompilationPhase(name, graph->isolate(), zone), graph_(graph) {
11544 if (FLAG_hydrogen_stats) {
11545 graph_zone_start_allocation_size_ = graph->zone()->allocation_size();
11546 }
11547 }
11548
11549
11557 HPhase::~HPhase() { 11550 HPhase::~HPhase() {
11551 // Also count allocations in the graph's zone if it's not the phase zone
11552 if (FLAG_hydrogen_stats && graph_->zone() != zone()) {
11553 unsigned size =
11554 graph_->zone()->allocation_size() - graph_zone_start_allocation_size_;
11555 isolate()->GetHStatistics()->SaveTiming(name(), 0, size);
11556 }
11557
11558 if (ShouldProduceTraceOutput()) { 11558 if (ShouldProduceTraceOutput()) {
11559 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 11559 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
11560 } 11560 }
11561 11561
11562 #ifdef DEBUG 11562 #ifdef DEBUG
11563 graph_->Verify(false); // No full verify. 11563 graph_->Verify(false); // No full verify.
11564 #endif 11564 #endif
11565 } 11565 }
11566 11566
11567 } } // namespace v8::internal 11567 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698