| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 3688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3699 int next_descriptor = 0; | 3699 int next_descriptor = 0; |
| 3700 for (int i = 0; i < number_of_descriptors(); i++) { | 3700 for (int i = 0; i < number_of_descriptors(); i++) { |
| 3701 if (IsProperty(i)) new_descriptors->CopyFrom(next_descriptor++, this, i); | 3701 if (IsProperty(i)) new_descriptors->CopyFrom(next_descriptor++, this, i); |
| 3702 } | 3702 } |
| 3703 ASSERT(next_descriptor == new_descriptors->number_of_descriptors()); | 3703 ASSERT(next_descriptor == new_descriptors->number_of_descriptors()); |
| 3704 | 3704 |
| 3705 return new_descriptors; | 3705 return new_descriptors; |
| 3706 } | 3706 } |
| 3707 | 3707 |
| 3708 | 3708 |
| 3709 void DescriptorArray::Sort() { | 3709 void DescriptorArray::SortUnchecked() { |
| 3710 // In-place heap sort. | 3710 // In-place heap sort. |
| 3711 int len = number_of_descriptors(); | 3711 int len = number_of_descriptors(); |
| 3712 | 3712 |
| 3713 // Bottom-up max-heap construction. | 3713 // Bottom-up max-heap construction. |
| 3714 // Index of the last node with children | 3714 // Index of the last node with children |
| 3715 const int max_parent_index = (len / 2) - 1; | 3715 const int max_parent_index = (len / 2) - 1; |
| 3716 for (int i = max_parent_index; i >= 0; --i) { | 3716 for (int i = max_parent_index; i >= 0; --i) { |
| 3717 int parent_index = i; | 3717 int parent_index = i; |
| 3718 const uint32_t parent_hash = GetKey(i)->Hash(); | 3718 const uint32_t parent_hash = GetKey(i)->Hash(); |
| 3719 while (parent_index <= max_parent_index) { | 3719 while (parent_index <= max_parent_index) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 3749 if (right_child_hash > child_hash) { | 3749 if (right_child_hash > child_hash) { |
| 3750 child_index++; | 3750 child_index++; |
| 3751 child_hash = right_child_hash; | 3751 child_hash = right_child_hash; |
| 3752 } | 3752 } |
| 3753 } | 3753 } |
| 3754 if (child_hash <= parent_hash) break; | 3754 if (child_hash <= parent_hash) break; |
| 3755 Swap(parent_index, child_index); | 3755 Swap(parent_index, child_index); |
| 3756 parent_index = child_index; | 3756 parent_index = child_index; |
| 3757 } | 3757 } |
| 3758 } | 3758 } |
| 3759 } |
| 3759 | 3760 |
| 3761 |
| 3762 void DescriptorArray::Sort() { |
| 3763 SortUnchecked(); |
| 3760 SLOW_ASSERT(IsSortedNoDuplicates()); | 3764 SLOW_ASSERT(IsSortedNoDuplicates()); |
| 3761 } | 3765 } |
| 3762 | 3766 |
| 3763 | 3767 |
| 3764 int DescriptorArray::BinarySearch(String* name, int low, int high) { | 3768 int DescriptorArray::BinarySearch(String* name, int low, int high) { |
| 3765 uint32_t hash = name->Hash(); | 3769 uint32_t hash = name->Hash(); |
| 3766 | 3770 |
| 3767 while (low <= high) { | 3771 while (low <= high) { |
| 3768 int mid = (low + high) / 2; | 3772 int mid = (low + high) / 2; |
| 3769 String* mid_name = GetKey(mid); | 3773 String* mid_name = GetKey(mid); |
| (...skipping 1409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5179 if (result.IsProperty() && result.type() == CALLBACKS) { | 5183 if (result.IsProperty() && result.type() == CALLBACKS) { |
| 5180 return false; | 5184 return false; |
| 5181 } | 5185 } |
| 5182 } | 5186 } |
| 5183 } | 5187 } |
| 5184 | 5188 |
| 5185 return true; | 5189 return true; |
| 5186 } | 5190 } |
| 5187 | 5191 |
| 5188 | 5192 |
| 5193 void SharedFunctionInfo::ForbidInlineConstructor() { |
| 5194 set_compiler_hints(BooleanBit::set(compiler_hints(), |
| 5195 kHasOnlySimpleThisPropertyAssignments, |
| 5196 false)); |
| 5197 } |
| 5198 |
| 5199 |
| 5189 void SharedFunctionInfo::SetThisPropertyAssignmentsInfo( | 5200 void SharedFunctionInfo::SetThisPropertyAssignmentsInfo( |
| 5190 bool only_simple_this_property_assignments, | 5201 bool only_simple_this_property_assignments, |
| 5191 FixedArray* assignments) { | 5202 FixedArray* assignments) { |
| 5192 set_compiler_hints(BooleanBit::set(compiler_hints(), | 5203 set_compiler_hints(BooleanBit::set(compiler_hints(), |
| 5193 kHasOnlySimpleThisPropertyAssignments, | 5204 kHasOnlySimpleThisPropertyAssignments, |
| 5194 only_simple_this_property_assignments)); | 5205 only_simple_this_property_assignments)); |
| 5195 set_this_property_assignments(assignments); | 5206 set_this_property_assignments(assignments); |
| 5196 set_this_property_assignments_count(assignments->length() / 3); | 5207 set_this_property_assignments_count(assignments->length() / 3); |
| 5197 } | 5208 } |
| 5198 | 5209 |
| (...skipping 3573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8772 if (break_point_objects()->IsUndefined()) return 0; | 8783 if (break_point_objects()->IsUndefined()) return 0; |
| 8773 // Single beak point. | 8784 // Single beak point. |
| 8774 if (!break_point_objects()->IsFixedArray()) return 1; | 8785 if (!break_point_objects()->IsFixedArray()) return 1; |
| 8775 // Multiple break points. | 8786 // Multiple break points. |
| 8776 return FixedArray::cast(break_point_objects())->length(); | 8787 return FixedArray::cast(break_point_objects())->length(); |
| 8777 } | 8788 } |
| 8778 #endif | 8789 #endif |
| 8779 | 8790 |
| 8780 | 8791 |
| 8781 } } // namespace v8::internal | 8792 } } // namespace v8::internal |
| OLD | NEW |