Commit e75a173f authored by ager@chromium.org's avatar ager@chromium.org

Revert r2324 until we can fix build and test errors.

TBR=bak@chromium.org

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2325 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 5cbb2094
......@@ -1434,8 +1434,8 @@ void Genesis::TransferNamedProperties(Handle<JSObject> from,
}
}
} else {
Handle<StringDictionary> properties =
Handle<StringDictionary>(from->property_dictionary());
Handle<Dictionary> properties =
Handle<Dictionary>(from->property_dictionary());
int capacity = properties->Capacity();
for (int i = 0; i < capacity; i++) {
Object* raw_key(properties->KeyAt(i));
......
......@@ -37,8 +37,8 @@ namespace internal {
Handle<Code> CodeStub::GetCode() {
uint32_t key = GetKey();
int index = Heap::code_stubs()->FindEntry(key);
if (index == NumberDictionary::kNotFound) {
int index = Heap::code_stubs()->FindNumberEntry(key);
if (index == -1) {
HandleScope scope;
// Update the static counter each time a new code stub is generated.
......@@ -80,15 +80,14 @@ Handle<Code> CodeStub::GetCode() {
#endif
// Update the dictionary and the root in Heap.
Handle<NumberDictionary> dict =
Factory::DictionaryAtNumberPut(
Handle<NumberDictionary>(Heap::code_stubs()),
key,
code);
Handle<Dictionary> dict =
Factory::DictionaryAtNumberPut(Handle<Dictionary>(Heap::code_stubs()),
key,
code);
Heap::set_code_stubs(*dict);
index = Heap::code_stubs()->FindEntry(key);
index = Heap::code_stubs()->FindNumberEntry(key);
}
ASSERT(index != NumberDictionary::kNotFound);
ASSERT(index != -1);
return Handle<Code>(Code::cast(Heap::code_stubs()->ValueAt(index)));
}
......
......@@ -49,17 +49,9 @@ Handle<FixedArray> Factory::NewFixedArrayWithHoles(int size) {
}
Handle<StringDictionary> Factory::NewStringDictionary(int at_least_space_for) {
Handle<Dictionary> Factory::NewDictionary(int at_least_space_for) {
ASSERT(0 <= at_least_space_for);
CALL_HEAP_FUNCTION(StringDictionary::Allocate(at_least_space_for),
StringDictionary);
}
Handle<NumberDictionary> Factory::NewNumberDictionary(int at_least_space_for) {
ASSERT(0 <= at_least_space_for);
CALL_HEAP_FUNCTION(NumberDictionary::Allocate(at_least_space_for),
NumberDictionary);
CALL_HEAP_FUNCTION(Dictionary::Allocate(at_least_space_for), Dictionary);
}
......@@ -663,11 +655,10 @@ Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo(Handle<String> name) {
}
Handle<NumberDictionary> Factory::DictionaryAtNumberPut(
Handle<NumberDictionary> dictionary,
uint32_t key,
Handle<Object> value) {
CALL_HEAP_FUNCTION(dictionary->AtNumberPut(key, *value), NumberDictionary);
Handle<Dictionary> Factory::DictionaryAtNumberPut(Handle<Dictionary> dictionary,
uint32_t key,
Handle<Object> value) {
CALL_HEAP_FUNCTION(dictionary->AtNumberPut(key, *value), Dictionary);
}
......
......@@ -47,9 +47,7 @@ class Factory : public AllStatic {
// Allocate a new fixed array with non-existing entries (the hole).
static Handle<FixedArray> NewFixedArrayWithHoles(int size);
static Handle<NumberDictionary> NewNumberDictionary(int at_least_space_for);
static Handle<StringDictionary> NewStringDictionary(int at_least_space_for);
static Handle<Dictionary> NewDictionary(int at_least_space_for);
static Handle<DescriptorArray> NewDescriptorArray(int number_of_descriptors);
......@@ -315,10 +313,9 @@ class Factory : public AllStatic {
static Handle<SharedFunctionInfo> NewSharedFunctionInfo(Handle<String> name);
static Handle<NumberDictionary> DictionaryAtNumberPut(
Handle<NumberDictionary>,
uint32_t key,
Handle<Object> value);
static Handle<Dictionary> DictionaryAtNumberPut(Handle<Dictionary>,
uint32_t key,
Handle<Object> value);
#ifdef ENABLE_DEBUGGER_SUPPORT
static Handle<DebugInfo> NewDebugInfo(Handle<SharedFunctionInfo> shared);
......
......@@ -198,8 +198,7 @@ class FixedArray;
class FunctionEntry;
class FunctionLiteral;
class FunctionTemplateInfo;
class NumberDictionary;
class StringDictionary;
class Dictionary;
class FreeStoreAllocationPolicy;
template <typename T> class Handle;
class Heap;
......
......@@ -1392,14 +1392,14 @@ bool Heap::CreateInitialObjects() {
prototype_accessors_ = Proxy::cast(obj);
// Allocate the code_stubs dictionary.
obj = NumberDictionary::Allocate(4);
obj = Dictionary::Allocate(4);
if (obj->IsFailure()) return false;
code_stubs_ = NumberDictionary::cast(obj);
code_stubs_ = Dictionary::cast(obj);
// Allocate the non_monomorphic_cache used in stub-cache.cc
obj = NumberDictionary::Allocate(4);
obj = Dictionary::Allocate(4);
if (obj->IsFailure()) return false;
non_monomorphic_cache_ = NumberDictionary::cast(obj);
non_monomorphic_cache_ = Dictionary::cast(obj);
CreateFixedStubs();
......@@ -2563,7 +2563,7 @@ Object* Heap::AllocateHashTable(int length) {
Object* result = Heap::AllocateFixedArray(length);
if (result->IsFailure()) return result;
reinterpret_cast<Array*>(result)->set_map(hash_table_map());
ASSERT(result->IsHashTable());
ASSERT(result->IsDictionary());
return result;
}
......
......@@ -118,8 +118,8 @@ namespace internal {
V(Map, neander_map) \
V(JSObject, message_listeners) \
V(Proxy, prototype_accessors) \
V(NumberDictionary, code_stubs) \
V(NumberDictionary, non_monomorphic_cache) \
V(Dictionary, code_stubs) \
V(Dictionary, non_monomorphic_cache) \
V(Code, js_entry_code) \
V(Code, js_construct_entry_code) \
V(Code, c_entry_code) \
......@@ -692,10 +692,10 @@ class Heap : public AllStatic {
static inline AllocationSpace TargetSpaceId(InstanceType type);
// Sets the stub_cache_ (only used when expanding the dictionary).
static void set_code_stubs(NumberDictionary* value) { code_stubs_ = value; }
static void set_code_stubs(Dictionary* value) { code_stubs_ = value; }
// Sets the non_monomorphic_cache_ (only used when expanding the dictionary).
static void set_non_monomorphic_cache(NumberDictionary* value) {
static void set_non_monomorphic_cache(Dictionary* value) {
non_monomorphic_cache_ = value;
}
......
......@@ -83,7 +83,7 @@ static void GenerateDictionaryLoad(MacroAssembler* masm, Label* miss_label,
// Compute the capacity mask.
const int kCapacityOffset =
Array::kHeaderSize + StringDictionary::kCapacityIndex * kPointerSize;
Array::kHeaderSize + Dictionary::kCapacityIndex * kPointerSize;
__ mov(r2, FieldOperand(r0, kCapacityOffset));
__ shr(r2, kSmiTagSize); // convert smi to int
__ dec(r2);
......@@ -93,18 +93,18 @@ static void GenerateDictionaryLoad(MacroAssembler* masm, Label* miss_label,
// cover ~93% of loads from dictionaries.
static const int kProbes = 4;
const int kElementsStartOffset =
Array::kHeaderSize + StringDictionary::kElementsStartIndex * kPointerSize;
Array::kHeaderSize + Dictionary::kElementsStartIndex * kPointerSize;
for (int i = 0; i < kProbes; i++) {
// Compute the masked index: (hash + i + i * i) & mask.
__ mov(r1, FieldOperand(name, String::kLengthOffset));
__ shr(r1, String::kHashShift);
if (i > 0) {
__ add(Operand(r1), Immediate(StringDictionary::GetProbeOffset(i)));
__ add(Operand(r1), Immediate(Dictionary::GetProbeOffset(i)));
}
__ and_(r1, Operand(r2));
// Scale the index by multiplying by the entry size.
ASSERT(StringDictionary::kEntrySize == 3);
// Scale the index by multiplying by the element size.
ASSERT(Dictionary::kElementSize == 3);
__ lea(r1, Operand(r1, r1, times_2, 0)); // r1 = r1 * 3
// Check if the key is identical to the name.
......
......@@ -744,12 +744,12 @@ void Proxy::ProxyVerify() {
ASSERT(IsProxy());
}
template<typename Shape, typename Key>
void Dictionary<Shape, Key>::Print() {
int capacity = HashTable<Shape, Key>::Capacity();
void Dictionary::Print() {
int capacity = Capacity();
for (int i = 0; i < capacity; i++) {
Object* k = HashTable<Shape, Key>::KeyAt(i);
if (HashTable<Shape, Key>::IsKey(k)) {
Object* k = KeyAt(i);
if (IsKey(k)) {
PrintF(" ");
if (k->IsString()) {
String::cast(k)->StringPrint();
......@@ -1017,7 +1017,7 @@ void JSObject::IncrementSpillStatistics(SpillInformation* info) {
info->number_of_fast_used_fields_ += map()->NextFreePropertyIndex();
info->number_of_fast_unused_fields_ += map()->unused_property_fields();
} else {
StringDictionary* dict = property_dictionary();
Dictionary* dict = property_dictionary();
info->number_of_slow_used_properties_ += dict->NumberOfElements();
info->number_of_slow_unused_properties_ +=
dict->Capacity() - dict->NumberOfElements();
......@@ -1034,7 +1034,7 @@ void JSObject::IncrementSpillStatistics(SpillInformation* info) {
info->number_of_fast_used_elements_ += len - holes;
info->number_of_fast_unused_elements_ += holes;
} else {
NumberDictionary* dict = element_dictionary();
Dictionary* dict = element_dictionary();
info->number_of_slow_used_elements_ += dict->NumberOfElements();
info->number_of_slow_unused_elements_ +=
dict->Capacity() - dict->NumberOfElements();
......
......@@ -1370,14 +1370,15 @@ void DescriptorArray::Swap(int first, int second) {
}
bool NumberDictionary::requires_slow_elements() {
bool Dictionary::requires_slow_elements() {
Object* max_index_object = get(kMaxNumberKeyIndex);
if (!max_index_object->IsSmi()) return false;
return 0 !=
(Smi::cast(max_index_object)->value() & kRequiresSlowElementsMask);
}
uint32_t NumberDictionary::max_number_key() {
uint32_t Dictionary::max_number_key() {
ASSERT(!requires_slow_elements());
Object* max_index_object = get(kMaxNumberKeyIndex);
if (!max_index_object->IsSmi()) return 0;
......@@ -1385,7 +1386,8 @@ uint32_t NumberDictionary::max_number_key() {
return value >> kRequiresSlowElementsTagSize;
}
void NumberDictionary::set_requires_slow_elements() {
void Dictionary::set_requires_slow_elements() {
set(kMaxNumberKeyIndex,
Smi::FromInt(kRequiresSlowElementsMask),
SKIP_WRITE_BARRIER);
......@@ -1398,6 +1400,7 @@ void NumberDictionary::set_requires_slow_elements() {
CAST_ACCESSOR(FixedArray)
CAST_ACCESSOR(DescriptorArray)
CAST_ACCESSOR(Dictionary)
CAST_ACCESSOR(SymbolTable)
CAST_ACCESSOR(CompilationCacheTable)
CAST_ACCESSOR(MapCache)
......@@ -1436,9 +1439,9 @@ CAST_ACCESSOR(Struct)
STRUCT_LIST(MAKE_STRUCT_CAST)
#undef MAKE_STRUCT_CAST
template <typename Shape, typename Key>
HashTable<Shape, Key>* HashTable<Shape, Key>::cast(Object* obj) {
template <int prefix_size, int elem_size>
HashTable<prefix_size, elem_size>* HashTable<prefix_size, elem_size>::cast(
Object* obj) {
ASSERT(obj->IsHashTable());
return reinterpret_cast<HashTable*>(obj);
}
......@@ -2465,15 +2468,15 @@ bool JSObject::HasIndexedInterceptor() {
}
StringDictionary* JSObject::property_dictionary() {
Dictionary* JSObject::property_dictionary() {
ASSERT(!HasFastProperties());
return StringDictionary::cast(properties());
return Dictionary::cast(properties());
}
NumberDictionary* JSObject::element_dictionary() {
Dictionary* JSObject::element_dictionary() {
ASSERT(!HasFastElements());
return NumberDictionary::cast(elements());
return Dictionary::cast(elements());
}
......@@ -2637,17 +2640,16 @@ void AccessorInfo::set_property_attributes(PropertyAttributes attributes) {
set_flag(Smi::FromInt(rest_value | AttributesField::encode(attributes)));
}
template<typename Shape, typename Key>
void Dictionary<Shape, Key>::SetEntry(int entry,
Object* key,
Object* value,
PropertyDetails details) {
void Dictionary::SetEntry(int entry,
Object* key,
Object* value,
PropertyDetails details) {
ASSERT(!key->IsString() || details.index() > 0);
int index = HashTable<Shape, Key>::EntryToIndex(entry);
WriteBarrierMode mode = FixedArray::GetWriteBarrierMode();
FixedArray::set(index, key, mode);
FixedArray::set(index+1, value, mode);
FixedArray::fast_set(this, index+2, details.AsSmi());
int index = EntryToIndex(entry);
WriteBarrierMode mode = GetWriteBarrierMode();
set(index, key, mode);
set(index+1, value, mode);
fast_set(this, index+2, details.AsSmi());
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -168,7 +168,7 @@ static Object* DeepCopyBoilerplate(JSObject* boilerplate) {
}
}
} else {
NumberDictionary* element_dictionary = copy->element_dictionary();
Dictionary* element_dictionary = copy->element_dictionary();
int capacity = element_dictionary->Capacity();
for (int i = 0; i < capacity; i++) {
Object* k = element_dictionary->KeyAt(i);
......@@ -2604,9 +2604,9 @@ static Object* Runtime_KeyedGetProperty(Arguments args) {
}
} else {
// Attempt dictionary lookup.
StringDictionary* dictionary = receiver->property_dictionary();
int entry = dictionary->FindEntry(key);
if ((entry != StringDictionary::kNotFound) &&
Dictionary* dictionary = receiver->property_dictionary();
int entry = dictionary->FindStringEntry(key);
if ((entry != Dictionary::kNotFound) &&
(dictionary->DetailsAt(entry).type() == NORMAL)) {
Object* value = dictionary->ValueAt(entry);
if (receiver->IsGlobalObject()) {
......@@ -5130,8 +5130,8 @@ class ArrayConcatVisitor {
storage_->set(index, *elm);
} else {
Handle<NumberDictionary> dict = Handle<NumberDictionary>::cast(storage_);
Handle<NumberDictionary> result =
Handle<Dictionary> dict = Handle<Dictionary>::cast(storage_);
Handle<Dictionary> result =
Factory::DictionaryAtNumberPut(dict, index, elm);
if (!result.is_identical_to(dict))
storage_ = result;
......@@ -5179,7 +5179,7 @@ static uint32_t IterateElements(Handle<JSObject> receiver,
}
} else {
Handle<NumberDictionary> dict(receiver->element_dictionary());
Handle<Dictionary> dict(receiver->element_dictionary());
uint32_t capacity = dict->Capacity();
for (uint32_t j = 0; j < capacity; j++) {
Handle<Object> k(dict->KeyAt(j));
......@@ -5333,7 +5333,7 @@ static Object* Runtime_ArrayConcat(Arguments args) {
uint32_t at_least_space_for = estimate_nof_elements +
(estimate_nof_elements >> 2);
storage = Handle<FixedArray>::cast(
Factory::NewNumberDictionary(at_least_space_for));
Factory::NewDictionary(at_least_space_for));
}
Handle<Object> len = Factory::NewNumber(static_cast<double>(result_length));
......@@ -5396,7 +5396,7 @@ static Object* Runtime_EstimateNumberOfElements(Arguments args) {
CONVERT_CHECKED(JSArray, array, args[0]);
HeapObject* elements = array->elements();
if (elements->IsDictionary()) {
return Smi::FromInt(NumberDictionary::cast(elements)->NumberOfElements());
return Smi::FromInt(Dictionary::cast(elements)->NumberOfElements());
} else {
return array->length();
}
......
......@@ -562,8 +562,8 @@ Object* StubCache::ComputeCallGlobal(int argc,
static Object* GetProbeValue(Code::Flags flags) {
NumberDictionary* dictionary = Heap::non_monomorphic_cache();
int entry = dictionary->FindEntry(flags);
Dictionary* dictionary = Heap::non_monomorphic_cache();
int entry = dictionary->FindNumberEntry(flags);
if (entry != -1) return dictionary->ValueAt(entry);
return Heap::undefined_value();
}
......@@ -579,7 +579,7 @@ static Object* ProbeCache(Code::Flags flags) {
Heap::non_monomorphic_cache()->AtNumberPut(flags,
Heap::undefined_value());
if (result->IsFailure()) return result;
Heap::set_non_monomorphic_cache(NumberDictionary::cast(result));
Heap::set_non_monomorphic_cache(Dictionary::cast(result));
return probe;
}
......@@ -587,7 +587,7 @@ static Object* ProbeCache(Code::Flags flags) {
static Object* FillCache(Object* code) {
if (code->IsCode()) {
int entry =
Heap::non_monomorphic_cache()->FindEntry(
Heap::non_monomorphic_cache()->FindNumberEntry(
Code::cast(code)->flags());
// The entry must be present see comment in ProbeCache.
ASSERT(entry != -1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment