Revision: 3047
Author: [email protected]
Date: Mon Oct 12 05:42:20 2009
Log: Changes to comments only, fixing errors and grammar.
Review URL: http://codereview.chromium.org/269050
http://code.google.com/p/v8/source/detail?r=3047

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

=======================================
--- /branches/bleeding_edge/src/compilation-cache.cc    Fri Aug 14 10:19:51  
2009
+++ /branches/bleeding_edge/src/compilation-cache.cc    Mon Oct 12 05:42:20  
2009
@@ -49,14 +49,14 @@
  static const int kRegExpGenerations = 2;
  #endif

-// Initial of each compilation cache table allocated.
+// Initial size of each compilation cache table allocated.
  static const int kInitialCacheSize = 64;

  // The compilation cache consists of several generational sub-caches which  
uses
  // this class as a base class. A sub-cache contains a compilation cache  
tables
-// for each generation of the sub-cache. As the same source code string has
-// different compiled code for scripts and evals. Internally, we use  
separate
-// sub-caches to avoid getting the wrong kind of result when looking up.
+// for each generation of the sub-cache. Since the same source code string  
has
+// different compiled code for scripts and evals, we use separate  
sub-caches
+// for different compilation modes, to avoid retrieving the wrong result.
  class CompilationSubCache {
   public:
    explicit CompilationSubCache(int generations): generations_(generations)  
{
=======================================
--- /branches/bleeding_edge/src/objects.cc      Tue Oct  6 06:11:05 2009
+++ /branches/bleeding_edge/src/objects.cc      Mon Oct 12 05:42:20 2009
@@ -6562,6 +6562,10 @@
        : string_(string),
          flags_(Smi::FromInt(flags.value())) { }

+  // Rather than storing the key in the hash table, a pointer to the
+  // stored value is stored where the key should be.  IsMatch then
+  // compares the search key to the found object, rather than comparing
+  // a key to a key.
    bool IsMatch(Object* obj) {
      FixedArray* val = FixedArray::cast(obj);
      return string_->Equals(String::cast(val->get(JSRegExp::kSourceIndex)))
@@ -7221,6 +7225,8 @@
    CompilationCacheTable* cache =
        reinterpret_cast<CompilationCacheTable*>(obj);
    int entry = cache->FindInsertionEntry(key.Hash());
+  // We store the value in the key slot, and compare the search key
+  // to the stored value with a custon IsMatch function during lookups.
    cache->set(EntryToIndex(entry), value);
    cache->set(EntryToIndex(entry) + 1, value);
    cache->ElementAdded();
=======================================
--- /branches/bleeding_edge/src/objects.h       Thu Oct  8 05:36:12 2009
+++ /branches/bleeding_edge/src/objects.h       Mon Oct 12 05:42:20 2009
@@ -2032,33 +2032,33 @@
  //     // The Element size indicates number of elements per entry.
  //     static const int kEntrySize = ..;
  //   };
-// table.  The prefix size indicates an amount of memory in the
+// The prefix size indicates an amount of memory in the
  // beginning of the backing storage that can be used for non-element
  // information by subclasses.

  template<typename Shape, typename Key>
  class HashTable: public FixedArray {
   public:
-  // Returns the number of elements in the dictionary.
+  // Returns the number of elements in the hash table.
    int NumberOfElements() {
      return Smi::cast(get(kNumberOfElementsIndex))->value();
    }

-  // Returns the capacity of the dictionary.
+  // Returns the capacity of the hash table.
    int Capacity() {
      return Smi::cast(get(kCapacityIndex))->value();
    }

    // ElementAdded should be called whenever an element is added to a
-  // dictionary.
+  // hash table.
    void ElementAdded() { SetNumberOfElements(NumberOfElements() + 1); }

    // ElementRemoved should be called whenever an element is removed from
-  // a dictionary.
+  // a hash table.
    void ElementRemoved() { SetNumberOfElements(NumberOfElements() - 1); }
    void ElementsRemoved(int n) { SetNumberOfElements(NumberOfElements() -  
n); }

-  // Returns a new array for dictionary usage. Might return Failure.
+  // Returns a new HashTable object. Might return Failure.
    static Object* Allocate(int at_least_space_for);

    // Returns the key at entry.
@@ -2108,7 +2108,7 @@
      return (entry * kEntrySize) + kElementsStartIndex;
    }

-  // Update the number of elements in the dictionary.
+  // Update the number of elements in the hash table.
    void SetNumberOfElements(int nof) {
      fast_set(this, kNumberOfElementsIndex, Smi::FromInt(nof));
    }
@@ -2144,7 +2144,7 @@
    virtual uint32_t Hash() = 0;
    // Returns the hash value for object.
    virtual uint32_t HashForObject(Object* key) = 0;
-  // Returns the key object for storing into the dictionary.
+  // Returns the key object for storing into the hash table.
    // If allocations fails a failure object is returned.
    virtual Object* AsObject() = 0;
    // Required.
@@ -3575,6 +3575,7 @@
    static const int kEntrySize = 2;
  };

+
  class CompilationCacheTable: public HashTable<CompilationCacheShape,
                                                HashTableKey*> {
   public:

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

Reply via email to