Showing with 28 additions and 19 deletions.
  1. +0 −1 src/heap.cc
  2. +2 −3 src/hir-instructions.h
  3. +2 −2 src/hir.cc
  4. +1 −1 src/lir.cc
  5. +1 −1 src/lir.h
  6. +1 −1 src/root.h
  7. +1 −1 src/scope.h
  8. +20 −9 src/utils.h
@@ -105,7 +105,6 @@ Heap::Heap(uint32_t page_size) : new_space_(this, page_size),
needs_gc_(kGCNone),
gc_(this) {
current_ = this;
references_.allocated = true;
factory_ = HValue::Cast(HObject::NewEmpty(this, kMinFactorySize));
Reference(Heap::kRefPersistent, &factory_, factory_);
}
@@ -17,7 +17,7 @@ class HIRPhi;
class LInstruction;

typedef ZoneList<HIRInstruction*> HIRInstructionList;
typedef HashMap<NumberKey, HIRInstruction, ZoneObject> HIRInstructionMap;
typedef ZoneMap<NumberKey, HIRInstruction, ZoneObject> HIRInstructionMap;
typedef ZoneList<HIRPhi*> HIRPhiList;

#define HIR_INSTRUCTION_TYPES(V) \
@@ -166,10 +166,9 @@ class HIRInstruction : public ZoneObject {

#undef HIR_INSTRUCTION_ENUM

class HIRGVNMap : public HashMap<HIRInstruction, HIRInstruction, ZoneObject>,
class HIRGVNMap : public ZoneMap<HIRInstruction, HIRInstruction, ZoneObject>,
public ZoneObject {
public:
HIRGVNMap() {}
};

#define HIR_DEFAULT_METHODS(V) \
@@ -306,7 +306,7 @@ void HIRGen::FindOutEffects(HIRInstruction* instr) {
if (instr->alias_visited == 1) return;
instr->alias_visited = 1;

HashMap<NumberKey, HIRInstruction, ZoneObject> effects_;
ZoneMap<NumberKey, HIRInstruction, ZoneObject> effects_;

HIRInstructionList::Item* uhead = instr->uses()->head();
for (; uhead != NULL; uhead = uhead->next()) {
@@ -343,7 +343,7 @@ void HIRGen::FindInEffects(HIRInstruction* instr) {
if (instr->alias_visited == 2) return;
instr->alias_visited = 2;

HashMap<NumberKey, HIRInstruction, ZoneObject> effects_;
ZoneMap<NumberKey, HIRInstruction, ZoneObject> effects_;

HIRInstructionList::Item* ahead = instr->args()->head();
for (; ahead != NULL; ahead = ahead->next()) {
@@ -756,7 +756,7 @@ void LGen::AllocateSpills() {
}
}

HashMap<NumberKey, LInterval, ZoneObject> blocked;
ZoneMap<NumberKey, LInterval, ZoneObject> blocked;
int max_index = 0;

head = active_spills_.head();
@@ -28,7 +28,7 @@ class SourceMap;
typedef ZoneList<LInterval*> LIntervalList;
typedef ZoneList<LRange*> LRangeList;
typedef ZoneList<LUse*> LUseList;
typedef HashMap<NumberKey, LUse, ZoneObject> LUseMap;
typedef ZoneMap<NumberKey, LUse, ZoneObject> LUseMap;

class LRange : public ZoneObject {
public:
@@ -32,7 +32,7 @@ class Root {

Heap* heap_;
HValueList values_;
HashMap<NumberKey, ScopeSlot, ZoneObject> map_;
ZoneMap<NumberKey, ScopeSlot, ZoneObject> map_;
};

} // namespace internal
@@ -82,7 +82,7 @@ class ScopeSlot : public ZoneObject {
};

// On each block or function enter new scope is created
class Scope : public HashMap<StringKey<ZoneObject>, ScopeSlot, ZoneObject> {
class Scope : public ZoneMap<StringKey<ZoneObject>, ScopeSlot, ZoneObject> {
public:
enum Type {
kBlock,
@@ -345,8 +345,8 @@ class StringKey : public Base {
};


template <class Key, class Value, class ItemParent>
class HashMap {
template <class Key, class Value, class ItemParent, class Policy>
class GenericHashMap {
public:
typedef void (*EnumerateCallback)(void* map, Value* value);

@@ -377,14 +377,14 @@ class HashMap {
Item* prev_scalar_;
Item* next_scalar_;

friend class HashMap;
friend class GenericHashMap;
};

HashMap() : allocated(false), head_(NULL), current_(NULL) {
GenericHashMap() : head_(NULL), current_(NULL) {
memset(&map_, 0, sizeof(map_));
}

~HashMap() {
~GenericHashMap() {
Item* i = head_;

while (i != NULL) {
@@ -394,7 +394,7 @@ class HashMap {
i = i->next_scalar();

delete prev;
if (allocated) delete value;
Policy::Delete(value);
}
}

@@ -481,7 +481,7 @@ class HashMap {
}

// Remove any allocated data
if (allocated) delete i->value();
Policy::Delete(i->value());
delete i;

return;
@@ -502,8 +502,6 @@ class HashMap {

inline Item* head() { return head_; }

bool allocated;

private:
static const uint32_t size_ = 32;
static const uint32_t mask_ = 31;
@@ -513,6 +511,19 @@ class HashMap {
};


template <class Key, class Value, class ItemParent>
class HashMap : public GenericHashMap<Key,
Value,
ItemParent,
DeletePolicy<Value*> > {
public:
};

template <class Key, class Value, class ItemParent>
class ZoneMap : public GenericHashMap<Key, Value, ItemParent, NopPolicy> {
public:
};

class NumberKey {
public:
static NumberKey* New(const intptr_t value) {