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

Side by Side Diff: src/objects.h

Issue 92123: Fix Issue 326. Handle sorting of non-array objects correctly. (Closed)
Patch Set: Simplified fixed-array collation loop. Added more tests for dictionary. Created 11 years, 7 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
« no previous file with comments | « src/array.js ('k') | src/objects.cc » ('j') | src/objects.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after
1171 inline Dictionary* property_dictionary(); // Gets slow properties. 1171 inline Dictionary* property_dictionary(); // Gets slow properties.
1172 1172
1173 // [elements]: The elements (properties with names that are integers). 1173 // [elements]: The elements (properties with names that are integers).
1174 // elements is a FixedArray in the fast case, and a Dictionary in the slow 1174 // elements is a FixedArray in the fast case, and a Dictionary in the slow
1175 // case. 1175 // case.
1176 DECL_ACCESSORS(elements, FixedArray) // Get and set fast elements. 1176 DECL_ACCESSORS(elements, FixedArray) // Get and set fast elements.
1177 inline void initialize_elements(); 1177 inline void initialize_elements();
1178 inline bool HasFastElements(); 1178 inline bool HasFastElements();
1179 inline Dictionary* element_dictionary(); // Gets slow elements. 1179 inline Dictionary* element_dictionary(); // Gets slow elements.
1180 1180
1181 // Collects elements starting at index 0.
1182 // Undefined values are placed after non-un defined values.
1183 // Returns the number of non-undefined values.
1184 Object* PrepareElementsForSort(uint32_t limit);
1185 // As PrepareElementsForSort, but only on objects where elements is
1186 // a dictionary, and it will stay a dictionary.
1187 Object* PrepareSlowElementsForSort(uint32_t limit);
1188
1181 Object* SetProperty(String* key, 1189 Object* SetProperty(String* key,
1182 Object* value, 1190 Object* value,
1183 PropertyAttributes attributes); 1191 PropertyAttributes attributes);
1184 Object* SetProperty(LookupResult* result, 1192 Object* SetProperty(LookupResult* result,
1185 String* key, 1193 String* key,
1186 Object* value, 1194 Object* value,
1187 PropertyAttributes attributes); 1195 PropertyAttributes attributes);
1188 Object* SetPropertyWithFailedAccessCheck(LookupResult* result, 1196 Object* SetPropertyWithFailedAccessCheck(LookupResult* result,
1189 String* name, 1197 String* name,
1190 Object* value); 1198 Object* value);
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after
1998 2006
1999 // Set the details for entry. 2007 // Set the details for entry.
2000 void DetailsAtPut(int entry, PropertyDetails value) { 2008 void DetailsAtPut(int entry, PropertyDetails value) {
2001 set(EntryToIndex(entry) + 2, value.AsSmi()); 2009 set(EntryToIndex(entry) + 2, value.AsSmi());
2002 } 2010 }
2003 2011
2004 // Remove all entries were key is a number and (from <= key && key < to). 2012 // Remove all entries were key is a number and (from <= key && key < to).
2005 void RemoveNumberEntries(uint32_t from, uint32_t to); 2013 void RemoveNumberEntries(uint32_t from, uint32_t to);
2006 2014
2007 // Sorting support 2015 // Sorting support
2008 Object* RemoveHoles();
2009 void CopyValuesTo(FixedArray* elements); 2016 void CopyValuesTo(FixedArray* elements);
2010 2017
2011 // Casting. 2018 // Casting.
2012 static inline Dictionary* cast(Object* obj); 2019 static inline Dictionary* cast(Object* obj);
2013 2020
2014 // Find entry for string key otherwise return -1. 2021 // Find entry for string key otherwise return -1.
2015 int FindStringEntry(String* key); 2022 int FindStringEntry(String* key);
2016 2023
2017 // Find entry for number key otherwise return -1. 2024 // Find entry for number key otherwise return -1.
2018 int FindNumberEntry(uint32_t index); 2025 int FindNumberEntry(uint32_t index);
(...skipping 1850 matching lines...) Expand 10 before | Expand all | Expand 10 after
3869 Object* JSArrayUpdateLengthFromIndex(uint32_t index, Object* value); 3876 Object* JSArrayUpdateLengthFromIndex(uint32_t index, Object* value);
3870 3877
3871 // Initialize the array with the given capacity. The function may 3878 // Initialize the array with the given capacity. The function may
3872 // fail due to out-of-memory situations, but only if the requested 3879 // fail due to out-of-memory situations, but only if the requested
3873 // capacity is non-zero. 3880 // capacity is non-zero.
3874 Object* Initialize(int capacity); 3881 Object* Initialize(int capacity);
3875 3882
3876 // Set the content of the array to the content of storage. 3883 // Set the content of the array to the content of storage.
3877 inline void SetContent(FixedArray* storage); 3884 inline void SetContent(FixedArray* storage);
3878 3885
3879 // Support for sorting
3880 Object* RemoveHoles();
3881
3882 // Casting. 3886 // Casting.
3883 static inline JSArray* cast(Object* obj); 3887 static inline JSArray* cast(Object* obj);
3884 3888
3885 // Uses handles. Ensures that the fixed array backing the JSArray has at 3889 // Uses handles. Ensures that the fixed array backing the JSArray has at
3886 // least the stated size. 3890 // least the stated size.
3887 void EnsureSize(int minimum_size_of_backing_fixed_array); 3891 void EnsureSize(int minimum_size_of_backing_fixed_array);
3888 3892
3889 // Dispatched behavior. 3893 // Dispatched behavior.
3890 #ifdef DEBUG 3894 #ifdef DEBUG
3891 void JSArrayPrint(); 3895 void JSArrayPrint();
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
4347 } else { 4351 } else {
4348 value &= ~(1 << bit_position); 4352 value &= ~(1 << bit_position);
4349 } 4353 }
4350 return value; 4354 return value;
4351 } 4355 }
4352 }; 4356 };
4353 4357
4354 } } // namespace v8::internal 4358 } } // namespace v8::internal
4355 4359
4356 #endif // V8_OBJECTS_H_ 4360 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/array.js ('k') | src/objects.cc » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698