Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: src/objects.cc

Issue 3427007: Merge r5476 into 2.3 branch (issue3434004). (Closed) Base URL: http://v8.googlecode.com/svn/branches/2.3/
Patch Set: Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects.h ('k') | src/version.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3809 matching lines...) Expand 10 before | Expand all | Expand 10 after
3820 int next_descriptor = 0; 3820 int next_descriptor = 0;
3821 for (int i = 0; i < number_of_descriptors(); i++) { 3821 for (int i = 0; i < number_of_descriptors(); i++) {
3822 if (IsProperty(i)) new_descriptors->CopyFrom(next_descriptor++, this, i); 3822 if (IsProperty(i)) new_descriptors->CopyFrom(next_descriptor++, this, i);
3823 } 3823 }
3824 ASSERT(next_descriptor == new_descriptors->number_of_descriptors()); 3824 ASSERT(next_descriptor == new_descriptors->number_of_descriptors());
3825 3825
3826 return new_descriptors; 3826 return new_descriptors;
3827 } 3827 }
3828 3828
3829 3829
3830 void DescriptorArray::Sort() { 3830 void DescriptorArray::SortUnchecked() {
3831 // In-place heap sort. 3831 // In-place heap sort.
3832 int len = number_of_descriptors(); 3832 int len = number_of_descriptors();
3833 3833
3834 // Bottom-up max-heap construction. 3834 // Bottom-up max-heap construction.
3835 // Index of the last node with children 3835 // Index of the last node with children
3836 const int max_parent_index = (len / 2) - 1; 3836 const int max_parent_index = (len / 2) - 1;
3837 for (int i = max_parent_index; i >= 0; --i) { 3837 for (int i = max_parent_index; i >= 0; --i) {
3838 int parent_index = i; 3838 int parent_index = i;
3839 const uint32_t parent_hash = GetKey(i)->Hash(); 3839 const uint32_t parent_hash = GetKey(i)->Hash();
3840 while (parent_index <= max_parent_index) { 3840 while (parent_index <= max_parent_index) {
(...skipping 29 matching lines...) Expand all
3870 if (right_child_hash > child_hash) { 3870 if (right_child_hash > child_hash) {
3871 child_index++; 3871 child_index++;
3872 child_hash = right_child_hash; 3872 child_hash = right_child_hash;
3873 } 3873 }
3874 } 3874 }
3875 if (child_hash <= parent_hash) break; 3875 if (child_hash <= parent_hash) break;
3876 Swap(parent_index, child_index); 3876 Swap(parent_index, child_index);
3877 parent_index = child_index; 3877 parent_index = child_index;
3878 } 3878 }
3879 } 3879 }
3880 }
3880 3881
3882
3883 void DescriptorArray::Sort() {
3884 SortUnchecked();
3881 SLOW_ASSERT(IsSortedNoDuplicates()); 3885 SLOW_ASSERT(IsSortedNoDuplicates());
3882 } 3886 }
3883 3887
3884 3888
3885 int DescriptorArray::BinarySearch(String* name, int low, int high) { 3889 int DescriptorArray::BinarySearch(String* name, int low, int high) {
3886 uint32_t hash = name->Hash(); 3890 uint32_t hash = name->Hash();
3887 3891
3888 while (low <= high) { 3892 while (low <= high) {
3889 int mid = (low + high) / 2; 3893 int mid = (low + high) / 2;
3890 String* mid_name = GetKey(mid); 3894 String* mid_name = GetKey(mid);
(...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after
5270 if (result.IsProperty() && result.type() == CALLBACKS) { 5274 if (result.IsProperty() && result.type() == CALLBACKS) {
5271 return false; 5275 return false;
5272 } 5276 }
5273 } 5277 }
5274 } 5278 }
5275 5279
5276 return true; 5280 return true;
5277 } 5281 }
5278 5282
5279 5283
5284 void SharedFunctionInfo::ForbidInlineConstructor() {
5285 set_compiler_hints(BooleanBit::set(compiler_hints(),
5286 kHasOnlySimpleThisPropertyAssignments,
5287 false));
5288 }
5289
5290
5280 void SharedFunctionInfo::SetThisPropertyAssignmentsInfo( 5291 void SharedFunctionInfo::SetThisPropertyAssignmentsInfo(
5281 bool only_simple_this_property_assignments, 5292 bool only_simple_this_property_assignments,
5282 FixedArray* assignments) { 5293 FixedArray* assignments) {
5283 set_compiler_hints(BooleanBit::set(compiler_hints(), 5294 set_compiler_hints(BooleanBit::set(compiler_hints(),
5284 kHasOnlySimpleThisPropertyAssignments, 5295 kHasOnlySimpleThisPropertyAssignments,
5285 only_simple_this_property_assignments)); 5296 only_simple_this_property_assignments));
5286 set_this_property_assignments(assignments); 5297 set_this_property_assignments(assignments);
5287 set_this_property_assignments_count(assignments->length() / 3); 5298 set_this_property_assignments_count(assignments->length() / 3);
5288 } 5299 }
5289 5300
(...skipping 3607 matching lines...) Expand 10 before | Expand all | Expand 10 after
8897 if (break_point_objects()->IsUndefined()) return 0; 8908 if (break_point_objects()->IsUndefined()) return 0;
8898 // Single beak point. 8909 // Single beak point.
8899 if (!break_point_objects()->IsFixedArray()) return 1; 8910 if (!break_point_objects()->IsFixedArray()) return 1;
8900 // Multiple break points. 8911 // Multiple break points.
8901 return FixedArray::cast(break_point_objects())->length(); 8912 return FixedArray::cast(break_point_objects())->length();
8902 } 8913 }
8903 #endif 8914 #endif
8904 8915
8905 8916
8906 } } // namespace v8::internal 8917 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698