OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 2500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2511 } | 2511 } |
2512 Object* obj; | 2512 Object* obj; |
2513 { MaybeObject* maybe_obj = | 2513 { MaybeObject* maybe_obj = |
2514 StringDictionary::Allocate(property_count); | 2514 StringDictionary::Allocate(property_count); |
2515 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 2515 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
2516 } | 2516 } |
2517 StringDictionary* dictionary = StringDictionary::cast(obj); | 2517 StringDictionary* dictionary = StringDictionary::cast(obj); |
2518 | 2518 |
2519 DescriptorArray* descs = map_of_this->instance_descriptors(); | 2519 DescriptorArray* descs = map_of_this->instance_descriptors(); |
2520 for (int i = 0; i < descs->number_of_descriptors(); i++) { | 2520 for (int i = 0; i < descs->number_of_descriptors(); i++) { |
2521 PropertyDetails details = descs->GetDetails(i); | 2521 PropertyDetails details(descs->GetDetails(i)); |
2522 switch (details.type()) { | 2522 switch (details.type()) { |
2523 case CONSTANT_FUNCTION: { | 2523 case CONSTANT_FUNCTION: { |
2524 PropertyDetails d = | 2524 PropertyDetails d = |
2525 PropertyDetails(details.attributes(), NORMAL, details.index()); | 2525 PropertyDetails(details.attributes(), NORMAL, details.index()); |
2526 Object* value = descs->GetConstantFunction(i); | 2526 Object* value = descs->GetConstantFunction(i); |
2527 Object* result; | 2527 Object* result; |
2528 { MaybeObject* maybe_result = | 2528 { MaybeObject* maybe_result = |
2529 dictionary->Add(descs->GetKey(i), value, d); | 2529 dictionary->Add(descs->GetKey(i), value, d); |
2530 if (!maybe_result->ToObject(&result)) return maybe_result; | 2530 if (!maybe_result->ToObject(&result)) return maybe_result; |
2531 } | 2531 } |
(...skipping 5563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8095 LocalLookupRealNamedProperty(key, &result); | 8095 LocalLookupRealNamedProperty(key, &result); |
8096 return result.IsProperty() && (result.type() == CALLBACKS); | 8096 return result.IsProperty() && (result.type() == CALLBACKS); |
8097 } | 8097 } |
8098 | 8098 |
8099 | 8099 |
8100 int JSObject::NumberOfLocalProperties(PropertyAttributes filter) { | 8100 int JSObject::NumberOfLocalProperties(PropertyAttributes filter) { |
8101 if (HasFastProperties()) { | 8101 if (HasFastProperties()) { |
8102 DescriptorArray* descs = map()->instance_descriptors(); | 8102 DescriptorArray* descs = map()->instance_descriptors(); |
8103 int result = 0; | 8103 int result = 0; |
8104 for (int i = 0; i < descs->number_of_descriptors(); i++) { | 8104 for (int i = 0; i < descs->number_of_descriptors(); i++) { |
8105 PropertyDetails details = descs->GetDetails(i); | 8105 PropertyDetails details(descs->GetDetails(i)); |
8106 if (details.IsProperty() && (details.attributes() & filter) == 0) { | 8106 if (details.IsProperty() && (details.attributes() & filter) == 0) { |
8107 result++; | 8107 result++; |
8108 } | 8108 } |
8109 } | 8109 } |
8110 return result; | 8110 return result; |
8111 } else { | 8111 } else { |
8112 return property_dictionary()->NumberOfElementsFilterAttributes(filter); | 8112 return property_dictionary()->NumberOfElementsFilterAttributes(filter); |
8113 } | 8113 } |
8114 } | 8114 } |
8115 | 8115 |
(...skipping 1546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9662 | 9662 |
9663 Heap* heap = GetHeap(); | 9663 Heap* heap = GetHeap(); |
9664 int removed_entries = 0; | 9664 int removed_entries = 0; |
9665 Object* sentinel = heap->null_value(); | 9665 Object* sentinel = heap->null_value(); |
9666 int capacity = Capacity(); | 9666 int capacity = Capacity(); |
9667 for (int i = 0; i < capacity; i++) { | 9667 for (int i = 0; i < capacity; i++) { |
9668 Object* key = KeyAt(i); | 9668 Object* key = KeyAt(i); |
9669 if (key->IsNumber()) { | 9669 if (key->IsNumber()) { |
9670 uint32_t number = static_cast<uint32_t>(key->Number()); | 9670 uint32_t number = static_cast<uint32_t>(key->Number()); |
9671 if (from <= number && number < to) { | 9671 if (from <= number && number < to) { |
9672 SetEntry(i, sentinel, sentinel, Smi::FromInt(0)); | 9672 SetEntry(i, sentinel, sentinel); |
9673 removed_entries++; | 9673 removed_entries++; |
9674 } | 9674 } |
9675 } | 9675 } |
9676 } | 9676 } |
9677 | 9677 |
9678 // Update the number of elements. | 9678 // Update the number of elements. |
9679 ElementsRemoved(removed_entries); | 9679 ElementsRemoved(removed_entries); |
9680 } | 9680 } |
9681 | 9681 |
9682 | 9682 |
9683 template<typename Shape, typename Key> | 9683 template<typename Shape, typename Key> |
9684 Object* Dictionary<Shape, Key>::DeleteProperty(int entry, | 9684 Object* Dictionary<Shape, Key>::DeleteProperty(int entry, |
9685 JSObject::DeleteMode mode) { | 9685 JSObject::DeleteMode mode) { |
9686 Heap* heap = Dictionary<Shape, Key>::GetHeap(); | 9686 Heap* heap = Dictionary<Shape, Key>::GetHeap(); |
9687 PropertyDetails details = DetailsAt(entry); | 9687 PropertyDetails details = DetailsAt(entry); |
9688 // Ignore attributes if forcing a deletion. | 9688 // Ignore attributes if forcing a deletion. |
9689 if (details.IsDontDelete() && mode != JSObject::FORCE_DELETION) { | 9689 if (details.IsDontDelete() && mode != JSObject::FORCE_DELETION) { |
9690 return heap->false_value(); | 9690 return heap->false_value(); |
9691 } | 9691 } |
9692 SetEntry(entry, heap->null_value(), heap->null_value(), Smi::FromInt(0)); | 9692 SetEntry(entry, heap->null_value(), heap->null_value()); |
9693 HashTable<Shape, Key>::ElementRemoved(); | 9693 HashTable<Shape, Key>::ElementRemoved(); |
9694 return heap->true_value(); | 9694 return heap->true_value(); |
9695 } | 9695 } |
9696 | 9696 |
9697 | 9697 |
9698 template<typename Shape, typename Key> | 9698 template<typename Shape, typename Key> |
9699 MaybeObject* Dictionary<Shape, Key>::AtPut(Key key, Object* value) { | 9699 MaybeObject* Dictionary<Shape, Key>::AtPut(Key key, Object* value) { |
9700 int entry = this->FindEntry(key); | 9700 int entry = this->FindEntry(key); |
9701 | 9701 |
9702 // If the entry is present set the value; | 9702 // If the entry is present set the value; |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10303 if (break_point_objects()->IsUndefined()) return 0; | 10303 if (break_point_objects()->IsUndefined()) return 0; |
10304 // Single beak point. | 10304 // Single beak point. |
10305 if (!break_point_objects()->IsFixedArray()) return 1; | 10305 if (!break_point_objects()->IsFixedArray()) return 1; |
10306 // Multiple break points. | 10306 // Multiple break points. |
10307 return FixedArray::cast(break_point_objects())->length(); | 10307 return FixedArray::cast(break_point_objects())->length(); |
10308 } | 10308 } |
10309 #endif | 10309 #endif |
10310 | 10310 |
10311 | 10311 |
10312 } } // namespace v8::internal | 10312 } } // namespace v8::internal |
OLD | NEW |