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

Side by Side Diff: src/data-flow.cc

Issue 885004: Only invoke reaching definitions if there are >0 variables and >0 definitions... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 9 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
« src/compiler.cc ('K') | « src/compiler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 2043 matching lines...) Expand 10 before | Expand all | Expand 10 after
2054 rd_.rd_in()->CopyFrom(new_rd_in); 2054 rd_.rd_in()->CopyFrom(new_rd_in);
2055 // Add the successor to the worklist if not already present. 2055 // Add the successor to the worklist if not already present.
2056 if (!successor_->IsMarkedWith(mark)) { 2056 if (!successor_->IsMarkedWith(mark)) {
2057 successor_->MarkWith(mark); 2057 successor_->MarkWith(mark);
2058 worklist->Insert(successor_); 2058 worklist->Insert(successor_);
2059 } 2059 }
2060 } 2060 }
2061 2061
2062 2062
2063 void ReachingDefinitions::Compute() { 2063 void ReachingDefinitions::Compute() {
2064 if (definitions_->is_empty()) return; 2064 ASSERT(!definitions_->is_empty());
Kevin Millikin (Chromium) 2010/03/12 14:58:16 I'd leave this check here.
2065 2065
2066 int variable_count = variables_.length(); 2066 int variable_count = variables_.length();
2067 int definition_count = definitions_->length(); 2067 int definition_count = definitions_->length();
2068 int node_count = postorder_->length(); 2068 int node_count = postorder_->length();
2069 2069
2070 // Step 1: For each variable, identify the set of all its definitions in 2070 // Step 1: For each variable, identify the set of all its definitions in
2071 // the body. 2071 // the body.
2072 for (int i = 0; i < definition_count; i++) { 2072 for (int i = 0; i < definition_count; i++) {
2073 Variable* var = definitions_->at(i)->AssignedVar(); 2073 Variable* var = definitions_->at(i)->AssignedVar();
2074 variables_[IndexFor(var, variable_count)]->Add(i); 2074 variables_[IndexFor(var, variable_count)]->Add(i);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
2114 // all necessary successors to the worklist. 2114 // all necessary successors to the worklist.
2115 while (!worklist.is_empty()) { 2115 while (!worklist.is_empty()) {
2116 Node* node = worklist.Remove(); 2116 Node* node = worklist.Remove();
2117 node->MarkWith(!mark); 2117 node->MarkWith(!mark);
2118 node->UpdateRDIn(&worklist, mark); 2118 node->UpdateRDIn(&worklist, mark);
2119 } 2119 }
2120 } 2120 }
2121 2121
2122 2122
2123 } } // namespace v8::internal 2123 } } // namespace v8::internal
OLDNEW
« src/compiler.cc ('K') | « src/compiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698