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

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

Issue 1040002: Fix bug in the count operation where we statically know the input is a smi. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Rearranged comments 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
« no previous file with comments | « no previous file | src/ia32/codegen-ia32.cc » ('j') | 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 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 } 1110 }
1111 1111
1112 // The direction of the count operation must agree with the start and the end 1112 // The direction of the count operation must agree with the start and the end
1113 // value. We currently do not allow the initial value to be the same as the 1113 // value. We currently do not allow the initial value to be the same as the
1114 // terminal value. This _would_ be ok as long as the loop body never executes 1114 // terminal value. This _would_ be ok as long as the loop body never executes
1115 // or executes exactly one time. 1115 // or executes exactly one time.
1116 if (init_value == term_value) return NULL; 1116 if (init_value == term_value) return NULL;
1117 if (init_value < term_value && update->op() != Token::INC) return NULL; 1117 if (init_value < term_value && update->op() != Token::INC) return NULL;
1118 if (init_value > term_value && update->op() != Token::DEC) return NULL; 1118 if (init_value > term_value && update->op() != Token::DEC) return NULL;
1119 1119
1120 // Check that the update operation cannot overflow the smi range. This can
1121 // occur in the two cases where the loop bound is equal to the largest or
1122 // smallest smi.
1123 if (update->op() == Token::INC && term_value == Smi::kMaxValue) return NULL;
1124 if (update->op() == Token::DEC && term_value == Smi::kMinValue) return NULL;
1125
1120 // Found a smi loop variable. 1126 // Found a smi loop variable.
1121 return loop_var; 1127 return loop_var;
1122 } 1128 }
1123 1129
1124 int AssignedVariablesAnalyzer::BitIndex(Variable* var) { 1130 int AssignedVariablesAnalyzer::BitIndex(Variable* var) {
1125 ASSERT(var != NULL); 1131 ASSERT(var != NULL);
1126 ASSERT(var->IsStackAllocated()); 1132 ASSERT(var->IsStackAllocated());
1127 Slot* slot = var->slot(); 1133 Slot* slot = var->slot();
1128 if (slot->type() == Slot::PARAMETER) { 1134 if (slot->type() == Slot::PARAMETER) {
1129 return slot->index(); 1135 return slot->index();
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after
2199 2205
2200 // Step 4: Based on RD_in for block nodes, propagate reaching definitions 2206 // Step 4: Based on RD_in for block nodes, propagate reaching definitions
2201 // to all variable uses in the block. 2207 // to all variable uses in the block.
2202 for (int i = 0; i < node_count; i++) { 2208 for (int i = 0; i < node_count; i++) {
2203 postorder_->at(i)->PropagateReachingDefinitions(&variables_); 2209 postorder_->at(i)->PropagateReachingDefinitions(&variables_);
2204 } 2210 }
2205 } 2211 }
2206 2212
2207 2213
2208 } } // namespace v8::internal 2214 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/ia32/codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698