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

Unified Diff: src/objects.h

Issue 10692185: Couple the enumeration index of a property to the size of the descriptor array where it first appea… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Adding assert in Set Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/factory.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index 4cbf2bd75d5f73d871c89e0be423321254c1f444..1e2fafe3a25517f48d41a3e4a6cdc89324fa3a49 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -2475,6 +2475,7 @@ class DescriptorArray: public FixedArray {
}
inline int number_of_entries() { return number_of_descriptors(); }
+ int NextEnumerationIndex() { return number_of_descriptors() + 1; }
int LastAdded() {
ASSERT(!IsEmpty());
@@ -2487,13 +2488,6 @@ class DescriptorArray: public FixedArray {
}
}
- int NextEnumerationIndex() {
- if (number_of_descriptors() == 0) {
- return PropertyDetails::kInitialIndex;
- }
- return GetDetails(LastAdded()).index() + 1;
- }
-
// Set index of the last added descriptor and flush any enum cache.
void SetLastAdded(int index) {
ASSERT(!IsEmpty() || index > 0);
@@ -2546,6 +2540,12 @@ class DescriptorArray: public FixedArray {
inline void Set(int descriptor_number,
Descriptor* desc,
const WhitenessWitness&);
+ // Append automatically sets the enumeration index. This should only be used
+ // to add descriptors in bulk at the end, followed by sorting the descriptor
+ // array.
+ inline void Append(int descriptor_number,
+ Descriptor* desc,
+ const WhitenessWitness&);
danno 2012/07/12 11:26:08 Remove the need for descriptor_number as discussed
// Transfer a complete descriptor from the src descriptor array to the dst
// one, dropping map transitions in CALLBACKS.
@@ -2613,6 +2613,9 @@ class DescriptorArray: public FixedArray {
// Constant for denoting key was not found.
static const int kNotFound = -1;
+ // Constant for denoting that the LastAdded field was not yet set.
+ static const int kNoneAdded = -1;
+
static const int kBackPointerStorageIndex = 0;
static const int kLastAddedIndex = 1;
static const int kTransitionsIndex = 2;
« no previous file with comments | « src/factory.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698