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

Unified Diff: src/compilation-cache.cc

Issue 115500: Use a large enough variable in CompilationCache::LookupScript to avoid overfl... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: '' Created 11 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compilation-cache.cc
===================================================================
--- src/compilation-cache.cc (revision 1983)
+++ src/compilation-cache.cc (working copy)
@@ -138,13 +138,17 @@
int line_offset,
int column_offset) {
Object* result = NULL;
- Entry generation = SCRIPT; // First generation.
+ // Using int below so value range propagation in gcc 4.3+ won't assume
+ // |generation| can only go up to LAST_ENTRY when in fact it can go
+ // up to SCRIPT + NUMBER_OF_SCRIPT_GENERATIONS.
+ int generation = static_cast<int>(SCRIPT); // First generation.
// Probe the script generation tables. Make sure not to leak handles
// into the caller's handle scope.
{ HandleScope scope;
while (generation < SCRIPT + NUMBER_OF_SCRIPT_GENERATIONS) {
- Handle<CompilationCacheTable> table = GetTable(generation);
+ Handle<CompilationCacheTable> table =
+ GetTable(static_cast<Entry>(generation));
Handle<Object> probe(table->Lookup(*source));
if (probe->IsJSFunction()) {
Handle<JSFunction> boilerplate = Handle<JSFunction>::cast(probe);
@@ -156,7 +160,7 @@
}
}
// Go to the next generation.
- generation = static_cast<Entry>(generation + 1);
+ generation++;
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698