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 3807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3818 int next_descriptor = 0; | 3818 int next_descriptor = 0; |
3819 for (int i = 0; i < number_of_descriptors(); i++) { | 3819 for (int i = 0; i < number_of_descriptors(); i++) { |
3820 if (IsProperty(i)) new_descriptors->CopyFrom(next_descriptor++, this, i); | 3820 if (IsProperty(i)) new_descriptors->CopyFrom(next_descriptor++, this, i); |
3821 } | 3821 } |
3822 ASSERT(next_descriptor == new_descriptors->number_of_descriptors()); | 3822 ASSERT(next_descriptor == new_descriptors->number_of_descriptors()); |
3823 | 3823 |
3824 return new_descriptors; | 3824 return new_descriptors; |
3825 } | 3825 } |
3826 | 3826 |
3827 | 3827 |
3828 void DescriptorArray::Sort() { | 3828 void DescriptorArray::SortUnchecked() { |
3829 // In-place heap sort. | 3829 // In-place heap sort. |
3830 int len = number_of_descriptors(); | 3830 int len = number_of_descriptors(); |
3831 | 3831 |
3832 // Bottom-up max-heap construction. | 3832 // Bottom-up max-heap construction. |
3833 // Index of the last node with children | 3833 // Index of the last node with children |
3834 const int max_parent_index = (len / 2) - 1; | 3834 const int max_parent_index = (len / 2) - 1; |
3835 for (int i = max_parent_index; i >= 0; --i) { | 3835 for (int i = max_parent_index; i >= 0; --i) { |
3836 int parent_index = i; | 3836 int parent_index = i; |
3837 const uint32_t parent_hash = GetKey(i)->Hash(); | 3837 const uint32_t parent_hash = GetKey(i)->Hash(); |
3838 while (parent_index <= max_parent_index) { | 3838 while (parent_index <= max_parent_index) { |
(...skipping 29 matching lines...) Expand all Loading... |
3868 if (right_child_hash > child_hash) { | 3868 if (right_child_hash > child_hash) { |
3869 child_index++; | 3869 child_index++; |
3870 child_hash = right_child_hash; | 3870 child_hash = right_child_hash; |
3871 } | 3871 } |
3872 } | 3872 } |
3873 if (child_hash <= parent_hash) break; | 3873 if (child_hash <= parent_hash) break; |
3874 Swap(parent_index, child_index); | 3874 Swap(parent_index, child_index); |
3875 parent_index = child_index; | 3875 parent_index = child_index; |
3876 } | 3876 } |
3877 } | 3877 } |
| 3878 } |
3878 | 3879 |
| 3880 |
| 3881 void DescriptorArray::Sort() { |
| 3882 SortUnchecked(); |
3879 SLOW_ASSERT(IsSortedNoDuplicates()); | 3883 SLOW_ASSERT(IsSortedNoDuplicates()); |
3880 } | 3884 } |
3881 | 3885 |
3882 | 3886 |
3883 int DescriptorArray::BinarySearch(String* name, int low, int high) { | 3887 int DescriptorArray::BinarySearch(String* name, int low, int high) { |
3884 uint32_t hash = name->Hash(); | 3888 uint32_t hash = name->Hash(); |
3885 | 3889 |
3886 while (low <= high) { | 3890 while (low <= high) { |
3887 int mid = (low + high) / 2; | 3891 int mid = (low + high) / 2; |
3888 String* mid_name = GetKey(mid); | 3892 String* mid_name = GetKey(mid); |
(...skipping 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5262 if (result.IsProperty() && result.type() == CALLBACKS) { | 5266 if (result.IsProperty() && result.type() == CALLBACKS) { |
5263 return false; | 5267 return false; |
5264 } | 5268 } |
5265 } | 5269 } |
5266 } | 5270 } |
5267 | 5271 |
5268 return true; | 5272 return true; |
5269 } | 5273 } |
5270 | 5274 |
5271 | 5275 |
| 5276 void SharedFunctionInfo::ForbidInlineConstructor() { |
| 5277 set_compiler_hints(BooleanBit::set(compiler_hints(), |
| 5278 kHasOnlySimpleThisPropertyAssignments, |
| 5279 false)); |
| 5280 } |
| 5281 |
| 5282 |
5272 void SharedFunctionInfo::SetThisPropertyAssignmentsInfo( | 5283 void SharedFunctionInfo::SetThisPropertyAssignmentsInfo( |
5273 bool only_simple_this_property_assignments, | 5284 bool only_simple_this_property_assignments, |
5274 FixedArray* assignments) { | 5285 FixedArray* assignments) { |
5275 set_compiler_hints(BooleanBit::set(compiler_hints(), | 5286 set_compiler_hints(BooleanBit::set(compiler_hints(), |
5276 kHasOnlySimpleThisPropertyAssignments, | 5287 kHasOnlySimpleThisPropertyAssignments, |
5277 only_simple_this_property_assignments)); | 5288 only_simple_this_property_assignments)); |
5278 set_this_property_assignments(assignments); | 5289 set_this_property_assignments(assignments); |
5279 set_this_property_assignments_count(assignments->length() / 3); | 5290 set_this_property_assignments_count(assignments->length() / 3); |
5280 } | 5291 } |
5281 | 5292 |
(...skipping 3607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8889 if (break_point_objects()->IsUndefined()) return 0; | 8900 if (break_point_objects()->IsUndefined()) return 0; |
8890 // Single beak point. | 8901 // Single beak point. |
8891 if (!break_point_objects()->IsFixedArray()) return 1; | 8902 if (!break_point_objects()->IsFixedArray()) return 1; |
8892 // Multiple break points. | 8903 // Multiple break points. |
8893 return FixedArray::cast(break_point_objects())->length(); | 8904 return FixedArray::cast(break_point_objects())->length(); |
8894 } | 8905 } |
8895 #endif | 8906 #endif |
8896 | 8907 |
8897 | 8908 |
8898 } } // namespace v8::internal | 8909 } } // namespace v8::internal |
OLD | NEW |