Chromium Code Reviews| Index: src/factory.cc |
| diff --git a/src/factory.cc b/src/factory.cc |
| index 1c29ea13b2b2dd8a17c5c179635f7ab8362f8c55..fa0c9b1a2bf3d7bc113b0f84120085020d669db6 100644 |
| --- a/src/factory.cc |
| +++ b/src/factory.cc |
| @@ -114,7 +114,7 @@ Handle<ObjectHashTable> Factory::NewObjectHashTable(int at_least_space_for) { |
| Handle<DescriptorArray> Factory::NewDescriptorArray(int number_of_descriptors) { |
| ASSERT(0 <= number_of_descriptors); |
| CALL_HEAP_FUNCTION(isolate(), |
| - DescriptorArray::Allocate(number_of_descriptors), |
| + DescriptorArray::Allocate(number_of_descriptors, false), |
| DescriptorArray); |
| } |
| @@ -495,7 +495,7 @@ Handle<Map> Factory::CopyMap(Handle<Map> src, |
| Handle<Map> Factory::CopyMapDropTransitions(Handle<Map> src) { |
| - CALL_HEAP_FUNCTION(isolate(), src->CopyDropTransitions(), Map); |
| + CALL_HEAP_FUNCTION(isolate(), src->CopyDropTransitions(false), Map); |
| } |
| @@ -866,6 +866,21 @@ Handle<String> Factory::SymbolFromString(Handle<String> value) { |
| } |
| +static int LinearSearchUnsorted(DescriptorArray* descriptor_array, |
| + String* name, int len) { |
| + uint32_t hash = name->Hash(); |
| + for (int number = 0; number < len; number++) { |
| + String* entry = descriptor_array->GetKey(number); |
| + if (entry->Hash() == hash && |
| + name->Equals(entry) && |
| + !descriptor_array->IsNullDescriptor(number)) { |
| + return number; |
| + } |
| + } |
| + return DescriptorArray::kNotFound; |
| +} |
| + |
| + |
| Handle<DescriptorArray> Factory::CopyAppendCallbackDescriptors( |
| Handle<DescriptorArray> array, |
| Handle<Object> descriptors) { |
| @@ -900,7 +915,7 @@ Handle<DescriptorArray> Factory::CopyAppendCallbackDescriptors( |
| Handle<String> key = |
| SymbolFromString(Handle<String>(String::cast(entry->name()))); |
| // Check if a descriptor with this name already exists before writing. |
| - if (result->LinearSearch(*key, descriptor_count) == |
| + if (LinearSearchUnsorted(*result, *key, descriptor_count) == |
|
danno
2012/06/01 13:49:55
Add a enum { EXPECT_SORTED, EXPECT_UNSORTED } and
Toon Verwaest
2012/06/04 09:17:48
Done.
|
| DescriptorArray::kNotFound) { |
| CallbacksDescriptor desc(*key, *entry, entry->property_attributes()); |
| result->Set(descriptor_count, &desc, witness); |