Author: [email protected]
Date: Tue May 19 23:42:12 2009
New Revision: 2004

Modified:
    branches/bleeding_edge/src/compilation-cache.cc

Log:
Fix compilation for gcc 4.3+. Patch by Lei Zhang.
Review URL: http://codereview.chromium.org/113621

Modified: branches/bleeding_edge/src/compilation-cache.cc
==============================================================================
--- branches/bleeding_edge/src/compilation-cache.cc     (original)
+++ branches/bleeding_edge/src/compilation-cache.cc     Tue May 19 23:42:12 2009
@@ -54,14 +54,15 @@
  }


-static Handle<CompilationCacheTable> GetTable(CompilationCache::Entry  
entry) {
+static Handle<CompilationCacheTable> GetTable(int index) {
+  ASSERT(index >= 0 && index < NUMBER_OF_TABLE_ENTRIES);
    Handle<CompilationCacheTable> result;
-  if (tables[entry]->IsUndefined()) {
+  if (tables[index]->IsUndefined()) {
      static const int kInitialCacheSize = 64;
      result = AllocateTable(kInitialCacheSize);
-    tables[entry] = *result;
+    tables[index] = *result;
    } else {
-    CompilationCacheTable* table =  
CompilationCacheTable::cast(tables[entry]);
+    CompilationCacheTable* table =  
CompilationCacheTable::cast(tables[index]);
      result = Handle<CompilationCacheTable>(table);
    }
    return result;
@@ -137,8 +138,11 @@
                                                    Handle<Object> name,
                                                    int line_offset,
                                                    int column_offset) {
+  // Use an int for the generation index, so value range propagation
+  // in gcc 4.3+ won't assume it can only go up to LAST_ENTRY when in
+  // fact it can go up to SCRIPT + NUMBER_OF_SCRIPT_GENERATIONS.
+  int generation = SCRIPT;
    Object* result = NULL;
-  Entry generation = SCRIPT;  // First generation.

    // Probe the script generation tables. Make sure not to leak handles
    // into the caller's handle scope.
@@ -156,7 +160,7 @@
          }
        }
        // Go to the next generation.
-      generation = static_cast<Entry>(generation + 1);
+      generation++;
      }
    }


--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to